From: Roy Marples Date: Thu, 18 May 2023 09:41:56 +0000 (+0100) Subject: options: Allow waitip to take space separated address families X-Git-Tag: v10.0.2~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a33c2271052026ba054503c39f25570defae3277;p=thirdparty%2Fdhcpcd.git options: Allow waitip to take space separated address families This is easier than writing confusing documentation to clarify. Fixes #206. --- diff --git a/src/if-options.c b/src/if-options.c index 1ef9cc99..bb1c1fca 100644 --- a/src/if-options.c +++ b/src/if-options.c @@ -958,11 +958,16 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo, break; case 'w': ifo->options |= DHCPCD_WAITIP; - if (arg != NULL && arg[0] != '\0') { - if (arg[0] == '4' || arg[1] == '4') + p = UNCONST(arg); + // Generally it's --waitip=46, but some expect + // --waitip="4 6" to work as well. + // It's easier to allow it rather than have confusing docs. + while (p != NULL && p[0] != '\0') { + if (p[0] == '4' || p[1] == '4') ifo->options |= DHCPCD_WAITIP4; - if (arg[0] == '6' || arg[1] == '6') + if (p[0] == '6' || p[1] == '6') ifo->options |= DHCPCD_WAITIP6; + p = strskipwhite(++p); } break; case 'y':