]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Move the compat options to the top and renable duid support IF the duid file exists...
authorRoy Marples <roy@marples.name>
Thu, 1 May 2008 18:00:59 +0000 (18:00 +0000)
committerRoy Marples <roy@marples.name>
Thu, 1 May 2008 18:00:59 +0000 (18:00 +0000)
README
dhcpcd.c

diff --git a/README b/README
index 6a5d6e16f0ac089a054396ad676762ba6673d412..488ba0525a540d5e0c97780decea3d8f357f8fcf 100644 (file)
--- 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.
index 6ce617bc5b53e1257ae43e0f14b36f7369abe2fd..7c62aa4b93bdc0e7dd1e4003e40574a7eb371344 100644 (file)
--- 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)