Message ID | 20200326094252.157914-1-brambonne@google.com |
---|---|
State | New |
Headers | show |
Series | [RFC] ipv6: Use dev_addr in stable-privacy address generation | expand |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 5b9de773ce73..cd69a4331246 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -3252,7 +3252,7 @@ static int ipv6_generate_stable_address(struct in6_addr *address, sha_init(digest); memset(&data, 0, sizeof(data)); memset(workspace, 0, sizeof(workspace)); - memcpy(data.hwaddr, idev->dev->perm_addr, idev->dev->addr_len); + memcpy(data.hwaddr, idev->dev->dev_addr, idev->dev->addr_len); data.prefix[0] = address->s6_addr32[0]; data.prefix[1] = address->s6_addr32[1]; data.secret = secret;
This patch extends the IN6_ADDR_GEN_MODE_STABLE_PRIVACY address generation mode to use the software-defined MAC address (dev_addr) rather than the permanent, hardware-defined MAC address (perm_addr) of the interface when generating IPv6 link-local addresses. This ensures that the IPv6 link-local address changes in line with the MAC address when per-network MAC address randomization is used, providing the expected privacy guarantees. When no MAC address randomization is used, dev_addr corresponds to perm_addr, and IN6_ADDR_GEN_MODE_STABLE_PRIVACY behaves as before. When MAC address randomization is used, this makes the MAC address fulfill the role of both the Net_Iface and the (optional) Network_ID parameters in RFC7217. Cc: Lorenzo Colitti <lorenzo@google.com> Cc: Jeffrey Vanderstoep <jeffv@google.com> Signed-off-by: Bram Bonné <brambonne@google.com> --- net/ipv6/addrconf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)