diff options
author | Roy Marples <roy@marples.name> | 2020-12-27 23:52:44 +0000 |
---|---|---|
committer | Roy Marples <roy@marples.name> | 2020-12-27 23:52:44 +0000 |
commit | 9b7c4f36e3646e26920c3707bce49d49bcefc4ce (patch) | |
tree | 966bb654caaf44944639faa336bca8d503423a74 | |
parent | bf1529adfad079df9e80e6988d3c493fc04d1084 (diff) | |
download | dhcpcd-9b7c4f36e3646e26920c3707bce49d49bcefc4ce.tar.xz |
DHCP: For anonymous, just use a generic clientid
-rw-r--r-- | src/dhcp.c | 18 |
1 files changed, 4 insertions, 14 deletions
@@ -3886,20 +3886,9 @@ dhcp_init(struct interface *ifp) state->clientid = NULL; if (ifo->options & DHCPCD_ANONYMOUS) { - uint8_t duid[DUID_LEN]; - uint8_t duid_len; - - duid_len = (uint8_t)duid_make(duid, ifp, DUID_LL); - if (duid_len != 0) { - state->clientid = malloc((size_t)duid_len + 6); - if (state->clientid == NULL) - goto eexit; - state->clientid[0] =(uint8_t)(duid_len + 5); - state->clientid[1] = 255; /* RFC 4361 */ - memcpy(state->clientid + 2, ifo->iaid, 4); - memset(state->clientid + 2, 0, 4); /* IAID */ - memcpy(state->clientid + 6, duid, duid_len); - } + /* Removing the option could show that we want anonymous. + * As such keep it as it's already in the hwaddr field. */ + goto make_clientid; } else if (*ifo->clientid) { state->clientid = malloc((size_t)(ifo->clientid[0] + 1)); if (state->clientid == NULL) @@ -3917,6 +3906,7 @@ dhcp_init(struct interface *ifp) memcpy(state->clientid + 6, ifp->ctx->duid, ifp->ctx->duid_len); } else { +make_clientid: len = (uint8_t)(ifp->hwlen + 1); state->clientid = malloc((size_t)len + 1); if (state->clientid == NULL) |