changeset 5112:899adcd7f449 draft

Fix build without INET or INET6
author Roy Marples <roy@marples.name>
date Thu, 02 Apr 2020 19:54:19 +0000
parents d0f726abddff
children 27ce149db941 25f207b44904
files src/dhcpcd.c src/if-bsd.c src/if-options.c src/privsep-root.c
diffstat 4 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/dhcpcd.c	Thu Apr 02 13:14:09 2020 +0100
+++ b/src/dhcpcd.c	Thu Apr 02 19:54:19 2020 +0000
@@ -2169,7 +2169,7 @@
 	}
 #endif
 
-#ifdef BSD
+#if defined(BSD) && defined(INET6)
 	/* Disable the kernel RTADV sysctl as early as possible. */
 	if (ctx.options & DHCPCD_IPV6 && ctx.options & DHCPCD_IPV6RS)
 		if_disable_rtadv();
--- a/src/if-bsd.c	Thu Apr 02 13:14:09 2020 +0100
+++ b/src/if-bsd.c	Thu Apr 02 19:54:19 2020 +0000
@@ -1524,6 +1524,8 @@
 #ifdef INET6
 	if (sa->sa_family == AF_INET6)
 		ifa_setscope(satosin6(sa), ifp->index);
+#else
+	UNUSED(ifp);
 #endif
 
 	cp = ctx->rt_missfilter + ctx->rt_missfilterlen;
--- a/src/if-options.c	Thu Apr 02 13:14:09 2020 +0100
+++ b/src/if-options.c	Thu Apr 02 19:54:19 2020 +0000
@@ -573,6 +573,8 @@
 		return;
 	}
 #endif
+#else
+	UNUSED(arg);
 #endif
 
 #ifdef INET
@@ -1275,6 +1277,7 @@
 		memset(ifo->nomask6, 0xff, sizeof(ifo->nomask6));
 
 		/* Allow the bare minimum through */
+#ifdef INET
 		del_option_mask(ifo->nomask, DHO_SUBNETMASK);
 		del_option_mask(ifo->nomask, DHO_CSR);
 		del_option_mask(ifo->nomask, DHO_ROUTER);
@@ -1286,11 +1289,14 @@
 		del_option_mask(ifo->nomask, DHO_RENEWALTIME);
 		del_option_mask(ifo->nomask, DHO_REBINDTIME);
 		del_option_mask(ifo->nomask, DHO_DNSSEARCH);
+#endif
 
+#ifdef INET6
 		del_option_mask(ifo->nomask6, D6_OPTION_DNS_SERVERS);
 		del_option_mask(ifo->nomask6, D6_OPTION_DOMAIN_LIST);
 		del_option_mask(ifo->nomask6, D6_OPTION_SOL_MAX_RT);
 		del_option_mask(ifo->nomask6, D6_OPTION_INF_MAX_RT);
+#endif
 
 		break;
 #ifdef INET
--- a/src/privsep-root.c	Thu Apr 02 13:14:09 2020 +0100
+++ b/src/privsep-root.c	Thu Apr 02 19:54:19 2020 +0000
@@ -435,8 +435,10 @@
 	struct dhcpcd_ctx *ctx = arg;
 	ssize_t err;
 
+#ifdef INET
 	err = ps_bpf_dispatch(ctx, psm, msg);
 	if (err == -1 && errno == ENOTSUP)
+#endif
 		err = ps_inet_dispatch(ctx, psm, msg);
 	return err;
 }