diff --git a/src/if-options.c b/src/if-options.c index 7b445f45..0ec71a43 100644 --- a/src/if-options.c +++ b/src/if-options.c @@ -2106,7 +2106,7 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo, } /* variable */ if (!fp) { - if (!(t & OT_OPTION)) { + if (!(t & OT_OPTION) || opt != O_ENCAP) { logerrx("type %s requires a variable name", arg); return -1; @@ -2117,7 +2117,14 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo, fp = strwhite(arg); if (fp) *fp++ = '\0'; - if (strcasecmp(arg, "reserved")) { + if (arg == NULL) { + if (!(t & OT_OPTION) || opt != O_ENCAP) { + logerrx( + "type requires a variable name"); + return -1; + } + np = NULL; + } else if (strcasecmp(arg, "reserved")) { np = strdup(arg); if (np == NULL) { logerr(__func__);