]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
options: Allow waitip to take space separated address families
authorRoy Marples <roy@marples.name>
Thu, 18 May 2023 09:41:56 +0000 (10:41 +0100)
committerRoy Marples <roy@marples.name>
Thu, 18 May 2023 09:41:56 +0000 (10:41 +0100)
This is easier than writing confusing documentation to clarify.
Fixes #206.

src/if-options.c

index 1ef9cc992777b8cd862705e635553d9e6fd742a9..bb1c1fca5793591387a7125e1798b32af3de2759 100644 (file)
@@ -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':