From patchwork Tue Apr 9 03:04:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paul Donald X-Patchwork-Id: 1921175 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=I5+MdEOT; 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=nsh2GO/T; 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 4VD9qg0PTbz1yY8 for ; Tue, 9 Apr 2024 13:07:27 +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-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=44+SPvoQd393KTaxkyS3tg9ZCAX3XAsebMhrzHo9DoA=; b=I5+MdEOTm6YzL/qYqK8t3V3Tem 1J2PW6ym/iXufUkckJNhpMMYEuO2z0CB0e813O5qaYpNFBoFxK+IE79zEyzJyiBS5cTTcAHkBkSFm 2TNBn3fKt7h4AB/Cb4QoCRlllfGVDa0pYmsZqkOT0Zm9i835OSe5/UFief5TAUW5BHCey57nsNhQp QBi0MmI4nNWIxXZIF6gBmzbOzft3bpqC2LGILGyoVLvUCrnJgYNl0Zn1cZ4K9O8Ks+S3dKcJdIAlY N5OQiP+gLsk//67rLo/YkgiE2EwYneUQgERxDZm02rqhMeqAzcB1ouugqQINaKqQ4P/ygcc9pmIVu JJ7UQ/DQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1ru1o6-000000002g0-3NRE; Tue, 09 Apr 2024 03:06:14 +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 1ru1nx-000000002aF-3xFh for openwrt-devel@lists.openwrt.org; Tue, 09 Apr 2024 03:05:51 +0000 Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-516d4d80d00so4274968e87.0 for ; Mon, 08 Apr 2024 20:05:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712631943; x=1713236743; 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=E21nv5Vm/YtVk0rDHduU1ADKzAR1V4F+/0YLIWu2upo=; b=nsh2GO/T+a5dxWSFwXEoEcAm+2wzNF9eR/KgOX5EaFbs1hUBytg/PJKRpMYzSWfe/o /mKWjsyLCtBWRxDWfvyqBFBqvCZD/f938AoXHaZ0swRA3w3MF5VTxENR7HUR6p/Kub3o oK5zG1kfAqsrY1A6i6lsnMWMYAPTvnYGC1oQdRLnKoEo80HOCw4P2azBNvPXOhFIFhin QQMJwbFHHku917/A1M5eSkd13n4pdW691LwM5ax3RcGXB3LnhOHy5gSDRn6AoFKueGQf WEvRFzXPb6+GUsIBokgCW1wG6URM8ny5RIU5W63YrOXED/iSyx5Jh64JnSnnXwyRHnnG L83w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712631943; x=1713236743; 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=E21nv5Vm/YtVk0rDHduU1ADKzAR1V4F+/0YLIWu2upo=; b=FRg34TFfF07YwsN5na/ay+SrCQwginw0bfoxk27kjQbVe9ynnLoVq0m5/h9zckhooy Z+J+uRaZAB+ZDE9thG799DpNv4J95RRUIwc+xIGZj8u6pD3yyCzH0yugdnpHfD5JhCvr R919Q4oqmlz8E/9PiBejKok+N6AIoVtJmd3F3llOiUMFwWeNSgDRFSASGE0ISVGCZuM8 YOTy28JywzhqXpCxXSn1FuwRd3IVxZHnll2J2okZTLH5X+lYj/rn4jM3dwccrvAIsO9S YEigjT8PV/3H3gjcHIg5GCncdvXYX0lXG3CeidtD6FEv7wsQ5jCLvCiIoCNBCT76n7x/ z1tg== X-Gm-Message-State: AOJu0YwtsmGnUaGUoWdFoTeWRj5UFFFNZlyuRgnD3MJOMjOp4QtDv931 6cLFs+3lR5F/8bR4DZrRvncvdwUJueNgEuiFxN2AoTWs2aKVQib7gwMeeBa4 X-Google-Smtp-Source: AGHT+IFXJE4tZA98GI/mXCi6EUuG6yH2V+mX8S0iDOWFg4yG8E43jiCkJCS5wBvlRFLJc2zRxPv//A== X-Received: by 2002:a19:7013:0:b0:516:a302:f29c with SMTP id h19-20020a197013000000b00516a302f29cmr6857485lfc.55.1712631942856; 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 4/9] router: Limit prefix preferred_lt to valid_lt in accordance with RFC4861 Date: Tue, 9 Apr 2024 05:04:05 +0200 Message-ID: <20240409030540.77576-5-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_082585_46361CE4 X-CRM114-Status: GOOD ( 10.14 ) 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: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_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 Follow-up fix for bc9d317f2921ae6b529f2c9f8de79b75992e206f https://www.rfc-editor.org/rfc/rfc4861#page-44 Signed-off-by: Paul Donald Reviewed-by: Daniel Golle --- src/router.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/router.c b/src/router.c index 61d0e69..c35180d 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;