From e7a77f591fdbd94009ec98af5ea7c65cb4366575 Mon Sep 17 00:00:00 2001 From: kevans Date: Thu, 14 Mar 2019 19:48:43 +0000 Subject: [PATCH] ether_fakeaddr: Use 'b' 's' 'd' for the prefix This has the advantage of being obvious to sniff out the designated prefix by eye and it has all the right bits set. Comment stolen from ffec. I've removed bryanv@'s pending question of using the FreeBSD OUI range -- no one has followed up on this with a definitive action, and there's no particular reason to shoot for it and the administrative overhead that comes with deciding exactly how to use it. --- sys/net/if_ethersubr.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index e8f364396fcb..d4a8601b5834 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -1406,13 +1406,14 @@ ether_fakeaddr(struct ether_addr *hwaddr) { /* - * Generate a non-multicast, locally administered address. - * - * BMV: Should we use the FreeBSD OUI range instead? + * Generate a convenient locally administered address, + * 'bsd' + random 24 low-order bits. 'b' is 0x62, which has the locally + * assigned bit set, and the broadcast/multicast bit clear. */ arc4rand(hwaddr->octet, ETHER_ADDR_LEN, 1); - hwaddr->octet[0] &= ~1; - hwaddr->octet[0] |= 2; + hwaddr->octet[0] = 'b'; + hwaddr->octet[1] = 's'; + hwaddr->octet[2] = 'd'; } DECLARE_MODULE(ether, ether_mod, SI_SUB_INIT_IF, SI_ORDER_ANY);