changeset 4285:92c215d75a0c draft

Fix compile without INET6
author Roy Marples <roy@marples.name>
date Sun, 03 Jun 2018 12:19:15 +0100
parents b0e348ab0a4a
children 36e7356b92e8
files src/dhcp.h src/dhcp6.h src/dhcpcd.c src/ipv4ll.h src/ipv6.c src/ipv6.h src/ipv6nd.h
diffstat 7 files changed, 22 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/dhcp.h	Sat Jun 02 10:29:29 2018 +0100
+++ b/src/dhcp.h	Sun Jun 03 12:19:15 2018 +0100
@@ -267,7 +267,6 @@
 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) {}
--- a/src/dhcp6.h	Sat Jun 02 10:29:29 2018 +0100
+++ b/src/dhcp6.h	Sun Jun 03 12:19:15 2018 +0100
@@ -245,7 +245,6 @@
 #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) {}
--- a/src/dhcpcd.c	Sat Jun 02 10:29:29 2018 +0100
+++ b/src/dhcpcd.c	Sun Jun 03 12:19:15 2018 +0100
@@ -363,14 +363,25 @@
 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 @@
 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 @@
 		    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 @@
 {
 	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 @@
 	}
 
 	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 @@
 				warn_iaid_conflict(ifp, ia->ia_type, ia->iaid);
 			}
 		}
+#endif
 	}
 
 	if (ifo->options & DHCPCD_IPV6 && ipv6_start(ifp) == -1) {
--- a/src/ipv4ll.h	Sat Jun 02 10:29:29 2018 +0100
+++ b/src/ipv4ll.h	Sun Jun 03 12:19:15 2018 +0100
@@ -75,7 +75,6 @@
 #define	ipv4ll_defaultroute(route, ifp)	(0)
 #define	ipv4ll_handlert(a, b, c)	(0)
 #define	ipv4ll_free(a)			{}
-#define	ipv4ll_drop(a)			{}
 #endif
 
 #endif
--- a/src/ipv6.c	Sat Jun 02 10:29:29 2018 +0100
+++ b/src/ipv6.c	Sun Jun 03 12:19:15 2018 +0100
@@ -1183,7 +1183,9 @@
 		return;
 
 	ipv6nd_handleifa(cmd, ia, pid);
+#ifdef DHCP6
 	dhcp6_handleifa(cmd, ia, pid);
+#endif
 
 out:
 	/* Done with the ia now, so free it. */
--- a/src/ipv6.h	Sat Jun 02 10:29:29 2018 +0100
+++ b/src/ipv6.h	Sun Jun 03 12:19:15 2018 +0100
@@ -285,7 +285,6 @@
 #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
--- a/src/ipv6nd.h	Sat Jun 02 10:29:29 2018 +0100
+++ b/src/ipv6nd.h	Sun Jun 03 12:19:15 2018 +0100
@@ -107,7 +107,6 @@
 #define ipv6nd_free(a) {}
 #define ipv6nd_hasra(a) (0)
 #define ipv6nd_dadcompleted(a) (0)
-#define ipv6nd_drop(a) {}
 #define ipv6nd_expire(a, b) {}
 #endif