From: Roy Marples Date: Wed, 23 Jan 2019 11:43:11 +0000 (+0000) Subject: IP4: Remove #defines for functions when INET is disabled X-Git-Tag: v7.1.1~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f6f93e399f827b8de2ec984590c9e07afe5a3d2d;p=thirdparty%2Fdhcpcd.git IP4: Remove #defines for functions when INET is disabled This allows us to optimise the code better and hopefully become less error prone. --- diff --git a/src/dhcpcd.c b/src/dhcpcd.c index 37ca68f8..b20b2d05 100644 --- a/src/dhcpcd.c +++ b/src/dhcpcd.c @@ -210,13 +210,18 @@ dhcpcd_ifafwaiting(const struct interface *ifp) return AF_MAX; opts = ifp->options->options; +#ifdef INET if (opts & DHCPCD_WAITIP4 && !ipv4_hasaddr(ifp)) return AF_INET; +#endif if (opts & DHCPCD_WAITIP6 && !ipv6_hasaddr(ifp)) return AF_INET6; if (opts & DHCPCD_WAITIP && !(opts & (DHCPCD_WAITIP4 | DHCPCD_WAITIP6)) && - !ipv4_hasaddr(ifp) && !ipv6_hasaddr(ifp)) +#ifdef INET + !ipv4_hasaddr(ifp) && +#endif + !ipv6_hasaddr(ifp)) return AF_UNSPEC; return AF_MAX; } @@ -233,9 +238,11 @@ dhcpcd_afwaiting(const struct dhcpcd_ctx *ctx) opts = ctx->options; TAILQ_FOREACH(ifp, ctx->ifaces, next) { +#ifdef INET if (opts & (DHCPCD_WAITIP | DHCPCD_WAITIP4) && ipv4_hasaddr(ifp)) opts &= ~(DHCPCD_WAITIP | DHCPCD_WAITIP4); +#endif if (opts & (DHCPCD_WAITIP | DHCPCD_WAITIP6) && ipv6_hasaddr(ifp)) opts &= ~(DHCPCD_WAITIP | DHCPCD_WAITIP6); @@ -1216,8 +1223,10 @@ reconf_reboot(struct dhcpcd_ctx *ctx, int action, int argc, char **argv, int oi) if (ifp->active == IF_ACTIVE_USER) { if (action) if_reboot(ifp, argc, argv); +#ifdef INET else ipv4_applyaddr(ifp); +#endif } else if (i != argc) { ifp->active = IF_ACTIVE_USER; dhcpcd_initstate1(ifp, argc, argv, 0); diff --git a/src/ipv4.h b/src/ipv4.h index ff0cb540..496b8ecd 100644 --- a/src/ipv4.h +++ b/src/ipv4.h @@ -139,11 +139,6 @@ void ipv4_handleifa(struct dhcpcd_ctx *, int, struct if_head *, const char *, int, pid_t); void ipv4_free(struct interface *); -#else -#define ipv4_sortinterfaces(a) {} -#define ipv4_applyaddr(a) {} -#define ipv4_free(a) {} -#define ipv4_hasaddr(a) (0) -#endif +#endif /* INET */ -#endif +#endif /* IPV4_H */