Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Mar 2019 19:48:43 +0000 (UTC)
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r345151 - head/sys/net
Message-ID:  <201903141948.x2EJmhvY075110@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201903141948.x2EJmhvY075110>