From: Danny Mayer Date: Sun, 30 Nov 2003 02:24:54 +0000 (-0500) Subject: Fixes for older platforms not returning the interface index and not supporting IPv6 X-Git-Tag: NTP_4_2_3~193^2~3^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a154d0108de41840a4c43d89cf9a289eb24fea92;p=thirdparty%2Fntp.git Fixes for older platforms not returning the interface index and not supporting IPv6 bk: 3fc954f6KOgal2sSOx3VcFLdJfbuNQ --- diff --git a/libisc/ifiter_ioctl.c b/libisc/ifiter_ioctl.c index 3b724e64bc..711e493a67 100644 --- a/libisc/ifiter_ioctl.c +++ b/libisc/ifiter_ioctl.c @@ -401,7 +401,16 @@ internal_current4(isc_interfaceiter_t *iter) { INSIST(sizeof(ifreq.ifr_name) <= sizeof(iter->current.name)); memset(iter->current.name, 0, sizeof(iter->current.name)); memcpy(iter->current.name, ifreq.ifr_name, sizeof(ifreq.ifr_name)); + + /* Some older O/S's don't have the interface index. Since ifr_index is + * usually a macro definition into the actual structure we + * use that to determine if we should get it. + */ +#ifdef ifr_index iter->current.ifindex = ifreq.ifr_index; /* Save the if index */ +#else + iter->current.ifindex = 0; +#endif get_addr(family, &iter->current.address, (struct sockaddr *)&ifrp->ifr_addr); diff --git a/libisc/interfaceiter.c b/libisc/interfaceiter.c index f4576aa836..37eff74065 100644 --- a/libisc/interfaceiter.c +++ b/libisc/interfaceiter.c @@ -78,6 +78,7 @@ get_addr(unsigned int family, isc_netaddr_t *dst, struct sockaddr *src) { } } +#ifdef ISC_PLATFORM_HAVEIPV6 /* * Get the scope id here for multicasting purposes * For the KAME stack we need to play games to get the scope. @@ -109,6 +110,7 @@ get_scopeid(unsigned int family, struct sockaddr *src) { } return (0); } +#endif /* * Include system-dependent code. */