svn commit: r303553 - head/sys/dev/ntb/if_ntb

Alexander Motin mav at FreeBSD.org
Sat Jul 30 15:51:17 UTC 2016


Author: mav
Date: Sat Jul 30 15:51:16 2016
New Revision: 303553
URL: https://svnweb.freebsd.org/changeset/base/303553

Log:
  Make MAC address generation more random.
  
  'ticks' approach does not work at boot time.

Modified:
  head/sys/dev/ntb/if_ntb/if_ntb.c

Modified: head/sys/dev/ntb/if_ntb/if_ntb.c
==============================================================================
--- head/sys/dev/ntb/if_ntb/if_ntb.c	Sat Jul 30 14:47:04 2016	(r303552)
+++ head/sys/dev/ntb/if_ntb/if_ntb.c	Sat Jul 30 15:51:16 2016	(r303553)
@@ -493,10 +493,9 @@ static void
 create_random_local_eui48(u_char *eaddr)
 {
 	static uint8_t counter = 0;
-	uint32_t seed = ticks;
 
 	eaddr[0] = EUI48_LOCALLY_ADMINISTERED;
-	memcpy(&eaddr[1], &seed, sizeof(uint32_t));
+	arc4rand(&eaddr[1], 4, 0);
 	eaddr[5] = counter++;
 }
 


More information about the svn-src-head mailing list