From patchwork Thu May 9 22:30:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Donald X-Patchwork-Id: 1933686 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=s7hcHsWY; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=casper.20170209 header.b=Mnyxxx6E; 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=LHmxjLHS; 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 4Vb7xS3hlwz213s for ; Fri, 10 May 2024 09:48:10 +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=i8F1pd9+oLswjeQVrFJd8ufi10NWlDpNQNdKDB/Je0g=; b=s7hcHsWYJRl5GO WqpQkxofxF3UZmI5Qrjb0fTsvVsUra+pfB2BWC0UZT/rI2jPgGEI7WSWkjzDZjX8FzX7Dcm+r6vhr SZZqs/LBVQClAusinWJME4wklyzYI6u6ZcGcptDvFocXQUfsL29+BMwxUJDW4x+9qssL5VkTKIlfT YR3i+nOh6NW/M+ymH7wXh6Ut84TRh2m/DNObDpCUZvI3ZYyk7Lb9cBzL0HzGv/1nYsUhkaD7UuRJq 1G5v+fe3fD8sMQXoFhMCj9DMRPEiuNTGT3MtvuOTYI3BTqVJ/k+loVxMxdtSYfP4HbS6+AlyiCDdz kzTJudUrE04lo++ddqFA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s5DTK-00000003Ixd-3LIS; Thu, 09 May 2024 23:46:46 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s5CJW-000000036tf-1XEK for openwrt-devel@bombadil.infradead.org; Thu, 09 May 2024 22:32:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description; bh=2vc4ZtSuX5JU71cwsGWyFAfe+kgVrPbAmRus5EZBUA4=; b=Mnyxxx6EskLtGKEJjt/kpoqGIZ C8sZHWxJ0TBQBL4vr6D6HkoGdS1aYppKkdAp+MKRUf0g8rEwpT18GTxWBKnZp42rt2DzyCruA3nq8 eKpt/Zfxmwv6EaIbKTH2MncoIhQdqB7qdMeSEQN8Wyb2gX0Fe28VxH3bSWvU13tZGUy62NF6gkyyS 1lYqh39uLianeYr6fzHHuk6ydGYWIGj1Y5xofKGyZs9wHUVAQnsSEqdvQtQU/5z4E5RH5+vnfNelR GNQ4HD9dOFkq9nNS0Ihv+yHn4nuy5gY26lVYiVR/nKI9Jhy2RdkQpleToYxzY+GQ9p5zzFuszaLq/ 975czkPA==; Received: from mail-lj1-x22c.google.com ([2a00:1450:4864:20::22c]) by casper.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s5CJQ-00000001aJp-2Bnq for openwrt-devel@lists.openwrt.org; Thu, 09 May 2024 22:32:33 +0000 Received: by mail-lj1-x22c.google.com with SMTP id 38308e7fff4ca-2e3fa13f018so16119271fa.3 for ; Thu, 09 May 2024 15:32:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715293941; x=1715898741; 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=2vc4ZtSuX5JU71cwsGWyFAfe+kgVrPbAmRus5EZBUA4=; b=LHmxjLHS6Jej7ZvVLp7tTzTC8FIjeHCEuyzn3wAeMCexfj5Pcp0awGrIx00Qg0Qc+u mPKtaZ/jNx9dTXpHq49aUCYeA4HrfbBIrfIR5//gxOsaA2R7/vmFPT5jh+C4M+QL5rzn y1PjVgboFfzHoS0jYkoh2wYkqxZc9S3YkUOt59JoYlNyIOw4OOhp/VGZ2LUIXnTwZapl pHVk6/MrkCOWHjVy/G2WbkOxyatKFIhHLU1bv32m9EY0R7Yk8c4Kc4tVYKbh7Zy6tqw9 HrvlYEL/dRwpMWveYhSLsvgq3rDic4mefieRPoPdVsHRNqxE0u54owM1BcSyd9YER92/ Y1iQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715293941; x=1715898741; 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=2vc4ZtSuX5JU71cwsGWyFAfe+kgVrPbAmRus5EZBUA4=; b=sqaf6KQhDUpVm/bNM9ek4OOGB+XC+QRK6mpkm81LMYImhmfWtQbEPLT1A4p84XWsBy RtZypqvFGmmCm3LIuqRIBfbqQ1yRbUWaZQlzYEoarF17NjbN5eUUB5LhAtkyaxXv7feW cI0c6vnoLjOWBlfOOEhRO/Yx0ZctuYmEWJ+q10VHfUpDwX+t1CiTSczXgPVoWdDi9dNt r4i7kdE2tgsXDtMukS4AGfKz/WQIs3oVlEYVeU0jwTGWfYoJ4acgalJY/faCVdv51Q4u DZCv8K2xSSgY9SiZZEuYwrTU6GJQoTAJh2crD21HB9U1rt8T+c4iRuBxOz3fIV4JQFwz VwzA== X-Gm-Message-State: AOJu0YwKlLGWtAt1CGxbu4jk5IujYtoyh1hr03miqxjAPtmDUo8/9idU YNJa2ooF2kfAl1T1zHuB6uGytRllj9b+VxV/6dEjfsZyecqHRElnz7aupQ== X-Google-Smtp-Source: AGHT+IG9SUMW27TURqAOsc787xhfy8oO0cDxKBDilorQXsbo8kap7azhczsosh3rL6xm7O7LCDesSQ== X-Received: by 2002:a2e:7307:0:b0:2e0:83a9:e388 with SMTP id 38308e7fff4ca-2e51fd2dd5fmr4331481fa.9.1715293940672; Thu, 09 May 2024 15:32:20 -0700 (PDT) Received: from blackhol3 ([2001:9b0:40::cae3:cb03]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2e4d0bbc3a6sm3156191fa.13.2024.05.09.15.32.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 May 2024 15:32:20 -0700 (PDT) From: Paul Donald To: OpenWrt Development List Subject: [RFC PATCH 12/14] config: clamp ra_mtu into 1280-65535 range Date: Fri, 10 May 2024 00:30:44 +0200 Message-ID: <20240509223213.97389-13-newtwen+github@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240509223213.97389-1-newtwen+github@gmail.com> References: <20240509223213.97389-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-20240509_233228_719364_1C4B7BA8 X-CRM114-Status: GOOD ( 10.38 ) X-Spam-Score: -2.1 (--) X-Spam-Report: SpamAssassin version 4.0.0 on casper.infradead.org summary: Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 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_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.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 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:22c 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 (ipv6 packets can be up to 4GB in size...) The old logic had a logic error of || instead of && Signed-off-by: Paul Donald --- src/config.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/config.c b/src/config.c index 160d7db..f4eaa3b 100644 --- a/src/config.c +++ b/src/config.c @@ -971,11 +971,10 @@ int config_parse_interface(void *data, size_t len, const char *name, bool overwr if ((c = tb[IFACE_ATTR_RA_MTU])) { uint32_t ra_mtu = blobmsg_get_u32(c); - if (ra_mtu >= 1280 || ra_mtu <= 65535) - iface->ra_mtu = ra_mtu; - else - syslog(LOG_ERR, "Invalid %s value configured for interface '%s'", - iface_attrs[IFACE_ATTR_RA_MTU].name, iface->name); + iface->ra_mtu = (ra_mtu < 1280) ? 1280 : (ra_mtu > 65535) ? 65535 : ra_mtu; + if (!(ra_mtu >= 1280 && ra_mtu <= 65535)) + syslog(LOG_INFO, "Clamped invalid %s value configured for interface '%s' to %d", + iface_attrs[IFACE_ATTR_RA_MTU].name, iface->name, iface->ra_mtu); } if ((c = tb[IFACE_ATTR_RA_SLAAC]))