]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
interface foo in dhcpcd.conf now only applies subsequent options for interface foo.
authorRoy Marples <roy@marples.name>
Thu, 24 Apr 2008 13:53:03 +0000 (13:53 +0000)
committerRoy Marples <roy@marples.name>
Thu, 24 Apr 2008 13:53:03 +0000 (13:53 +0000)
dhcpcd.c
dhcpcd.conf.5

index f6c7be0e48d907f1f8d04e4ee8d79f752accdd93..36cefe374b2ca2c98913fad6d0c57581c313fb1e 100644 (file)
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -371,6 +371,7 @@ main(int argc, char **argv)
        size_t len = 0;
        FILE *f;
        char *cf = NULL;
+       char *intf = NULL;
 
        /* Close any un-needed fd's */
        for (i = getdtablesize() - 1; i >= 3; --i)
@@ -502,11 +503,21 @@ main(int argc, char **argv)
                        }
                        if (lp)
                                *lp = '\0';
+                       if (strcmp(option, "interface") == 0) {
+                               free(intf);
+                               intf = xstrdup(line);
+                               continue;
+                       }
+                       /* If we're in an interface block don't use these
+                        * options unless it's for us */
+                       if (intf && strcmp(intf, options->interface) != 0)
+                               continue;
                        r = parse_config_line(option, line, options);
                        if (r != 1)
                                break;
                }
                free(buffer);
+               free(intf);
                fclose(f);
                if (r == 0)
                        usage();
index e0b37a77330eb6f73fd7d566a610752e44bdc502..d9ede8e32723b7f2aa8074d81611114e240d934c 100644 (file)
@@ -57,6 +57,9 @@ if a FQDN (ie, contains a .) then it will be encoded a such.
 .It Ic fqdn Op none | ptr | both
 none disables FQDN encoding, ptr just asks the DHCP server to update the PTR
 record of the host in DNS whereas both also updates the A record.
+.It interface Ar interface
+Subsequent options are only parsed for this
+.Ar interface .
 .It Ic leasetime Ar seconds
 Request a leasetime of
 .Ar seconds .