]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Fix compile without INET6
authorRoy Marples <roy@marples.name>
Sun, 3 Jun 2018 11:19:15 +0000 (12:19 +0100)
committerRoy Marples <roy@marples.name>
Sun, 3 Jun 2018 11:19:15 +0000 (12:19 +0100)
src/dhcp.h
src/dhcp6.h
src/dhcpcd.c
src/ipv4ll.h
src/ipv6.c
src/ipv6.h
src/ipv6nd.h

index b4313d435eabb4ab09eef41fbfee23597332d442..fb2795874a73b5d7297f63d844329305c587d8ba 100644 (file)
@@ -267,7 +267,6 @@ void dhcp_close(struct interface *);
 void dhcp_free(struct interface *);
 int dhcp_dump(struct interface *);
 #else
-#define dhcp_drop(a, b) {}
 #define dhcp_start(a) {}
 #define dhcp_abort(a) {}
 #define dhcp_renew(a) {}
index f9f8c40369543fba2a19c9596dd3b7a13f7fada7..0e48ad0e6a8209d60d26573e3fbb23264ec3b5a3 100644 (file)
@@ -245,7 +245,6 @@ int dhcp6_dump(struct interface *);
 #define dhcp6_renew(a) {}
 #define dhcp6_env(a, b, c, d, e) (0)
 #define dhcp6_free(a) {}
-#define dhcp6_handleifa(a, b) {}
 #define dhcp6_dadcompleted(a) (0)
 #define dhcp6_drop(a, b) {}
 #define dhcp6_dropnondelegates(a) {}
index 2483e38c3cbe03315d6c4e982b03fee1113d60bc..d63fa0c216940749250942e0357069789efa1533 100644 (file)
@@ -363,14 +363,25 @@ static void
 dhcpcd_drop(struct interface *ifp, int stop)
 {
 
+#ifdef DHCP6
        dhcp6_drop(ifp, stop ? NULL : "EXPIRE6");
+#endif
+#ifdef INET6
        ipv6nd_drop(ifp);
        ipv6_drop(ifp);
+#endif
+#ifdef IPV4LL
        ipv4ll_drop(ifp);
+#endif
+#ifdef DHCP
        dhcp_drop(ifp, stop ? "STOP" : "EXPIRE");
+#endif
 #ifdef ARP
        arp_drop(ifp);
 #endif
+#if !defined(DHCP6) && !defined(DHCP)
+       UNUSED(stop);
+#endif
 }
 
 static void
@@ -773,8 +784,10 @@ static void
 warn_iaid_conflict(struct interface *ifp, uint16_t ia_type, uint8_t *iaid)
 {
        struct interface *ifn;
+#ifdef INET6
        size_t i;
        struct if_ia *ia;
+#endif
 
        TAILQ_FOREACH(ifn, ifp->ctx->ifaces, next) {
                if (ifn == ifp || !ifn->active)
@@ -783,12 +796,14 @@ warn_iaid_conflict(struct interface *ifp, uint16_t ia_type, uint8_t *iaid)
                    memcmp(ifn->options->iaid, iaid,
                    sizeof(ifn->options->iaid)) == 0)
                        break;
+#ifdef INET6
                for (i = 0; i < ifn->options->ia_len; i++) {
                        ia = &ifn->options->ia[i];
                        if (ia->ia_type == ia_type &&
                            memcmp(ia->iaid, iaid, sizeof(ia->iaid)) == 0)
                                break;
                }
+#endif
        }
 
        /* This is only a problem if the interfaces are on the same network. */
@@ -802,7 +817,6 @@ dhcpcd_startinterface(void *arg)
 {
        struct interface *ifp = arg;
        struct if_options *ifo = ifp->options;
-       size_t i;
        char buf[DUID_LEN * 3];
        int carrier;
        struct timespec tv;
@@ -842,13 +856,17 @@ dhcpcd_startinterface(void *arg)
        }
 
        if (ifo->options & (DHCPCD_DUID | DHCPCD_IPV6)) {
+#ifdef INET6
+               size_t i;
                struct if_ia *ia;
+#endif
 
                /* Report IAIDs */
                loginfox("%s: IAID %s", ifp->name,
                    hwaddr_ntoa(ifo->iaid, sizeof(ifo->iaid),
                    buf, sizeof(buf)));
                warn_iaid_conflict(ifp, 0, ifo->iaid);
+#ifdef INET6
                for (i = 0; i < ifo->ia_len; i++) {
                        ia = &ifo->ia[i];
                        if (memcmp(ifo->iaid, ia->iaid, sizeof(ifo->iaid))) {
@@ -859,6 +877,7 @@ dhcpcd_startinterface(void *arg)
                                warn_iaid_conflict(ifp, ia->ia_type, ia->iaid);
                        }
                }
+#endif
        }
 
        if (ifo->options & DHCPCD_IPV6 && ipv6_start(ifp) == -1) {
index 074de6933ef21c9a5cf5029bd2e546e0d61d8340..6ce1bef2d22e1f69f06798defaa6e04678da0285 100644 (file)
@@ -75,7 +75,6 @@ void ipv4ll_freedrop(struct interface *, int);
 #define        ipv4ll_defaultroute(route, ifp) (0)
 #define        ipv4ll_handlert(a, b, c)        (0)
 #define        ipv4ll_free(a)                  {}
-#define        ipv4ll_drop(a)                  {}
 #endif
 
 #endif
index 3085b8884f4d9acca87389d671fe83e21ae1509c..b3b026b320260b026557843ad6c72aefb8a0e97c 100644 (file)
@@ -1183,7 +1183,9 @@ ipv6_handleifa(struct dhcpcd_ctx *ctx,
                return;
 
        ipv6nd_handleifa(cmd, ia, pid);
+#ifdef DHCP6
        dhcp6_handleifa(cmd, ia, pid);
+#endif
 
 out:
        /* Done with the ia now, so free it. */
index 2b6eb5cced3b359e5d3caddd5461be7b6af5d600..ef740ba4a2fd7d36cd8850b5740a116a948eed58 100644 (file)
@@ -285,7 +285,6 @@ bool inet6_getroutes(struct dhcpcd_ctx *, struct rt_head *);
 #define ipv6_hasaddr(a) (0)
 #define ipv6_free_ll_callbacks(a) {}
 #define ipv6_free(a) {}
-#define ipv6_drop(a) {}
 #define ipv6_ctxfree(a) {}
 #define ipv6_gentempifid(a) {}
 #endif
index 7e123e48d5fd3d973e2c2f26f6afee6c3c6776e6..d40ed0341d8935b77a7cefe18728980bcb50106d 100644 (file)
@@ -107,7 +107,6 @@ void ipv6nd_neighbour(struct dhcpcd_ctx *, struct in6_addr *, int);
 #define ipv6nd_free(a) {}
 #define ipv6nd_hasra(a) (0)
 #define ipv6nd_dadcompleted(a) (0)
-#define ipv6nd_drop(a) {}
 #define ipv6nd_expire(a, b) {}
 #endif