From patchwork Fri Apr 5 00:53:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Donald X-Patchwork-Id: 1920019 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=3obdth4M; 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=C5pb8woM; 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 4V9g7R2ggxz23vG for ; Fri, 5 Apr 2024 11:57:23 +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=zf3dfrkJaNe2uFnDXO140pGjwd/bn59xyb+h+0zs/YI=; b=3obdth4MJ8Nep7 yU8LbBNkcSjUnnnxKqehwjViQ2c0UYNqhQaYmxrRIrVGPCL+Pnp/kC53KWM0M+HVZ2V4VdUCotgvi Pl5MWVuJmUGRC3Wucaq7HyvC0ilOb9aIqKOzs0ChpLovBY0/eiJ8EVmZCuZJrw/p34Afpv/azZtjM fPnYTxHDO3zyjb38Z3NY0AKMmwGNgNDkNoikUyL6/vcFbhpr+lGGCdWC7fHo4P0kImJJ9Vxju7SN1 VazmM26EI6kfKMenH6C2SLdAxuUeZ/IFcyd/XjaHWMQFHp9Ll1+pF8DA8r2D9WieK/CWgQB9fKOGg ZoNWW25HMGhvD30iLLag==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsXrZ-00000004kHS-03Cj; Fri, 05 Apr 2024 00:55:25 +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 1rsXrQ-00000004kD6-040W for openwrt-devel@lists.openwrt.org; Fri, 05 Apr 2024 00:55:19 +0000 Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-516d2600569so709114e87.0 for ; Thu, 04 Apr 2024 17:55:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712278512; x=1712883312; 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=/UVyJ5pXQC5+bNXkF9+NP/177KcRp09zGiITfKRVVWs=; b=C5pb8woMxNoZqMiRuNBqoyeMjXyBt0NTr3lCG2uvB98d8Kudu1sq8YoNRPaPxMQZNZ FjRHChS1DcIh5AXd7fHHTdwWOihcsaNkGRD0E5ewKv9gywA9ZfxhrQSYzathl/aAoC25 edV5s+C2DxEOcu7o7ucALU4XNQi8jdU8jbbfUJSdNfs+jUSoHe1t+KcN7Vv6UFoO9aKm O3wlryk4ziG+Mj5mc8o+8WC5tXHtqE/YrUxbQXrZZKqw3ebddQG+IG2R2hq56Hnw4N3x NNk2VBRae0B8l+yKRasxPJzAW64O8DljyOSz8ng8w7jGKmLbu9izOfgzk5zAblbRQ5k2 3pfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712278512; x=1712883312; 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=/UVyJ5pXQC5+bNXkF9+NP/177KcRp09zGiITfKRVVWs=; b=WWfF10d79bTnYVFQ5msJOOjBuEBgB1IT7eWviTtdOke/JA27ilC5hPetn3e9qCGJq8 ehvV4g86CXzXGcvBdZdvLSWkwpzxw+15MAqtA2RSy8EfPX5P3Ii6CaHo8eMZ0n0Rl1um 8Ap/xoPLrb0eCIMv/Veg4RwcVvoUjFmxM3cCiiP/ia69Plpy6G4pR4HlCDF5uq6AF4DY BxMkYKZul7eKPOvp12Lh/I/VrifvCoGFjm29uWWZT4mkGw61T0RJYnsrSegy4hfLWc+I KuiMJTMDJU0iDNs6Qoxv7bgohVHxeFvIpzLlkWKZT63aDLtM8/LvPRlEziwDuqNB7l4C MkUA== X-Gm-Message-State: AOJu0YyhRcbtf0vjMrip9v6tCLP8uZj6ljEOmXraV/4DENNnQbIyhJMS hfAJh8JMfWvm/ySCQQJ2HtC7WlXlfRiRK4iUbiQhkYxWJXsO0li3uOobBagf9DI= X-Google-Smtp-Source: AGHT+IHYmIieVe5rlnGXwwyFTfRxTeY2m8c6BEd1GW8DM+NmyWfzXr/SeqJ5mIHf3J5GYN/lG0GjXg== X-Received: by 2002:a05:6512:304c:b0:513:cbde:8764 with SMTP id b12-20020a056512304c00b00513cbde8764mr3320719lfb.57.1712278511626; Thu, 04 Apr 2024 17:55:11 -0700 (PDT) Received: from blackhol3 ([2001:9b0:40::cae3:cb03]) by smtp.gmail.com with ESMTPSA id a1-20020ac25201000000b00516c1bddfecsm46630lfl.182.2024.04.04.17.55.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 17:55:11 -0700 (PDT) From: Paul Donald To: OpenWrt Development List Subject: [PATCH 1/9] various: refactor Date: Fri, 5 Apr 2024 02:53:04 +0200 Message-ID: <20240405005510.19778-2-newtwen+github@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240405005510.19778-1-newtwen+github@gmail.com> References: <20240405005510.19778-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-20240404_175516_141586_7D52370E X-CRM114-Status: GOOD ( 20.42 ) 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:12a listed in] [list.dnswl.org] -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_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -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.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 --- 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 00:53:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Donald X-Patchwork-Id: 1920012 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=Mxja5EQI; 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=jT5l61lA; 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 4V9g7H5Yfwz1yZQ for ; Fri, 5 Apr 2024 11:57:13 +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=pOGiZwxSu19vhHh9i1DtgDiHEVLm+w4a7SvPkQl1a8c=; b=Mxja5EQItLN2Uc ihcv5In+koHvLJrTTmRrjA4mUj8mdX55F63E3HZNE8NIZosDr08vwopV1wTIy3a5voitkfjSBOX7N GNbqV85yf7bpFsVxbb1jetAfqrEFTStc5gvj5CRHgIpHPS3Zb4B+KcyIW2UVfLNS+G9NbygJz1qVf djhuJPCLW3uoKCxJ4t5S7VTuyYImhXzusDUNTffnQ5mNNmDLzw3fLE4EGKBhMLFwzCqyxuRRv86v2 N/D/RUw6K/b420NdLtpTRr1f9NBkHZGlNknuAsn5Ct0XFlmOICkVJeq+CKI9ZH/vqO+/Qx3qdSdVi vjfnxBsu55PrJFqC1EBA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsXrV-00000004kGL-3VlQ; Fri, 05 Apr 2024 00:55:21 +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 1rsXrQ-00000004kDA-049T for openwrt-devel@lists.openwrt.org; Fri, 05 Apr 2024 00:55:17 +0000 Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-516c116f480so2205751e87.2 for ; Thu, 04 Apr 2024 17:55:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712278512; x=1712883312; 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=+y54TkveBhwVbcySOHUbhmYK8/xig/8Q870QN7TQgQg=; b=jT5l61lA6MvCcq79WfzJwktNjRIrax9GMEy8am7eRfvDJsRq04KRpci19eubO5P2N2 CuDoC6x442VBN8Bdi9T2gt3rxeAWAviDM4LRJl33L1iTrkCkbFD86naTcnU+4E8ylpQU hntafzL5qpoftv0xq/BdDx2okX5t21NkIgamFJaGJRCOuev09QdyeZp2hafgouQFkDgQ 8mYvzWB78/8eu1qIFVYvpWhwVHFiQkvH+LCaBWx54thkvbKAXzCDS3TXAxVebMRpsQH0 2wN0gQxZddPHjh0Ah2e/0jruPgM+4X/HNuMzPzeUQadwaBoazTQxjPX8JVLjOEZxM7hI g5sQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712278512; x=1712883312; 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=+y54TkveBhwVbcySOHUbhmYK8/xig/8Q870QN7TQgQg=; b=R/3Zvqawi0PdPB5iyfvp/jSwwuSMJzZY3pnnhfmGJEzDc4S0CIIOD/OAqt4/UKxypl fRxX+z+EUSVxJDYBWz1rlWlGWRa//T9blTn+RXL0L9hhqpmBhNz7mfwT/s7wLwHtAzpA D+UOc4IznM1v+0CwRiv6Ew5RZejThVpfwdrje8066Bsh6L+JoXHIZ0OMApO57B8vl9WF I7aYPFHckIQOcpDVUjvJBbJqjePvw4ipLJ9VBdIP6w3++uLW+P8mernKBVYE9Hw9u/+e 2/FdVm1YmaC7vu68/rBB9uVYKLN8O1uhMH2tLxhV5tjGn0Ca8qoYbx6Jo2EZv1j/DaD4 ZghA== X-Gm-Message-State: AOJu0YzVHuBt1s9hw3HecZyVJ2QKx0ZDsoUg0aXul3MH0y00YX4TuAZz Esuzk3bWRJgdBXsmkPPojSnzJQ3nX8VnXcNvdgp9IvLUfrGfZeXmE1WJ8lNgi1g= X-Google-Smtp-Source: AGHT+IF2FoDOTiUuDIAJaL70VvwTu17yqrXA/jpzg05QeyheoXRADVd6ZTPd1Y6tYKSY+b14HcbY7A== X-Received: by 2002:a05:6512:250:b0:516:cc24:17d3 with SMTP id b16-20020a056512025000b00516cc2417d3mr2213485lfo.20.1712278512010; Thu, 04 Apr 2024 17:55:12 -0700 (PDT) Received: from blackhol3 ([2001:9b0:40::cae3:cb03]) by smtp.gmail.com with ESMTPSA id a1-20020ac25201000000b00516c1bddfecsm46630lfl.182.2024.04.04.17.55.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 17:55:11 -0700 (PDT) From: Paul Donald To: OpenWrt Development List Subject: [PATCH 2/9] various: refactor Date: Fri, 5 Apr 2024 02:53:05 +0200 Message-ID: <20240405005510.19778-3-newtwen+github@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240405005510.19778-1-newtwen+github@gmail.com> References: <20240405005510.19778-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-20240404_175516_138615_05619413 X-CRM114-Status: GOOD ( 20.13 ) 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 --- src/dhcpv6-ia.c | 62 ++++++++++++++++++++++++ src/dhcpv6.c | 4 ++-- src/dhcpv6.h | 4 ++-- src/netlink.c | 24 +++++++++ src/odhcpd.c [...] 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_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -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.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:12d 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 Refactor "valid" (valid what?) to "valid_lt". Signed-off-by: Paul Donald --- 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 00:53:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paul Donald X-Patchwork-Id: 1920014 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=f9GzAeki; 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=PFmmh7An; 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 4V9g7H65cyz23vH for ; Fri, 5 Apr 2024 11:57:13 +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=9Xrnth90b5Of2+69xf3Hby0S3sKEkkPcfDK6lTYGWEs=; b=f9GzAekiGm6N/zGTz53iqTma9M VtVxvYwjQpjQyxrZpD8HfBaemund/e9C3htK10hfTxLBCVhE0fDlB8YMJeY6Ug/khVYlNL0ZHXjT4 3QWDs4N1PclZAQ1TXe3ca9O7WsQpqQkKpjAzkOClhD8EUVIdc9HNTt2v1WAbFG2Vr24TwEYKIOwIy ppDWU4ZxRKzEJOphafA5pq5GnubnkNMDJsjrwStirdvECqN5LNX9vQQT+krR5Z/OQRcJGYEawYE/K +lJn0aBJr4SE9aI9NGLhDju6NDVlKNL+e5hIpbqqIIg2m2u6Q5OynRErdY+zlf/OuuQ4qC7317bIV eSUSVd6w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsXrd-00000004kIV-26DT; Fri, 05 Apr 2024 00:55:29 +0000 Received: from mail-lj1-x22d.google.com ([2a00:1450:4864:20::22d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsXrQ-00000004kDB-1m3Q for openwrt-devel@lists.openwrt.org; Fri, 05 Apr 2024 00:55:19 +0000 Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2d109e82bd0so18214851fa.3 for ; Thu, 04 Apr 2024 17:55:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712278514; x=1712883314; 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=74Uebden/znLTS9auSccUvMXAF9+gOsX9RxrTB2c39A=; b=PFmmh7AnvQ6dHwA+V6+ahjLMm4tC1tNuYqoiiwTQsCAfzvcV+1KAWJAD33s8hGkTXD riSbjidKtqDUTicrYvNK5nu4r6YGT5jX2M3phy/89mB4bcRFMxY18wnZbsmaXlGvJetu 1MtbclYoJDho3MszTucI6yMAz+K6mB1y1lOTWVPiq+HFqvnaOWD4VIorUprVVaEeqeiF UBmPTODony99vtQRsgWsOs3iI4rLCMmqym7ahmuWMWUvYNzGC6kMSKXu3jvJibWn61cf oxqAssj3LWvTEKZUGqwlpSjP4N78G2XQLSK6XZn+meLjRBMeprZNuc9qGUS7xbYoyolK Ojfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712278514; x=1712883314; 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=74Uebden/znLTS9auSccUvMXAF9+gOsX9RxrTB2c39A=; b=DrN1IBBpU7Qcn3nmAzbcKkwLLlO1FjjspMsm591QA99bOInnakTzUWafe9Ya7OCWbe JSjpMK9EvTNY4QNlUs6dyOql/gCaWkkf5uutVh2gbLQncYYsg6fRVb1d1+QUGjcRYKID KlqEDETfx0kxqOIjStUxatLkTr7fqrx9YW4hmQVa0RLCh/ShVVOSRoOpQUhVUP1D2nNo uZQC3zA0RX+RWH8zZ0KKCpjHaFs/Of7Qv+M8Vv6n/biwJYp3nRhHOKcd2wvBVXBDf5L9 EBWQELH80vb/dNS9z0ylA5vNcsZlvhuiFxGn9PKJ2XK2uM/io4kLMcMLZq8qVX/2g2Bc 2b/w== X-Gm-Message-State: AOJu0Yw9aSURX7BEPZhROPibESIjUHTltYGP2/uyM6/kwA9vkQAFadAJ h7CtbDon41yZqN67jyQEFOimic1aFvSKrmqMm+uz6Ha90JPqUGOXRKPJ0MpLMOU= X-Google-Smtp-Source: AGHT+IFEp8cPRTd9rKVxQQZIXwq76+LkRdj+DA08Fn6+Rv402PF2fbPZXy48PNWOjujyPb8Gn2k6hw== X-Received: by 2002:a05:6512:536:b0:515:cf15:285a with SMTP id o22-20020a056512053600b00515cf15285amr677313lfc.61.1712278513614; Thu, 04 Apr 2024 17:55:13 -0700 (PDT) Received: from blackhol3 ([2001:9b0:40::cae3:cb03]) by smtp.gmail.com with ESMTPSA id a1-20020ac25201000000b00516c1bddfecsm46630lfl.182.2024.04.04.17.55.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 17:55:12 -0700 (PDT) From: Paul Donald To: OpenWrt Development List Subject: [PATCH 3/9] various: Comment fixes Date: Fri, 5 Apr 2024 02:53:06 +0200 Message-ID: <20240405005510.19778-4-newtwen+github@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240405005510.19778-1-newtwen+github@gmail.com> References: <20240405005510.19778-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-20240404_175516_535620_6E546DB5 X-CRM114-Status: GOOD ( 14.55 ) 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 --- 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 arpre [...] 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_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -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.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:22d 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 --- 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 00:53:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Donald X-Patchwork-Id: 1920020 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=wYBUsEJC; 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=BQCOUkDj; 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 4V9g7S4sZ2z1yYf for ; Fri, 5 Apr 2024 11:57:24 +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=Iyicr5qjrdLSvJtUwA0+of2dmG1nxp2rP1H+sVbQOpE=; b=wYBUsEJCTtYfPy IkDZzT3OIpu7/5oyL0GEBbZrao4uqbZGrw4kSVt/wxizel3mMBthlcgyJGGchtC9dRrsqySiHGcK/ 1+t9Mon9N4b7wbzN8pLWtvUfa/hm/URqBHyP0e1sA6o/kpqC1/+NXpY26N/jEr9EEeaL5C1g13jzq QnLhjGAV6ucyK2aBxByx6jgM3RSDs320KQQ7k1ymvqZQBYCCnqw+nGkWRcgEbUSM8/Wo1CZJQ8UPN rICEyZumLA2boAIez01ZRAGqZRrKq6+fGszuKnqV10iXYpppqBMKEpM24qtA7iYLwXbmxFRwgNpTi dt1+JuzVdAGpe2C7HLPQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsXra-00000004kHx-1rEv; Fri, 05 Apr 2024 00:55:26 +0000 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsXrQ-00000004kDC-3oIE for openwrt-devel@lists.openwrt.org; Fri, 05 Apr 2024 00:55:19 +0000 Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-516c97ddcd1so1827832e87.2 for ; Thu, 04 Apr 2024 17:55:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712278514; x=1712883314; 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=/fYFrCp2t9IIKC+PbMX7h8TE2s3K19KXAyP+0Z9q0gY=; b=BQCOUkDjcvoVfTCsLG9+TiXnFEujwK/2txGTUFwSYsgT2HzE9drpQudUVBcbPT3sD8 e9cszhVkyA/nKRrUNDinQpsztZojsY8e4aIc+/2oWi87sssr4A4r/aAgHMov0OzNDBiv E6GtIEQHzHQ8sXiC3LrGPSBZ3EZssMZOIPjvWuLw6cA/3dEIApMcbJWhwRc9UVFAwVFJ 34+rc0ucp0vLX0/I2SgpV4oGyvcNEiT/gB9JN4oXCoG1gLbdkwJJWrU6MMBvoQzKJXLv jJAcN9n5vf7C4zgLM18n0uYWl3v1iwDjeJaOwnRm4M5vSviirn1lV+WbDw7x4/IOqz9+ 0WuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712278514; x=1712883314; 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=/fYFrCp2t9IIKC+PbMX7h8TE2s3K19KXAyP+0Z9q0gY=; b=sH5tAwOxsCKdkQ32BUSuewHSsZ5fxAF1bPtejUc7tj1eKiqZtLMvGIrRbssyyBbf5A hY64+ofZNDYMNEzQAo4hUBLRPxLaCHRHTcEbDtzsmMI+k/AVFh1Zsz3uCOmq/2I4vSo/ F7DRmAYHKzy4t19j5e5/nHMUEFaB+UgQf8RRCYoOUFPSFCEAgv7EZwL/H8O4SxK65FtT CN+nk7u4gefESoKmSJfvZBlQpoPzHXMpnXRUWXipuBR782nbwskrs7qPKZPBEGvBNlbz C/UGmUrqR3GDonSJv0mJ09bsTPKVIoXeq20Jg1g74AgYwWb6wJg+WnOah9NxCMjTWm6P eIoQ== X-Gm-Message-State: AOJu0Yx/v10Qkid7Duy82I7V6NPO7z/cu/AUA5Q3a1/pMtePJzWMMyWg 89BXWTqO2phyh8lRXKJFao1WNxfiPw+wSTgkMui0prvGRMR11M95TmOh+0Ykn9s= X-Google-Smtp-Source: AGHT+IE8H8e4e0eLn01rQd8lf9vg9XTO8oeeSPVUdJlXCLeX/bM7UJ00P+nunu48Jv/1KRFGbdwnUA== X-Received: by 2002:a05:6512:3da7:b0:516:cdb2:6198 with SMTP id k39-20020a0565123da700b00516cdb26198mr2796561lfv.18.1712278514060; Thu, 04 Apr 2024 17:55:14 -0700 (PDT) Received: from blackhol3 ([2001:9b0:40::cae3:cb03]) by smtp.gmail.com with ESMTPSA id a1-20020ac25201000000b00516c1bddfecsm46630lfl.182.2024.04.04.17.55.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 17:55:13 -0700 (PDT) From: Paul Donald To: OpenWrt Development List Subject: [PATCH 4/9] router: inherit user-assigned preferred_lifetime Date: Fri, 5 Apr 2024 02:53:07 +0200 Message-ID: <20240405005510.19778-5-newtwen+github@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240405005510.19778-1-newtwen+github@gmail.com> References: <20240405005510.19778-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-20240404_175516_976166_B68687C9 X-CRM114-Status: GOOD ( 11.58 ) 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:133 listed in] [list.dnswl.org] -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_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -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.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. Signed-off-by: Paul Donald --- 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 00:53:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paul Donald X-Patchwork-Id: 1920021 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=JfWubfcF; 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=AD4zHr/9; 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 4V9g7T3JCwz1yZQ for ; Fri, 5 Apr 2024 11:57:25 +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=f9Gir8F9m7nVxPFIXK+vNRPHOZboduUClMAQcmVzM/Y=; b=JfWubfcF3iFthu2WR2cI5lrrvq I15hrwfLyBXA2m5/GL8V5Ne5ou8IdhcJZPmzX1s1h4mLZ7TUhgtTERyYZj1XYsx2u4LXpVvPXq/SM 9fe8QyyIjJhVkzBmH58Wa9/lmIllvFR1cYB3BuWfyzJTfZwhEnoqPUnJgheEpieM/2VS7LL/vhLp7 +3v4rE+gPE5XVDlrmArIY6KL48X15tgxhrYXLfzmEuHEog0Ug3wgIY6ZO29vxDqJ3iPNcCtQtCGBT cN+CzN9lwpjxHoRQnciE+BDW+Eu/OZvEg/CoTf5yhaG1MNXnI7ryxRbyfepzywrFmUjq+Au32EXaf 6RW5gt/A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsXrb-00000004kIG-3FNm; Fri, 05 Apr 2024 00:55:27 +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 1rsXrR-00000004kE6-2oRW for openwrt-devel@lists.openwrt.org; Fri, 05 Apr 2024 00:55:19 +0000 Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-516d09bd434so1217922e87.1 for ; Thu, 04 Apr 2024 17:55:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712278515; x=1712883315; 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=5rTN2XT64ElOh49XniZnuFjkarn8dOg6fonK4+ukV04=; b=AD4zHr/97GsmZpYvCvoDvkfMBwJyDx8d/5nLZJjoZ+Tm2JsaN5YGCH03eD/M0B7SnN qZauUcVGC6hq4hCxrQFLlGu0isERchnMP4yPfFxe/ZcNPSPq+K7HQiaHL2YWtvAi9L7i 76iMCbKNqn6TOr6l+7vGcf4RBQmJcOrwh45k0xXsipONDOWiOWuhRGF+cOho3gVK4ulw xR+RQ1GL/ZhQpomLif5Ag4o2zTjzerWapoHwNxVXe19F2zBLfoN8dJUCt3bVcEYwmGX+ oA6AdpwlYA2EN4GVyiALelynDDM7Ytms0zrsY48CPBe5rh0N1Yg2IhK2+0OwL/45lCkG X9Pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712278515; x=1712883315; 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=5rTN2XT64ElOh49XniZnuFjkarn8dOg6fonK4+ukV04=; b=fBzm+OzmAlphbNmPpndrzoUgZ+z8Maa6U6Nm4sbr59Ba3znXphM29Ekx/TLDwskYXs 1Fm5ckTSDVS1/FNlBSxxMvN7wqwTz6pTB6Aqu9SlIuCYAU+WyETVZHaJDT3OGDKAfD3o Oy+320vX+0LAp17I9APDZA3MzKUcRZBZGVsD8+M06EyNgVJPLwIUANE7M3FEC6cfNfui wN+njLWSZVc6cl13H86BHDTqtaVCGn8JPJeRF3Oam9+azGBa8IB5Og+GquUkbzP506WW CH/7PPo/xIiwkn0ss4ShN2nKhtaa5XOd/Y/oL0bAl0SajyXNtcSY7opGrbilCOS8ncwS B7iA== X-Gm-Message-State: AOJu0YwzhgRY8Anmu12Jkw87sT48YH9WDM/S9PXUAPDDvqwqehmGeRrC k4/g8v25IWDU4DMi+nVcKDRb0mYf+q5mnGZngSCXqOt8bW2uDMyYBDdqqNJsVLs= X-Google-Smtp-Source: AGHT+IG68YP9pcnHbf+UEQRAYy06HNQOiY0a0Ht5K6kyQIcHQvonoqp7cLZ4KjgKfdr0Co4aLts8sA== X-Received: by 2002:ac2:4e95:0:b0:515:b67c:d72a with SMTP id o21-20020ac24e95000000b00515b67cd72amr2499318lfr.56.1712278515436; Thu, 04 Apr 2024 17:55:15 -0700 (PDT) Received: from blackhol3 ([2001:9b0:40::cae3:cb03]) by smtp.gmail.com with ESMTPSA id a1-20020ac25201000000b00516c1bddfecsm46630lfl.182.2024.04.04.17.55.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 17:55:14 -0700 (PDT) From: Paul Donald To: OpenWrt Development List Subject: [PATCH 5/9] router: Limit prefix preferred_lt to valid_lt in accordance with RFC4861 Date: Fri, 5 Apr 2024 02:53:08 +0200 Message-ID: <20240405005510.19778-6-newtwen+github@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240405005510.19778-1-newtwen+github@gmail.com> References: <20240405005510.19778-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-20240404_175517_792885_116B958A X-CRM114-Status: UNSURE ( 9.74 ) 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:12d listed in] [list.dnswl.org] -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_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -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.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 --- 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 00:53:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paul Donald X-Patchwork-Id: 1920017 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=lfHD3CAH; 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=lsZ+kaRE; 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 4V9g7Q55kbz1yZQ for ; Fri, 5 Apr 2024 11:57:22 +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=7j8vlDPyIqP40icBkytGTwGLgM8jdnzU4qUybtNxNGU=; b=lfHD3CAHljiEy9hP/5cR2nNuPR TuKtC3v+qmxTMwjqGBPOSTB3jCU9IBq4gZuggThw2Js0pfbZD1NRKLLHnO0IKf1nYsBkZx882sWrz JzgbeIp6Dvh1DEjgZ6EdTkY7HcfhaiEjd4Gg8+HBtIjdwtrpP583N0uMNfTtf846d47mfVc0+/yk8 LjJ5uHrULJDqrQQheMYMbD80bYeMV86LLnuMvgWiqGZNm2a9+eZn5vnPbk13d70LMAdwRMHRj9URo 49iUw7IdG6mxT3frknH69+kFqUb5kKqA4ohq/gg0mkr5Y7VlBxqoD8xNciFEg7nf1ZIB7Ue1xyKZh Ai3PUoPQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsXrf-00000004kJB-3KSU; Fri, 05 Apr 2024 00:55:31 +0000 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsXrS-00000004kEK-3myb for openwrt-devel@lists.openwrt.org; Fri, 05 Apr 2024 00:55:20 +0000 Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-516d15d72c3so1168115e87.1 for ; Thu, 04 Apr 2024 17:55:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712278516; x=1712883316; 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=GLjAysJrpjgy8dgcbhDWHA1qMEdmrkS4z6GFYVaDRZ4=; b=lsZ+kaREAVipRoQn+UL38I79pCIgallFY/BJF1ziw5J017w1ST2OJxapHXC6lqmbck 4FgWJlwyURNXqhWE0MpQielJhPZDPYt14MNZK90wU6RsiyqxKcyVhAk1HuFy/essYo65 TW9ejXCUVsexTb97IFn646HGlw8+dNz9jYD1YKBNXjzuh3ilpPxpU4eeWmqCmmpS7BNm E2NAJ5e16s59HktUXAZJJolMBP8/xkTzz6jb1mHntz3XHQb2R6ktu4V8tCnbKKWkVxl9 rl66YNRtIpmPsVrVecgXoiM2hzX9n8Q3meqbvJYN11xHvZhO31chhl1UrGeTPFnW9d5e fP0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712278516; x=1712883316; 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=GLjAysJrpjgy8dgcbhDWHA1qMEdmrkS4z6GFYVaDRZ4=; b=iTQsF9S2j4wOmFxlz0hNRK0iiCX+KIJXGU7Mpqze5kOm7mh3WSNaOUWkyAgG5r7eZZ GARZfKiqEf0Y/hIJcVqdlpm1MPXLrVKiDbkuxA3RHPWwq/ZRHQSSfBIo4WXUNm3uavwb 47hGkDosM0ym6vf7fbf43UKCGx9sup/foSK2KUQQYl4wRfo1CblsmWG7gfVMaBA8X8Ca VNg02R98EHzHd+C3PkbNBo8hpH3mL1Ry00FZIh5/l9biPhyreE3DuziW/qFwFY/IkZD7 V2CC4Vxnn29AL6dlJU0LQcVW8aaGLJzT+fbD0+a3X1HnF+FbMUR3jgfIMSUaNOIjzddQ 0gxw== X-Gm-Message-State: AOJu0YxZCH+0DuTUE6sn+Izs1kZEHSYi8yqMMJQWjwTBghc+n0XBd3Aw EfSnGIeg3kp8JWkPWXM7LkGoDt8THTeG+XY23dOUXLHQg0Gj8vlfdx1NykVuCAo= X-Google-Smtp-Source: AGHT+IGKykI1CoBAfhhDXTwD3ctwJ3LDCwcVuekzDBlX84F1USd7SV8GRXnz10VjbeILDs0WCwY/fw== X-Received: by 2002:ac2:48a7:0:b0:513:d3cb:249f with SMTP id u7-20020ac248a7000000b00513d3cb249fmr2806318lfg.52.1712278515959; Thu, 04 Apr 2024 17:55:15 -0700 (PDT) Received: from blackhol3 ([2001:9b0:40::cae3:cb03]) by smtp.gmail.com with ESMTPSA id a1-20020ac25201000000b00516c1bddfecsm46630lfl.182.2024.04.04.17.55.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 17:55:15 -0700 (PDT) From: Paul Donald To: OpenWrt Development List Subject: [PATCH 6/9] router: Apply updated values from RFC8319 (updates RFC4861) Date: Fri, 5 Apr 2024 02:53:09 +0200 Message-ID: <20240405005510.19778-7-newtwen+github@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240405005510.19778-1-newtwen+github@gmail.com> References: <20240405005510.19778-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-20240404_175519_355137_964C6893 X-CRM114-Status: GOOD ( 11.35 ) 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 --- 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 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -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.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] 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 --- 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 00:53:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Donald X-Patchwork-Id: 1920015 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/6KGeVc; 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=OS/Awf0U; 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 4V9g7H3vzFz1yYf for ; Fri, 5 Apr 2024 11:57:13 +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=8wagXBXj4kQDpmGi8OUhlp+GiEWZFxFKyGRuyf/ebf8=; b=n/6KGeVccjfvQ/ +J4793t90mRH5HKYKMoyFlxFOLaD0FTXQq/PKeANLe9rfAaYFlPP45ff4mvopjM79aVn2RS5DlHB4 bon4utseB1/qoZWXh3ZbGDgP87wRc/fQ4eU7NYaLVg/wX3UcqCBhV288hVscqPKOO03vfNuW6/VGW L4i26EsBj2J5tknSpfOLukY/egXebH64ZDsXqKG8THaqZng/o/PRqlMW1Hj0qTfYd32HemPAYIg99 y7nsNtFkknDN/nqVJdz+0UdpP05rkMcSTdQ4F2Qi3BeQeRGRA7tZkmnn+AmXcKqDTw1P+A2OM+AyR pEKOdYEchi7u35iUPPOQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsXrh-00000004kJt-2Tev; Fri, 05 Apr 2024 00:55:33 +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 1rsXrU-00000004kEq-0XKN for openwrt-devel@lists.openwrt.org; Fri, 05 Apr 2024 00:55:21 +0000 Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-516c403cc46so3053628e87.3 for ; Thu, 04 Apr 2024 17:55:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712278517; x=1712883317; 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=A3OMDwf9u4KDJp6wosOM9JoMBVDC56mJxOA2o9k9ZNE=; b=OS/Awf0UmSCEq0Z3KXAF1IIiAGASI164XMn++CpIupfEtAB9d3tUz0mHry5J0FM2ve 9Jz7Gh/U5kzebpffo3B3zzV8VBsHGhMY8ukULuHiqZARAxjXUeuvyycANNNpyUHPIPLb Ht82DzVLWZOH4W/uOeu0wMNOXJ4y/tfqG/dip/SFKnDyEg8eFn1/elTpdudM4EoVksba cflcDEHTJpN2VN6y3KDXkhglchpWrb8mSgYE3nu3LJYqi137wkodRNTSbztceHjUbFnd Ad6Wqr2Rf4rsfc4DJB+6tVh2PqkXTXQ8hYdWqOMDWSJJjSFEXVepD17ODCt5eeGBUQh7 r28Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712278517; x=1712883317; 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=A3OMDwf9u4KDJp6wosOM9JoMBVDC56mJxOA2o9k9ZNE=; b=P90WbzyOofH3nNOc8U0UqOJ+XLEcgkbD6kCk1JxGRIgQtfBRrRdTQnCGobENwf+VXB XKwGPZfyJBfx1UHOsv24QOz2QXKDnB3RvLwfkya601fCumjmWvsE8WB3kIETRhIq222/ t31vnhAmmuJbAefzom2e7qTgdsYoFxbf1SOmMpV5nUTavQ8Z3YGQgtvT39x5V9VUwVt/ qYmC2dJSLjGWaHMe3ZOCHWiPZimJLAikBX/L6H7raWkcn7CcqdXF0wjXlVl1Q6zAc3K4 LlZrCJtIezjHepwjqh2EX8FoxwCWkzs73z49SydlXlrNyXMQVHgv7z+D+H+y439ULvUO oY7A== X-Gm-Message-State: AOJu0YzujX7XWougcCnH9ow0Z8iCzdpxe+JN+gKq8JTazizDfUMXKkbT GAL8Oles+hTxoQTo5TLWQsswzdm0bFF+lXzGa6Ov5NMtJMxh5s4166FOPWy6FCg= X-Google-Smtp-Source: AGHT+IFFVAYuvl69Azwc61P0CS0wMKAenCq0enxvJXMcJTPtaLZpYq77aDPAvw9foFcWjztLO2JOsg== X-Received: by 2002:a05:6512:488a:b0:513:cc18:d4c6 with SMTP id eq10-20020a056512488a00b00513cc18d4c6mr3991560lfb.41.1712278517397; Thu, 04 Apr 2024 17:55:17 -0700 (PDT) Received: from blackhol3 ([2001:9b0:40::cae3:cb03]) by smtp.gmail.com with ESMTPSA id a1-20020ac25201000000b00516c1bddfecsm46630lfl.182.2024.04.04.17.55.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 17:55:16 -0700 (PDT) From: Paul Donald To: OpenWrt Development List Subject: [PATCH 7/9] config: ra_management is deprecated comment Date: Fri, 5 Apr 2024 02:53:10 +0200 Message-ID: <20240405005510.19778-8-newtwen+github@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240405005510.19778-1-newtwen+github@gmail.com> References: <20240405005510.19778-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-20240404_175520_195265_0536C48B X-CRM114-Status: UNSURE ( 7.98 ) 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 Signed-off-by: Paul Donald --- 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_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -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.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:132 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 --- 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 00:53:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Donald X-Patchwork-Id: 1920018 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=LO09mbH7; 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=MSKa/BNs; 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 4V9g7R2zj0z23vH for ; Fri, 5 Apr 2024 11:57:23 +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=RU8fdLx5pHoreV2BjlE2mzOj8bD7JPHbbGpVN2UTbgs=; b=LO09mbH7cNRWKu qlLILkMKcBbyofKmmGy+G8A+uCZW1qOBTVKhcuug8nAeyyjQKLGmupous5Zc7S5eQFfAtVJZlwN4a EnRQo5EYA1dAzSt+2Gdx6oiHEn6FephM4HrT/naaW27vKBQNzQdNSTaFtZRF1uNiz+YeoB7eQzviy QIDc4Sd/spsfIT1BRKAnJo6lt8A7Tillr3ysQirkHij1+mxJ3e+sfq11ugAH6ArHgMXb1zd0j5HOq uiqQjqX72joxVSGRrLB2EdhF37N2J1yuQfiiKROd/BPaab3fvoVPSIQOih5XGMex7GFkXQgUPKm5E yk2QtPcn9nwr+oaDZMJg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsXrj-00000004kKN-261u; Fri, 05 Apr 2024 00:55:35 +0000 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsXrU-00000004kEs-3BcS for openwrt-devel@lists.openwrt.org; Fri, 05 Apr 2024 00:55:22 +0000 Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-516d1c8dc79so998277e87.1 for ; Thu, 04 Apr 2024 17:55:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712278518; x=1712883318; 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=x0fIdZpFnzTtWJvLTXqRNNL5wdt943PJZ3ySoFW5Ssc=; b=MSKa/BNs3F181c7MZcWRXAgdh+jdccyyzSfmwysxMJmkAMlZ3dkNMUykTFxQlg99fi EfEg4cVWx20k0g6dmdCWRaK7qtNAur01n/ge6pzbIyGRwT1boUwmJmbsg5qGOArYdK8L EIL4WQEvWnohqgmf8JKEYlgH9NhKZIdu9/AJs0nbC07J8UL4TuB8WjgJrZ/FcchCaRMY n9bSqVT0mz/t5sRRZqwcfnjLPwJx5uS4u/yZGyk0k5IuTlDG0FP2CBlFdOKh+kG5jdSz L/juMcD5hwUH9ilJ+CNfcMUTKhgnBGySdnknFMrv45W4XYdyIjxM18La09MV+TQydM0p Gvbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712278518; x=1712883318; 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=x0fIdZpFnzTtWJvLTXqRNNL5wdt943PJZ3ySoFW5Ssc=; b=ekVKoMtpVBHRLOVxntzN3UdnmYXs/o4A/oI83nn96X1InpDZPXt11reEzxGZFUj1Ha zQe/uJ2REsfQLEnCHObqUrol1TOLbc43LNfmywP9wRGAA3bVZ6DvfnrvEUfP3FIBGFOx t2FiBq4EwokAm9hvLFIY3E9thfZyo7ElzJUUWwPc3nCS1y8tjbzV3zPJ3Qe/R6y7eMFJ JLy7KQjVxZ+gOSqDoSuwJEsuRG7I9zrsObHIWg3ReJFQQ/kRWQAHFNA65/lZR+NDEpqa cbuf9srjvKb2TgfB+zNETxI/gudXw8DPa4EidgqyOzA1tSxswPK160XMhct/bio7YQP+ v3iQ== X-Gm-Message-State: AOJu0YwGnzzVgwYpQIermI690lQ1ppmGyejUZnbxd2lTxAQrPhwZjme2 kzrMoZIXzcYH6qt5kWYWAwaTXTmvcUvZDqIyi2hUUkaIy+T0AJWy/ElaMw/KY6I= X-Google-Smtp-Source: AGHT+IE8PHVESPv9gqMV0v2k/fvgy/JL756xG6XyUMfSK/3wNLnKqZ4ycOwBerIlMWIFwpvFXH0miQ== X-Received: by 2002:a19:9103:0:b0:515:ad59:d46a with SMTP id t3-20020a199103000000b00515ad59d46amr588501lfd.21.1712278517842; Thu, 04 Apr 2024 17:55:17 -0700 (PDT) Received: from blackhol3 ([2001:9b0:40::cae3:cb03]) by smtp.gmail.com with ESMTPSA id a1-20020ac25201000000b00516c1bddfecsm46630lfl.182.2024.04.04.17.55.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 17:55:17 -0700 (PDT) From: Paul Donald To: OpenWrt Development List Subject: [PATCH 8/9] router: Type comments Date: Fri, 5 Apr 2024 02:53:11 +0200 Message-ID: <20240405005510.19778-9-newtwen+github@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240405005510.19778-1-newtwen+github@gmail.com> References: <20240405005510.19778-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-20240404_175520_864067_A14BEA23 X-CRM114-Status: GOOD ( 10.81 ) 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 --- 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_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -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.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:134 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 --- 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 00:53:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Donald X-Patchwork-Id: 1920013 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=jVi7JQOG; 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=iSMVg3vl; 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 4V9g7H5bbmz23vG for ; Fri, 5 Apr 2024 11:57:14 +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=1No1TIHnJDKdiE+w+MLbAabNUv131y/2REWrBLrHkDg=; b=jVi7JQOGGHFRpk Jas1/31mKT9GEb5NKTawz2/OiGo+XotKqqwzh9W9ehUTtpJXMET9ebiZ0QLbve/gXPK964IPTmNtU 1i/Tu4XH+quUUd6iqJcQ+w9kkb36O690+9sU9fY63ibk3xy6Y7ON8z6RiJDeybkjDaTHym3LY+Qz6 FCBR4Z2dBqQUbJV1LLjDEsy2eFvSuu8ziQWh23ALndY7ZpqI7WqG+I0U2Gf/uPQU+2PlnwjdQnMAi duTdNO4FitA9+9Evpk6u22dURldCihzgKOmTt1t1ZCWwJO7qpdAkdfaVuDW7QutjzUujMQxCl/er4 UWJGIKaj17Sa9ie7q8sw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsXrl-00000004kKn-0UHi; Fri, 05 Apr 2024 00:55:37 +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 1rsXrU-00000004kFT-3vzx for openwrt-devel@lists.openwrt.org; Fri, 05 Apr 2024 00:55:22 +0000 Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-516c08c25e1so2185399e87.1 for ; Thu, 04 Apr 2024 17:55:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712278519; x=1712883319; 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=Vt6hG2s4vu2SDzBt+Mo0+6cbljt3YsJYB8uedjVJkaM=; b=iSMVg3vliLkNV0vonBnNeIbXph+ZYgFWCtRqVKqIycadp+X/gcDUY95l/Q4HE3zn5j 6/YAWI58EOdr+Qrc4obz7iuU2NzN10ExLX0/gRhdzgWvhDr25kZy0Dqr7S0836TCNqei 6y0y+LPTzS6fI8lC/PWB6sgkoU2lGxTOHY8nDrHyqWkI5QZgPn1XUJ6/hRA8m3jCOe2J 6A8bKN2K0trO4ML8s2UVcJQuNlmbvhhtrrN5MHgqofA90ngxSd7rNCzu7ijcqASlipZW nE6hS4zyijFZz2ZVE1Kz8zNk3H5s1FbtYGfeU/mUg0UH+jr5Voffq+qpiqIwGBfcHUbM aYYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712278519; x=1712883319; 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=Vt6hG2s4vu2SDzBt+Mo0+6cbljt3YsJYB8uedjVJkaM=; b=T5grq+sU7VXZtxUxJqMp7kx7/HjoEcSMP5FN7BK/TDhUsfvrAezKQbpySnwRyu+ZV6 eMH+g28cYTvSs824AW34xgpuckpQXbbhOeQCDZ2CbO5Gcti2Fn5yUL60yLkt53eYfnYj zDX9Zz6hRnnVpLXOsx5T65t27iC+FzctcpU3PXaLtpAnsHZkjI83dUWu/KC4oehxKEEK f7YaJwu6zM81gpH7m+hnQwCbdOseH5JAalhyjSfOt7Jnji+Gx9iY+C/l/sw4Dj7o6khO n0+uQdF1s+PaCOnWsLGa0ov/ENamPiBee0urtNFyx6m6iAaHyg9MYPbc0FNq9fVlGQA6 nvGw== X-Gm-Message-State: AOJu0YzPNtUpdVxCo8KJnltDySlAT409ZIdTgQlqkJjmdOs3S+E7mmGS oRczU2WgJakAyvijIMO4oPu9iA8c2X04s3CuHODFvfFxCK9Lm1Uet5c8bG9tcTM= X-Google-Smtp-Source: AGHT+IESYgjM62AvGNNHhWw3pcIz2wAkhcXXlDFGfmVe4EmvzSxQfR9+gaR5ixabkZuZ7kJCLRvnhQ== X-Received: by 2002:a19:8c1b:0:b0:516:b4e1:9b12 with SMTP id o27-20020a198c1b000000b00516b4e19b12mr658148lfd.34.1712278519174; Thu, 04 Apr 2024 17:55:19 -0700 (PDT) Received: from blackhol3 ([2001:9b0:40::cae3:cb03]) by smtp.gmail.com with ESMTPSA id a1-20020ac25201000000b00516c1bddfecsm46630lfl.182.2024.04.04.17.55.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 17:55:18 -0700 (PDT) From: Paul Donald To: OpenWrt Development List Subject: [PATCH 9/9] ndp: Comments Date: Fri, 5 Apr 2024 02:53:12 +0200 Message-ID: <20240405005510.19778-10-newtwen+github@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240405005510.19778-1-newtwen+github@gmail.com> References: <20240405005510.19778-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-20240404_175521_041941_598DADD0 X-CRM114-Status: GOOD ( 10.61 ) 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 --- 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_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -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.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 --- 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) ||