]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
IP4: Remove #defines for functions when INET is disabled
authorRoy Marples <roy@marples.name>
Wed, 23 Jan 2019 11:43:11 +0000 (11:43 +0000)
committerRoy Marples <roy@marples.name>
Wed, 23 Jan 2019 11:43:11 +0000 (11:43 +0000)
This allows us to optimise the code better and hopefully
become less error prone.

src/dhcpcd.c
src/ipv4.h

index 37ca68f81dbe75b5d234e0d5a413d03786c53b88..b20b2d0530d9b90f29ece3dcbe25e123af4261aa 100644 (file)
@@ -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);
index ff0cb5402c191345fa41254e684cd2db55eb511f..496b8ecd23a2d743e8c500d479adef98499a1a3e 100644 (file)
@@ -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 */