]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Fix crash with last patch for rebinding interfaces
authorRoy Marples <roy@marples.name>
Wed, 9 Jun 2010 16:51:40 +0000 (16:51 +0000)
committerRoy Marples <roy@marples.name>
Wed, 9 Jun 2010 16:51:40 +0000 (16:51 +0000)
dhcpcd.c
if-options.c

index 0d7d830cc3cc0ca7d34507e1e9a2e89aae8d35b7..fc659a13d1b276d43a59efdd8ee9b5690849a998 100644 (file)
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -1369,8 +1369,10 @@ reconf_reboot(int action, int argc, char **argv, int oi)
                        for (ifn = ifs; ifn; ifn = ifn->next)
                                if (strcmp(ifn->name, ifp->name) == 0)
                                        break;
-                       if (ifn == NULL)
+                       if (ifn == NULL) {
+                               ifl = ifp->next;
                                stop_interface(ifp);
+                       }
                }
        }
        
@@ -1408,7 +1410,7 @@ handle_signal(_unused void *arg)
        struct interface *ifp, *ifl;
        struct if_options *ifo;
        int sig = signal_read();
-       int do_release, do_rebind;
+       int do_release, do_rebind, i;
 
        do_rebind = do_release = 0;
        switch (sig) {
@@ -1420,7 +1422,18 @@ handle_signal(_unused void *arg)
                break;
        case SIGALRM:
                syslog(LOG_INFO, "received SIGALRM, rebinding");
+               for (i = 0; i < ifac; i++)
+                       free(ifav[i]);
+               free(ifav);
+               ifav = NULL;
+               ifac = 0;
+               for (i = 0; i < ifdc; i++)
+                       free(ifdv[i]);
+               free(ifdv);
+               ifdc = 0;
+               ifdv = NULL;
                ifo = read_config(cffile, NULL, NULL, NULL);
+               add_options(ifo, margc, margv);
                /* We need to preserve these two options. */
                if (options & DHCPCD_MASTER)
                        ifo->options |= DHCPCD_MASTER;
index 43f75ea2c37550f9ff16909016baca463052bed6..da7f6145c4df66b1579b00249c32ab84e0e83606 100644 (file)
@@ -524,9 +524,7 @@ parse_option(struct if_options *ifo, int opt, const char *arg)
                }
                break;
        case 'z':
-               /* We only set this if we haven't got any interfaces */
-               if (!ifaces)
-                       ifav = splitv(&ifac, ifav, arg);
+               ifav = splitv(&ifac, ifav, arg);
                break;
        case 'A':
                ifo->options &= ~DHCPCD_ARP;
@@ -712,9 +710,7 @@ parse_option(struct if_options *ifo, int opt, const char *arg)
                ifo->blacklist[ifo->blacklist_len++] = addr2.s_addr;
                break;
        case 'Z':
-               /* We only set this if we haven't got any interfaces */
-               if (!ifaces)
-                       ifdv = splitv(&ifdc, ifdv, arg);
+               ifdv = splitv(&ifdc, ifdv, arg);
                break;
        case O_ARPING:
                if (parse_addr(&addr, NULL, arg) != 0)
@@ -849,8 +845,7 @@ read_config(const char *file,
                }
                if (skip)
                        continue;
-               if (parse_config_line(ifo, option, line) != 1)
-                       break;
+               parse_config_line(ifo, option, line);
        }
        fclose(f);