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.
This commit is contained in:
kevans 2019-03-14 19:48:43 +00:00
parent df0eda7afd
commit e7a77f591f

View File

@ -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);