[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#740509: ifconfig: ioctl(SIOCGIFINFO_IN6): No such device or address



reassign 740509 glibc
found 740509 glibc/2.19-11
affects 740509 + freebsd-net-tools
tags 740509 + patch
thanks

Hi,

On 21/10/14 03:00, Steven Chamberlain wrote:
> The attached patch uses rt_msghdr->ifm_msglen to guess the
> running kernel version and accordingly, find the right place for the
> struct sockaddr_dl.  I expect it will still work for the i386-on-amd64
> compat case also.

It works!  It passed glibc's testsuite when running on kfreebsd-i386 9.0
(like on the buildds), and has fixed ifconfig on kfreebsd-i386 10.1.

I've also committed it to /svn/glibc-bsd/trunk/glibc-ports
Please could we get this into the next glibc upload, in order to fix
kfreebsd-i386 networking?

It might be an idea to also bump the Build-Depends to
kfreebsd-kernel-headers (>> 10.1~) [kfreebsd-any]
because otherwise, building against older k-k-h could produce a glibc
that still has this bug when run on a 10.1 (sid/jessie) kernel.

Thanks!
Regards,
-- 
Steven Chamberlain
steven@pyro.eu.org
From: Steven Chamberlain <steven@pyro.eu.org>
Subject: getifaddrs: work around a kfreebsd 9.0 to 10.1 ABI break

--- a/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/ifaddrs.c	2014-10-21 01:19:18.000000000 +0000
+++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/ifaddrs.c	2014-10-21 01:27:59.072736100 +0000
@@ -147,7 +147,13 @@
 			if (ifm->ifm_addrs & RTA_IFP) {
 				idx = ifm->ifm_index;
 				++icnt;
+				/* XXX: smooth over a kfreebsd 9.0->10.1 ABI break:
+				  sizeof(struct rt_msghdr) is correct for 10.1 kernel */
 				dl = (struct sockaddr_dl *)(void *)(ifm + 1);
+				if (rtm->rtm_msglen == 152) {
+					/* on kfreebsd-i386 9.0, struct rt_msghdr is 96 bytes */
+					dl = (struct sockaddr_dl *)((char *)ifm + 96);
+				}
 				dcnt += SA_RLEN((struct sockaddr *)(void*)dl) +
 				    ALIGNBYTES;
 #ifdef	HAVE_IFM_DATA
@@ -234,7 +240,13 @@
 			ifm = (struct if_msghdr *)(void *)rtm;
 			if (ifm->ifm_addrs & RTA_IFP) {
 				idx = ifm->ifm_index;
+				/* XXX: smooth over a kfreebsd 9.0->10.1 ABI break:
+				  sizeof(struct rt_msghdr) is correct for 10.1 kernel */
 				dl = (struct sockaddr_dl *)(void *)(ifm + 1);
+				if (rtm->rtm_msglen == 152) {
+					/* on kfreebsd-i386 9.0, struct rt_msghdr is 96 bytes */
+					dl = (struct sockaddr_dl *)((char *)ifm + 96);
+				}
 
 				cif = ift;
 				ift->ifa_name = names;

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: