From: Roy Marples Date: Mon, 17 Nov 2008 17:25:54 +0000 (+0000) Subject: We no longer send a ClientID by default. This is so we now mirror the kernel DHCP... X-Git-Tag: v5.0.0~181 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c989b02361577d2227094cd396c760c1df39e697;p=thirdparty%2Fdhcpcd.git We no longer send a ClientID by default. This is so we now mirror the kernel DHCP client and can re-use its lease by default. To retain the old behaviour, simply add clientid to dhcpcd.conf. --- diff --git a/README b/README index f80c330c..86ee1848 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -dhcpcd-4 - DHCP client daemon +dhcpcd - DHCP client daemon Copyright 2006-2008 Roy Marples @@ -43,9 +43,13 @@ make HOOKSCRIPTS=50-ntp install Compatibility ------------- -dhcpcd-4.1 is only fully command line compatible with dhcpcd-4.0 +dhcpcd-5.0 is only fully command line compatible with dhcpcd-4.0 For compatibility with older versions, use dhcpcd-4.0 +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. ChangeLog --------- diff --git a/dhcpcd.8.in b/dhcpcd.8.in index 2375933b..13fd07e2 100644 --- a/dhcpcd.8.in +++ b/dhcpcd.8.in @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd October 07, 2008 +.Dd November 17, 2008 .Dt DHCPCD 8 SMM .Sh NAME .Nm dhcpcd @@ -351,9 +351,11 @@ 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 we send a default +clientid of the hardware family and the hardware address. .El .Ss Restriciting behaviour .Nm @@ -474,8 +476,4 @@ does not wait for commands to complete when sending them to the master .Nm process. .Pp -One of the goals for one instance managing multiple interfaces is more -intelligent route and configuration management. -This has not yet been done. -.Pp Please report them to http://roy.marples.name/projects/dhcpcd diff --git a/dhcpcd.c b/dhcpcd.c index 9cec6403..27973ec0 100644 --- a/dhcpcd.c +++ b/dhcpcd.c @@ -857,6 +857,12 @@ configure_interface(struct interface *iface, int argc, char **argv) if (ifo->metric != -1) iface->metric = ifo->metric; + /* 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 (!(ifo->options & DHCPCD_CLIENTID) && iface->hwlen > DHCP_CHADDR_LEN) + ifo->options |= DHCPCD_CLIENTID; + free(iface->clientid); if (*ifo->clientid) { iface->clientid = xmalloc(ifo->clientid[0] + 1); diff --git a/dhcpcd.conf.5.in b/dhcpcd.conf.5.in index d6e9d29d..90b2c1ba 100644 --- a/dhcpcd.conf.5.in +++ b/dhcpcd.conf.5.in @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd October 07, 2008 +.Dd November 17, 2008 .Dt DHCPCD.CONF 5 SMM .Sh NAME .Nm dhcpcd.conf @@ -61,9 +61,11 @@ 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 we send a default +clientid of the hardware family and the hardware address. .It Ic duid Generate an .Rs diff --git a/if-options.c b/if-options.c index 24bf5ad3..6d031295 100644 --- a/if-options.c +++ b/if-options.c @@ -467,7 +467,7 @@ parse_option(struct if_options *ifo, int opt, const char *arg) free(p); break; case 'D': - ifo->options |= DHCPCD_DUID; + ifo->options |= DHCPCD_CLIENTID | DHCPCD_DUID; break; case 'E': ifo->options |= DHCPCD_LASTLEASE; @@ -505,11 +505,8 @@ parse_option(struct if_options *ifo, int opt, const char *arg) syslog(LOG_ERR, "clientid: %m"); return -1; } + ifo->options |= DHCPCD_CLIENTID; ifo->clientid[0] = (uint8_t)s; - if (s == 0) { - ifo->options &= ~DHCPCD_DUID; - ifo->options &= ~DHCPCD_CLIENTID; - } break; case 'K': ifo->options &= ~DHCPCD_LINK; @@ -591,7 +588,7 @@ read_config(const char *file, const char *ifname) /* Seed our default options */ ifo = xzalloc(sizeof(*ifo)); - ifo->options |= DHCPCD_CLIENTID | DHCPCD_GATEWAY | DHCPCD_DAEMONISE; + ifo->options |= DHCPCD_GATEWAY | DHCPCD_DAEMONISE; ifo->options |= DHCPCD_ARP | DHCPCD_IPV4LL | DHCPCD_LINK; ifo->timeout = DEFAULT_TIMEOUT; ifo->reboot = DEFAULT_REBOOT;