From patchwork Thu May 9 22:30:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Donald X-Patchwork-Id: 1933677 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=Rsj8t+h/; 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=Ua3XmIAH; 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=ROPMnJHV; 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 4Vb6Kh69xJz213s for ; Fri, 10 May 2024 08:35:36 +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=+WIsTNpgvG+WU6zdtXAPpY2Ev79vSx72U0OiSoiWgAA=; b=Rsj8t+h//KfeIw 6x7bw1Tb+X+zm3kl8s/4q+TWSOaLDkBa7BSKbSy+QG5BLXswctMa19EXR/xqBnQp8sZrLFqwrc4pC hcfCnGOP4DPfJ51tH9I5VFK0buG4kfp+ZrgFmnakvfAw/4ZbQ3jkt0yu4zGzAJ7Q9TegVLGgCKevz hsK2rlt9CUkhn8I24uh0D/RDnXKN/VkDYkSCCOspf/P6zynozTzHsgn7ps50P81yjdr9ROlTbTIXk eQ7CGKuOtLp7iLdO1w7VG5d9xWoWj6untHmv8D5Bp9/BYe9eFIK1O2YPmKzJHXt5yBmbcjLG5u06h 5gxwCfg0czL0eG3N/3qQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s5CJq-0000000374a-027L; Thu, 09 May 2024 22:32:54 +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 1s5CJX-000000036uA-0d6e for openwrt-devel@bombadil.infradead.org; Thu, 09 May 2024 22:32:35 +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=WcUJTUbwKHtTX0Znp0u9MNqMJwpP8UxQ9+1vCvrnTIc=; b=Ua3XmIAH51FTJgWWc+dLlWl0sS WrTuk73lPzYvX24jg9JrYyX4sLUhMTt5HbJnZf5qG9NLwAZrAvpyow7gX5F4zi1ISU51uilYlIKXp feS3/KMVbmUHOtFHTs0/R0/yWfsCG8WHS+/AqFmtWK/HOZ/gA93/i5PpoyacmUoQcom7fL47FhE3S 3pCfKqTZSxxEnZDvhJtWdZ4vrXb2dq12aYnN+0ohckfsM9aGhuNpIc6p0wGA4XCI6NsBufHILYOWd kBfVuLVZ/qvZ2F4tR85JA8uu9PYR4CMrkOL4Ii8C2XyjY170E+ib0LBVGQ7OxvTgds9ugyGLHq8oB 5HsxFTBw==; Received: from mail-lj1-x22d.google.com ([2a00:1450:4864:20::22d]) by casper.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s5CJQ-00000001aJq-2VSP for openwrt-devel@lists.openwrt.org; Thu, 09 May 2024 22:32:32 +0000 Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2e1fa824504so18176291fa.0 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=WcUJTUbwKHtTX0Znp0u9MNqMJwpP8UxQ9+1vCvrnTIc=; b=ROPMnJHVOzmOkCPOM4w/Yc06SVjZCsY8U6V8cTNAnF0GGuT7hoshKr3rXp+Fo6ec5l JnnbWfHqXR3N2Z6leS6G5wzeWrYlzqvIgO10U7FmeuC5eoUS55kLBsGQJAv5Ssr1hDBB f6IMQAYbjSXvgDROV2vXYbUGtgyIu1/Q3Taz0K5Z4bg2ZBSOWWJ+R66xz1lrVRkWdj6x NJABaAU4cGhvczLqU6IN28RVwjJRE/yIB8KHFUv4ZZTavtWm5pZS9kMotLaH+mi97gw/ 0j8zptI1sNpCEMxrEsqUUXYfIWGZ7iDEP6/4CJy04DU4N7PyI+UqnEa9HY2hzy6CDbrZ UKHQ== 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=WcUJTUbwKHtTX0Znp0u9MNqMJwpP8UxQ9+1vCvrnTIc=; b=jJYPLpNpeZM51mPQGu872OhgcoEWTERUF2p/o44kYUHHL09a7cgUFGJWrJXBj5aJqX nTXFwO3LkrxUQTdn3QclEUknvFPHbEfcK9AG5V6QEtfF563BfEUuWnXuBpPRNt3iUuB1 npSfXVxnktz3bvKUNU0Ty6ehYt+L5QRf9TI0mc57WH/3zQKVlXXg4tMMpZJNz39C8nVj MQU7TTULFxcAsQCzGVdTtBHXfntAprRvsMOXDFPnS5TgaDoalN9oMb/Lq0tLWxIB30eK b7dA2MXAqckdau0NA645Sl5YYVCZYBr9nwR2SZ6B8/B4zkzBwHxZAK1TZ1kQGXV8pS45 OaSA== X-Gm-Message-State: AOJu0YzNUP+uKUA2Sv7UTyIz5he0tar9bb0pL37PT8uEGTaK8f8ViHS4 52oiKyztBYkFWIWzepjxZXAjvjddQ+9cOrUpN7UmyciHVltBeaWbAaCSFw== X-Google-Smtp-Source: AGHT+IE+j4xXQcEtZCgIlzCgUO1vim+wF5jshPDAsoaSPCyaK3aTM7OqwwfqsYuwcW1uwsO3AVi67A== X-Received: by 2002:a2e:b6c2:0:b0:2e1:ba1c:efea with SMTP id 38308e7fff4ca-2e51ff4d69fmr4487581fa.19.1715293941054; Thu, 09 May 2024 15:32:21 -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 13/14] config: clamp dhcpv6_hostid_len Date: Fri, 10 May 2024 00:30:45 +0200 Message-ID: <20240509223213.97389-14-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_721992_525E9C0A X-CRM114-Status: GOOD ( 11.54 ) 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: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 Attempt to be helpful. Signed-off-by: Paul Donald --- src/config.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/config.c b/src/config.c index f4eaa3b..4d35548 100644 --- a/src/config.c +++ b/src/config.c @@ -896,11 +896,12 @@ int config_parse_interface(void *data, size_t len, const char *name, bool overwr if ((c = tb[IFACE_ATTR_DHCPV6_HOSTID_LEN])) { uint32_t hostid_len = blobmsg_get_u32(c); - if (hostid_len >= HOSTID_LEN_MIN && hostid_len <= HOSTID_LEN_MAX) - iface->dhcpv6_hostid_len = hostid_len; - else - syslog(LOG_ERR, "Invalid %s value configured for interface '%s'", - iface_attrs[IFACE_ATTR_DHCPV6_HOSTID_LEN].name, iface->name); + iface->dhcpv6_hostid_len = (hostid_len < HOSTID_LEN_MIN) ? + HOSTID_LEN_MIN : (hostid_len > HOSTID_LEN_MAX) ? + HOSTID_LEN_MAX : hostid_len; + if (!(hostid_len >= HOSTID_LEN_MIN && hostid_len <= HOSTID_LEN_MAX)) + syslog(LOG_INFO, "Clamped invalid %s value configured for interface '%s' to %d", + iface_attrs[IFACE_ATTR_DHCPV6_HOSTID_LEN].name, iface->name, iface->dhcpv6_hostid_len); }