From: Roy Marples Date: Tue, 5 Feb 2008 21:38:00 +0000 (+0000) Subject: Allow hardware type to be specified in the ClientID. This is needed, as the ethernet... X-Git-Tag: v3.2.3~37 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c737e99e65a44c413d3c16d6ce79403727033d7e;p=thirdparty%2Fdhcpcd.git Allow hardware type to be specified in the ClientID. This is needed, as the ethernet length matches other lengths. --- diff --git a/client.c b/client.c index f52886bb..aa8d709a 100644 --- a/client.c +++ b/client.c @@ -373,30 +373,13 @@ static bool client_setup (state_t *state, const options_t *options) } if (*options->clientid) { - uint8_t family = 0; /* Attempt to see if the ClientID is a hardware address */ iface->clientid_len = hwaddr_aton (NULL, options->clientid); - - /* We need to at least try and guess the family */ - switch (iface->clientid_len) { - case ETHER_ADDR_LEN: - family = ARPHRD_ETHER; - break; - case EUI64_ADDR_LEN: - family = ARPHRD_IEEE1394; - break; - case INFINIBAND_ADDR_LEN: - family = ARPHRD_INFINIBAND; - break; - } - - /* It looks and smells like one, so make it one */ - if (family) { - iface->clientid_len += 1; + if (iface->clientid_len) { iface->clientid = xmalloc (iface->clientid_len); - *iface->clientid = family; - hwaddr_aton (iface->clientid + 1, options->clientid); + hwaddr_aton (iface->clientid, options->clientid); } else { + /* Nope, so mark it as-is */ iface->clientid_len = strlen (options->clientid) + 1; iface->clientid = xmalloc (iface->clientid_len); *iface->clientid = '\0'; diff --git a/dhcpcd.8.in b/dhcpcd.8.in index ed3b4137..0ff37a0c 100644 --- a/dhcpcd.8.in +++ b/dhcpcd.8.in @@ -256,8 +256,14 @@ Send .Ar clientid as a client identifier string. If .Ar clientid -matches a hardware address format, such as 00:01:02:03:04:05 then we encode -it as that, otherwise as a string. +matches a hardware address format, such as 01:00:01:02:03:04:05 then we encode +it as that, otherwise as a string. You need to specify the hardware type in +the first byte. Ethernet is 01, and the hardware address in the example is +00:01:02:03:04:05. If the +.Ar clientid +is a blank string, then we disable DUID support and use a +.Ar clientid +as shown above. .It Fl S, -mscsr Microsoft have their own code for Classless Static Routes .Po