summaryrefslogtreecommitdiff
path: root/inet
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-11-26 03:29:06 +0000
committerRoland McGrath <roland@gnu.org>2002-11-26 03:29:06 +0000
commit6938e63f714b15c377d8cbf8e97b6f15b0e1b692 (patch)
tree953d8b439443cb9e73dd8021709ddefc06786aea /inet
parent14fa7a214c1ad32997db99c6560d7f93ceb254aa (diff)
* inet/test-ifaddrs.c (main: addr_string): Handle null SA.
Grok AF_LINK if defined. From Momchil Velikov <velco@fadata.bg>. * sysdeps/gnu/ifaddrs.c (getifaddrs): If ioctl fails for netmask, brdaddr, or dstaddr, just set those pointers to null and don't fail. Reported by Momchil Velikov <velco@fadata.bg>. * sysdeps/generic/ifreq.h (__if_nextreq) [_HAVE_SA_LEN]: If sa_len is > sizeof IFR->ifa_addr, advance past the whole longer length. (__ifreq): Count up NIFS that way too. Reported by Momchil Velikov <velco@fadata.bg>. * sysdeps/mach/hurd/lchmod.c: Include <fcntl.h>.
Diffstat (limited to 'inet')
-rw-r--r--inet/test-ifaddrs.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/inet/test-ifaddrs.c b/inet/test-ifaddrs.c
index 42fb7e75bf..52cda73508 100644
--- a/inet/test-ifaddrs.c
+++ b/inet/test-ifaddrs.c
@@ -50,6 +50,9 @@ Name Flags Address Netmask Broadcast/Destination");
char abuf[64], mbuf[64], dbuf[64];
inline const char *addr_string (struct sockaddr *sa, char *buf)
{
+ if (sa == NULL)
+ return "<none>";
+
switch (sa->sa_family)
{
case AF_INET:
@@ -60,6 +63,10 @@ Name Flags Address Netmask Broadcast/Destination");
return inet_ntop (AF_INET6,
&((struct sockaddr_in6 *) sa)->sin6_addr,
buf, sizeof abuf);
+#ifdef AF_LINK
+ case AF_LINK:
+ return "<link>";
+#endif
case AF_UNSPEC:
return "---";
default: