From: florian Date: Mon, 29 May 2017 07:54:46 +0000 (+0000) Subject: only send router solicitation on RTM_NEWADDR if the l2 address changed X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=3952d506e9413000462391f77105fa1997c0c29c;p=openbsd only send router solicitation on RTM_NEWADDR if the l2 address changed --- diff --git a/usr.sbin/slaacd/engine.c b/usr.sbin/slaacd/engine.c index dca4fec17bd..7a873f11adc 100644 --- a/usr.sbin/slaacd/engine.c +++ b/usr.sbin/slaacd/engine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: engine.c,v 1.24 2017/05/28 20:40:13 florian Exp $ */ +/* $OpenBSD: engine.c,v 1.25 2017/05/29 07:54:46 florian Exp $ */ /* * Copyright (c) 2017 Florian Obser @@ -462,11 +462,29 @@ engine_dispatch_frontend(int fd, short event, void *bula) LIST_INIT(&iface->addr_proposals); LIST_INIT(&iface->dfr_proposals); } else { + int need_refresh = 0; DEBUG_IMSG("%s: updating %d", __func__, imsg_ifinfo.if_index); + + if (iface->autoconfprivacy != + imsg_ifinfo.autoconfprivacy) { + iface->autoconfprivacy = + imsg_ifinfo.autoconfprivacy; + need_refresh = 1; + } + if (memcmp(&iface->hw_address, + &imsg_ifinfo.hw_address, + sizeof(struct ether_addr)) != 0) { + memcpy(&iface->hw_address, + &imsg_ifinfo.hw_address, + sizeof(struct ether_addr)); + need_refresh = 1; + } + if (!iface->state == IF_DOWN && - imsg_ifinfo.running) + imsg_ifinfo.running && need_refresh) start_probe(iface); + iface->running = imsg_ifinfo.running; if (!iface->running) { iface->state = IF_DOWN; @@ -474,11 +492,7 @@ engine_dispatch_frontend(int fd, short event, void *bula) NULL)) evtimer_del(&iface->timer); } - iface->autoconfprivacy = - imsg_ifinfo.autoconfprivacy; - memcpy(&iface->hw_address, - &imsg_ifinfo.hw_address, - sizeof(struct ether_addr)); + memcpy(&iface->ll_address, &imsg_ifinfo.ll_address, sizeof(struct sockaddr_in6)); diff --git a/usr.sbin/slaacd/frontend.c b/usr.sbin/slaacd/frontend.c index fd68ec8937a..83c28416675 100644 --- a/usr.sbin/slaacd/frontend.c +++ b/usr.sbin/slaacd/frontend.c @@ -1,4 +1,4 @@ -/* $OpenBSD: frontend.c,v 1.11 2017/05/28 09:35:56 florian Exp $ */ +/* $OpenBSD: frontend.c,v 1.12 2017/05/29 07:54:46 florian Exp $ */ /* * Copyright (c) 2017 Florian Obser @@ -600,12 +600,6 @@ handle_route_message(struct rt_msghdr *rtm, struct sockaddr **rti_info) } break; case RTM_NEWADDR: - /* - * XXX we get a RTM_NEWADDR if the l2 addr changes, also - * when we configure an ip ourselfs or someone - * configures an ip, don't send solicitations in that - * case - */ ifm = (struct if_msghdr *)rtm; if_name = if_indextoname(ifm->ifm_index, ifnamebuf); log_debug("RTM_NEWADDR: %s[%u]", if_name, ifm->ifm_index);