From patchwork Fri Apr 5 11:06:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Donald X-Patchwork-Id: 1920215 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=akxpWHRO; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=eWVQFdkW; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V9wmq1GNWz1yZM for ; Fri, 5 Apr 2024 22:12:11 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=InSOIUqt/U0bydbRc+u4lBA6kJmXS7hdw4hcXzxr9WQ=; b=akxpWHRO0MKsXP U3uvjyRatc90jeBtMY8+YvnWnH4IqbLo2QxKmmXoX/ku1ssN54xZ2v2nwcJcjIndmabxGbMpjHbWe N0lBds+lR6/qeAwxrtfPW9PAGiZBg+7UOZ2B1ei70lpNPd4m6tdSSTCZbQ9pJp4AzTrLq8hDpKFgF bQSCrn8jnHurQrKlt5A5u0PcFAOV3WMlg9jxWJK6Zf+zel80CB9CXaY1yqyZFIxllRVWTkBaRl8TW eJFQAADACoa50VkNrD5exeh1w7a2FcyUkRMELME9zDtLf7XZYB+Ksj12lkwyQraIQ56SWUOsCKeJ3 4fTZt5xw/OgPJO0sJtBA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rshT1-00000006bl0-0bzn; Fri, 05 Apr 2024 11:10:43 +0000 Received: from mail-lf1-x12d.google.com ([2a00:1450:4864:20::12d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rshSn-00000006bcl-47Gn for openwrt-devel@lists.openwrt.org; Fri, 05 Apr 2024 11:10:33 +0000 Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-516c97ddcd1so2407198e87.2 for ; Fri, 05 Apr 2024 04:10:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712315427; x=1712920227; darn=lists.openwrt.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=fdDxShVpdfFt0NjuNFohiiYuYGo6XVeWOEAf0nh8Dg0=; b=eWVQFdkWMMz0p4D7X17tLykZT/UQsGO7jABX7rx14ZzxCVA12zyvm2PAU7OvMvMNLR Brrn5kRGcUxF5uEeKV0CkqyKL6FhjREIf8ruxIZxQ2e+ok3eVQCinkBqlWbhg8cbqpzZ IhOU8Gm00KbekDsPZ+GuTQkK/hxWJD4PbPgBblt57d0+FDMXprgvj3lOsaChXgXnxPhh e3AJVQYlxQ9s5lkhjgGi4l1z0ihyfVWH0nuCEGpX9ReU1bDgdFMypIKrcug5qhyCHDkV hhEo6cewuwu4rKZitbH+h0itfnVEsJSzOolcaPsZThXifozSFzsw1gPcCm1cFLtN4XUR BHoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712315427; x=1712920227; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:sender:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=fdDxShVpdfFt0NjuNFohiiYuYGo6XVeWOEAf0nh8Dg0=; b=AiY4fMcTHzjVBx8bOt+LhJComx+0GHRsBwg/7F8BNhoWTI4DMONP9w2/mAev4aCH0b PHjgCk9zQGULvMOZJzIPl56fENr/Px9Dh93AyJhb3V52EMx1a+5eg/W9Q+aYw13e3IUx tGA+/WtfZdkMl4rYPODIHcltilEPDIl64BLlIH9KtmJdpXwKVd1H5JXuSBKMNEhYhTHZ 3XZZs97pcmlfJcmFrd888NdhEov3Ha1L1eVbkJ0Dngfj8D78/2mVsP8miLV4/niSDqbB VqF/HVIiaVn/vEbdtbsedhwsOSFt9VNCf3dvjQc008uSjDXK+rjYIituC7EuRFkdXvX3 zilg== X-Gm-Message-State: AOJu0YyqqD+CJ/9GZVx8X9t5LUfcehZLB0nlQkoc+n/8gKDf2eoPN9+y 3ZXLpOR2dyqkykwWlETSmlJGdG8fjp5navsgEW4vTDQ4bF3zuKy8Y4kbwGHCWLdk+w== X-Google-Smtp-Source: AGHT+IE9KmxU0MZCwDkVcvnOfq5RnqLI8sjrqQ2Ce0KJmDTvhV7e11qqCmMCYrmiT68G4vqyNiGumA== X-Received: by 2002:a19:9155:0:b0:516:ce40:14a6 with SMTP id y21-20020a199155000000b00516ce4014a6mr660197lfj.1.1712315427062; Fri, 05 Apr 2024 04:10:27 -0700 (PDT) Received: from blackhol3 ([2001:9b0:40::cae3:cb03]) by smtp.gmail.com with ESMTPSA id g21-20020ac24d95000000b00516cdadf377sm163719lfe.137.2024.04.05.04.10.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 04:10:26 -0700 (PDT) From: Paul Donald To: OpenWrt Development List Subject: [PATCH v2 1/9] various: refactor pref(erred) to preferred_lt (lifetime) Date: Fri, 5 Apr 2024 13:06:45 +0200 Message-ID: <20240405111025.26478-2-newtwen+github@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240405111025.26478-1-newtwen+github@gmail.com> References: <20240405005510.19778-1-newtwen+github@gmail.com> <20240405111025.26478-1-newtwen+github@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240405_041030_140887_09AC821B X-CRM114-Status: GOOD ( 20.68 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Paul Donald Refactor "preferred" (preferred what?) and "pref" (obscure) to "preferred_lt". It is now more difficult to conflate prefix, preference and other "pref" related terminology with preferred_lifetime. Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:12d listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [newtwen+github(at)gmail.com] X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org From: Paul Donald Refactor "preferred" (preferred what?) and "pref" (obscure) to "preferred_lt". It is now more difficult to conflate prefix, preference and other "pref" related terminology with preferred_lifetime. Signed-off-by: Paul Donald Reviewed-by: Daniel Golle --- src/dhcpv6-ia.c | 84 ++++++++++++++++++++++++------------------------- src/dhcpv6.c | 2 +- src/dhcpv6.h | 4 +-- src/netlink.c | 34 ++++++++++---------- src/odhcpd.c | 6 ++-- src/odhcpd.h | 2 +- src/router.c | 14 ++++----- 7 files changed, 73 insertions(+), 73 deletions(-) diff --git a/src/dhcpv6-ia.c b/src/dhcpv6-ia.c index 1fbed44..6a9098e 100644 --- a/src/dhcpv6-ia.c +++ b/src/dhcpv6-ia.c @@ -120,7 +120,7 @@ static inline bool valid_prefix_length(const struct dhcp_assignment *a, const ui static inline bool valid_addr(const struct odhcpd_ipaddr *addr, time_t now) { - return (addr->prefix <= 96 && addr->preferred > (uint32_t)now); + return (addr->prefix <= 96 && addr->preferred_lt > (uint32_t)now); } static size_t get_preferred_addr(const struct odhcpd_ipaddr *addrs, const size_t addrlen) @@ -128,8 +128,8 @@ static size_t get_preferred_addr(const struct odhcpd_ipaddr *addrs, const size_t size_t i, m; for (i = 0, m = 0; i < addrlen; ++i) { - if (addrs[i].preferred > addrs[m].preferred || - (addrs[i].preferred == addrs[m].preferred && + if (addrs[i].preferred_lt > addrs[m].preferred_lt || + (addrs[i].preferred_lt == addrs[m].preferred_lt && memcmp(&addrs[i].addr, &addrs[m].addr, 16) > 0)) m = i; } @@ -226,7 +226,7 @@ void dhcpv6_ia_enum_addrs(struct interface *iface, struct dhcp_assignment *c, for (size_t i = 0; i < addrlen; ++i) { struct in6_addr addr; - uint32_t pref, valid; + uint32_t preferred_lt, valid; int prefix = c->managed ? addrs[i].prefix : c->length; if (!valid_addr(&addrs[i], now)) @@ -242,7 +242,7 @@ void dhcpv6_ia_enum_addrs(struct interface *iface, struct dhcp_assignment *c, } addr = addrs[i].addr.in6; - pref = addrs[i].preferred; + preferred_lt = addrs[i].preferred_lt; valid = addrs[i].valid; if (c->flags & OAF_DHCPV6_NA) { @@ -259,14 +259,14 @@ void dhcpv6_ia_enum_addrs(struct interface *iface, struct dhcp_assignment *c, addr.s6_addr32[2] = addr.s6_addr32[3] = 0; } - if (pref > (uint32_t)c->preferred_until) - pref = c->preferred_until; + if (preferred_lt > (uint32_t)c->preferred_until) + preferred_lt = c->preferred_until; - if (pref > (uint32_t)c->valid_until) - pref = c->valid_until; + if (preferred_lt > (uint32_t)c->valid_until) + preferred_lt = c->valid_until; - if (pref != UINT32_MAX) - pref -= now; + if (preferred_lt != UINT32_MAX) + preferred_lt -= now; if (valid > (uint32_t)c->valid_until) valid = c->valid_until; @@ -274,7 +274,7 @@ void dhcpv6_ia_enum_addrs(struct interface *iface, struct dhcp_assignment *c, if (valid != UINT32_MAX) valid -= now; - func(&addr, prefix, pref, valid, arg); + func(&addr, prefix, preferred_lt, valid, arg); } } @@ -288,7 +288,7 @@ struct write_ctxt { int buf_idx; }; -static void dhcpv6_write_ia_addrhosts(struct in6_addr *addr, int prefix, _unused uint32_t pref, +static void dhcpv6_write_ia_addrhosts(struct in6_addr *addr, int prefix, _unused uint32_t pref_lt, _unused uint32_t valid, void *arg) { struct write_ctxt *ctxt = (struct write_ctxt *)arg; @@ -308,7 +308,7 @@ static void dhcpv6_write_ia_addrhosts(struct in6_addr *addr, int prefix, _unused } } -static void dhcpv6_write_ia_addr(struct in6_addr *addr, int prefix, _unused uint32_t pref, +static void dhcpv6_write_ia_addr(struct in6_addr *addr, int prefix, _unused uint32_t pref_lt, _unused uint32_t valid, void *arg) { struct write_ctxt *ctxt = (struct write_ctxt *)arg; @@ -629,7 +629,7 @@ static void set_border_assignment_size(struct interface *iface, struct dhcp_assi if (ADDR_MATCH_PIO_FILTER(addr, iface)) continue; - if (addr->preferred > (uint32_t)now && + if (addr->preferred_lt > (uint32_t)now && addr->prefix < 64 && addr->prefix > minprefix) minprefix = addr->prefix; @@ -678,20 +678,20 @@ static void managed_handle_pd_data(struct ustream *s, _unused int bytes_new) continue; x = strtok_r(NULL, ",", &saveptr2); - if (sscanf(x, "%u", &n->preferred) < 1) + if (sscanf(x, "%u", &n->preferred_lt) < 1) continue; x = strtok_r(NULL, ",", &saveptr2); if (sscanf(x, "%u", &n->valid) < 1) continue; - if (n->preferred > n->valid) + if (n->preferred_lt > n->valid) continue; - if (UINT32_MAX - now < n->preferred) - n->preferred = UINT32_MAX; + if (UINT32_MAX - now < n->preferred_lt) + n->preferred_lt = UINT32_MAX; else - n->preferred += now; + n->preferred_lt += now; if (UINT32_MAX - now < n->valid) n->valid = UINT32_MAX; @@ -1037,14 +1037,14 @@ static size_t build_ia(uint8_t *buf, size_t buflen, uint16_t status, } if (a) { - uint32_t leasetime, pref; + uint32_t leasetime, preferred_lt; if (a->leasetime) { leasetime = a->leasetime; - pref = a->leasetime; + preferred_lt = a->leasetime; } else { leasetime = iface->dhcp_leasetime; - pref = iface->preferred_lifetime; + preferred_lt = iface->preferred_lifetime; } uint32_t valid = leasetime; @@ -1054,7 +1054,7 @@ static size_t build_ia(uint8_t *buf, size_t buflen, uint16_t status, size_t m = get_preferred_addr(addrs, addrlen); for (size_t i = 0; i < addrlen; ++i) { - uint32_t prefix_pref, prefix_valid; + uint32_t prefix_preferred_lt, prefix_valid; if (!valid_addr(&addrs[i], now)) continue; @@ -1068,14 +1068,14 @@ static size_t build_ia(uint8_t *buf, size_t buflen, uint16_t status, continue; } - prefix_pref = addrs[i].preferred; + prefix_preferred_lt = addrs[i].preferred_lt; prefix_valid = addrs[i].valid; - if (prefix_pref != UINT32_MAX) - prefix_pref -= now; + if (prefix_preferred_lt != UINT32_MAX) + prefix_preferred_lt -= now; - if (prefix_pref > pref) - prefix_pref = pref; + if (prefix_preferred_lt > preferred_lt) + prefix_preferred_lt = preferred_lt; if (prefix_valid != UINT32_MAX) prefix_valid -= now; @@ -1083,14 +1083,14 @@ static size_t build_ia(uint8_t *buf, size_t buflen, uint16_t status, if (prefix_valid > leasetime) prefix_valid = leasetime; - if (prefix_pref > prefix_valid) - prefix_pref = prefix_valid; + if (prefix_preferred_lt > prefix_valid) + prefix_preferred_lt = prefix_valid; if (a->flags & OAF_DHCPV6_PD) { struct dhcpv6_ia_prefix o_ia_p = { .type = htons(DHCPV6_OPT_IA_PREFIX), .len = htons(sizeof(o_ia_p) - 4), - .preferred = htonl(prefix_pref), + .preferred_lt = htonl(prefix_preferred_lt), .valid = htonl(prefix_valid), .prefix = (a->managed_size) ? addrs[i].prefix : a->length, .addr = addrs[i].addr.in6, @@ -1114,7 +1114,7 @@ static size_t build_ia(uint8_t *buf, size_t buflen, uint16_t status, .type = htons(DHCPV6_OPT_IA_ADDR), .len = htons(sizeof(o_ia_a) - 4), .addr = addrs[i].addr.in6, - .preferred = htonl(prefix_pref), + .preferred_lt = htonl(prefix_preferred_lt), .valid = htonl(prefix_valid) }; @@ -1132,9 +1132,9 @@ static size_t build_ia(uint8_t *buf, size_t buflen, uint16_t status, } /* Calculate T1 / T2 based on non-deprecated addresses */ - if (prefix_pref > 0) { - if (prefix_pref < pref) - pref = prefix_pref; + if (prefix_preferred_lt > 0) { + if (prefix_preferred_lt < preferred_lt) + preferred_lt = prefix_preferred_lt; if (prefix_valid < valid) valid = prefix_valid; @@ -1147,10 +1147,10 @@ static size_t build_ia(uint8_t *buf, size_t buflen, uint16_t status, if (!INFINITE_VALID(a->preferred_until)) /* UINT32_MAX is considered as infinite leasetime */ - a->preferred_until = (pref == UINT32_MAX) ? 0 : pref + now; + a->preferred_until = (preferred_lt == UINT32_MAX) ? 0 : preferred_lt + now; - o_ia.t1 = htonl((pref == UINT32_MAX) ? pref : pref * 5 / 10); - o_ia.t2 = htonl((pref == UINT32_MAX) ? pref : pref * 8 / 10); + o_ia.t1 = htonl((preferred_lt == UINT32_MAX) ? preferred_lt : preferred_lt * 5 / 10); + o_ia.t2 = htonl((preferred_lt == UINT32_MAX) ? preferred_lt : preferred_lt * 8 / 10); if (!o_ia.t1) o_ia.t1 = htonl(1); @@ -1211,7 +1211,7 @@ static size_t build_ia(uint8_t *buf, size_t buflen, uint16_t status, struct dhcpv6_ia_prefix o_ia_p = { .type = htons(DHCPV6_OPT_IA_PREFIX), .len = htons(sizeof(o_ia_p) - 4), - .preferred = 0, + .preferred_lt = 0, .valid = 0, .prefix = ia_p->prefix, .addr = ia_p->addr, @@ -1227,7 +1227,7 @@ static size_t build_ia(uint8_t *buf, size_t buflen, uint16_t status, .type = htons(DHCPV6_OPT_IA_ADDR), .len = htons(sizeof(o_ia_a) - 4), .addr = ia_a->addr, - .preferred = 0, + .preferred_lt = 0, .valid = 0, }; @@ -1252,7 +1252,7 @@ struct log_ctxt { int buf_idx; }; -static void dhcpv6_log_ia_addr(struct in6_addr *addr, int prefix, _unused uint32_t pref, +static void dhcpv6_log_ia_addr(struct in6_addr *addr, int prefix, _unused uint32_t pref_lt, _unused uint32_t valid, void *arg) { struct log_ctxt *ctxt = (struct log_ctxt *)arg; diff --git a/src/dhcpv6.c b/src/dhcpv6.c index b086fd8..b0e5a79 100644 --- a/src/dhcpv6.c +++ b/src/dhcpv6.c @@ -773,7 +773,7 @@ static struct odhcpd_ipaddr *relay_link_address(struct interface *iface) if (iface->addr6[i].valid <= (uint32_t)now) continue; - if (iface->addr6[i].preferred > (uint32_t)now) { + if (iface->addr6[i].preferred_lt > (uint32_t)now) { addr = &iface->addr6[i]; break; } diff --git a/src/dhcpv6.h b/src/dhcpv6.h index f344969..8681d7f 100644 --- a/src/dhcpv6.h +++ b/src/dhcpv6.h @@ -130,7 +130,7 @@ struct dhcpv6_ia_hdr { struct dhcpv6_ia_prefix { uint16_t type; uint16_t len; - uint32_t preferred; + uint32_t preferred_lt; uint32_t valid; uint8_t prefix; struct in6_addr addr; @@ -140,7 +140,7 @@ struct dhcpv6_ia_addr { uint16_t type; uint16_t len; struct in6_addr addr; - uint32_t preferred; + uint32_t preferred_lt; uint32_t valid; } _packed; diff --git a/src/netlink.c b/src/netlink.c index c2b9576..cf77035 100644 --- a/src/netlink.c +++ b/src/netlink.c @@ -206,8 +206,8 @@ static void refresh_iface_addr6(int ifindex) for (ssize_t i = 0; !change && i < len; ++i) { if (!IN6_ARE_ADDR_EQUAL(&addr[i].addr.in6, &iface->addr6[i].addr.in6) || addr[i].prefix != iface->addr6[i].prefix || - (addr[i].preferred > (uint32_t)now) != (iface->addr6[i].preferred > (uint32_t)now) || - addr[i].valid < iface->addr6[i].valid || addr[i].preferred < iface->addr6[i].preferred) + (addr[i].preferred_lt > (uint32_t)now) != (iface->addr6[i].preferred_lt > (uint32_t)now) || + addr[i].valid < iface->addr6[i].valid || addr[i].preferred_lt < iface->addr6[i].preferred_lt) change = true; } @@ -258,7 +258,7 @@ static void refresh_iface_addr6(int ifindex) iface->invalid_addr6 = new_invalid_addr6; iface->invalid_addr6_len++; memcpy(&iface->invalid_addr6[pos], &iface->addr6[i], sizeof(*iface->invalid_addr6)); - iface->invalid_addr6[pos].valid = iface->invalid_addr6[pos].preferred = (uint32_t)now; + iface->invalid_addr6[pos].valid = iface->invalid_addr6[pos].preferred_lt = (uint32_t)now; if (iface->invalid_addr6[pos].prefix < 64) iface->invalid_addr6[pos].prefix = 64; @@ -630,12 +630,12 @@ static int cb_addr_valid(struct nl_msg *msg, void *arg) if (nla[IFA_CACHEINFO]) { struct ifa_cacheinfo *ifc = nla_data(nla[IFA_CACHEINFO]); - addrs[ctxt->ret].preferred = ifc->ifa_prefered; + addrs[ctxt->ret].preferred_lt = ifc->ifa_prefered; addrs[ctxt->ret].valid = ifc->ifa_valid; } if (ifa->ifa_flags & IFA_F_DEPRECATED) - addrs[ctxt->ret].preferred = 0; + addrs[ctxt->ret].preferred_lt = 0; if (ifa->ifa_family == AF_INET6 && ifa->ifa_flags & IFA_F_TENTATIVE) @@ -689,9 +689,9 @@ static int prefix_cmp(const void *va, const void *vb) static int prefix6_cmp(const void *va, const void *vb) { const struct odhcpd_ipaddr *a = va, *b = vb; - uint32_t a_pref = IN6_IS_ADDR_ULA(&a->addr.in6) ? 1 : a->preferred; - uint32_t b_pref = IN6_IS_ADDR_ULA(&b->addr.in6) ? 1 : b->preferred; - return (a_pref < b_pref) ? 1 : (a_pref > b_pref) ? -1 : 0; + uint32_t a_pref_lt = IN6_IS_ADDR_ULA(&a->addr.in6) ? 1 : a->preferred_lt; + uint32_t b_pref_lt = IN6_IS_ADDR_ULA(&b->addr.in6) ? 1 : b->preferred_lt; + return (a_pref_lt < b_pref_lt) ? 1 : (a_pref_lt > b_pref_lt) ? -1 : 0; } @@ -749,8 +749,8 @@ ssize_t netlink_get_interface_addrs(int ifindex, bool v6, struct odhcpd_ipaddr * qsort(addr, ctxt.ret, sizeof(*addr), v6 ? prefix6_cmp : prefix_cmp); for (ssize_t i = 0; i < ctxt.ret; ++i) { - if (addr[i].preferred < UINT32_MAX - now) - addr[i].preferred += now; + if (addr[i].preferred_lt < UINT32_MAX - now) + addr[i].preferred_lt += now; if (addr[i].valid < UINT32_MAX - now) addr[i].valid += now; @@ -1114,14 +1114,14 @@ int netlink_setup_addr(struct odhcpd_ipaddr *addr, .tstamp = 0 }; time_t now = odhcpd_time(); - if (addr->preferred) { - int64_t preferred = addr->preferred - now; - if (preferred < 0) - preferred = 0; - else if (preferred > UINT32_MAX) - preferred = UINT32_MAX; + if (addr->preferred_lt) { + int64_t preferred_lt = addr->preferred_lt - now; + if (preferred_lt < 0) + preferred_lt = 0; + else if (preferred_lt > UINT32_MAX) + preferred_lt = UINT32_MAX; - cinfo.ifa_prefered = preferred; + cinfo.ifa_prefered = preferred_lt; } if (addr->valid) { diff --git a/src/odhcpd.c b/src/odhcpd.c index 554e5f1..e2e89c0 100644 --- a/src/odhcpd.c +++ b/src/odhcpd.c @@ -277,8 +277,8 @@ int odhcpd_get_interface_dns_addr(const struct interface *iface, struct in6_addr continue; } - if (iface->addr6[m].preferred >= (uint32_t)now && - iface->addr6[i].preferred < (uint32_t)now) + if (iface->addr6[m].preferred_lt >= (uint32_t)now && + iface->addr6[i].preferred_lt < (uint32_t)now) continue; if (IN6_IS_ADDR_ULA(&iface->addr6[i].addr.in6)) { @@ -289,7 +289,7 @@ int odhcpd_get_interface_dns_addr(const struct interface *iface, struct in6_addr } else if (IN6_IS_ADDR_ULA(&iface->addr6[m].addr.in6)) continue; - if (iface->addr6[i].preferred > iface->addr6[m].preferred) + if (iface->addr6[i].preferred_lt > iface->addr6[m].preferred_lt) m = i; } diff --git a/src/odhcpd.h b/src/odhcpd.h index 02b6ac0..df27c14 100644 --- a/src/odhcpd.h +++ b/src/odhcpd.h @@ -126,7 +126,7 @@ struct netevent_handler { struct odhcpd_ipaddr { union if_addr addr; uint8_t prefix; - uint32_t preferred; + uint32_t preferred_lt; uint32_t valid; union { diff --git a/src/router.c b/src/router.c index d5ef7f8..55f3acb 100644 --- a/src/router.c +++ b/src/router.c @@ -301,7 +301,7 @@ static bool router_icmpv6_valid(struct sockaddr_in6 *source, uint8_t *data, size static bool parse_routes(struct odhcpd_ipaddr *n, ssize_t len) { struct odhcpd_ipaddr p = { .addr.in6 = IN6ADDR_ANY_INIT, .prefix = 0, - .dprefix = 0, .preferred = 0, .valid = 0}; + .dprefix = 0, .preferred_lt = 0, .valid = 0}; bool found_default = false; char line[512], ifname[16]; @@ -549,7 +549,7 @@ static int send_router_advert(struct interface *iface, const struct in6_addr *fr for (ssize_t i = 0; i < valid_addr_cnt + invalid_addr_cnt; ++i) { struct odhcpd_ipaddr *addr = &addrs[i]; struct nd_opt_prefix_info *p = NULL; - uint32_t preferred = 0; + uint32_t preferred_lt = 0; uint32_t valid = 0; if (addr->prefix > 96 || (i < valid_addr_cnt && addr->valid <= (uint32_t)now)) { @@ -587,12 +587,12 @@ static int send_router_advert(struct interface *iface, const struct in6_addr *fr memset(p, 0, sizeof(*p)); } - if (addr->preferred > (uint32_t)now) { - preferred = TIME_LEFT(addr->preferred, now); + if (addr->preferred_lt > (uint32_t)now) { + preferred_lt = TIME_LEFT(addr->preferred_lt, now); if (iface->ra_useleasetime && - preferred > iface->preferred_lifetime) - preferred = iface->preferred_lifetime; + preferred_lt > iface->preferred_lifetime) + preferred_lt = iface->preferred_lifetime; } if (addr->valid > (uint32_t)now) { @@ -620,7 +620,7 @@ static int send_router_advert(struct interface *iface, const struct in6_addr *fr p->nd_opt_pi_flags_reserved |= ND_OPT_PI_FLAG_AUTO; if (iface->ra_advrouter) p->nd_opt_pi_flags_reserved |= ND_OPT_PI_FLAG_RADDR; - p->nd_opt_pi_preferred_time = htonl(preferred); + p->nd_opt_pi_preferred_time = htonl(preferred_lt); p->nd_opt_pi_valid_time = htonl(valid); } From patchwork Fri Apr 5 11:06:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Donald X-Patchwork-Id: 1920214 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=Q6DWg9II; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=JlkNsEq/; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V9wmm1Ympz1yZQ for ; Fri, 5 Apr 2024 22:12:07 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=mfVLCw9JKX/hPORHP2CW+y36ZVNm+aEKKJ3XNcCQ0Qs=; b=Q6DWg9IIp3B55a MXnElrSPBWsvq2MrtnjZEXjk+yj/tkxffovPqA/OtDsOA9HJrRQdohfmSJ+MgyE7NDfl2ghdbUgSw YhrPmQvQN2RSFXVr0iToffgZ/2oWexKSSLPz/Dd2HvwUKCVOqLRPXdF+UjV55v2wB/R2E1bQ+PKyN aQgv6KlSaa47IutlW7IqlzsACWd8nK+7CzFXKKJzy0+ba9TIa7o6/u/CyZ80uS7C6k16WkUwqqMqR 4wU6ayPSbj0XY4AzfYkl3lr0ejfugK0Xm8fMPcAJaNRCHAmZGp/0ACeqLcxAtJfNWEyQAuu0pC/+M qp+g2WVhBfKU+1GY8g0Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rshSy-00000006bje-1SbJ; Fri, 05 Apr 2024 11:10:40 +0000 Received: from mail-lf1-x130.google.com ([2a00:1450:4864:20::130]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rshSn-00000006bcm-48fc for openwrt-devel@lists.openwrt.org; Fri, 05 Apr 2024 11:10:31 +0000 Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-516d487659bso668086e87.2 for ; Fri, 05 Apr 2024 04:10:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712315428; x=1712920228; darn=lists.openwrt.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=DEgV11gJFi7IZMyyJtUpMC5D8rDnWOGlEm1yYP07E9o=; b=JlkNsEq/nBILdSBHMYvFE8rEX7NJWae/LZWSKXKFy6X6nqGmtuq8SxuOSRt+pcCNkH 8DpS5hSQiJPrXB6BAR5CfqN2rIolAQ7gjVrRsZkcnY7sdBHUXRyuJdMvSY3bTgVm+sz+ 7PRdoZU39Z4hInNO1n/UFDXW3j56XsxukmrOJmvYKgsLdCxHQ7esEOcHB/mffLgyzc27 jrevuAM0yQJl51UKi9S6Ni5m4vYnzbsMay0BXL2/Ts/FZgenYT9UcVDfWDVl7ZGYFGew wM7/Qs4+RNQQ8mnYur5rrkdag514n1jwVcXWxLKH0ST4EqxEov/VG6TmmKe5bWNTQUF/ sT4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712315428; x=1712920228; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:sender:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=DEgV11gJFi7IZMyyJtUpMC5D8rDnWOGlEm1yYP07E9o=; b=izZvn6FFBfpkNs3FY851qnwpZkB1nLznty/osOeNe3FPmFV2TeAJm8tvogkcojTE+T dpcYxVWYtAgmvy1QueLZIrVeCCzSmt2EGtdOfC0x3y52uadodRQOs66BVLzUuGHWINhz ODMzx0VSOA7OZ3bK8AAUZC2Q7DFbV51AJsmUQbxfnPpB2pmqqgQ5kwnct68KlCxArdb2 ly8R/R7nM9GIw/Exw9M1AnLynFIWdwU28UvzNMsjJlZZvxg8oQZwVRJZ/Kbukd6fe+lc T5/hpCXL2QpFdYGi7/1lWTgu6PQps/YiL09QylG3nllNTOdkqKkix4JsJ7Gc01VT5DGf 3G5g== X-Gm-Message-State: AOJu0Yx3eNDkDRyZHuTcZWx9GJrF7GamT0g5B4HH1tv2KYggxgBgW/XB 8E7ULtq3v8Jzvvt9Vl88QG8i/KPiFJ15iEtUk5HzDv1FlW9GCBV4w7NGKnszs4kO+Q== X-Google-Smtp-Source: AGHT+IF55UgSXuR5eJ3n2+TxCjEo1cIrh9SeLzbPqHB5V6AaJPMaM2T6DwPNHq6s4aX6dRz35MRcSw== X-Received: by 2002:a19:a416:0:b0:516:d4c8:8618 with SMTP id q22-20020a19a416000000b00516d4c88618mr794669lfc.61.1712315427765; Fri, 05 Apr 2024 04:10:27 -0700 (PDT) Received: from blackhol3 ([2001:9b0:40::cae3:cb03]) by smtp.gmail.com with ESMTPSA id g21-20020ac24d95000000b00516cdadf377sm163719lfe.137.2024.04.05.04.10.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 04:10:27 -0700 (PDT) From: Paul Donald To: OpenWrt Development List Subject: [PATCH v2 2/9] various: refactor valid -> valid_lt (lifetime) Date: Fri, 5 Apr 2024 13:06:46 +0200 Message-ID: <20240405111025.26478-3-newtwen+github@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240405111025.26478-1-newtwen+github@gmail.com> References: <20240405005510.19778-1-newtwen+github@gmail.com> <20240405111025.26478-1-newtwen+github@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240405_041030_116888_E763161F X-CRM114-Status: GOOD ( 20.43 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Paul Donald Refactor "valid" (valid what?) to "valid_lt". Signed-off-by: Paul Donald Reviewed-by: Daniel Golle --- src/dhcpv6-ia.c | 62 ++++++++++++++++++++++++ src/dhcpv6.c | 4 ++-- src/dhcpv6.h | 4 ++-- src/netlink.c | 24 +++++ [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:130 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [newtwen+github(at)gmail.com] X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org From: Paul Donald Refactor "valid" (valid what?) to "valid_lt". Signed-off-by: Paul Donald Reviewed-by: Daniel Golle --- src/dhcpv6-ia.c | 62 ++++++++++++++++++++++++------------------------- src/dhcpv6.c | 4 ++-- src/dhcpv6.h | 4 ++-- src/netlink.c | 24 +++++++++---------- src/odhcpd.c | 2 +- src/odhcpd.h | 2 +- src/router.c | 38 +++++++++++++++--------------- 7 files changed, 68 insertions(+), 68 deletions(-) diff --git a/src/dhcpv6-ia.c b/src/dhcpv6-ia.c index 6a9098e..39a316a 100644 --- a/src/dhcpv6-ia.c +++ b/src/dhcpv6-ia.c @@ -226,7 +226,7 @@ void dhcpv6_ia_enum_addrs(struct interface *iface, struct dhcp_assignment *c, for (size_t i = 0; i < addrlen; ++i) { struct in6_addr addr; - uint32_t preferred_lt, valid; + uint32_t preferred_lt, valid_lt; int prefix = c->managed ? addrs[i].prefix : c->length; if (!valid_addr(&addrs[i], now)) @@ -243,7 +243,7 @@ void dhcpv6_ia_enum_addrs(struct interface *iface, struct dhcp_assignment *c, addr = addrs[i].addr.in6; preferred_lt = addrs[i].preferred_lt; - valid = addrs[i].valid; + valid_lt = addrs[i].valid_lt; if (c->flags & OAF_DHCPV6_NA) { if (!ADDR_ENTRY_VALID_IA_ADDR(iface, i, m, addrs)) @@ -268,13 +268,13 @@ void dhcpv6_ia_enum_addrs(struct interface *iface, struct dhcp_assignment *c, if (preferred_lt != UINT32_MAX) preferred_lt -= now; - if (valid > (uint32_t)c->valid_until) - valid = c->valid_until; + if (valid_lt > (uint32_t)c->valid_until) + valid_lt = c->valid_until; - if (valid != UINT32_MAX) - valid -= now; + if (valid_lt != UINT32_MAX) + valid_lt -= now; - func(&addr, prefix, preferred_lt, valid, arg); + func(&addr, prefix, preferred_lt, valid_lt, arg); } } @@ -289,7 +289,7 @@ struct write_ctxt { }; static void dhcpv6_write_ia_addrhosts(struct in6_addr *addr, int prefix, _unused uint32_t pref_lt, - _unused uint32_t valid, void *arg) + _unused uint32_t valid_lt, void *arg) { struct write_ctxt *ctxt = (struct write_ctxt *)arg; char ipbuf[INET6_ADDRSTRLEN]; @@ -309,7 +309,7 @@ static void dhcpv6_write_ia_addrhosts(struct in6_addr *addr, int prefix, _unused } static void dhcpv6_write_ia_addr(struct in6_addr *addr, int prefix, _unused uint32_t pref_lt, - _unused uint32_t valid, void *arg) + _unused uint32_t valid_lt, void *arg) { struct write_ctxt *ctxt = (struct write_ctxt *)arg; char ipbuf[INET6_ADDRSTRLEN]; @@ -682,10 +682,10 @@ static void managed_handle_pd_data(struct ustream *s, _unused int bytes_new) continue; x = strtok_r(NULL, ",", &saveptr2); - if (sscanf(x, "%u", &n->valid) < 1) + if (sscanf(x, "%u", &n->valid_lt) < 1) continue; - if (n->preferred_lt > n->valid) + if (n->preferred_lt > n->valid_lt) continue; if (UINT32_MAX - now < n->preferred_lt) @@ -693,10 +693,10 @@ static void managed_handle_pd_data(struct ustream *s, _unused int bytes_new) else n->preferred_lt += now; - if (UINT32_MAX - now < n->valid) - n->valid = UINT32_MAX; + if (UINT32_MAX - now < n->valid_lt) + n->valid_lt = UINT32_MAX; else - n->valid += now; + n->valid_lt += now; n->dprefix = 0; @@ -1047,14 +1047,14 @@ static size_t build_ia(uint8_t *buf, size_t buflen, uint16_t status, preferred_lt = iface->preferred_lifetime; } - uint32_t valid = leasetime; + uint32_t valid_lt = leasetime; struct odhcpd_ipaddr *addrs = (a->managed) ? a->managed : iface->addr6; size_t addrlen = (a->managed) ? (size_t)a->managed_size : iface->addr6_len; size_t m = get_preferred_addr(addrs, addrlen); for (size_t i = 0; i < addrlen; ++i) { - uint32_t prefix_preferred_lt, prefix_valid; + uint32_t prefix_preferred_lt, prefix_valid_lt; if (!valid_addr(&addrs[i], now)) continue; @@ -1069,7 +1069,7 @@ static size_t build_ia(uint8_t *buf, size_t buflen, uint16_t status, } prefix_preferred_lt = addrs[i].preferred_lt; - prefix_valid = addrs[i].valid; + prefix_valid_lt = addrs[i].valid_lt; if (prefix_preferred_lt != UINT32_MAX) prefix_preferred_lt -= now; @@ -1077,21 +1077,21 @@ static size_t build_ia(uint8_t *buf, size_t buflen, uint16_t status, if (prefix_preferred_lt > preferred_lt) prefix_preferred_lt = preferred_lt; - if (prefix_valid != UINT32_MAX) - prefix_valid -= now; + if (prefix_valid_lt != UINT32_MAX) + prefix_valid_lt -= now; - if (prefix_valid > leasetime) - prefix_valid = leasetime; + if (prefix_valid_lt > leasetime) + prefix_valid_lt = leasetime; - if (prefix_preferred_lt > prefix_valid) - prefix_preferred_lt = prefix_valid; + if (prefix_preferred_lt > prefix_valid_lt) + prefix_preferred_lt = prefix_valid_lt; if (a->flags & OAF_DHCPV6_PD) { struct dhcpv6_ia_prefix o_ia_p = { .type = htons(DHCPV6_OPT_IA_PREFIX), .len = htons(sizeof(o_ia_p) - 4), .preferred_lt = htonl(prefix_preferred_lt), - .valid = htonl(prefix_valid), + .valid_lt = htonl(prefix_valid_lt), .prefix = (a->managed_size) ? addrs[i].prefix : a->length, .addr = addrs[i].addr.in6, }; @@ -1115,7 +1115,7 @@ static size_t build_ia(uint8_t *buf, size_t buflen, uint16_t status, .len = htons(sizeof(o_ia_a) - 4), .addr = addrs[i].addr.in6, .preferred_lt = htonl(prefix_preferred_lt), - .valid = htonl(prefix_valid) + .valid_lt = htonl(prefix_valid_lt) }; o_ia_a.addr.s6_addr32[2] = htonl(a->assigned_host_id >> 32); @@ -1136,14 +1136,14 @@ static size_t build_ia(uint8_t *buf, size_t buflen, uint16_t status, if (prefix_preferred_lt < preferred_lt) preferred_lt = prefix_preferred_lt; - if (prefix_valid < valid) - valid = prefix_valid; + if (prefix_valid_lt < valid_lt) + valid_lt = prefix_valid_lt; } } if (!INFINITE_VALID(a->valid_until)) /* UINT32_MAX is considered as infinite leasetime */ - a->valid_until = (valid == UINT32_MAX) ? 0 : valid + now; + a->valid_until = (valid_lt == UINT32_MAX) ? 0 : valid_lt + now; if (!INFINITE_VALID(a->preferred_until)) /* UINT32_MAX is considered as infinite leasetime */ @@ -1212,7 +1212,7 @@ static size_t build_ia(uint8_t *buf, size_t buflen, uint16_t status, .type = htons(DHCPV6_OPT_IA_PREFIX), .len = htons(sizeof(o_ia_p) - 4), .preferred_lt = 0, - .valid = 0, + .valid_lt = 0, .prefix = ia_p->prefix, .addr = ia_p->addr, }; @@ -1228,7 +1228,7 @@ static size_t build_ia(uint8_t *buf, size_t buflen, uint16_t status, .len = htons(sizeof(o_ia_a) - 4), .addr = ia_a->addr, .preferred_lt = 0, - .valid = 0, + .valid_lt = 0, }; if (buflen < ia_len + sizeof(o_ia_a)) @@ -1253,7 +1253,7 @@ struct log_ctxt { }; static void dhcpv6_log_ia_addr(struct in6_addr *addr, int prefix, _unused uint32_t pref_lt, - _unused uint32_t valid, void *arg) + _unused uint32_t valid_lt, void *arg) { struct log_ctxt *ctxt = (struct log_ctxt *)arg; char addrbuf[INET6_ADDRSTRLEN]; diff --git a/src/dhcpv6.c b/src/dhcpv6.c index b0e5a79..58b7d9f 100644 --- a/src/dhcpv6.c +++ b/src/dhcpv6.c @@ -770,7 +770,7 @@ static struct odhcpd_ipaddr *relay_link_address(struct interface *iface) time_t now = odhcpd_time(); for (size_t i = 0; i < iface->addr6_len; i++) { - if (iface->addr6[i].valid <= (uint32_t)now) + if (iface->addr6[i].valid_lt <= (uint32_t)now) continue; if (iface->addr6[i].preferred_lt > (uint32_t)now) { @@ -778,7 +778,7 @@ static struct odhcpd_ipaddr *relay_link_address(struct interface *iface) break; } - if (!addr || (iface->addr6[i].valid > addr->valid)) + if (!addr || (iface->addr6[i].valid_lt > addr->valid_lt)) addr = &iface->addr6[i]; } diff --git a/src/dhcpv6.h b/src/dhcpv6.h index 8681d7f..b925928 100644 --- a/src/dhcpv6.h +++ b/src/dhcpv6.h @@ -131,7 +131,7 @@ struct dhcpv6_ia_prefix { uint16_t type; uint16_t len; uint32_t preferred_lt; - uint32_t valid; + uint32_t valid_lt; uint8_t prefix; struct in6_addr addr; } _packed; @@ -141,7 +141,7 @@ struct dhcpv6_ia_addr { uint16_t len; struct in6_addr addr; uint32_t preferred_lt; - uint32_t valid; + uint32_t valid_lt; } _packed; struct dhcpv6_cer_id { diff --git a/src/netlink.c b/src/netlink.c index cf77035..c33e3ea 100644 --- a/src/netlink.c +++ b/src/netlink.c @@ -207,7 +207,7 @@ static void refresh_iface_addr6(int ifindex) if (!IN6_ARE_ADDR_EQUAL(&addr[i].addr.in6, &iface->addr6[i].addr.in6) || addr[i].prefix != iface->addr6[i].prefix || (addr[i].preferred_lt > (uint32_t)now) != (iface->addr6[i].preferred_lt > (uint32_t)now) || - addr[i].valid < iface->addr6[i].valid || addr[i].preferred_lt < iface->addr6[i].preferred_lt) + addr[i].valid_lt < iface->addr6[i].valid_lt || addr[i].preferred_lt < iface->addr6[i].preferred_lt) change = true; } @@ -230,7 +230,7 @@ static void refresh_iface_addr6(int ifindex) for (size_t i = 0; i < iface->addr6_len; ++i) { bool removed = true; - if (iface->addr6[i].valid <= (uint32_t)now) + if (iface->addr6[i].valid_lt <= (uint32_t)now) continue; for (ssize_t j = 0; removed && j < len; ++j) { @@ -258,7 +258,7 @@ static void refresh_iface_addr6(int ifindex) iface->invalid_addr6 = new_invalid_addr6; iface->invalid_addr6_len++; memcpy(&iface->invalid_addr6[pos], &iface->addr6[i], sizeof(*iface->invalid_addr6)); - iface->invalid_addr6[pos].valid = iface->invalid_addr6[pos].preferred_lt = (uint32_t)now; + iface->invalid_addr6[pos].valid_lt = iface->invalid_addr6[pos].preferred_lt = (uint32_t)now; if (iface->invalid_addr6[pos].prefix < 64) iface->invalid_addr6[pos].prefix = 64; @@ -631,7 +631,7 @@ static int cb_addr_valid(struct nl_msg *msg, void *arg) struct ifa_cacheinfo *ifc = nla_data(nla[IFA_CACHEINFO]); addrs[ctxt->ret].preferred_lt = ifc->ifa_prefered; - addrs[ctxt->ret].valid = ifc->ifa_valid; + addrs[ctxt->ret].valid_lt = ifc->ifa_valid; } if (ifa->ifa_flags & IFA_F_DEPRECATED) @@ -752,8 +752,8 @@ ssize_t netlink_get_interface_addrs(int ifindex, bool v6, struct odhcpd_ipaddr * if (addr[i].preferred_lt < UINT32_MAX - now) addr[i].preferred_lt += now; - if (addr[i].valid < UINT32_MAX - now) - addr[i].valid += now; + if (addr[i].valid_lt < UINT32_MAX - now) + addr[i].valid_lt += now; } free: @@ -1124,16 +1124,16 @@ int netlink_setup_addr(struct odhcpd_ipaddr *addr, cinfo.ifa_prefered = preferred_lt; } - if (addr->valid) { - int64_t valid = addr->valid - now; - if (valid <= 0) { + if (addr->valid_lt) { + int64_t valid_lt = addr->valid_lt - now; + if (valid_lt <= 0) { nlmsg_free(msg); return -1; } - else if (valid > UINT32_MAX) - valid = UINT32_MAX; + else if (valid_lt > UINT32_MAX) + valid_lt = UINT32_MAX; - cinfo.ifa_valid = valid; + cinfo.ifa_valid = valid_lt; } nla_put(msg, IFA_CACHEINFO, sizeof(cinfo), &cinfo); diff --git a/src/odhcpd.c b/src/odhcpd.c index e2e89c0..0849b43 100644 --- a/src/odhcpd.c +++ b/src/odhcpd.c @@ -269,7 +269,7 @@ int odhcpd_get_interface_dns_addr(const struct interface *iface, struct in6_addr return -1; for (size_t i = 0; i < iface->addr6_len; ++i) { - if (iface->addr6[i].valid <= (uint32_t)now) + if (iface->addr6[i].valid_lt <= (uint32_t)now) continue; if (m < 0) { diff --git a/src/odhcpd.h b/src/odhcpd.h index df27c14..7a82e98 100644 --- a/src/odhcpd.h +++ b/src/odhcpd.h @@ -127,7 +127,7 @@ struct odhcpd_ipaddr { union if_addr addr; uint8_t prefix; uint32_t preferred_lt; - uint32_t valid; + uint32_t valid_lt; union { /* ipv6 only */ diff --git a/src/router.c b/src/router.c index 55f3acb..6a9e19d 100644 --- a/src/router.c +++ b/src/router.c @@ -301,7 +301,7 @@ static bool router_icmpv6_valid(struct sockaddr_in6 *source, uint8_t *data, size static bool parse_routes(struct odhcpd_ipaddr *n, ssize_t len) { struct odhcpd_ipaddr p = { .addr.in6 = IN6ADDR_ANY_INIT, .prefix = 0, - .dprefix = 0, .preferred_lt = 0, .valid = 0}; + .dprefix = 0, .preferred_lt = 0, .valid_lt = 0}; bool found_default = false; char line[512], ifname[16]; @@ -550,12 +550,12 @@ static int send_router_advert(struct interface *iface, const struct in6_addr *fr struct odhcpd_ipaddr *addr = &addrs[i]; struct nd_opt_prefix_info *p = NULL; uint32_t preferred_lt = 0; - uint32_t valid = 0; + uint32_t valid_lt = 0; - if (addr->prefix > 96 || (i < valid_addr_cnt && addr->valid <= (uint32_t)now)) { - syslog(LOG_INFO, "Address %s (prefix %d, valid %u) not suitable as RA prefix on %s", + if (addr->prefix > 96 || (i < valid_addr_cnt && addr->valid_lt <= (uint32_t)now)) { + syslog(LOG_INFO, "Address %s (prefix %d, valid-lifetime %u) not suitable as RA prefix on %s", inet_ntop(AF_INET6, &addr->addr.in6, buf, sizeof(buf)), addr->prefix, - addr->valid, iface->name); + addr->valid_lt, iface->name); continue; } @@ -595,17 +595,17 @@ static int send_router_advert(struct interface *iface, const struct in6_addr *fr preferred_lt = iface->preferred_lifetime; } - if (addr->valid > (uint32_t)now) { - valid = TIME_LEFT(addr->valid, now); + if (addr->valid_lt > (uint32_t)now) { + valid_lt = TIME_LEFT(addr->valid_lt, now); - if (iface->ra_useleasetime && valid > iface->dhcp_leasetime) - valid = iface->dhcp_leasetime; + if (iface->ra_useleasetime && valid_lt > iface->dhcp_leasetime) + valid_lt = iface->dhcp_leasetime; } - if (minvalid > valid) - minvalid = valid; + if (minvalid > valid_lt) + minvalid = valid_lt; - if ((!IN6_IS_ADDR_ULA(&addr->addr.in6) || iface->default_router) && valid) + if ((!IN6_IS_ADDR_ULA(&addr->addr.in6) || iface->default_router) && valid_lt) valid_prefix = true; odhcpd_bmemcpy(&p->nd_opt_pi_prefix, &addr->addr.in6, @@ -621,7 +621,7 @@ static int send_router_advert(struct interface *iface, const struct in6_addr *fr if (iface->ra_advrouter) p->nd_opt_pi_flags_reserved |= ND_OPT_PI_FLAG_RADDR; p->nd_opt_pi_preferred_time = htonl(preferred_lt); - p->nd_opt_pi_valid_time = htonl(valid); + p->nd_opt_pi_valid_time = htonl(valid_lt); } iov[IOV_RA_PFXS].iov_base = (char *)pfxs; @@ -780,12 +780,12 @@ pref64_out: for (ssize_t i = 0; i < valid_addr_cnt; ++i) { struct odhcpd_ipaddr *addr = &addrs[i]; struct nd_opt_route_info *tmp; - uint32_t valid; + uint32_t valid_lt; - if (addr->dprefix >= 64 || addr->dprefix == 0 || addr->valid <= (uint32_t)now) { - syslog(LOG_INFO, "Address %s (dprefix %d, valid %u) not suitable as RA route on %s", + if (addr->dprefix >= 64 || addr->dprefix == 0 || addr->valid_lt <= (uint32_t)now) { + syslog(LOG_INFO, "Address %s (dprefix %d, valid-lifetime %u) not suitable as RA route on %s", inet_ntop(AF_INET6, &addr->addr.in6, buf, sizeof(buf)), - addr->dprefix, addr->valid, iface->name); + addr->dprefix, addr->valid_lt, iface->name); continue; /* Address not suitable */ } @@ -822,8 +822,8 @@ pref64_out: else if (iface->route_preference > 0) routes[routes_cnt].flags |= ND_RA_PREF_HIGH; - valid = TIME_LEFT(addr->valid, now); - routes[routes_cnt].lifetime = htonl(valid < lifetime ? valid : lifetime); + valid_lt = TIME_LEFT(addr->valid_lt, now); + routes[routes_cnt].lifetime = htonl(valid_lt < lifetime ? valid_lt : lifetime); routes[routes_cnt].addr[0] = addr->addr.in6.s6_addr32[0]; routes[routes_cnt].addr[1] = addr->addr.in6.s6_addr32[1]; routes[routes_cnt].addr[2] = 0; From patchwork Fri Apr 5 11:06:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paul Donald X-Patchwork-Id: 1920245 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=v5Q1T/dY; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=dq0kZ9O5; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V9yJP5dhfz1yZQ for ; Fri, 5 Apr 2024 23:21:09 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=vDt+ecOivwGi9/PX3ylhOBxGveptvu0JensqOhkgy8A=; b=v5Q1T/dYZA9DLV935axDD144SZ 35zySag9I7Ofj0znrNr5aShWTEhasqysv/RU+FfwR35RRWHO3tYLJ+nU3tnG4lCqLog2EKtaNAFFq AXmqy/BV4QLPkZmvTU5dHpXWiKlW6hkOxdPQwQzhOVk4c3WTNWqJOEpkOXSFV/UKm17S3VYqnaLr+ tcLvENXFFdOf9BahSMODfJtp3l/HgBCf2sLEnEHFIrlJEAOzS4hS/SeO9ewgWDWSmDDniOyUwdndR 7INQN9ZUwymZI7yfmJRwLqU0lwGC5THItphnsjCSIAzyzRxN8n/M5FrrejIdvwwkzu6niCHLvm6x9 A1+JrY1Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsiY1-00000006tL0-1TzY; Fri, 05 Apr 2024 12:19:57 +0000 Received: from mail-lj1-x234.google.com ([2a00:1450:4864:20::234]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rshSq-00000006be0-2ru8 for openwrt-devel@lists.openwrt.org; Fri, 05 Apr 2024 11:10:35 +0000 Received: by mail-lj1-x234.google.com with SMTP id 38308e7fff4ca-2d6ff0422a2so23425011fa.2 for ; Fri, 05 Apr 2024 04:10:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712315429; x=1712920229; darn=lists.openwrt.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=vvBPx8MUGYzVwXyoNgcGbGFqkf+iBbUdBp+yGv6X7ag=; b=dq0kZ9O5IY4A9R4HtYGg1YvGVD/xE4HjxBM8hgAWLi6hw/5Rt/ots7iA3VKX+L0yVI t4a4FdPZD4cI1g/GSyfJOyNaDcXOffyYiDlRbX68xnDE8y/RLE+ty+8PqcC+HX+KLIli 2PGKwG0f5i3VPHoJiKcUwEJWDIkGZ3rjdNgaRkdBQPTCOgPTl79VxfkW93MvBkjG1uLx U+Coa3zWHq0mWWO5jhEXiywt2i3lwDQXZ1+lQYWJ/ccFaz8bPXbOnZFfn7vH+ngxYUEP zg68HStfJyLSUiVbfUEsCT8cZfr/fY16s1dDknX9WgitP7hBeXcx07USIG/qqGpYie+v UtBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712315429; x=1712920229; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:sender:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=vvBPx8MUGYzVwXyoNgcGbGFqkf+iBbUdBp+yGv6X7ag=; b=jMfeQgDPcSvG4RjubbXphZbQCEgNr+WS0W4mldSBSnfcnqVLHotH8vZDUbSFXWpapa 8Hb7cdL9L5KD8srODbmzir9+Gnd+5bEG9Adw+CAJdWP4AK7QKJiJokRO2T9qXMCO3Tnt gOJU7zJZTbJYNDPhdBTmhbNys7KQxH5E+EF/jrYlrsrnGnIchlSlgT17nGkeJtwYlYKc NBJkbp5/s3b2W6jhWYxLIPyRpNgj7JZn20zdN+O8Uu+r2vEYTgW7EuvNo6NxQHZ84115 flSsjA0Lh0EHwWn4cvSz1GTKvFan4FD11nnmTyLzsTsc/5GlyZI7dW/dHxg+82JbBq6W vkvg== X-Gm-Message-State: AOJu0YyruDx0/o20E5G6g7t4xT/S8AKQMext0kcuRTPFFYrVB5yY0x2T C9LWz8AVh2a0vsowO0bWOTXRSuKbXyDpBJTIThbLZ2FxNC706mGkn7TuW2O2cc0KoA== X-Google-Smtp-Source: AGHT+IFiAoR4NCsHt2rEaR/te9c6KwlJ9mkRGkF+ihHUeoOtr+ptTnZoHgCbuJXnTMsYU2VGNp4GFw== X-Received: by 2002:a05:6512:3c8e:b0:516:d15e:88a4 with SMTP id h14-20020a0565123c8e00b00516d15e88a4mr967968lfv.49.1712315428938; Fri, 05 Apr 2024 04:10:28 -0700 (PDT) Received: from blackhol3 ([2001:9b0:40::cae3:cb03]) by smtp.gmail.com with ESMTPSA id g21-20020ac24d95000000b00516cdadf377sm163719lfe.137.2024.04.05.04.10.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 04:10:28 -0700 (PDT) From: Paul Donald To: OpenWrt Development List Subject: [PATCH v2 3/9] various: Comment spell-fixes and clarification Date: Fri, 5 Apr 2024 13:06:47 +0200 Message-ID: <20240405111025.26478-4-newtwen+github@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240405111025.26478-1-newtwen+github@gmail.com> References: <20240405005510.19778-1-newtwen+github@gmail.com> <20240405111025.26478-1-newtwen+github@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240405_041032_838367_C92174B9 X-CRM114-Status: GOOD ( 14.64 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Paul Donald Signed-off-by: Paul Donald Reviewed-by: Daniel Golle --- src/dhcpv4.c | 2 +- src/dhcpv6-ia.c | 6 +++--- src/netlink.c | 2 +- src/router.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:234 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [newtwen+github(at)gmail.com] X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org From: Paul Donald Signed-off-by: Paul Donald Reviewed-by: Daniel Golle --- src/dhcpv4.c | 2 +- src/dhcpv6-ia.c | 6 +++--- src/netlink.c | 2 +- src/router.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/dhcpv4.c b/src/dhcpv4.c index 3191ff2..cb0484f 100644 --- a/src/dhcpv4.c +++ b/src/dhcpv4.c @@ -893,7 +893,7 @@ void dhcpv4_handle_msg(void *addr, void *data, size_t len, struct arpreq arp = {.arp_flags = ATF_COM}; /* - * send reply to the newly (in this proccess) allocated IP + * send reply to the newly (in this process) allocated IP */ dest.sin_addr = reply.yiaddr; dest.sin_port = htons(DHCPV4_CLIENT_PORT); diff --git a/src/dhcpv6-ia.c b/src/dhcpv6-ia.c index 39a316a..dde224d 100644 --- a/src/dhcpv6-ia.c +++ b/src/dhcpv6-ia.c @@ -1142,11 +1142,11 @@ static size_t build_ia(uint8_t *buf, size_t buflen, uint16_t status, } if (!INFINITE_VALID(a->valid_until)) - /* UINT32_MAX is considered as infinite leasetime */ + /* UINT32_MAX is RFC defined as infinite lease-time */ a->valid_until = (valid_lt == UINT32_MAX) ? 0 : valid_lt + now; if (!INFINITE_VALID(a->preferred_until)) - /* UINT32_MAX is considered as infinite leasetime */ + /* UINT32_MAX is RFC defined as infinite lease-time */ a->preferred_until = (preferred_lt == UINT32_MAX) ? 0 : preferred_lt + now; o_ia.t1 = htonl((preferred_lt == UINT32_MAX) ? preferred_lt : preferred_lt * 5 / 10); @@ -1570,7 +1570,7 @@ ssize_t dhcpv6_ia_handle_IAs(uint8_t *buf, size_t buflen, struct interface *ifac /* Set error status */ status = (is_pd) ? DHCPV6_STATUS_NOPREFIXAVAIL : DHCPV6_STATUS_NOADDRSAVAIL; else if (hdr->msg_type == DHCPV6_MSG_REQUEST && !dhcpv6_ia_on_link(ia, a, iface)) { - /* Send NOTONLINK staus for the IA */ + /* Send NOTONLINK status for the IA */ status = DHCPV6_STATUS_NOTONLINK; assigned = false; } else if (accept_reconf && assigned && !first && diff --git a/src/netlink.c b/src/netlink.c index c33e3ea..368e69c 100644 --- a/src/netlink.c +++ b/src/netlink.c @@ -213,7 +213,7 @@ static void refresh_iface_addr6(int ifindex) if (change) { /* - * Keep track on removed prefixes, so we could advertise them as invalid + * Keep track of removed prefixes, so we could advertise them as invalid * for at least a couple of times. * * RFC7084 § 4.3 : diff --git a/src/router.c b/src/router.c index 6a9e19d..335218f 100644 --- a/src/router.c +++ b/src/router.c @@ -709,7 +709,7 @@ static int send_router_advert(struct interface *iface, const struct in6_addr *fr iov[IOV_RA_SEARCH].iov_len = search_sz; if (iface->pref64_length) { - /* RFC 8781 § 4.1 rounding up lifetime to multiply of 8 */ + /* RFC 8781 § 4.1 rounding up lifetime to multiple of 8 */ uint16_t pref64_lifetime = lifetime < (UINT16_MAX - 7) ? lifetime + 7 : UINT16_MAX; uint8_t prefix_length_code; uint32_t mask_a1, mask_a2; From patchwork Fri Apr 5 11:06:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Donald X-Patchwork-Id: 1920246 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=N//aHzyw; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=Zm9/4e9R; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V9yJS13S5z1yYh for ; Fri, 5 Apr 2024 23:21:12 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=BLMIRUGoWPU2SCNWuEvXXLZw+Fo2BvZ8tNsIzgjPAQg=; b=N//aHzyw346HCe e5j/mlI0C6YEb4RgwQgvS66Hfa/yc08sVoTCXpiVwIauUvd6mDqVOgrzZbz8u9PMTLUMS4j3K3S4e IgHAogDNUrbJJWMg4VJVJXt4LQ6O7rd5awnXc3uJlYF9Ylku5JDR8V2TqTSXbS6PIdHW0Io3r2uaX xKPxX/OTW1l1jkVO5zXtwM17W9Fy78tdYGW6/PPfqPGCy3awuVwlLQ9l4554NVF5Z9g0vGFV5O3R6 Tur5uzWx7Ycxr/tJ1SYYC/UM7XNbz+XvPFoZ+80yMSCJW3Io8dKLEIuIUZsevYDm1bASPhKitmBMj 4EUofKEDqggGf1VWckPA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsiXz-00000006tKM-3Dek; Fri, 05 Apr 2024 12:19:55 +0000 Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rshSq-00000006be7-2HLX for openwrt-devel@lists.openwrt.org; Fri, 05 Apr 2024 11:10:34 +0000 Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-516d1ecaf25so1357860e87.2 for ; Fri, 05 Apr 2024 04:10:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712315429; x=1712920229; darn=lists.openwrt.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=ZPosSTX+2j7rr1hsMuDKh9gceWzS7JutZ5ylJX+cdsw=; b=Zm9/4e9R7usfVw1616lUbHtQgP27UQLQLxWAKYPQqIfpwpnoPTPST195o2QvzWu2d3 njyfC/kyhS9viw6ZAeZ2hy87cKUV+1zbwnuRu5mErIf1PRujptNM5sQux4QaAqNnX7WN HoMmkLn0Ht2HT12MHfoAEUgGyoIrNpqv/HF/AUkjD7D3qe/x3SDFMofOfB0Ih+7Ga3jw c2q85YR+XGQlkHlDstf5ec5ELLz/GjDzNfrCi1oHm0vlU890eHV7uYCF5jxIlpSEWfbG 7IHqSISrsT3K+wtOEUMbxJIXOPuNhzbPGZqsBrKxADQesqvsCkhtG8l/MSYAixQ4Snld 8XoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712315429; x=1712920229; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:sender:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=ZPosSTX+2j7rr1hsMuDKh9gceWzS7JutZ5ylJX+cdsw=; b=jOSC17raT/eooWKLiwCQ+J7WuBnQfpWR1OuFQRqJXRTVIPSnlYMgt96bfITAQQlm2/ 22WR1goAOftwuqFIWDCbOdkEGPRkCfFwA5+WxNUfUGB8/EmBb3EvHoSo1lhy15oOCMeT 760agSBAg55URoNpCy12hP6Au1eJ+6uSshubizYAwz0j0rwOvdYX0Qoduh9iWMJFPJRD ypvRRgnqnVGSyxPrEOkSqSb0sx4UeANl3wnMk7GtMeic6o8wnHaiW+BJD/KJ9cHYjzTd SLoWt/GxlNu/mBEdm/jAg6/Cb84JBZWBCdT8BJpfaLA5soksL6hfxcmCAJeGU8vaRmxS /a2A== X-Gm-Message-State: AOJu0YwFObaZfzmjnmB9E3Q4fyY++97ethiyIrp1n9gL+LrmU2/QvMNg 9K+ZP4xfyEWbzmNSvEe7sxjA8UdLv17dY6AVoFBUV5hBFSsf5V3hd66dWmXPDM6M8g== X-Google-Smtp-Source: AGHT+IHmRHHcfGVojLcKeaTl6nlbyAIky2+7LZpce0QO3X/ad5qD0CBnFKcaKNB8oyc8B1MZnDn76A== X-Received: by 2002:a05:6512:2387:b0:513:5951:61a4 with SMTP id c7-20020a056512238700b00513595161a4mr917081lfv.6.1712315429429; Fri, 05 Apr 2024 04:10:29 -0700 (PDT) Received: from blackhol3 ([2001:9b0:40::cae3:cb03]) by smtp.gmail.com with ESMTPSA id g21-20020ac24d95000000b00516cdadf377sm163719lfe.137.2024.04.05.04.10.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 04:10:29 -0700 (PDT) From: Paul Donald To: OpenWrt Development List Subject: [PATCH v2 4/9] router: inherit user-assigned preferred_lifetime Date: Fri, 5 Apr 2024 13:06:48 +0200 Message-ID: <20240405111025.26478-5-newtwen+github@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240405111025.26478-1-newtwen+github@gmail.com> References: <20240405005510.19778-1-newtwen+github@gmail.com> <20240405111025.26478-1-newtwen+github@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240405_041032_708754_A2356927 X-CRM114-Status: GOOD ( 11.90 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Paul Donald Inherit preferred_lifetime value irrespective of whether ra_useleasetime is set or not. User-provided values for preferred_lifetime are now assigned, instead of ignored. Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:135 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [newtwen+github(at)gmail.com] X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org From: Paul Donald Inherit preferred_lifetime value irrespective of whether ra_useleasetime is set or not. User-provided values for preferred_lifetime are now assigned, instead of ignored. Before: == ICMPv6 Option (Prefix information : fd51:1c2a:8909::/64) Type: Prefix information (3) Length: 4 (32 bytes) Prefix Length: 64 Flag: 0xc0, On-link flag(L), Autonomous address-configuration flag(A) Valid Lifetime: Infinity (4294967295) Preferred Lifetime: Infinity (4294967295) Reserved Prefix: fd51:1c2a:8909:: ==After (preferred_lifetime set to 7 minutes):== ICMPv6 Option (Prefix information : fd51:1c2a:8909::/64) Type: Prefix information (3) Length: 4 (32 bytes) Prefix Length: 64 Flag: 0xc0, On-link flag(L), Autonomous address-configuration flag(A) Valid Lifetime: Infinity (4294967295) Preferred Lifetime: 420 Reserved Prefix: fd51:1c2a:8909:: == Signed-off-by: Paul Donald Reviewed-by: Daniel Golle --- src/router.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/router.c b/src/router.c index 335218f..3890c0b 100644 --- a/src/router.c +++ b/src/router.c @@ -590,9 +590,10 @@ static int send_router_advert(struct interface *iface, const struct in6_addr *fr if (addr->preferred_lt > (uint32_t)now) { preferred_lt = TIME_LEFT(addr->preferred_lt, now); - if (iface->ra_useleasetime && - preferred_lt > iface->preferred_lifetime) + if (preferred_lt > iface->preferred_lifetime) { + // set to possibly user mandated preferred_lt preferred_lt = iface->preferred_lifetime; + } } if (addr->valid_lt > (uint32_t)now) { From patchwork Fri Apr 5 11:06:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paul Donald X-Patchwork-Id: 1920244 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=GAJvw5oi; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=VR9e6UGe; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V9yJP4K3Wz1yYh for ; Fri, 5 Apr 2024 23:21:09 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=xiKRnM7N/j4dDgeQsZ5iSK02vgnStQvai97+4llXZCI=; b=GAJvw5oid56ZBSq21xl6VhlTEU tsDFdUukpBkcNAynFbnCDTiUMEN1Ep6Q0HlXR4LZICnVqcbWkF/7nfZbJzO7Mf3qhofC6GA2gh59z 7eGmvSGZF51JW9tXUYrW3JNbs28hK6QOgtWYJmNqC8C4AL7e6Meo6VlTmHaMk+ERPbFuxrhAdLoDI TrwR/R+l5ukJ8DkHY1Och2W9dtmv/c4qpt6HtLfj7W7qt5E92L8x91Huy02rCWx7PyHxX1X+0tnRz Uhg8v/Ym9uKG34xlV/zZBtjSdE53YEsLPwL32p/LnYdjVzT62/LsBccchuZS1nBJpDaXVnZ58JJEu aLHQ+Y1Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsiY3-00000006tLc-1Zg2; Fri, 05 Apr 2024 12:19:59 +0000 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rshSr-00000006bej-3F48 for openwrt-devel@lists.openwrt.org; Fri, 05 Apr 2024 11:10:36 +0000 Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-516d6898bebso277822e87.3 for ; Fri, 05 Apr 2024 04:10:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712315431; x=1712920231; darn=lists.openwrt.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=NBixtORa4eb7BRTkueJQVHIRYrhOsaxMVhEdhkJioqU=; b=VR9e6UGeGwR2jMneTh6v91epZa5yt/gT5cRJ7Z6xwMs9MxvdthLsyjYJhqzINH7+Lm l1/jA5lOB4g6yF6NBsoU6pB6Qyad0DGFyhl4LXQSigX3JVMYw3+eQ0eT9Lu8q/mFn9aS GINS/uPHih2qvFCiskO6UwUG0toTjri2xBfoK3EwShp1W6FJWfLXjTuHOEmANP/x/6ON 1rcdDld7PTvdPfmYFEQBirXeOSAZSPFcrvIEP1CKbuf+ksWICkKAhnNscBysOuw3f5Le dk/Nm4F28Uf2N6lRbkf+PUPZ4P8zePpK3AotZEnE2XivLD8LHQY+NOWSpR2GfP+PHb+X ulVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712315431; x=1712920231; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:sender:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=NBixtORa4eb7BRTkueJQVHIRYrhOsaxMVhEdhkJioqU=; b=mZ8sE94evYy8Izz5RzcEJIRE+RHU0TKnajqBS9P1J8RHncATbKUVghEm170dg20m3N QJVy6XTC7A44kYaBySSN0r+9kTlEt2wS5LpbGliXLj9/s50CKGErpL2vu+Qj2nxz/Q1L aLB1s4Y1O2zJLS2/xxWAHJQuHiA2tAv4mZOeLQ1R+AfWWmRghVTKorAdm3BFYA8ugr6D mdLh/EK4BYYDighdJtWbuXDmlHs0m/JDD12xql8t7P+G6cSz5eVUy1NQMWsnXbafFrzv 5alKzhtw2ocC9m7V5N5/rHP2JIKBJEQ8jC3396IZUBhVqqtqNCnqVkoJLGo63K1Ryetn V2OA== X-Gm-Message-State: AOJu0YwjHXuT2cKqY/hCRl8smG/iiiDgUaAS6aLGS88mV5S+KvZ4bBBd j1K08fZ/0mZ9c8y+Qg5tZvdkWfu+g291s1sNdNzfWi3SeoSE1iBhoAOirX/vnVONaw== X-Google-Smtp-Source: AGHT+IFy/OuNXcU8js10iXzjKlM0cvO6mE+jV+wWGAhARjNhynMMiyno9cr4cY7xbwKUFzerH2FlmQ== X-Received: by 2002:ac2:4a99:0:b0:516:c860:3c70 with SMTP id l25-20020ac24a99000000b00516c8603c70mr685265lfp.57.1712315430605; Fri, 05 Apr 2024 04:10:30 -0700 (PDT) Received: from blackhol3 ([2001:9b0:40::cae3:cb03]) by smtp.gmail.com with ESMTPSA id g21-20020ac24d95000000b00516cdadf377sm163719lfe.137.2024.04.05.04.10.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 04:10:29 -0700 (PDT) From: Paul Donald To: OpenWrt Development List Subject: [PATCH v2 5/9] router: Limit prefix preferred_lt to valid_lt in accordance with RFC4861 Date: Fri, 5 Apr 2024 13:06:49 +0200 Message-ID: <20240405111025.26478-6-newtwen+github@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240405111025.26478-1-newtwen+github@gmail.com> References: <20240405005510.19778-1-newtwen+github@gmail.com> <20240405111025.26478-1-newtwen+github@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240405_041033_984353_B0233445 X-CRM114-Status: UNSURE ( 9.76 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Paul Donald Follow-up fix for bc9d317f2921ae6b529f2c9f8de79b75992e206f https://www.rfc-editor.org/rfc/rfc4861#page-44 Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:12a listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [newtwen+github(at)gmail.com] X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org From: Paul Donald Follow-up fix for bc9d317f2921ae6b529f2c9f8de79b75992e206f https://www.rfc-editor.org/rfc/rfc4861#page-44 Signed-off-by: Paul Donald Reviewed-by: Daniel Golle --- src/router.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/router.c b/src/router.c index 3890c0b..a1a7829 100644 --- a/src/router.c +++ b/src/router.c @@ -603,6 +603,13 @@ static int send_router_advert(struct interface *iface, const struct in6_addr *fr valid_lt = iface->dhcp_leasetime; } + if (preferred_lt > valid_lt) { + /* RFC4861 § 6.2.1 + This value [AdvPreferredLifetime] MUST NOT be larger than AdvValidLifetime. + */ + preferred_lt = valid_lt; + } + if (minvalid > valid_lt) minvalid = valid_lt; From patchwork Fri Apr 5 11:06:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paul Donald X-Patchwork-Id: 1920212 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=CHQYXHVw; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=fr+64sKq; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V9wmn3kN8z23vG for ; Fri, 5 Apr 2024 22:12:09 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=VHERIXKLGi3vivHoWyC5c1PzF854Sy6aCfDviKjsvZo=; b=CHQYXHVwC60SQ+UK3QLCdcuWr9 xUc/Wpj2O8O5XATw0Vj4k0balxORtaOFXLTAtnPREesNwgg9ReYwMNXzUuwDuzmyoEUuwEWP5NS3u yw/JeM4ak85QLjUxAHIrv96gvDqwuPgSEyU1K7HjJKHlL2cdBDgQHZqdQ5cugjDbl/5WwHtisuJAa zW9KuH2o1vkA5tROg70FuNwBgSilQ1isCbMGXifYNFJGx0Z89BoVaobF8i5wn0WvQqmGL0Fv/PWKu pDWGpjoz9bo537WWg+IlTu1sX9v+IhnScOTrIo1OfnKMvd45C0ieOmqazaMW5EWALq8Ns1jqlyRMm j13pf4Jw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rshT8-00000006boi-35qv; Fri, 05 Apr 2024 11:10:50 +0000 Received: from mail-lf1-x12c.google.com ([2a00:1450:4864:20::12c]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rshSs-00000006bf2-1GbE for openwrt-devel@lists.openwrt.org; Fri, 05 Apr 2024 11:10:37 +0000 Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-516cdb21b34so2254737e87.1 for ; Fri, 05 Apr 2024 04:10:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712315431; x=1712920231; darn=lists.openwrt.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=0NWmE0uirc1v18b6Z5r8Ya/B69ift2jErmjzCx9kHk0=; b=fr+64sKqxno2UJjLud7KY94BfliFgxf2OjF+Rhppe9Gg0ljv4zc1lNotPWvacUnvuy 0M6ccRte4y3FGwjp8owNK2eU1+z3iiOtSEo8tWOQDWuz/+bwj6hARK8S9LuL+8dWD9ly eZwZCtJ6GmtaYxTL6SAwXSN+RPPcHMs9MGAUbG3ZY+gl0Z3z0acEFh0OFZmAJVDkgo2H TUmIgF964DuRxyiqBtXhXqApxe+IdgK9WzkWtjte+5W3coPRjl2+qe4Pj917RNbx8/yB J9yYn75uTYtde3g1wMY+UEbkZqlihjqiim1N9h2D0g00EfJ6XAd0e0NsPRPiiZyrDRJ/ LnUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712315431; x=1712920231; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:sender:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=0NWmE0uirc1v18b6Z5r8Ya/B69ift2jErmjzCx9kHk0=; b=aPc9ySzQ+2SBvaMyvC6HcNFLcaKwDxbKYRPQ/P+n9vD53U81UePFL8YdV5XWwfp+Ml h3rkiFK2WbDqCHiKIkKVvm4zrn0YpZqiRrPgefYrqP9HUD9r2notGucf1PE8K/L9vtQA IzTMvssNUPDdRB+ztNupLYFuM9BZkvQztT4DCHjt73q1W+76v1GsDBatPlH6ow27Z4B1 mt3t8H9my/HEqn8mTj/dmL1o8TYpa0JEewT2FtPb3qyji/pjG6w8lZxxazkWtrRlmaEC 8SAeWidZH2dXjD9Kvb1hphS164/TSUJjWrBkZGgKarVm+Ac4nU/6DmwsmEnBccf/bl/1 lK4w== X-Gm-Message-State: AOJu0YziHmmbJ9DUJ4iOXmsca1ZAYuAjLkBoOstQyur5w09KZurEtpg+ nC5SeF3qx1MY8qPpniD1kErYmpLxUVK4rIkan6uWL0qPrhSZnCQFAvheHY/JhxnHQg== X-Google-Smtp-Source: AGHT+IEek0eGQ77UdQEAggEoosvnXyt6Z9D45soaFtRo0/w+mDGmoJbHIhvAPjmLqASpAMstU//bRA== X-Received: by 2002:a19:ad03:0:b0:513:cc25:d3b5 with SMTP id t3-20020a19ad03000000b00513cc25d3b5mr754896lfc.7.1712315431111; Fri, 05 Apr 2024 04:10:31 -0700 (PDT) Received: from blackhol3 ([2001:9b0:40::cae3:cb03]) by smtp.gmail.com with ESMTPSA id g21-20020ac24d95000000b00516cdadf377sm163719lfe.137.2024.04.05.04.10.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 04:10:30 -0700 (PDT) From: Paul Donald To: OpenWrt Development List Subject: [PATCH v2 6/9] router: Apply updated values from RFC8319 (updates RFC4861) to RA/ND Date: Fri, 5 Apr 2024 13:06:50 +0200 Message-ID: <20240405111025.26478-7-newtwen+github@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240405111025.26478-1-newtwen+github@gmail.com> References: <20240405005510.19778-1-newtwen+github@gmail.com> <20240405111025.26478-1-newtwen+github@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240405_041034_517592_E46181E0 X-CRM114-Status: GOOD ( 11.74 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Paul Donald https://www.rfc-editor.org/rfc/rfc8319#section-4 Signed-off-by: Paul Donald Reviewed-by: Daniel Golle --- src/router.c | 6 ++++-- src/router.h | 21 ++++++++++++++++++++- 2 files changed, 24 insertions(+), 3 deletions(-) Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:12c listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [newtwen+github(at)gmail.com] X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org From: Paul Donald https://www.rfc-editor.org/rfc/rfc8319#section-4 Signed-off-by: Paul Donald Reviewed-by: Daniel Golle --- src/router.c | 6 ++++-- src/router.h | 21 ++++++++++++++++++++- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/router.c b/src/router.c index a1a7829..4239aa8 100644 --- a/src/router.c +++ b/src/router.c @@ -377,8 +377,10 @@ static uint32_t calc_ra_lifetime(struct interface *iface, uint32_t maxival) lifetime = iface->ra_lifetime; if (lifetime > 0 && lifetime < maxival) lifetime = maxival; - else if (lifetime > 9000) - lifetime = 9000; + else if (lifetime > AdvDefaultLifetime) + lifetime = AdvDefaultLifetime; + else if (lifetime > RouterLifetime) + lifetime = RouterLifetime; } return lifetime; diff --git a/src/router.h b/src/router.h index 0444da8..b91c60a 100644 --- a/src/router.h +++ b/src/router.h @@ -32,8 +32,27 @@ struct icmpv6_opt { #define MaxInitialRtrAdvInterval 16 #define MaxInitialRtAdvs 3 -#define MaxRtrAdvInterval 1800 +/* RFC8319 §4 + This document updates §4.2 and 6.2.1 of [RFC4861] to change + the following router configuration variables. + + In §6.2.1, inside the paragraph that defines + MaxRtrAdvInterval, change 1800 to 65535 seconds. + + In §6.2.1, inside the paragraph that defines + AdvDefaultLifetime, change 9000 to 65535 seconds. +*/ +#define MaxRtrAdvInterval 65535 #define MinRtrAdvInterval 3 +#define AdvDefaultLifetime 65535 +/* RFC8319 §4 + This document updates §4.2 and 6.2.1 of [RFC4861] to change + the following router configuration variables. + + In §4.2, inside the paragraph that defines Router Lifetime, + change 9000 to 65535 seconds. +*/ +#define RouterLifetime 65535 #define ND_RA_FLAG_PROXY 0x4 #define ND_RA_PREF_HIGH (1 << 3) From patchwork Fri Apr 5 11:06:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Donald X-Patchwork-Id: 1920218 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=GEGVaOM0; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=desiato.20200630 header.b=cIIZ/joa; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=KhLLpF5/; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V9wnG1t8kz1yZM for ; Fri, 5 Apr 2024 22:12:34 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=tu39UoM+Tsnwhsb0qZzNiX3YXip2zYVvRNGdMw5RXUY=; b=GEGVaOM0uhZ6To abudVnEnQN3tRebm5uQ4DL9EtjzZvO/oX+P+WpGC0XGtf/IVt3I78UtsSiNlKxbq1B2rDGI62bd2V 5cgl2CH453TT5qmyOTlIysBgC9PCKFWFy0dTLjXf41OmqikFs3WNgcB7OBJAWoOK4GsIrOhm7PDe+ iplnyhO/NnuP3KOI2ATjt3/Nf/LYdQzeS+W21+khkrYLLoYfcCmH5q9XIVt5ejcGUWjbIqrJ8tSvX 92DrVn5mqCR8VwG0PQARACIqKyXvKpBjXDhpqteyvTigeofTmL7ZYN31L2WuK3Z4dqufo/hw7rTqX UjlqQZ5izUdt/Y6KxWmg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rshTl-00000006cCK-1RdQ; Fri, 05 Apr 2024 11:11:29 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rshTG-00000006btx-0A7y for openwrt-devel@bombadil.infradead.org; Fri, 05 Apr 2024 11:10:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description; bh=gU+J+2yU56BDgi6fhKkiolDC5dd9zee8x3qww8xlHT8=; b=cIIZ/joa/jMbNBS5wSrfWzlkqs D24wGQVnV1MFd6asI5n0T3XZLYp29M2brdpOQ1SKszEsV2nbrnaSY7igb91Kua7s7CABb1tTk7Lz2 gsZeD/RCVnvGz77D7qkNmmbnsNqHD7EjdSSh9rDFwQT/Emdw7xrFAHSXzAjrWLxdtg/n3DzxbI7QE JrSSZJT2vJc9gYHiuwlYx7g17KiXtxeJuCBc0PZ8q+0goQ1K442pAXsOfTn4pmg/1Bj6j2jjK6i78 m75YpwgJ7TMaHbQ1lgHGlZWIDNwVeNyhU7bwQLODskSOqA5PxHPg3BozSpuda40ld4KoI0Vji0lfx Dn2lrzOA==; Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rshT0-00000005ZpG-091w for openwrt-devel@lists.openwrt.org; Fri, 05 Apr 2024 11:10:49 +0000 Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-516c87a511bso2147391e87.3 for ; Fri, 05 Apr 2024 04:10:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712315432; x=1712920232; darn=lists.openwrt.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=gU+J+2yU56BDgi6fhKkiolDC5dd9zee8x3qww8xlHT8=; b=KhLLpF5/yay5G9TvNK2qeoaKOyKRxCKeDfl08md43S6teCJm34hm38TyLg3YnLkxaW wxfdBhosam2wojLJdDnNCwYeR9fGE9qxNRcB2Ap9hFTYDJMUFLaS/eF3CbiUIcYbwx2S FaHVerYkry30faX1es6Cvfk9nLX/EEAVSnj3apUDx9JiS1PGknHTyLN5xF8oc9JU4c/I vS/KH0xp5hhQ33xEh6ft8oti9foahKl+zY+lPitawcW+Wmmnxh1noKokGy6DuExsvqFF WSorMnTSulTowxOQivjyV/T9EKcFSIlrFOMeRLdXbaCP94YvmIW/2dWxGRptBlitdhaL Vzcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712315432; x=1712920232; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:sender:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=gU+J+2yU56BDgi6fhKkiolDC5dd9zee8x3qww8xlHT8=; b=eurfYm5oLiqjLNGjahPb/u7DkuOtYd1CalS05CraKOjMroewxuh4zSxWpssFfU8oJQ ufM9mbYLKLj4G+Y7y8QkHSx/eIv7i8FfUaYJxba1MPHYelieCb7P8pfMmgvi8Wi9SPnH 4MMRBF7JYvLgewvbkQYGyTxHYym4bAgJQXv0b0RGaNf1w7CGbTdzXP6n2zhTFy8fE8fq ANb2BzIvi+3lDuljO/Ha0DwlfNov5PHRQvcmSIt8tyLMlaPN7Yh65i70k6ldkMbhETr2 K7v/h3ZxDQdoALvkL3JmOxjybbUw39hpXJaIt1e5nCK+IGNPsdMsx3/XmNCPfXdFa8ri otYg== X-Gm-Message-State: AOJu0Yxn1bz30JcDutzDMsWWSBgiiBvM+esEqHsiGj+LuuFiYxoj1Vl7 DxZQSJoZgebyDywOdISgyqSvcHUqikyz8FU7XRfJ15AXONoG2uvFgSnQUrI2yXWqpA== X-Google-Smtp-Source: AGHT+IGPnSi3mpI48Y7Y90zRqmMMAO6aA0HjmGe07McHMrxdXH/QWfjwzKD3aK+SyUfFGECPyfD0Pw== X-Received: by 2002:ac2:4301:0:b0:516:cd76:ee11 with SMTP id l1-20020ac24301000000b00516cd76ee11mr853532lfh.17.1712315431633; Fri, 05 Apr 2024 04:10:31 -0700 (PDT) Received: from blackhol3 ([2001:9b0:40::cae3:cb03]) by smtp.gmail.com with ESMTPSA id g21-20020ac24d95000000b00516cdadf377sm163719lfe.137.2024.04.05.04.10.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 04:10:31 -0700 (PDT) From: Paul Donald To: OpenWrt Development List Subject: [PATCH v2 7/9] config: ra_management is deprecated comment Date: Fri, 5 Apr 2024 13:06:51 +0200 Message-ID: <20240405111025.26478-8-newtwen+github@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240405111025.26478-1-newtwen+github@gmail.com> References: <20240405005510.19778-1-newtwen+github@gmail.com> <20240405111025.26478-1-newtwen+github@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240405_121042_356474_113963D5 X-CRM114-Status: UNSURE ( 8.24 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "desiato.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Paul Donald Signed-off-by: Paul Donald Reviewed-by: Daniel Golle --- src/config.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/config.c b/src/config.c index 1cd4608..0368e74 100644 --- a/src/config.c +++ b/src/config.c @@ -892,6 +892,7 @@ int config_parse_interface(void *data, size_t len, const char *name, bo [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [newtwen+github(at)gmail.com] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:12e listed in] [list.dnswl.org] X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org From: Paul Donald Signed-off-by: Paul Donald Reviewed-by: Daniel Golle --- src/config.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/config.c b/src/config.c index 1cd4608..0368e74 100644 --- a/src/config.c +++ b/src/config.c @@ -892,6 +892,7 @@ int config_parse_interface(void *data, size_t len, const char *name, bool overwr if ((c = tb[IFACE_ATTR_RA_DEFAULT])) iface->default_router = blobmsg_get_u32(c); + /* IFACE_ATTR_RA_MANAGEMENT aka ra_management is deprecated since 2019 */ if (!tb[IFACE_ATTR_RA_FLAGS] && !tb[IFACE_ATTR_RA_SLAAC] && (c = tb[IFACE_ATTR_RA_MANAGEMENT])) { switch (blobmsg_get_u32(c)) { From patchwork Fri Apr 5 11:06:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Donald X-Patchwork-Id: 1920217 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=r1u8ho2R; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=desiato.20200630 header.b=QHtaYfSh; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=Af0FjfHL; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V9wn82R3Wz1yZM for ; Fri, 5 Apr 2024 22:12:28 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=KQ4RQwojaYy+yqoXbSCJztFwj+3TLYOl3znw5m3aXio=; b=r1u8ho2RgaYD0t lQ1AwQ9gPrana5bq8S6Qou4gPhc5mNqrktLu/zrqdG314oZabwgti223WL2GWw9jX7TdzDh/JVDJq WW33vH3lUrKDXajA6b4KhT1gU8WFY9NOndR+gKuDJ8L7GTSrm2zzmhfxZpKhDiTX0vsCIswo4aGvm KosYrvO8y7uPED4semrC8zNJ24RmrsoE58cWblr64uFcTdJAVhg9ZeNUeT12KmQY4fluwyF3kXqXX vESf5VwU8YDq4pYO0LJSqmh0T6vNm5/MMKtLourBlFuRNVEYheMfGa/qp5w0FI5nwhfL7vQD4LCF+ ++hcwnn4le//YiKZhEfw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rshTa-00000006c66-3c1o; Fri, 05 Apr 2024 11:11:18 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rshTF-00000006btW-1moH for openwrt-devel@bombadil.infradead.org; Fri, 05 Apr 2024 11:10:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description; bh=zS/p2Z3RYBewPWK7Ly6/Uv28U3F9M7the7+ArJijWLA=; b=QHtaYfSh6WyAnFAUTjV9HLlwgQ bsJ7NOigWkxDhY1kOY4S6/eA6RWilwriYsgLxQu9uIvR/GBU9jxx7vu3IuTuo8Ny+Oz+HFR1+ziiO SgwMGsQ3CifZjcwrhULHg5C5F3ouPcXhAtVXf8KfWiq24ekqr4Nd4Ts+maEMVNPSR/85R7ufcDt5J ncz/C8Acy+GwpSlA4n77ka7Rf8/EaGgLYbtcEoMBtYXTpjNr8QVP96EhG+MT1r2CqUmzvv9BSZwPe M3bSC6d1SsiAxN9CKjuDzTI/UsyUBbxXx4ZN0IIiVdctayHQlyJeUKPCJC2en0VRzGsbqRM5P8IOJ oQNiHWIg==; Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rshSz-00000005ZpH-3zTa for openwrt-devel@lists.openwrt.org; Fri, 05 Apr 2024 11:10:49 +0000 Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-516d09bd434so1718857e87.1 for ; Fri, 05 Apr 2024 04:10:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712315432; x=1712920232; darn=lists.openwrt.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=zS/p2Z3RYBewPWK7Ly6/Uv28U3F9M7the7+ArJijWLA=; b=Af0FjfHLr913/EeVHdHUPnGMzPx0H4aVs+t2VqxUoRTk6CQyg++ozmEGCejvRrkHeA zEl3xh6aezzi1DU0Sxas41WQMXWuzhkBQv6FWqQc/hsz9b6VfjXoQrmX4MVim0mMi5Du SourXnQulzh5Eysci1vkVe7CeIYNurxysX2fI72xqZW2p3dFlNis/v8752VwOlLf6EAg 3X+UZqSBVtj4830dh784EENCT7oylGBv5pn/DaFhOdt0XeT9MysZBIatT3mXrhnBSPZW AMXzWs0AH09eBBZWxzNqVqVECjp9aktlXohPmsXrFBJKoD+yozqMnjxq/ea26X6xaodo tlTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712315432; x=1712920232; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:sender:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=zS/p2Z3RYBewPWK7Ly6/Uv28U3F9M7the7+ArJijWLA=; b=psJPBiP4138gARcaEcYS60W/jIoMOJyWbNg7RrOayyx+RjL/jEyZWQQ0/pIuE9eNkA JViUwqaow2M/KUXqsnH+Ymx8KCuw5euRDpHfq6T46MC8pRj3ei0THThqLIFHsEU+giUK b27K2wyqqHjI5AvPG0hjy7QvCvrbRXLBlkOgoRO5ck8j0UoPthkCnUr+yhv6EXqAv8vx TOVco9oJwpHYWXS/vfr9t1MGxanHZYdNgib4+AuDyj1+Vi0xbp8TB409GDC1TrlRgqKz cSzB2LLmr7GGKXuUOmbYJybs3nWOqO7VAun9nRJByWvW/nFBklW/m/Mmex+Pv0tSmtM7 CPLA== X-Gm-Message-State: AOJu0YyTKG1WQbcNbd19VT4xcrqX7C3q3kmFLOUMP4RU1kydiKsBSPLG 17SHHoUVSGDHCuoRinTsJObUxIKIqdFBv8HiqUtM3bC4JAx2/fRUQ53flZusg5zw9Q== X-Google-Smtp-Source: AGHT+IGDe9VuKjtnX0vP/XAfKE8M3sjYIX/IZoenlqleA2TbLg3W7V5O1jp1uZ/sktvUkyqn7gFpkw== X-Received: by 2002:ac2:5612:0:b0:516:d414:c09d with SMTP id v18-20020ac25612000000b00516d414c09dmr882599lfd.4.1712315432135; Fri, 05 Apr 2024 04:10:32 -0700 (PDT) Received: from blackhol3 ([2001:9b0:40::cae3:cb03]) by smtp.gmail.com with ESMTPSA id g21-20020ac24d95000000b00516cdadf377sm163719lfe.137.2024.04.05.04.10.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 04:10:31 -0700 (PDT) From: Paul Donald To: OpenWrt Development List Subject: [PATCH v2 8/9] router: DNSRecursiveDNS and DNSSearchOpt Type comments Date: Fri, 5 Apr 2024 13:06:52 +0200 Message-ID: <20240405111025.26478-9-newtwen+github@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240405111025.26478-1-newtwen+github@gmail.com> References: <20240405005510.19778-1-newtwen+github@gmail.com> <20240405111025.26478-1-newtwen+github@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240405_121042_195719_BD57BD0D X-CRM114-Status: GOOD ( 11.22 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "desiato.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Paul Donald Signed-off-by: Paul Donald Reviewed-by: Daniel Golle --- src/router.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/router.c b/src/router.c index 4239aa8..c87fd39 100644 --- a/src/router.c +++ b/src/router.c @@ -668,7 +668,7 @@ static int send_router_advert(struct interface *iface, const struct in6 [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [newtwen+github(at)gmail.com] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:133 listed in] [list.dnswl.org] X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org From: Paul Donald Signed-off-by: Paul Donald Reviewed-by: Daniel Golle --- src/router.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/router.c b/src/router.c index 4239aa8..c87fd39 100644 --- a/src/router.c +++ b/src/router.c @@ -668,7 +668,7 @@ static int send_router_advert(struct interface *iface, const struct in6_addr *fr uint8_t *search_domain = iface->search; uint8_t search_buf[256]; - /* DNS Recursive DNS */ + /* DNS Recursive DNS aka RDNSS Type 25; RFC8106 */ if (iface->dns_cnt > 0) { dns_addr = iface->dns; dns_cnt = iface->dns_cnt; @@ -688,7 +688,7 @@ static int send_router_advert(struct interface *iface, const struct in6_addr *fr memcpy(dns->addr, dns_addr, sizeof(struct in6_addr)*dns_cnt); } - /* DNS Search options */ + /* DNS Search options aka DNSSL Type 31; RFC8106 */ if (!search_domain && !res_init() && _res.dnsrch[0] && _res.dnsrch[0][0]) { int len = dn_comp(_res.dnsrch[0], search_buf, sizeof(search_buf), NULL, NULL); From patchwork Fri Apr 5 11:06:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Donald X-Patchwork-Id: 1920216 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=WLUypksm; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=hb2NFdkB; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V9wmr6Dlyz1yZM for ; Fri, 5 Apr 2024 22:12:12 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=elfPxhOQ0l0wmk14wktdmsBzz2lzDeddRqjczVddNJk=; b=WLUypksmq3C0qD GZPgQJJ1ewdPV+A1L+0AjHUMIW10BtOkx0e8J3gJu7ON6WSVT6FDSy0anwDXME+oRMK3nU87K/kBJ InHbUiNG5aTMp7Ok0Aw6+LKmk4Qzz6d4ptzV57JNLiBaw7jGn80zqVUI6N+siYv56lvTxHhLSNoZA cFG7b1R77fYwfXRPj8qlEc18nwEj1PRZLbhp1dw7ltPq9xfR/mAbbNJiXfkYv9zH781pzycK66k/b PlqcpWqzSWRDd6jnzqver1XttRUnL1kcU86u9TZtllmDS4PM/cki6I6s2KKgm5ky5sa6mSV09wNO6 rUAJ1wwkgE0bKSZ2DSfw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rshTL-00000006bve-0HCl; Fri, 05 Apr 2024 11:11:03 +0000 Received: from mail-lf1-x132.google.com ([2a00:1450:4864:20::132]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rshSu-00000006bhC-2L8j for openwrt-devel@lists.openwrt.org; Fri, 05 Apr 2024 11:10:38 +0000 Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-516c403c2e4so1960869e87.0 for ; Fri, 05 Apr 2024 04:10:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712315433; x=1712920233; darn=lists.openwrt.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=0BQFOse7RJd7FRhyrmevYhgxSMd7/ErH/FyPhyosiU0=; b=hb2NFdkBInEDe39bIGb8+p4Dn9KZhLO9n6L5fvcYXeAyd100IP0MsBMGMgSDxun8D3 dFmn4YgPqMzK1W6z7Ls634qhlL5xG+30gPXvN++ThOVv3GSszzR3/oTnNkemhfVHDb3t sffWC/03fQptyBRVGcm/2/DfhbyoOZLbllGK/r6jBJtP4M4VNu3rCIQerfsqOIIR5R8H 4AeQL3/f2iAv8e4sYQzILr1VUgYa2yA4kk2vjLI6TVVy5Ck87+qUme6U70lIi5fE8RCl zhbB145rP5ym9bQukknmmUSYZFO0kURiIQ81RMbQiLnd4hr7mxp4yssG3PA1IsoT47UF 1V0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712315433; x=1712920233; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:sender:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=0BQFOse7RJd7FRhyrmevYhgxSMd7/ErH/FyPhyosiU0=; b=gR1w3w8QweyoFM0FTJ8mJ/HwSOs7Eut4dturz3FFVwH2PAIrjKZeGHqTplvXBi67qN +RdxSpyRNs9D2W5FLI/mbLO1kl7NWmtIEraHJ2/BWPHerhKpqjeTcBZrySesf6bT1Q2J swV8ih8StrgEO4TR+HGjr+2nrYjU51jpeh/JKCs34mdHSpOddndRClX3Jw6T5UQyyOzM ND/2xyf2JkQxZXTo8wIFRIKX/iBY4umWPbQPbhRmUwK2YOfGTOlRx7ALntUUMdZE0T2g 6vhNrElm6t47aNONka8gx6eEATWp1zycic36WXmNUVYF6KK5z7wQdL9nDXMVttfblUam iA/A== X-Gm-Message-State: AOJu0YyOsT2kvx3Zj5rW9VnilCs5cIzkkXQNz2hZzOy7vQQpGqdkImXt dQd7c7oIBDomNCgHRIb9Gc/P4Tmujsk9LFWvGQ/1TDn8O0VTiNkOi3bbF/tpHbMrew== X-Google-Smtp-Source: AGHT+IE0GdczXfstEi+yAd35IJUHh6MjW1oPGvCRStkCJta/cFHA5ioncXq9z7LeTqIv4TfA1IoZRA== X-Received: by 2002:a19:a416:0:b0:513:c47e:d811 with SMTP id q22-20020a19a416000000b00513c47ed811mr427767lfc.33.1712315433408; Fri, 05 Apr 2024 04:10:33 -0700 (PDT) Received: from blackhol3 ([2001:9b0:40::cae3:cb03]) by smtp.gmail.com with ESMTPSA id g21-20020ac24d95000000b00516cdadf377sm163719lfe.137.2024.04.05.04.10.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 04:10:32 -0700 (PDT) From: Paul Donald To: OpenWrt Development List Subject: [PATCH v2 9/9] ndp: Comments (spelling) Date: Fri, 5 Apr 2024 13:06:53 +0200 Message-ID: <20240405111025.26478-10-newtwen+github@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240405111025.26478-1-newtwen+github@gmail.com> References: <20240405005510.19778-1-newtwen+github@gmail.com> <20240405111025.26478-1-newtwen+github@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240405_041036_776201_D427360C X-CRM114-Status: GOOD ( 10.84 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Paul Donald Signed-off-by: Paul Donald Reviewed-by: Daniel Golle --- src/ndp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ndp.c b/src/ndp.c index dfbb111..0ec6fed 100644 --- a/src/ndp.c +++ b/src/ndp.c @@ -39,7 +39,7 @@ static void setup_addr_for_relaying(struct in6_addr *addr, struct interface *ifa stat [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:132 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [newtwen+github(at)gmail.com] X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org From: Paul Donald Signed-off-by: Paul Donald Reviewed-by: Daniel Golle --- src/ndp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ndp.c b/src/ndp.c index dfbb111..0ec6fed 100644 --- a/src/ndp.c +++ b/src/ndp.c @@ -39,7 +39,7 @@ static void setup_addr_for_relaying(struct in6_addr *addr, struct interface *ifa static void handle_solicit(void *addr, void *data, size_t len, struct interface *iface, void *dest); -/* Filter ICMPv6 messages of type neighbor soliciation */ +/* Filter ICMPv6 messages of type neighbor solicitation */ static struct sock_filter bpf[] = { BPF_STMT(BPF_LD | BPF_B | BPF_ABS, offsetof(struct ip6_hdr, ip6_nxt)), BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, IPPROTO_ICMPV6, 0, 3), @@ -343,7 +343,7 @@ static void handle_solicit(void *addr, void *data, size_t len, return; if (len < sizeof(*ip6) + sizeof(*req)) - return; // Invalid reqicitation + return; // Invalid total length if (IN6_IS_ADDR_LINKLOCAL(&req->nd_ns_target) || IN6_IS_ADDR_LOOPBACK(&req->nd_ns_target) ||