]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Backport r1074 to dhcpcd-4.0 which stops sending a ClientID by default. If CMDLINE_CO... v4.0.5
authorRoy Marples <roy@marples.name>
Fri, 21 Nov 2008 08:05:55 +0000 (08:05 +0000)
committerRoy Marples <roy@marples.name>
Fri, 21 Nov 2008 08:05:55 +0000 (08:05 +0000)
README
client.c
dhcpcd.8.in
dhcpcd.c
dhcpcd.conf.5.in

diff --git a/README b/README
index d25847a97257edb6597392c31554c1ba1b4616f6..1dff417d4f14f770b4febd7855fbf64a6bd65650 100644 (file)
--- a/README
+++ b/README
@@ -56,6 +56,13 @@ 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 no longer sends a default ClientID for ethernet interfaces. 
+This is so we can re-use the address the kernel DHCP client found. 
+To retain the old behaviour of sending a default ClientID based on the 
+hardware address for interface, simply add the keyword clientid to dhcpcd.conf.
+If CMDLINE_COMPAT is defined, we renable the sending of ClientID by default
+AND adding clientid to dhcpcd.conf causes it NOT to be sent.
+
 dhcpcd-4 is NOT fully commandline compatible with dhcpcd-2 and older and
 changes the meaning of some options.
 
index 03a4ef76592d97a6f4c5f53a5269e4a83b0b77ce..9456750030f09a06fc6a387da9610623dd03ceb3 100644 (file)
--- a/client.c
+++ b/client.c
@@ -520,12 +520,18 @@ client_setup(struct if_state *state, const struct options *options)
                iface->net.s_addr = lease->net.s_addr;
        }
 
+       /* If we haven't specified a ClientID and our hardware address 
+       * length is greater than DHCP_CHADDR_LEN then we enforce a ClientID 
+       * of the hardware address family and the hardware address. */ 
+       if (!(state->options & DHCPCD_CLIENTID) && iface->hwlen > DHCP_CHADDR_LEN) 
+               state->options |= DHCPCD_CLIENTID; 
        if (*options->clientid) {
                iface->clientid = xmalloc(options->clientid[0] + 1);
                memcpy(iface->clientid,
                       options->clientid, options->clientid[0] + 1);
-       } else if (options->options & DHCPCD_CLIENTID) {
-               if (options->options & DHCPCD_DUID) {
+       } else if (state->options & DHCPCD_CLIENTID) {
+               if (state->options & DHCPCD_DUID) {
                        duid = xmalloc(DUID_LEN);
                        if ((len = get_duid(duid, iface)) == 0)
                                logger(LOG_ERR, "get_duid: %s",
index 0a9e51e45ee1984782262d6de926f214e60e4b02..66341d4948fccb2a7b94564c63b53b2bb61b4dbf 100644 (file)
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd August 20, 2008
+.Dd November 18, 2008
 .Dt DHCPCD 8 SMM
 .Sh NAME
 .Nm dhcpcd
@@ -324,9 +324,16 @@ itself never does any DNS updates.
 encodes the FQDN hostname as specified in
 .Li RFC1035 .
 .It Fl I , -clientid Ar clientid
-Change the default clientid sent from the interface hardware address.
+Send the
+.Ar clientid .
 If the string is of the format 01:02:03 then it is encoded as hex.
-If not set then none is sent.
+For interfaces whose hardware address is longer than 8 bytes, or if the
+.Ar clientid
+is an empty string then
+.Nm
+sends a default
+.Ar clientid
+of the hardware family and the hardware address.
 .El
 .Ss Restriciting behaviour
 .Nm
index b8ec18470c1ae31732963a3d8f68cc46ffba9270..93d8b8d669178c81c051ac42a99a65a986c36706 100644 (file)
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -521,10 +521,14 @@ parse_option(int opt, char *oarg, struct options *options)
                        return -1;
                }
                options->clientid[0] = (uint8_t)s;
+#ifdef CMDLINE_COMPAT
                if (s == 0) {
                        options->options &= ~DHCPCD_DUID;
                        options->options &= ~DHCPCD_CLIENTID;
                }
+#else
+               options->options |= DHCPCD_CLIENTID;
+#endif
                break;
        case 'K':
                options->options &= ~DHCPCD_LINK;
@@ -618,7 +622,7 @@ main(int argc, char **argv)
        setlogprefix(PACKAGE ": ");
 
        options = xzalloc(sizeof(*options));
-       options->options |= DHCPCD_CLIENTID | DHCPCD_GATEWAY | DHCPCD_DAEMONISE;
+       options->options |= DHCPCD_GATEWAY | DHCPCD_DAEMONISE;
        options->options |= DHCPCD_ARP | DHCPCD_IPV4LL | DHCPCD_LINK;
        options->timeout = DEFAULT_TIMEOUT;
        strlcpy(options->script, SCRIPT, sizeof(options->script));
@@ -628,6 +632,7 @@ main(int argc, char **argv)
                                             "%s %s", PACKAGE, VERSION);
 
 #ifdef CMDLINE_COMPAT
+       options->options |= DHCPCD_CLIENTID;
        add_option_mask(options->requestmask, DHO_DNSSERVER);
        add_option_mask(options->requestmask, DHO_DNSDOMAIN);
        add_option_mask(options->requestmask, DHO_DNSSEARCH);
index 05ba64630d7913fe9fbe7dcc208683207e17b074..6f0d31893e0d90c6b54c1cded4cd43b55991d587 100644 (file)
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd August 18, 2008
+.Dd November 18, 2008
 .Dt DHCPCD.CONF 5 SMM
 .Sh NAME
 .Nm dhcpcd.conf
@@ -48,9 +48,16 @@ Background immediately.
 This is useful for startup scripts which don't disable link messages for
 carrier status.
 .It Ic clientid Ar string
-Change the default clientid sent from the interface hardware address.
+Send the
+.Ar clientid .
 If the string is of the format 01:02:03 then it is encoded as hex.
-If not set then none is sent.
+For interfaces whose hardware address is longer than 8 bytes, or if the
+.Ar clientid
+is an empty string then
+.Nm dhcpcd
+sends a default
+.Ar clientid
+of the hardware family and the hardware address.
 .It Ic duid
 Generate an
 .Rs