kern/170460: [kern] uuidgen(2) uses ipfw0 interface for MAC address resulting in zeros

Bryan Drewery bdrewery at FreeBSD.org
Tue Aug 7 17:40:02 UTC 2012


>Number:         170460
>Category:       kern
>Synopsis:       [kern] uuidgen(2) uses ipfw0 interface for MAC address resulting in zeros
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Tue Aug 07 17:40:01 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Bryan Drewery
>Release:        FreeBSD 8.3-RELEASE i386
>Organization:
>Environment:

	
>Description:
	uuidgen(2) reads the first MAC address it finds. This can result in the ipfw0 interace address being used, which is 0.

	# ifconfig
	ipfw0: flags=8801<UP,SIMPLEX,MULTICAST> metric 0 mtu 65536
		nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
	lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
		options=3<RXCSUM,TXCSUM>
		inet6 ::1 prefixlen 128 
		inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2 
		inet 127.0.0.1 netmask 0xff000000 
		nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
	xn0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
		options=503<RXCSUM,TXCSUM,TSO4,LRO>
		ether 08:00:27:a2:7d:bf
		inet6 fe80::a00:27ff:fea2:7dbf%xn0 prefixlen 64 scopeid 0x3 
		inet 10.10.0.35 netmask 0xffff0000 broadcast 10.10.255.255
		inet6 2001:470:1f11:262:a00:27ff:fea2:7dbf prefixlen 64 autoconf 
		nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
		media: Ethernet manual
		status: active

	# uuidgen
	102beb5c-e0b5-11e1-9304-000000000000


>How-To-Repeat:
	Compile with IPFIREWALL.
	I'm also using XEN domU.

	Somehow the ipfw0 interface is coming first.
>Fix:

	Ignore interfaces with no link address.
	With patch, it properly ignores ipfw0:
	# uuidgen
	7ba3705f-e0b5-11e1-9bf7-080027a27dbf
	# uuidgen
	7bf8778f-e0b5-11e1-9bf7-080027a27dbf


--- patch-kern_uuid_ipfw0.txt begins here ---
Index: sys/kern/kern_uuid.c
===================================================================
--- sys/kern/kern_uuid.c	(revision 239130)
+++ sys/kern/kern_uuid.c	(working copy)
@@ -102,7 +102,7 @@
 		TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
 			sdl = (struct sockaddr_dl*)ifa->ifa_addr;
 			if (sdl != NULL && sdl->sdl_family == AF_LINK &&
-			    sdl->sdl_type == IFT_ETHER) {
+			    sdl->sdl_type == IFT_ETHER && sdl->sdl_alen > 0) {
 				/* Got a MAC address. */
 				bcopy(LLADDR(sdl), node, UUID_NODE_LEN);
 				IF_ADDR_RUNLOCK(ifp);
--- patch-kern_uuid_ipfw0.txt ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list