From: Roy Marples Date: Thu, 24 Apr 2008 13:53:03 +0000 (+0000) Subject: interface foo in dhcpcd.conf now only applies subsequent options for interface foo. X-Git-Tag: v4.0.2~455 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=012fd5d37f2b9198e10d5e75a16184cd84205ac5;p=thirdparty%2Fdhcpcd.git interface foo in dhcpcd.conf now only applies subsequent options for interface foo. --- diff --git a/dhcpcd.c b/dhcpcd.c index f6c7be0e..36cefe37 100644 --- 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(); diff --git a/dhcpcd.conf.5 b/dhcpcd.conf.5 index e0b37a77..d9ede8e3 100644 --- a/dhcpcd.conf.5 +++ b/dhcpcd.conf.5 @@ -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 .