diff options
author | Tom Marshall <tdm@cyngn.com> | 2015-06-23 10:05:54 -0700 |
---|---|---|
committer | Tom Marshall <tdm@cyngn.com> | 2015-06-23 17:18:03 +0000 |
commit | 0d3220d3e1306141ab6404e8a88a30bb887eba83 (patch) | |
tree | 6a9ae9e9b02f635c2bab3725b2003952107d9fea | |
parent | b92246818a9eaece78d09d173e16fe18357f7429 (diff) | |
download | android_external_dhcpcd-cm-12.0.tar.gz android_external_dhcpcd-cm-12.0.tar.bz2 android_external_dhcpcd-cm-12.0.zip |
dhcpcd: Send unique IAIDcm-12.0
The current logic uses the kernel iface index when the name is longer
than 4 octets. This is not stable -- the iface index changes under
various scenarios, such as toggling airplane mode.
Instead, use the lower 4 octets of the iface hwaddr. This is the same
logic used in the current dhcpcd code and in the ISC DHCP client.
Note the upstream fix is here:
http://roy.marples.name/projects/dhcpcd/ci/31ea92e995477728?sbs=1
This is several revisions beyond our current code and it is rumored
that the next major AOSP release will switch to a different DHCP
client, so we won't bother trying to sync up with upstream.
Change-Id: I0663b9bcf3803978adcef6d936ae49e128c7b1f2
-rw-r--r-- | dhcpcd.c | 14 |
1 files changed, 3 insertions, 11 deletions
@@ -776,7 +776,7 @@ configure_interface1(struct interface *iface) struct if_state *ifs = iface->state; struct if_options *ifo = ifs->options; uint8_t *duid; - size_t len = 0, ifl; + size_t len = 0; /* Do any platform specific configuration */ if_conf(iface); @@ -824,16 +824,8 @@ configure_interface1(struct interface *iface) iface->clientid = xmalloc(len + 6); iface->clientid[0] = len + 5; iface->clientid[1] = 255; /* RFC 4361 */ - ifl = strlen(iface->name); - if (ifl < 5) { - memcpy(iface->clientid + 2, iface->name, ifl); - if (ifl < 4) - memset(iface->clientid + 2 + ifl, - 0, 4 - ifl); - } else { - ifl = htonl(if_nametoindex(iface->name)); - memcpy(iface->clientid + 2, &ifl, 4); - } + memcpy(iface->clientid + 2, + iface->hwaddr + iface->hwlen - 4, 4); memcpy(iface->clientid + 6, duid, len); } else if (len == 0) { len = iface->hwlen + 1; |