-/* $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 <florian@openbsd.org>
#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)
*/
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;
uint32_t rdomain;
int running;
int autoconf;
- int autoconfprivacy;
+ int temporary;
int soii;
struct ether_addr hw_address;
struct sockaddr_in6 ll_address;
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);
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,
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;
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));
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;
}
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;
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);
{
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 &&
else
vltime = TWO_HOURS;
- if (addr_proposal->privacy) {
+ if (addr_proposal->temporary) {
struct timespec now;
int64_t ltime, mtime;
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;
/* 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);
}
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,
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;
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 =
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);
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;
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 */
}
-/* $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 <claudio@openbsd.org>
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,
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");