From patchwork Fri Apr 5 11:06:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Donald X-Patchwork-Id: 1920246 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=N//aHzyw; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=Zm9/4e9R; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V9yJS13S5z1yYh for ; Fri, 5 Apr 2024 23:21:12 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=BLMIRUGoWPU2SCNWuEvXXLZw+Fo2BvZ8tNsIzgjPAQg=; b=N//aHzyw346HCe e5j/mlI0C6YEb4RgwQgvS66Hfa/yc08sVoTCXpiVwIauUvd6mDqVOgrzZbz8u9PMTLUMS4j3K3S4e IgHAogDNUrbJJWMg4VJVJXt4LQ6O7rd5awnXc3uJlYF9Ylku5JDR8V2TqTSXbS6PIdHW0Io3r2uaX xKPxX/OTW1l1jkVO5zXtwM17W9Fy78tdYGW6/PPfqPGCy3awuVwlLQ9l4554NVF5Z9g0vGFV5O3R6 Tur5uzWx7Ycxr/tJ1SYYC/UM7XNbz+XvPFoZ+80yMSCJW3Io8dKLEIuIUZsevYDm1bASPhKitmBMj 4EUofKEDqggGf1VWckPA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsiXz-00000006tKM-3Dek; Fri, 05 Apr 2024 12:19:55 +0000 Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rshSq-00000006be7-2HLX for openwrt-devel@lists.openwrt.org; Fri, 05 Apr 2024 11:10:34 +0000 Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-516d1ecaf25so1357860e87.2 for ; Fri, 05 Apr 2024 04:10:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712315429; x=1712920229; darn=lists.openwrt.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=ZPosSTX+2j7rr1hsMuDKh9gceWzS7JutZ5ylJX+cdsw=; b=Zm9/4e9R7usfVw1616lUbHtQgP27UQLQLxWAKYPQqIfpwpnoPTPST195o2QvzWu2d3 njyfC/kyhS9viw6ZAeZ2hy87cKUV+1zbwnuRu5mErIf1PRujptNM5sQux4QaAqNnX7WN HoMmkLn0Ht2HT12MHfoAEUgGyoIrNpqv/HF/AUkjD7D3qe/x3SDFMofOfB0Ih+7Ga3jw c2q85YR+XGQlkHlDstf5ec5ELLz/GjDzNfrCi1oHm0vlU890eHV7uYCF5jxIlpSEWfbG 7IHqSISrsT3K+wtOEUMbxJIXOPuNhzbPGZqsBrKxADQesqvsCkhtG8l/MSYAixQ4Snld 8XoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712315429; x=1712920229; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:sender:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=ZPosSTX+2j7rr1hsMuDKh9gceWzS7JutZ5ylJX+cdsw=; b=jOSC17raT/eooWKLiwCQ+J7WuBnQfpWR1OuFQRqJXRTVIPSnlYMgt96bfITAQQlm2/ 22WR1goAOftwuqFIWDCbOdkEGPRkCfFwA5+WxNUfUGB8/EmBb3EvHoSo1lhy15oOCMeT 760agSBAg55URoNpCy12hP6Au1eJ+6uSshubizYAwz0j0rwOvdYX0Qoduh9iWMJFPJRD ypvRRgnqnVGSyxPrEOkSqSb0sx4UeANl3wnMk7GtMeic6o8wnHaiW+BJD/KJ9cHYjzTd SLoWt/GxlNu/mBEdm/jAg6/Cb84JBZWBCdT8BJpfaLA5soksL6hfxcmCAJeGU8vaRmxS /a2A== X-Gm-Message-State: AOJu0YwFObaZfzmjnmB9E3Q4fyY++97ethiyIrp1n9gL+LrmU2/QvMNg 9K+ZP4xfyEWbzmNSvEe7sxjA8UdLv17dY6AVoFBUV5hBFSsf5V3hd66dWmXPDM6M8g== X-Google-Smtp-Source: AGHT+IHmRHHcfGVojLcKeaTl6nlbyAIky2+7LZpce0QO3X/ad5qD0CBnFKcaKNB8oyc8B1MZnDn76A== X-Received: by 2002:a05:6512:2387:b0:513:5951:61a4 with SMTP id c7-20020a056512238700b00513595161a4mr917081lfv.6.1712315429429; Fri, 05 Apr 2024 04:10:29 -0700 (PDT) Received: from blackhol3 ([2001:9b0:40::cae3:cb03]) by smtp.gmail.com with ESMTPSA id g21-20020ac24d95000000b00516cdadf377sm163719lfe.137.2024.04.05.04.10.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 04:10:29 -0700 (PDT) From: Paul Donald To: OpenWrt Development List Subject: [PATCH v2 4/9] router: inherit user-assigned preferred_lifetime Date: Fri, 5 Apr 2024 13:06:48 +0200 Message-ID: <20240405111025.26478-5-newtwen+github@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240405111025.26478-1-newtwen+github@gmail.com> References: <20240405005510.19778-1-newtwen+github@gmail.com> <20240405111025.26478-1-newtwen+github@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240405_041032_708754_A2356927 X-CRM114-Status: GOOD ( 11.90 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Paul Donald Inherit preferred_lifetime value irrespective of whether ra_useleasetime is set or not. User-provided values for preferred_lifetime are now assigned, instead of ignored. Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:135 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [newtwen+github(at)gmail.com] X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org From: Paul Donald Inherit preferred_lifetime value irrespective of whether ra_useleasetime is set or not. User-provided values for preferred_lifetime are now assigned, instead of ignored. Before: == ICMPv6 Option (Prefix information : fd51:1c2a:8909::/64) Type: Prefix information (3) Length: 4 (32 bytes) Prefix Length: 64 Flag: 0xc0, On-link flag(L), Autonomous address-configuration flag(A) Valid Lifetime: Infinity (4294967295) Preferred Lifetime: Infinity (4294967295) Reserved Prefix: fd51:1c2a:8909:: ==After (preferred_lifetime set to 7 minutes):== ICMPv6 Option (Prefix information : fd51:1c2a:8909::/64) Type: Prefix information (3) Length: 4 (32 bytes) Prefix Length: 64 Flag: 0xc0, On-link flag(L), Autonomous address-configuration flag(A) Valid Lifetime: Infinity (4294967295) Preferred Lifetime: 420 Reserved Prefix: fd51:1c2a:8909:: == Signed-off-by: Paul Donald Reviewed-by: Daniel Golle --- src/router.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/router.c b/src/router.c index 335218f..3890c0b 100644 --- a/src/router.c +++ b/src/router.c @@ -590,9 +590,10 @@ static int send_router_advert(struct interface *iface, const struct in6_addr *fr if (addr->preferred_lt > (uint32_t)now) { preferred_lt = TIME_LEFT(addr->preferred_lt, now); - if (iface->ra_useleasetime && - preferred_lt > iface->preferred_lifetime) + if (preferred_lt > iface->preferred_lifetime) { + // set to possibly user mandated preferred_lt preferred_lt = iface->preferred_lifetime; + } } if (addr->valid_lt > (uint32_t)now) {