From patchwork Tue Apr 9 03:04: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: 1921173 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=hCAa/ffu; 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=XOfzhKGc; 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 4VD9qT5n0xz1yY8 for ; Tue, 9 Apr 2024 13:07:17 +1000 (AEST) 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=kYCUYbM3GUD/y1dl31WSzSz/F2iuYmLkZCC7kQ5IFRo=; b=hCAa/ffuVk827s OONZmkkMXeVeQzy414MFCGsShpEHsdUnEKA/N/yCrfqm9VW4NcTnZjRtBLMnoiX63wHtHHPZmnPkh 2zzk9hvxv/4/n8KuBn0mgW/XzmRYqjc9JwC1QglG12qB8xcsK/5maXCkSq12W7mcHS2s8jon+94Q8 oR6e5zHKHtpsjvIv+3owX5LruZPYxFpIr+w0TTL/PZH1NWm3Fspa1U7DhwUjGvGY9Sb4kM7TkjxT9 fosvq6I9IFp0EplKZBxtQu5DwXIKNCm7eiTQAa89TLDBzdW6bXGveFocbE5vS2Bw69qmKjFAKzWc3 oWrTOlYIKV7LPdirKE6Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1ru1o2-000000002em-2hYp; Tue, 09 Apr 2024 03:05:54 +0000 Received: from mail-lf1-x12f.google.com ([2a00:1450:4864:20::12f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1ru1nx-000000002a3-3z4r for openwrt-devel@lists.openwrt.org; Tue, 09 Apr 2024 03:05:51 +0000 Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-516d09bd434so5367817e87.1 for ; Mon, 08 Apr 2024 20:05:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712631942; x=1713236742; 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=LukxuceD09d4LtE8YaJgt8hoeLNPkweBoovq7VwbLXE=; b=XOfzhKGcEKl2S4H95BfMYLh1/iIKtEjITw66UxL0O2pWjFUWZCVuZlIGBLTecETVu6 Yh1ogrhJGEe2d04QFqS94l0P5bz64qfoBZVlaiQKG+MHmmb419MkcrfBjRgcK/K29qvD 1OWxsPr3i2y3O6TKJUb39f3mvT4RvvOYjLjrjxHVykmdg2wlCNPJ5vN2BmxTkegskFW1 3TU/6vDsZiWwYCeRKIFTPVpbKNMb7JxwelY9KfMcxu4f7Cz5CElAi5kU4qkZz58Ipjeq OiVYcf7mepWjy1YmrGZzZQQKOGpeHIHlEHy99sSkDaVnhJY86nSv4m7rnA/tsH2Z/Byq abAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712631942; x=1713236742; 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=LukxuceD09d4LtE8YaJgt8hoeLNPkweBoovq7VwbLXE=; b=LsFn9t5rerpekDcY8VmfR2A6C86oOFkhs3wRx/7cw1sdda+nxieFw/OilTgCiRLEhh WnpHalqs6n6zJoE6Dp0jtASN8RMaekUPUU5RfIJHLx7MR9+2/i6/YCMYQp9eMNbU0IER Fjqjjmkg7EiOVvzXEWZofhb1YP6mIMCvUaLRnw2hNguTc/T3JnhBCxDBIncpNK5fPvda 7JlRxir1X1oLcevvyqoc3A0m+z5zH6Zr74tvIr6RNPUPlXybugIza4oSB121SQ1FKx97 bxhWLPYSLd3MWeuDmdlu2lDyssl+c6Yz9PwJMDsRh5JcQPacuzOGN9i0OH9nouQo5gHw 9rZg== X-Gm-Message-State: AOJu0YxI6568vWnFRVrdZHEsp5dpnKEVYV0wjK7ojkbSRuqCJ6SpDcX/ V5ZVHHVbRQrdpVOhSsCh52YPo2A9P/mim1kUrYfif9WzBM2wxVn6YiHgS2zH X-Google-Smtp-Source: AGHT+IFca+IZ7UNxa5anN58xwwfA73BKcSbqxgn0H4Q1aaDsRb8FMAaJGycRw3+5sPjyPisvsRquLQ== X-Received: by 2002:a05:6512:4d1:b0:516:d17f:3c38 with SMTP id w17-20020a05651204d100b00516d17f3c38mr5990067lfq.7.1712631942438; Mon, 08 Apr 2024 20:05:42 -0700 (PDT) Received: from blackhol3 ([2001:9b0:40::cae3:cb03]) by smtp.gmail.com with ESMTPSA id d9-20020ac25ec9000000b00516b0051e6esm1399491lfq.231.2024.04.08.20.05.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 20:05:42 -0700 (PDT) From: Paul Donald To: OpenWrt Development List Subject: [PATCH v3 3/9] router: inherit user-assigned preferred_lifetime Date: Tue, 9 Apr 2024 05:04:04 +0200 Message-ID: <20240409030540.77576-4-newtwen+github@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240409030540.77576-1-newtwen+github@gmail.com> References: <20240405005510.19778-1-newtwen+github@gmail.com> <20240409030540.77576-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-20240408_200550_069649_E543AFCB X-CRM114-Status: GOOD ( 12.31 ) 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:12f 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_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [newtwen+github(at)gmail.com] X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org From: Paul Donald Inherit preferred_lifetime value irrespective of whether ra_useleasetime is set or not. User-provided values for preferred_lifetime are now assigned, instead of ignored. Before: == ICMPv6 Option (Prefix information : fd51:1c2a:8909::/64) Type: Prefix information (3) Length: 4 (32 bytes) Prefix Length: 64 Flag: 0xc0, On-link flag(L), Autonomous address-configuration flag(A) Valid Lifetime: Infinity (4294967295) Preferred Lifetime: Infinity (4294967295) Reserved Prefix: fd51:1c2a:8909:: ==After (preferred_lifetime set to 7 minutes):== ICMPv6 Option (Prefix information : fd51:1c2a:8909::/64) Type: Prefix information (3) Length: 4 (32 bytes) Prefix Length: 64 Flag: 0xc0, On-link flag(L), Autonomous address-configuration flag(A) Valid Lifetime: Infinity (4294967295) Preferred Lifetime: 420 Reserved Prefix: fd51:1c2a:8909:: == Signed-off-by: Paul Donald Reviewed-by: Daniel Golle --- src/router.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/router.c b/src/router.c index 6a9e19d..61d0e69 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) {