[Glibc-bsd-commits] r2484 - trunk/glibc-ports/kfreebsd

Aurelien Jarno aurel32 at alioth.debian.org
Fri May 1 17:26:34 UTC 2009


Author: aurel32
Date: 2009-05-01 17:26:34 +0000 (Fri, 01 May 2009)
New Revision: 2484

Modified:
   trunk/glibc-ports/kfreebsd/if_index.c
Log:
Fix if_nameindex() when running a 32-bit libc on a 64-bit kernel


Modified: trunk/glibc-ports/kfreebsd/if_index.c
===================================================================
--- trunk/glibc-ports/kfreebsd/if_index.c	2009-04-28 17:08:55 UTC (rev 2483)
+++ trunk/glibc-ports/kfreebsd/if_index.c	2009-05-01 17:26:34 UTC (rev 2484)
@@ -75,7 +75,15 @@
 	      if (index == 0)
 		abort ();
 
+	      /* FIXME: 'struct if_msghdr' contains a 'struct if_data' which in turns
+	         contains 'unsigned long' values. Their size therefore depends on
+		 the running kernel (32 or 64 bits). This should be fixed in the
+		 compat layer of the kernel. Meanwhile just workaround the bug here/ */
+#if 0
 	      sdl = (struct sockaddr_dl *) (msg + 1);
+#else
+	      sdl = (struct sockaddr_dl *) (p + msg->ifm_msglen - sizeof(struct sockaddr_dl) - 2);
+#endif
 	      namelen = sdl->sdl_nlen;
 	      /* Avoid overflowing namebuf[].  */
 	      if (namelen > IFNAMSIZ)




More information about the Glibc-bsd-commits mailing list