From 261009b061fbf9758b28822f999f58b3b6a07df0 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Mon, 3 Aug 2020 16:56:14 +0100 Subject: [PATCH] dhcpcd: If using -4 or -6, check we have support for it Better to error early sensibly. --- src/if-options.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/if-options.c b/src/if-options.c index 3373f7df..9ea629ae 100644 --- a/src/if-options.c +++ b/src/if-options.c @@ -1207,13 +1207,23 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo, ifo->options |= DHCPCD_ONESHOT; break; case '4': +#ifdef INET ifo->options &= ~DHCPCD_IPV6; ifo->options |= DHCPCD_IPV4; break; +#else + logerrx("INET has been compiled out"); + return -1; +#endif case '6': +#ifdef INET6 ifo->options &= ~DHCPCD_IPV4; ifo->options |= DHCPCD_IPV6; break; +#else + logerrx("INET6 has been compiled out"); + return -1; +#endif case O_IPV4: ifo->options |= DHCPCD_IPV4; break; -- 2.47.2