summaryrefslogtreecommitdiff
path: root/net/ipv6
diff options
context:
space:
mode:
authorHarout Hedeshian <harouth@codeaurora.org>2015-06-24 15:16:34 -0600
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-22 11:06:00 -0700
commit07c71659e8d7fb998b30bcbd827d606f5a1c4b27 (patch)
tree4f20a4e8265cc48051536b866508b1336b83c9f4 /net/ipv6
parent07f438368ca6fcb555080d9c738ea6b904e0b04d (diff)
ipv6: generate random IID only for temporary addresses on RAWIP devices
RAWIP devices require the device IID to be used for permanent addresses only, and random IIDs to be generated for temporary addresses. Legacy user-space applications rely on this behavior CRs-Fixed: 860791 Change-Id: I007bdf8bcfdce687ad31612fed9d9c769321edb9 Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
Diffstat (limited to 'net/ipv6')
-rw-r--r--net/ipv6/addrconf.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index acc269350cbc..b7f586106a0b 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -2055,10 +2055,17 @@ static int ipv6_generate_eui64(u8 *eui, struct net_device *dev)
return addrconf_ifid_ieee1394(eui, dev);
case ARPHRD_TUNNEL6:
return addrconf_ifid_ip6tnl(eui, dev);
- case ARPHRD_RAWIP:
- get_random_bytes(eui, 8);
+ case ARPHRD_RAWIP: {
+ struct in6_addr lladdr;
+
+ if (ipv6_get_lladdr(dev, &lladdr, IFA_F_TENTATIVE))
+ get_random_bytes(eui, 8);
+ else
+ memcpy(eui, lladdr.s6_addr + 8, 8);
+
return 0;
}
+ }
return -1;
}