diff options
author | Florian Obser <florian@cvs.openbsd.org> | 2021-03-20 17:07:50 +0000 |
---|---|---|
committer | Florian Obser <florian@cvs.openbsd.org> | 2021-03-20 17:07:50 +0000 |
commit | 3def01ee2c9c8938b8b9e62b55a25a0cec6e1f88 (patch) | |
tree | aeb7029056e353159ace63810c3dcb1a37810707 | |
parent | 29d581f499a3b727622da4e42b511e2d654eac66 (diff) |
RFC 8981 allows the configuration of only temporary IPv6 addresses.
Track autoconf and temporary flag individually to be able to support
this.
OK kn
-rw-r--r-- | sbin/slaacd/engine.c | 15 | ||||
-rw-r--r-- | sbin/slaacd/frontend.c | 10 | ||||
-rw-r--r-- | sbin/slaacd/slaacd.h | 4 |
3 files changed, 21 insertions, 8 deletions
diff --git a/sbin/slaacd/engine.c b/sbin/slaacd/engine.c index 34e16eff9fd..7b49b330328 100644 --- a/sbin/slaacd/engine.c +++ b/sbin/slaacd/engine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: engine.c,v 1.68 2021/03/20 16:46:03 kn Exp $ */ +/* $OpenBSD: engine.c,v 1.69 2021/03/20 17:07:49 florian Exp $ */ /* * Copyright (c) 2017 Florian Obser <florian@openbsd.org> @@ -248,6 +248,7 @@ struct slaacd_iface { uint32_t if_index; uint32_t rdomain; int running; + int autoconf; int autoconfprivacy; int soii; struct ether_addr hw_address; @@ -786,6 +787,7 @@ send_interface_info(struct slaacd_iface *iface, pid_t pid) memset(&cei, 0, sizeof(cei)); cei.if_index = iface->if_index; cei.running = iface->running; + cei.autoconf = iface->autoconf; cei.autoconfprivacy = iface->autoconfprivacy; cei.soii = iface->soii; memcpy(&cei.hw_address, &iface->hw_address, sizeof(struct ether_addr)); @@ -1089,6 +1091,7 @@ engine_update_iface(struct imsg_ifinfo *imsg_ifinfo) iface->rdomain = imsg_ifinfo->rdomain; iface->running = imsg_ifinfo->running; iface->link_state = imsg_ifinfo->link_state; + iface->autoconf = imsg_ifinfo->autoconf; iface->autoconfprivacy = imsg_ifinfo->autoconfprivacy; iface->soii = imsg_ifinfo->soii; memcpy(&iface->hw_address, &imsg_ifinfo->hw_address, @@ -1107,6 +1110,11 @@ engine_update_iface(struct imsg_ifinfo *imsg_ifinfo) memcpy(&iface->ll_address, &imsg_ifinfo->ll_address, sizeof(struct sockaddr_in6)); + if (iface->autoconf != imsg_ifinfo->autoconf) { + iface->autoconf = imsg_ifinfo->autoconf; + need_refresh = 1; + } + if (iface->autoconfprivacy != imsg_ifinfo->autoconfprivacy) { iface->autoconfprivacy = imsg_ifinfo->autoconfprivacy; need_refresh = 1; @@ -1913,11 +1921,12 @@ update_iface_ra_prefix(struct slaacd_iface *iface, struct radv *ra, } } - if (!found && duplicate_found && iface->soii) { + if (!found && iface->autoconf && duplicate_found && iface->soii) { prefix->dad_counter++; log_debug("%s dad_counter: %d", __func__, prefix->dad_counter); gen_address_proposal(iface, ra, prefix, 0); - } else if (!found && (iface->soii || prefix->prefix_len <= 64)) + } else if (!found && iface->autoconf && (iface->soii || + prefix->prefix_len <= 64)) /* new proposal */ gen_address_proposal(iface, ra, prefix, 0); diff --git a/sbin/slaacd/frontend.c b/sbin/slaacd/frontend.c index 47dc80b83a3..ebd8e9b792e 100644 --- a/sbin/slaacd/frontend.c +++ b/sbin/slaacd/frontend.c @@ -1,4 +1,4 @@ -/* $OpenBSD: frontend.c,v 1.53 2021/03/20 16:46:03 kn Exp $ */ +/* $OpenBSD: frontend.c,v 1.54 2021/03/20 17:07:49 florian Exp $ */ /* * Copyright (c) 2017 Florian Obser <florian@openbsd.org> @@ -502,7 +502,7 @@ update_iface(uint32_t if_index, char* if_name) get_xflags(if_name)) == -1) return; - if (!(xflags & IFXF_AUTOCONF6)) + if (!(xflags & (IFXF_AUTOCONF6 | IFXF_AUTOCONF6TEMP))) return; if((ifrdomain = get_ifrdomain(if_name)) == -1) @@ -532,6 +532,7 @@ update_iface(uint32_t if_index, char* if_name) imsg_ifinfo.rdomain = ifrdomain; imsg_ifinfo.running = (flags & (IFF_UP | IFF_RUNNING)) == (IFF_UP | IFF_RUNNING); + imsg_ifinfo.autoconf = (xflags & IFXF_AUTOCONF6); imsg_ifinfo.autoconfprivacy = (xflags & IFXF_AUTOCONF6TEMP); imsg_ifinfo.soii = !(xflags & IFXF_INET6_NOSOII); @@ -597,7 +598,7 @@ update_autoconf_addresses(uint32_t if_index, char* if_name) if ((xflags = get_xflags(if_name)) == -1) return; - if (!(xflags & IFXF_AUTOCONF6)) + if (!(xflags & (IFXF_AUTOCONF6 | IFXF_AUTOCONF6TEMP))) return; memset(&imsg_addrinfo, 0, sizeof(imsg_addrinfo)); @@ -796,7 +797,8 @@ handle_route_message(struct rt_msghdr *rtm, struct sockaddr **rti_info) &if_index, sizeof(if_index)); } else { xflags = get_xflags(if_name); - if (xflags == -1 || !(xflags & IFXF_AUTOCONF6)) { + if (xflags == -1 || !(xflags & (IFXF_AUTOCONF6 | + IFXF_AUTOCONF6TEMP))) { log_debug("RTM_IFINFO: %s(%d) no(longer) " "autoconf6", if_name, ifm->ifm_index); if_index = ifm->ifm_index; diff --git a/sbin/slaacd/slaacd.h b/sbin/slaacd/slaacd.h index 2f0830f8b59..4b6ca984757 100644 --- a/sbin/slaacd/slaacd.h +++ b/sbin/slaacd/slaacd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: slaacd.h,v 1.31 2021/03/07 10:31:20 florian Exp $ */ +/* $OpenBSD: slaacd.h,v 1.32 2021/03/20 17:07:49 florian Exp $ */ /* * Copyright (c) 2017 Florian Obser <florian@openbsd.org> @@ -87,6 +87,7 @@ enum rpref { struct ctl_engine_info { uint32_t if_index; int running; + int autoconf; int autoconfprivacy; int soii; struct ether_addr hw_address; @@ -189,6 +190,7 @@ struct imsg_ifinfo { int rdomain; int running; int link_state; + int autoconf; int autoconfprivacy; int soii; struct ether_addr hw_address; |