From: Roy Marples Date: Thu, 1 May 2008 18:00:59 +0000 (+0000) Subject: Move the compat options to the top and renable duid support IF the duid file exists... X-Git-Tag: v4.0.2~443 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=84fdc6af2697c22acda2b4ea59546b366ce0abf5;p=thirdparty%2Fdhcpcd.git Move the compat options to the top and renable duid support IF the duid file exists and we're in compat mode. --- diff --git a/README b/README index 6a5d6e16..488ba052 100644 --- a/README +++ b/README @@ -47,6 +47,9 @@ commandline compatible with prior versions. dhcpcd-3 enabled DUID support by default - this has changed in dhcpcd-4. You can enable it via the --duid, -D command line option or by using the duid directive in dhcpcd.conf. +If CMDLINE_COMPAT is defined the we renable DUID support by default IF +the dhcpcd.duid file exits. This keeps the clients working as they were, +which is good. dhcpcd-4 is NOT fully commandline compatible with dhcpcd-2 and older and changes the meaning of some options. diff --git a/dhcpcd.c b/dhcpcd.c index 6ce617bc..7c62aa4b 100644 --- a/dhcpcd.c +++ b/dhcpcd.c @@ -405,6 +405,22 @@ main(int argc, char **argv) DHCPCD_DAEMONISE | DHCPCD_CLIENTID; options->timeout = DEFAULT_TIMEOUT; +#ifdef CMDLINE_COMPAT + add_reqmask(options->reqmask, DHCP_DNSSERVER); + add_reqmask(options->reqmask, DHCP_DNSDOMAIN); + add_reqmask(options->reqmask, DHCP_DNSSEARCH); + add_reqmask(options->reqmask, DHCP_NISSERVER); + add_reqmask(options->reqmask, DHCP_NISDOMAIN); + add_reqmask(options->reqmask, DHCP_NTPSERVER); + + /* If the duid file exists, then enable duid by default + * This means we don't break existing clients that easily :) */ + if ((f = fopen(DUIDFILE, "r"))) { + options->options |= DHCPCD_DUID; + fclose(f); + } +#endif + gethostname(options->hostname, sizeof(options->hostname)); if (strcmp(options->hostname, "(none)") == 0 || strcmp(options->hostname, "localhost") == 0) @@ -547,15 +563,6 @@ main(int argc, char **argv) } } -#ifdef CMDLINE_COMAPT - add_reqmask(options->reqmask, DHCP_DNSSERVER); - add_reqmask(options->reqmask, DHCP_DNSDOMAIN); - add_reqmask(options->reqmask, DHCP_DNSSEARCH); - add_reqmask(options->reqmask, DHCP_NISSERVER); - add_reqmask(options->reqmask, DHCP_NISDOMAIN); - add_reqmask(options->reqmask, DHCP_NTPSERVER); -#endif - optind = 0; while ((opt = getopt_long(argc, argv, OPTS EXTRA_OPTS, longopts, &option_index)) != -1)