]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Fix multiple arping options
authorRoy Marples <roy@marples.name>
Fri, 13 Dec 2013 09:35:35 +0000 (09:35 +0000)
committerRoy Marples <roy@marples.name>
Fri, 13 Dec 2013 09:35:35 +0000 (09:35 +0000)
if-options.c

index aac0ff402b163683d966cef3c6dfe355188c95a1..9dd065e8f9223230716ccbee3595b15404cf4075 100644 (file)
@@ -1039,16 +1039,25 @@ parse_option(struct if_options *ifo, int opt, const char *arg)
                break;
 #ifdef INET
        case O_ARPING:
-               if (parse_addr(&addr, NULL, arg) != 0)
-                       return -1;
-               naddr = realloc(ifo->arping,
-                   sizeof(in_addr_t) * (ifo->arping_len + 1));
-               if (naddr == NULL) {
-                       syslog(LOG_ERR, "%s: %m", __func__);
-                       return -1;
+               while (arg && *arg != '\0') {
+                       fp = strwhite(arg);
+                       if (fp)
+                               *fp++ = '\0';
+                       if (parse_addr(&addr, NULL, arg) != 0)
+                               return -1;
+                       naddr = realloc(ifo->arping,
+                           sizeof(in_addr_t) * (ifo->arping_len + 1));
+                       if (naddr == NULL) {
+                               syslog(LOG_ERR, "%s: %m", __func__);
+                               return -1;
+                       }
+                       ifo->arping = naddr;
+                       ifo->arping[ifo->arping_len++] = addr.s_addr;
+                       if (fp)
+                               arg = strskipwhite(fp);
+                       else
+                               arg = NULL;
                }
-               ifo->arping = naddr;
-               ifo->arping[ifo->arping_len++] = addr.s_addr;
                break;
        case O_DESTINATION:
                if (make_option_mask(dhcp_opts, dhcp_opts_len,