svn commit: r345151 - head/sys/net

Kyle Evans kevans at FreeBSD.org
Thu Mar 14 19:48:44 UTC 2019


Author: kevans
Date: Thu Mar 14 19:48:43 2019
New Revision: 345151
URL: https://svnweb.freebsd.org/changeset/base/345151

Log:
  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.

Modified:
  head/sys/net/if_ethersubr.c

Modified: head/sys/net/if_ethersubr.c
==============================================================================
--- head/sys/net/if_ethersubr.c	Thu Mar 14 19:41:34 2019	(r345150)
+++ head/sys/net/if_ethersubr.c	Thu Mar 14 19:48:43 2019	(r345151)
@@ -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);


More information about the svn-src-head mailing list