From 09cba6015dbfb9a58ed64f3f43642f870cdbb830 Mon Sep 17 00:00:00 2001 From: florian Date: Mon, 29 May 2017 08:15:38 +0000 Subject: [PATCH] Compare the l2 address from which the slaac address was formed with the current interface l2 address. Only update the address lifetime if they are the same. This way we get a new address on ifconfig lladdr random. --- usr.sbin/slaacd/engine.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/usr.sbin/slaacd/engine.c b/usr.sbin/slaacd/engine.c index 7a873f11adc..7bbf65f8a36 100644 --- a/usr.sbin/slaacd/engine.c +++ b/usr.sbin/slaacd/engine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: engine.c,v 1.25 2017/05/29 07:54:46 florian Exp $ */ +/* $OpenBSD: engine.c,v 1.26 2017/05/29 08:15:38 florian Exp $ */ /* * Copyright (c) 2017 Florian Obser @@ -172,6 +172,7 @@ struct address_proposal { struct timespec when; struct timespec uptime; uint32_t if_index; + struct ether_addr hw_address; struct sockaddr_in6 addr; struct in6_addr mask; struct in6_addr prefix; @@ -1555,6 +1556,12 @@ void update_iface_ra(struct slaacd_iface *iface, struct radv *ra) &addr_proposal->prefix, sizeof(struct in6_addr)) != 0) continue; + + if (memcmp(&addr_proposal->hw_address, + &iface->hw_address, + sizeof(addr_proposal->hw_address)) != 0) + continue; + if (addr_proposal->privacy) { /* * create new privacy address if old @@ -1675,6 +1682,8 @@ gen_address_proposal(struct slaacd_iface *iface, struct radv *ra, struct addr_proposal->when = ra->when; addr_proposal->uptime = ra->uptime; addr_proposal->if_index = iface->if_index; + memcpy(&addr_proposal->hw_address, &iface->hw_address, + sizeof(addr_proposal->hw_address)); addr_proposal->privacy = privacy; memcpy(&addr_proposal->prefix, &prefix->prefix, sizeof(addr_proposal->prefix)); -- 2.20.1