On Fri, Apr 17, 2009 at 08:55:15PM +0100, Roy Marples wrote:
So something like this?
Index: sys/net/rtsock.c
===================================================================
RCS file: /cvsroot/src/sys/net/rtsock.c,v
retrieving revision 1.125
diff -u -p -r1.125 rtsock.c
--- sys/net/rtsock.c 2 Apr 2009 21:02:06 -0000 1.125
+++ sys/net/rtsock.c 17 Apr 2009 19:51:33 -0000
@@ -1061,7 +1061,8 @@ sysctl_iflist(int af, struct rt_walkarg
}
}
IFADDR_FOREACH(ifa, ifp) {
- if (af && af != ifa->ifa_addr->sa_family)
+ if (ifa == ifp->if_dl ||
+ (af && af != ifa->ifa_addr->sa_family))
continue;
info.rti_info[RTAX_IFA] = ifa->ifa_addr;
info.rti_info[RTAX_NETMASK] = ifa->ifa_netmask;
The kernel copies out the interface information in an RTM_IFINFO
message, then each of the addresses in an RTM_NEWADDR message. There
is overlap between the _IFINFO and _NEWADDR information, but it's not
a *total* overlap, so you really do have to copy out one _NEWADDR per
ifaddr.