[Git][NTPsec/ntpsec][master] if_nametoindex() is POSIX 2001 - remove a conditional.

Eric S. Raymond gitlab at mg.gitlab.com
Sun Sep 11 21:07:09 UTC 2016


Eric S. Raymond pushed to branch master at NTPsec / ntpsec


Commits:
0b82dbaa by Eric S. Raymond at 2016-09-11T17:06:08-04:00
if_nametoindex() is POSIX 2001 - remove a conditional.

- - - - -


4 changed files:

- libisc/ifiter_getifaddrs.c
- libisc/ifiter_ioctl.c
- libisc/interfaceiter.c
- wafhelpers/configure.py


Changes:

=====================================
libisc/ifiter_getifaddrs.c
=====================================
--- a/libisc/ifiter_getifaddrs.c
+++ b/libisc/ifiter_getifaddrs.c
@@ -218,9 +218,7 @@ internal_current(isc_interfaceiter_t *iter) {
 		get_addr(family, &iter->current.broadcast, ifa->ifa_broadaddr,
 			 ifa->ifa_name);
 
-#ifdef ISC_PLATFORM_HAVEIFNAMETOINDEX
 	iter->current.ifindex = if_nametoindex(iter->current.name);
-#endif
 	return (ISC_R_SUCCESS);
 }
 


=====================================
libisc/ifiter_ioctl.c
=====================================
--- a/libisc/ifiter_ioctl.c
+++ b/libisc/ifiter_ioctl.c
@@ -511,9 +511,7 @@ internal_current4(isc_interfaceiter_t *iter) {
 		}
 		iter->current.netmask.type.in6.s6_addr[i] = (~0 << bits) & 0xff;
 	}
-#ifdef ISC_PLATFORM_HAVEIFNAMETOINDEX
 	iter->current.ifindex = if_nametoindex(iter->current.name);
-#endif
 	return (ISC_R_SUCCESS);
 
  inet:
@@ -579,9 +577,7 @@ internal_current4(isc_interfaceiter_t *iter) {
 	}
 	get_addr(family, &iter->current.netmask,
 		 (struct sockaddr *)&ifreq.ifr_addr, ifreq.ifr_name);
-#ifdef ISC_PLATFORM_HAVEIFNAMETOINDEX
 	iter->current.ifindex = if_nametoindex(iter->current.name);
-#endif
 	return (ISC_R_SUCCESS);
 }
 
@@ -753,9 +749,7 @@ internal_current6(isc_interfaceiter_t *iter) {
 			iter->current.netmask.type.in6.s6_addr[i / 8] =
 				(~0 << bits) & 0xff;
 		}
-#ifdef ISC_PLATFORM_HAVEIFNAMETOINDEX
 		iter->current.ifindex = if_nametoindex(iter->current.name);
-#endif
 		return (ISC_R_SUCCESS);
 	}
 #endif
@@ -775,9 +769,7 @@ internal_current6(isc_interfaceiter_t *iter) {
 	get_addr(family, &iter->current.netmask,
 		 (struct sockaddr *)&lifreq.lifr_addr, lifreq.lifr_name);
 
-#ifdef ISC_PLATFORM_HAVEIFNAMETOINDEX
 	iter->current.ifindex = if_nametoindex(iter->current.name);
-#endif
 	return (ISC_R_SUCCESS);
 }
 #endif


=====================================
libisc/interfaceiter.c
=====================================
--- a/libisc/interfaceiter.c
+++ b/libisc/interfaceiter.c
@@ -55,8 +55,7 @@ get_addr(unsigned int family, isc_netaddr_t *dst, struct sockaddr *src,
 {
 	struct sockaddr_in6 *sa6;
 
-#if !defined(ISC_PLATFORM_HAVEIFNAMETOINDEX) || \
-    !defined(ISC_PLATFORM_HAVESCOPEID)
+#if !defined(ISC_PLATFORM_HAVESCOPEID)
 	UNUSED(ifname);
 #endif
 
@@ -74,7 +73,7 @@ get_addr(unsigned int family, isc_netaddr_t *dst, struct sockaddr *src,
 		sa6 = (struct sockaddr_in6 *)(void *)src;
 		memcpy(&dst->type.in6, &sa6->sin6_addr,
 		       sizeof(struct in6_addr));
-#ifdef ISC_PLATFORM_HAVESCOPEID
+#ifdef ISC_PLATFORM_HAVESCOPEIDS
 		if (sa6->sin6_scope_id != 0)
 			isc_netaddr_setzone(dst, sa6->sin6_scope_id);
 		else {
@@ -101,7 +100,6 @@ get_addr(unsigned int family, isc_netaddr_t *dst, struct sockaddr *src,
 							    (uint32_t)zone16);
 					dst->type.in6.s6_addr[2] = 0;
 					dst->type.in6.s6_addr[3] = 0;
-#ifdef ISC_PLATFORM_HAVEIFNAMETOINDEX
 				} else if (ifname != NULL) {
 					unsigned int zone;
 
@@ -116,7 +114,6 @@ get_addr(unsigned int family, isc_netaddr_t *dst, struct sockaddr *src,
 						isc_netaddr_setzone(dst,
 								    (uint32_t)zone);
 					}
-#endif
 				}
 			}
 		}


=====================================
wafhelpers/configure.py
=====================================
--- a/wafhelpers/configure.py
+++ b/wafhelpers/configure.py
@@ -471,7 +471,6 @@ def cmd_configure(ctx, config):
         # XXX: Hack that needs to be fixed properly for all platforms
         ctx.define("ISC_PLATFORM_NORETURN_PRE", "", quote=False)
         ctx.define("ISC_PLATFORM_NORETURN_POST", "__attribute__((__noreturn__))", quote=False)
-        ctx.define("ISC_PLATFORM_HAVEIFNAMETOINDEX", 1)
         ctx.define("ISC_PLATFORM_HAVEIN6PKTINFO", 1)
         ctx.define("ISC_PLATFORM_HAVEIPV6", 1)
         ctx.define("ISC_PLATFORM_HAVESCOPEID", 1)



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/0b82dbaa372facf7801287dcd5469b9826705735
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20160911/d53e8afe/attachment.html>


More information about the vc mailing list