From 804ba004a3c6e32b6d518dc386f786a27bcddcc5 Mon Sep 17 00:00:00 2001 From: florian Date: Sun, 21 Mar 2021 18:25:24 +0000 Subject: [PATCH] Use new terminology of RFC 8981 and (mechanically) replace "privacy" with "temporary". --- sbin/slaacd/engine.c | 59 ++++++++++++++++++------------------ sbin/slaacd/engine.h | 4 +-- sbin/slaacd/frontend.c | 10 +++--- sbin/slaacd/slaacd.c | 4 +-- sbin/slaacd/slaacd.h | 10 +++--- usr.sbin/slaacctl/slaacctl.c | 9 +++--- 6 files changed, 49 insertions(+), 47 deletions(-) diff --git a/sbin/slaacd/engine.c b/sbin/slaacd/engine.c index 35eb7606272..07e55b98fbd 100644 --- a/sbin/slaacd/engine.c +++ b/sbin/slaacd/engine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: engine.c,v 1.70 2021/03/21 13:59:22 florian Exp $ */ +/* $OpenBSD: engine.c,v 1.71 2021/03/21 18:25:24 florian Exp $ */ /* * Copyright (c) 2017 Florian Obser @@ -89,7 +89,7 @@ #define MAX_RTR_SOLICITATIONS 3 /* - * Constants for RFC 8981 autoconf privacy extensions + * Constants for RFC 8981 temporary address extensions * * PRIV_PREFERRED_LIFETIME > (PRIV_MAX_DESYNC_FACTOR + PRIV_REGEN_ADVANCE) */ @@ -198,7 +198,7 @@ struct address_proposal { struct sockaddr_in6 addr; struct in6_addr mask; struct in6_addr prefix; - int privacy; + int temporary; uint8_t prefix_len; uint32_t vltime; uint32_t pltime; @@ -249,7 +249,7 @@ struct slaacd_iface { uint32_t rdomain; int running; int autoconf; - int autoconfprivacy; + int temporary; int soii; struct ether_addr hw_address; struct sockaddr_in6 ll_address; @@ -739,7 +739,7 @@ engine_dispatch_main(int fd, short event, void *bula) addr_proposal->prefix.s6_addr[i] &= addr_proposal->mask.s6_addr[i]; - addr_proposal->privacy = imsg_addrinfo.privacy; + addr_proposal->temporary = imsg_addrinfo.temporary; addr_proposal->prefix_len = in6_mask2prefixlen(&addr_proposal->mask); @@ -788,7 +788,7 @@ send_interface_info(struct slaacd_iface *iface, pid_t pid) cei.if_index = iface->if_index; cei.running = iface->running; cei.autoconf = iface->autoconf; - cei.autoconfprivacy = iface->autoconfprivacy; + cei.temporary = iface->temporary; cei.soii = iface->soii; memcpy(&cei.hw_address, &iface->hw_address, sizeof(struct ether_addr)); memcpy(&cei.ll_address, &iface->ll_address, @@ -869,7 +869,7 @@ send_interface_info(struct slaacd_iface *iface, pid_t pid) memcpy(&cei_addr_proposal.prefix, &addr_proposal->prefix, sizeof(cei_addr_proposal.prefix)); cei_addr_proposal.prefix_len = addr_proposal->prefix_len; - cei_addr_proposal.privacy = addr_proposal->privacy; + cei_addr_proposal.temporary = addr_proposal->temporary; cei_addr_proposal.vltime = addr_proposal->vltime; cei_addr_proposal.pltime = addr_proposal->pltime; @@ -1092,7 +1092,7 @@ engine_update_iface(struct imsg_ifinfo *imsg_ifinfo) iface->running = imsg_ifinfo->running; iface->link_state = imsg_ifinfo->link_state; iface->autoconf = imsg_ifinfo->autoconf; - iface->autoconfprivacy = imsg_ifinfo->autoconfprivacy; + iface->temporary = imsg_ifinfo->temporary; iface->soii = imsg_ifinfo->soii; memcpy(&iface->hw_address, &imsg_ifinfo->hw_address, sizeof(struct ether_addr)); @@ -1115,8 +1115,8 @@ engine_update_iface(struct imsg_ifinfo *imsg_ifinfo) need_refresh = 1; } - if (iface->autoconfprivacy != imsg_ifinfo->autoconfprivacy) { - iface->autoconfprivacy = imsg_ifinfo->autoconfprivacy; + if (iface->temporary != imsg_ifinfo->temporary) { + iface->temporary = imsg_ifinfo->temporary; need_refresh = 1; } @@ -1410,7 +1410,7 @@ err: void gen_addr(struct slaacd_iface *iface, struct radv_prefix *prefix, struct - address_proposal *addr_proposal, int privacy) + address_proposal *addr_proposal, int temporary) { SHA2_CTX ctx; struct in6_addr iid; @@ -1437,7 +1437,7 @@ gen_addr(struct slaacd_iface *iface, struct radv_prefix *prefix, struct addr_proposal->addr.sin6_addr.s6_addr32[i] &= addr_proposal->mask.s6_addr32[i]; - if (privacy) { + if (temporary) { arc4random_buf(&iid.s6_addr, sizeof(iid.s6_addr)); } else if (iface->soii) { SHA512Init(&ctx); @@ -1829,9 +1829,9 @@ update_iface_ra_prefix(struct slaacd_iface *iface, struct radv *ra, { struct address_proposal *addr_proposal; uint32_t remaining_lifetime, pltime, vltime; - int found, found_privacy, duplicate_found; + int found, found_temporary, duplicate_found; - found = found_privacy = duplicate_found = 0; + found = found_temporary = duplicate_found = 0; LIST_FOREACH(addr_proposal, &iface->addr_proposals, entries) { if (prefix->prefix_len == addr_proposal-> prefix_len && @@ -1864,7 +1864,7 @@ update_iface_ra_prefix(struct slaacd_iface *iface, struct radv *ra, else vltime = TWO_HOURS; - if (addr_proposal->privacy) { + if (addr_proposal->temporary) { struct timespec now; int64_t ltime, mtime; @@ -1886,7 +1886,7 @@ update_iface_ra_prefix(struct slaacd_iface *iface, struct radv *ra, vltime = ltime > 0 ? ltime : 0; if ((mtime - now.tv_sec) > PRIV_REGEN_ADVANCE) - found_privacy = 1; + found_temporary = 1; } else { pltime = prefix->pltime; found = 1; @@ -1930,14 +1930,14 @@ update_iface_ra_prefix(struct slaacd_iface *iface, struct radv *ra, /* new proposal */ gen_address_proposal(iface, ra, prefix, 0); - /* privacy addresses do not depend on eui64 */ - if (!found_privacy && iface->autoconfprivacy) { + /* temporary addresses do not depend on eui64 */ + if (!found_temporary && iface->temporary) { if (prefix->pltime >= PRIV_REGEN_ADVANCE) { - /* new privacy proposal */ + /* new temporary proposal */ gen_address_proposal(iface, ra, prefix, 1); } else if (prefix->pltime > 0) { log_warnx("%s: pltime from %s is too small: %d < %d; " - "not generating privacy address", __func__, + "not generating temporary address", __func__, sin6_to_str(&ra->from), prefix->pltime, PRIV_REGEN_ADVANCE); } @@ -2030,7 +2030,7 @@ configure_address(struct address_proposal *addr_proposal) memcpy(&address.mask, &addr_proposal->mask, sizeof(address.mask)); address.vltime = addr_proposal->vltime; address.pltime = addr_proposal->pltime; - address.privacy = addr_proposal->privacy; + address.temporary = addr_proposal->temporary; address.mtu = addr_proposal->mtu; engine_imsg_compose_main(IMSG_CONFIGURE_ADDRESS, 0, &address, @@ -2039,7 +2039,7 @@ configure_address(struct address_proposal *addr_proposal) void gen_address_proposal(struct slaacd_iface *iface, struct radv *ra, struct - radv_prefix *prefix, int privacy) + radv_prefix *prefix, int temporary) { struct address_proposal *addr_proposal; const char *hbuf; @@ -2061,12 +2061,12 @@ gen_address_proposal(struct slaacd_iface *iface, struct radv *ra, struct sizeof(addr_proposal->hw_address)); memcpy(&addr_proposal->soiikey, &iface->soiikey, sizeof(addr_proposal->soiikey)); - addr_proposal->privacy = privacy; + addr_proposal->temporary = temporary; memcpy(&addr_proposal->prefix, &prefix->prefix, sizeof(addr_proposal->prefix)); addr_proposal->prefix_len = prefix->prefix_len; - if (privacy) { + if (temporary) { addr_proposal->vltime = MINIMUM(prefix->vltime, PRIV_VALID_LIFETIME); addr_proposal->desync_factor = @@ -2086,7 +2086,7 @@ gen_address_proposal(struct slaacd_iface *iface, struct radv *ra, struct iface->cur_mtu = ra->mtu; } - gen_addr(iface, prefix, addr_proposal, privacy); + gen_addr(iface, prefix, addr_proposal, temporary); LIST_INSERT_HEAD(&iface->addr_proposals, addr_proposal, entries); configure_address(addr_proposal); @@ -2367,12 +2367,13 @@ address_proposal_timeout(int fd, short events, void *arg) log_debug("%s: iface %d: %s [%s], priv: %s", __func__, addr_proposal->if_index, hbuf, proposal_state_name[addr_proposal->state], - addr_proposal->privacy ? "y" : "n"); + addr_proposal->temporary ? "y" : "n"); switch (addr_proposal->state) { case PROPOSAL_CONFIGURED: - log_debug("PROPOSAL_CONFIGURED timeout: id: %lld, privacy: %s", - addr_proposal->id, addr_proposal->privacy ? "y" : "n"); + log_debug("PROPOSAL_CONFIGURED timeout: id: %lld, temporary: " + "%s", addr_proposal->id, addr_proposal->temporary ? + "y" : "n"); addr_proposal->next_timeout = 1; addr_proposal->timeout_count = 0; @@ -2403,7 +2404,7 @@ address_proposal_timeout(int fd, short events, void *arg) 0, &addr_proposal->if_index, sizeof(addr_proposal->if_index)); - if (addr_proposal->privacy) { + if (addr_proposal->temporary) { addr_proposal->next_timeout = 0; break; /* just let it expire */ } diff --git a/sbin/slaacd/engine.h b/sbin/slaacd/engine.h index e97538f539c..7a8551d2c50 100644 --- a/sbin/slaacd/engine.h +++ b/sbin/slaacd/engine.h @@ -1,4 +1,4 @@ -/* $OpenBSD: engine.h,v 1.5 2020/09/14 09:07:05 florian Exp $ */ +/* $OpenBSD: engine.h,v 1.6 2021/03/21 18:25:24 florian Exp $ */ /* * Copyright (c) 2004, 2005 Esben Norby @@ -23,7 +23,7 @@ struct imsg_configure_address { uint32_t vltime; uint32_t pltime; uint32_t mtu; - int privacy; + int temporary; }; struct imsg_configure_dfr { diff --git a/sbin/slaacd/frontend.c b/sbin/slaacd/frontend.c index ebd8e9b792e..10fd6b8b9aa 100644 --- a/sbin/slaacd/frontend.c +++ b/sbin/slaacd/frontend.c @@ -1,4 +1,4 @@ -/* $OpenBSD: frontend.c,v 1.54 2021/03/20 17:07:49 florian Exp $ */ +/* $OpenBSD: frontend.c,v 1.55 2021/03/21 18:25:24 florian Exp $ */ /* * Copyright (c) 2017 Florian Obser @@ -533,7 +533,7 @@ update_iface(uint32_t if_index, char* if_name) 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.temporary = (xflags & IFXF_AUTOCONF6TEMP); imsg_ifinfo.soii = !(xflags & IFXF_INET6_NOSOII); if (getifaddrs(&ifap) != 0) @@ -635,7 +635,7 @@ update_autoconf_addresses(uint32_t if_index, char* if_name) IN6_IFF_TEMPORARY))) continue; - imsg_addrinfo.privacy = ifr6.ifr_ifru.ifru_flags6 & + imsg_addrinfo.temporary = ifr6.ifr_ifru.ifru_flags6 & IN6_IFF_TEMPORARY ? 1 : 0; memset(&ifr6, 0, sizeof(ifr6)); @@ -685,7 +685,7 @@ const char* flags_to_str(int flags) { static char buf[sizeof(" anycast tentative duplicated detached " - "deprecated autoconf autoconfprivacy")]; + "deprecated autoconf temporary")]; buf[0] = '\0'; if (flags & IN6_IFF_ANYCAST) @@ -701,7 +701,7 @@ flags_to_str(int flags) if (flags & IN6_IFF_AUTOCONF) strlcat(buf, " autoconf", sizeof(buf)); if (flags & IN6_IFF_TEMPORARY) - strlcat(buf, " autoconfprivacy", sizeof(buf)); + strlcat(buf, " temporary", sizeof(buf)); return (buf); } diff --git a/sbin/slaacd/slaacd.c b/sbin/slaacd/slaacd.c index 6aa603e850f..9e1e9998b2f 100644 --- a/sbin/slaacd/slaacd.c +++ b/sbin/slaacd/slaacd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: slaacd.c,v 1.58 2021/03/07 10:31:20 florian Exp $ */ +/* $OpenBSD: slaacd.c,v 1.59 2021/03/21 18:25:24 florian Exp $ */ /* * Copyright (c) 2017 Florian Obser @@ -657,7 +657,7 @@ configure_interface(struct imsg_configure_address *address) in6_addreq.ifra_flags |= IN6_IFF_AUTOCONF; - if (address->privacy) + if (address->temporary) in6_addreq.ifra_flags |= IN6_IFF_TEMPORARY; log_debug("%s: %s", __func__, if_name); diff --git a/sbin/slaacd/slaacd.h b/sbin/slaacd/slaacd.h index 4b6ca984757..0bad1163846 100644 --- a/sbin/slaacd/slaacd.h +++ b/sbin/slaacd/slaacd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: slaacd.h,v 1.32 2021/03/20 17:07:49 florian Exp $ */ +/* $OpenBSD: slaacd.h,v 1.33 2021/03/21 18:25:24 florian Exp $ */ /* * Copyright (c) 2017 Florian Obser @@ -88,7 +88,7 @@ struct ctl_engine_info { uint32_t if_index; int running; int autoconf; - int autoconfprivacy; + int temporary; int soii; struct ether_addr hw_address; struct sockaddr_in6 ll_address; @@ -136,7 +136,7 @@ struct ctl_engine_info_address_proposal { struct timespec uptime; struct sockaddr_in6 addr; struct in6_addr prefix; - int privacy; + int temporary; uint8_t prefix_len; uint32_t vltime; uint32_t pltime; @@ -171,7 +171,7 @@ struct imsg_addrinfo { uint32_t if_index; struct sockaddr_in6 addr; struct in6_addr mask; - int privacy; + int temporary; uint32_t vltime; uint32_t pltime; }; @@ -191,7 +191,7 @@ struct imsg_ifinfo { int running; int link_state; int autoconf; - int autoconfprivacy; + int temporary; int soii; struct ether_addr hw_address; struct sockaddr_in6 ll_address; diff --git a/usr.sbin/slaacctl/slaacctl.c b/usr.sbin/slaacctl/slaacctl.c index 7dcffdb32d1..aa80b999c49 100644 --- a/usr.sbin/slaacctl/slaacctl.c +++ b/usr.sbin/slaacctl/slaacctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: slaacctl.c,v 1.21 2021/02/27 10:28:12 florian Exp $ */ +/* $OpenBSD: slaacctl.c,v 1.22 2021/03/21 18:25:24 florian Exp $ */ /* * Copyright (c) 2005 Claudio Jeker @@ -199,7 +199,8 @@ show_interface_msg(struct imsg *imsg) printf("%s:\n", bufp != NULL ? bufp : "unknown"); printf("\t index: %3u ", cei->if_index); printf("running: %3s ", cei->running ? "yes" : "no"); - printf("privacy: %3s\n", cei->autoconfprivacy ? "yes" : "no"); + printf("temporary: %3s\n", cei->temporary ? "yes" : + "no"); printf("\tlladdr: %s\n", ether_ntoa(&cei->hw_address)); if (getnameinfo((struct sockaddr *)&cei->ll_address, cei->ll_address.sin6_len, hbuf, sizeof(hbuf), NULL, 0, @@ -272,9 +273,9 @@ show_interface_msg(struct imsg *imsg) NULL, 0, NI_NUMERICHOST | NI_NUMERICSERV)) err(1, "cannot get proposal IP"); - printf("\t\tid: %4lld, state: %15s, privacy: %s\n", + printf("\t\tid: %4lld, state: %15s, temporary: %s\n", cei_addr_proposal->id, cei_addr_proposal->state, - cei_addr_proposal->privacy ? "y" : "n"); + cei_addr_proposal->temporary ? "y" : "n"); if (clock_gettime(CLOCK_MONOTONIC, &now)) err(1, "clock_gettime"); -- 2.20.1