Fix roken getifaddrs for IPv4 & IPv6 on HP-UX & Solaris

HP-UX only returns IPv6 addresses using SIOCGLIFCONF,
SIOCGIFCONF has to be used for IPv4 addresses.
Solaris uses the same code as described in the comments, which
should correctly detect all addresses when running in a zone.

This adds the code that went missing from commit e20183da.

Signed-off-by: Love Hornquist Astrand <lha@h5l.org>
This commit is contained in:
Ted Percival
2009-12-04 13:50:29 -07:00
committed by Love Hornquist Astrand
parent 778df10ddc
commit c93cea7ea6

View File

@@ -1039,7 +1039,7 @@ getlifaddrs2(struct ifaddrs **ifap,
goto error_out;
}
#ifndef __hpux
ifconf.lifc_family = AF_UNSPEC;
ifconf.lifc_family = af;
ifconf.lifc_flags = 0;
#endif
ifconf.lifc_len = buf_size;
@@ -1154,6 +1154,27 @@ getlifaddrs2(struct ifaddrs **ifap,
}
#endif /* defined(HAVE_IPV6) && defined(SIOCGLIFCONF) && defined(SIOCGLIFFLAGS) */
/**
* Join two struct ifaddrs lists by appending supp to base.
* Either may be NULL. The new list head (usually base) will be
* returned.
*/
static struct ifaddrs *
append_ifaddrs(struct ifaddrs *base, struct ifaddrs *supp) {
if (!base)
return supp;
if (!supp)
return base;
while (base->ifa_next)
base = base->ifa_next;
base->ifa_next = supp;
return base;
}
ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
rk_getifaddrs(struct ifaddrs **ifap)
{