From patchwork Sun Mar 19 18:38:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 1758758 X-Patchwork-Delegate: ansuelsmth@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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=) 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=zzkjF6QZ; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=YLgENA2k; dkim-atps=neutral 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 (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PfmvL6lPJz2476 for ; Mon, 20 Mar 2023 05:42:37 +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:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=zTZdVvjqh7S/WTu9ov4woDe4tW+VUDIgzmoZSNP3Hb0=; b=zzkjF6QZaIdI8C c8I8AjIn47wV3SYm4jeORXTWQFTWZV+fluvUai2ja772qYEn/QOE56OGu7qCV7ZEOfMA4TE5B58d1 18D0afh8hbkjqXJbAYc2u1lhESTfzzRsd9+NVYey+29WNtTI1aV5HnX/w/fDa13yJfTE0ya5ny1mK RlXpU3gU2MFpEwuFwvDFYwBuVmmRQfRl313QmKY3sYbvSYG3oIBoAnrxXoxinyPVZjKjNACkJHC75 nhn8RV5ibPL/vK1BRup1Qf+rgmgHxNngeEgLwvVYFc8/2Q7sYPQs/6bzsZsZ/htyCWWmDdVDWSd8d tl5jVk8e2g+gBajlbdmA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pdxw7-007B0g-1O; Sun, 19 Mar 2023 18:39:19 +0000 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pdxw4-007Azy-0s for openwrt-devel@lists.openwrt.org; Sun, 19 Mar 2023 18:39:17 +0000 Received: by mail-wm1-x332.google.com with SMTP id p16so6166751wmq.5 for ; Sun, 19 Mar 2023 11:39:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679251153; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=BQjKYKWYxEDMDHd2GdO2vdJ1ihepklKy9YK51iKhKAI=; b=YLgENA2katyzHvzc4FfCS7DwDHBg1rRLWw08SUZuLOPlel4p1pH8dV0QxzBdIrD3Nq 6lNxA7joOAiEOvv2TlCNd0Lous6fsuaE6zOSRllKRw12jCnNms4HWcFopXfcG5u7qW4M EDOt8pAuwqQfc+OcKyMPz04+LRO5Y8YnjlGtXUK/7WVR1P3GqPvTl1PguYun9dYTohvh DMN4c7aERXT/2Hi5KSFRZEO4WQp3bXxCuy1pymbI956mH03ClcY6ERRZAtI/C1DIO80O YjdnOOc5uj08VPKymi4KCNFfjVZ+XwJ+tPf0Z+9Azxf/H3jugxXrssH9yIHifQ2wpTwG Px9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679251153; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=BQjKYKWYxEDMDHd2GdO2vdJ1ihepklKy9YK51iKhKAI=; b=78IQNUCL6wumaEhrF76y9l16lAo/8lhDKFg/s99+Wii2edmWUCQj5Qs05Nl9aosMrZ jlfKPnQzcHMmu4RHi7pE5tKeDsg/0H1ZQuDKti0HC9YzMuCL4r6FcxECbuhreUbUkeCF 64dpdHvJgY4E4Scf22rzKlgOpXcOWsDQpZiSGNEJsbmNtFpgV8GW4dAIcGwJZuTSE8yY HV8NBgfos508h1IRicq0C3IutEvzUdVcFDYgu1gdKlrTqh0fUiDZdmaWvza8+hZ955u1 cMjYdFhJjOS5/3jNFjESQKSa9ZoZeVeQbCzUj0YQGzkcDfkdIBC2vyiSoxyrxl4gLtv/ YUcg== X-Gm-Message-State: AO0yUKUS3boFwAryqNNnzTKTlu/L9dylT8gU/poZ+oqh4FTvZdAqHKd9 j1doR/uB/TUbwt/kqNmDBfo= X-Google-Smtp-Source: AK7set83zWIp9VPKMEeyex/8KYBVpv4py1Odv+c6ylU2AryFtqyrUs5tcfEWf6U0eYpr9qtLonRR2Q== X-Received: by 2002:a05:600c:4f05:b0:3ed:2dbf:6a80 with SMTP id l5-20020a05600c4f0500b003ed2dbf6a80mr7464715wmq.5.1679251153445; Sun, 19 Mar 2023 11:39:13 -0700 (PDT) Received: from localhost.localdomain (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.googlemail.com with ESMTPSA id v15-20020a05600c444f00b003edddce5b00sm2214057wmn.12.2023.03.19.11.39.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Mar 2023 11:39:12 -0700 (PDT) From: Christian Marangi To: Jo-Philipp Wich , Stijn Tintel , OpenWrt Development List Cc: Christian Marangi , Hans Dedecker Subject: [odhcpd PATCH v2 1/2] config: skip interface setup if interface not IFF_RUNNING Date: Sun, 19 Mar 2023 19:38:56 +0100 Message-Id: <20230319183857.1519-1-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230319_113916_333081_94A2B9DB X-CRM114-Status: GOOD ( 13.60 ) 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: We currently setup odhcp service even if the interface is not running. This is the case for bridge or specific interface that are flagged as UP but have no carrier as nothing is connected to it. This [...] 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:332 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.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [ansuelsmth[at]gmail.com] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -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_EF Message has a valid DKIM or DK signature from envelope-from domain 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 We currently setup odhcp service even if the interface is not running. This is the case for bridge or specific interface that are flagged as UP but have no carrier as nothing is connected to it. This cause a similar error like: Failed to send to ff02::1%br-lan (Address not available) This is caused by the kernel assigning IPV6 address only when the interface is set to IFF_RUNNING. A LINK-LOCAL IPV6 address is required for odhcpd_send() to work or every request will be rejected. To fix this setup services only when interface is in IFF_RUNNING state. When an interface change state, odhcpd is reloaded and the services are correctly setup again. Signed-off-by: Christian Marangi Acked-by: Hans Dedecker --- src/config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config.c b/src/config.c index 9b1f659..30da879 100644 --- a/src/config.c +++ b/src/config.c @@ -1303,7 +1303,7 @@ void odhcpd_reload(void) avl_for_each_element_safe(&interfaces, i, avl, tmp) { - if (i->inuse) { + if (i->inuse && i->ifflags & IFF_RUNNING) { /* Resolve hybrid mode */ if (i->dhcpv6 == MODE_HYBRID) i->dhcpv6 = (master && master->dhcpv6 == MODE_RELAY) ?