]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
dhcpcd: If using -4 or -6, check we have support for it
authorRoy Marples <roy@marples.name>
Mon, 3 Aug 2020 15:56:14 +0000 (16:56 +0100)
committerRoy Marples <roy@marples.name>
Mon, 3 Aug 2020 15:56:14 +0000 (16:56 +0100)
Better to error early sensibly.

src/if-options.c

index 3373f7df7558e547b80ba34db76341000f2aac18..9ea629ae67934161143d040aad2747d4d7dbbeb6 100644 (file)
@@ -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;