FreeBSD Port: e2fsprogs-libuuid-1.41.8

Douglas Thrift douglas at douglasthrift.net
Mon Sep 21 02:10:57 UTC 2009


Hello,

I discovered that libuuid wasn't actually producing type 1 UUIDs from
the MAC address of the machine. I've made a patch that gets it to do
that correctly, but I haven't wrangled with autotools to get it so it
would be suitable for sending upstream.
____________________________________________________________
Douglas William Thrift
<douglas at douglasthrift.net>
<http://douglasthrift.net/>
-------------- next part --------------
diff -Nrux .svn -x work /usr/ports/misc/e2fsprogs-libuuid/Makefile e2fsprogs-libuuid/Makefile
--- /usr/ports/misc/e2fsprogs-libuuid/Makefile	2009-07-20 08:28:20.000000000 -0700
+++ e2fsprogs-libuuid/Makefile	2009-09-20 17:34:57.058779406 -0700
@@ -24,8 +24,11 @@
 INSTALL_TARGET=	install install-shlibs
 INSTALL_WRKSRC=	${WRKSRC}/lib/uuid
 FILESDIR=	${.CURDIR}/files
+EXTRA_PATCHES+=	${FILESDIR}/patch-lib-uuid-gen_uuid.c
 USE_RC_SUBR=	uuidd
 
+CFLAGS+=	-DHAVE_NET_IF_DL_H
+
 MAN1=		uuidgen.1
 
 MAN3=		uuid.3 uuid_clear.3 uuid_compare.3 uuid_copy.3 uuid_generate.3 \
diff -Nrux .svn -x work /usr/ports/misc/e2fsprogs-libuuid/files/patch-lib-uuid-gen_uuid.c e2fsprogs-libuuid/files/patch-lib-uuid-gen_uuid.c
--- /usr/ports/misc/e2fsprogs-libuuid/files/patch-lib-uuid-gen_uuid.c	1969-12-31 16:00:00.000000000 -0800
+++ e2fsprogs-libuuid/files/patch-lib-uuid-gen_uuid.c	2009-07-28 06:47:29.421206931 -0700
@@ -0,0 +1,40 @@
+--- ./lib/uuid/gen_uuid.c.orig	2009-06-30 20:41:09.000000000 -0700
++++ ./lib/uuid/gen_uuid.c	2009-07-28 06:46:12.380950940 -0700
+@@ -89,6 +89,8 @@
+ #ifdef HAVE_SYS_RESOURCE_H
+ #include <sys/resource.h>
+ #endif
++#include <net/if_dl.h>
++#include <ifaddrs.h>
+ 
+ #include "uuidP.h"
+ #include "uuidd.h"
+@@ -295,6 +297,28 @@
+ 		}
+ 	}
+ 	close(sd);
++#else
++	struct ifaddrs *ifaddrsp, *ifaddrp;
++	unsigned char 	*a;
++
++	if (getifaddrs(&ifaddrsp) < 0)
++		return -1;
++	for (ifaddrp = ifaddrsp; ifaddrp != NULL; ifaddrp = ifaddrp->ifa_next)
++	{
++		if (ifaddrp->ifa_addr == NULL)
++			continue;
++		if (ifaddrp->ifa_addr->sa_family != AF_LINK)
++			continue;
++		a = LLADDR((struct sockaddr_dl *)ifaddrp->ifa_addr);
++		if (!a[0] && !a[1] && !a[2] && !a[3] && !a[4] && !a[5])
++			continue;
++		if (node_id) {
++			memcpy(node_id, a, 6);
++			freeifaddrs(ifaddrsp);
++			return 1;
++		}
++	}
++	freeifaddrs(ifaddrsp);
+ #endif
+ 	return 0;
+ }


More information about the freebsd-ports mailing list