Message ID | 20221212125738.644468-1-alin.nastac@gmail.com |
---|---|
State | New |
Headers | show
Return-Path: <openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org> 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=<UNKNOWN>) 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=gZ2ktYoE; 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=V8LHZXwK; 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 4NW1tp0hBDz240J for <incoming@patchwork.ozlabs.org>; Tue, 13 Dec 2022 00:00:02 +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=1dKlg1StBUvdf4m1Ek3l3o9AgpNOb0RX1ODzFNE1XsA=; b=gZ2ktYoENaIfO6 2Q0uJctX0/xrnnL+5fjihUnlxKKH8eWhxbwjsIn2YR6FAPmvkrvuFhKHZd42s09HW06Yftw0oIEia 2efrfXrrYx3pt/Ih5jkKR0FyrZVHmKFWFt/Llcy4VQjsfO+EFwYC9jjrEtfQXVa5OrJsNTCD1EzOa 62s0Sr//j1U50GBfSjjppmg1XOccfISefNEra33d987jpg64Gc3ArJfinB/q9x997k1xL6VO2DXqc LgTx9+cMEvijG823xwtIETZsTzTnWYMSZuqBsGAKN4r2zKeCi5uFGkHEq0+QAfsAqf49OoveHP1Mk kh3BueI4mIsiKzVcr50A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p4iNb-00FzMx-VN; Mon, 12 Dec 2022 12:58:00 +0000 Received: from mail-qt1-x832.google.com ([2607:f8b0:4864:20::832]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1p4iNY-00Fz9l-Oy for openwrt-devel@lists.openwrt.org; Mon, 12 Dec 2022 12:57:58 +0000 Received: by mail-qt1-x832.google.com with SMTP id h16so8816344qtu.2 for <openwrt-devel@lists.openwrt.org>; Mon, 12 Dec 2022 04:57:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=lZrNxJGlqgUaDHQnK9I/BRLtj0BszRwKKYm+V7aoHac=; b=V8LHZXwKNK2dmbR6h1CDdkDHxdK0wnaEW6l5U56/mDLC0Xf8H2HKJQ1WgwFZzrdSQ3 K1lcaXtRQ4wVf7MOzsHceVJzUGAKAm8U0yLFpnYQ7/waFfhCxLWV522v/oi3T/gOY2kk gCzLCHTBfYmbmlBMH9eYpWQbPvyF+NGYWWJ37D1pNJIL40ggAIvCeeN8q0ETZNvz13hf AM3iXV/95oorv0pvqU/iQdTluhfNC7v51XJHha7qFLOZKJU+78r7SSSJmCLrd/6lhk89 6ZTWLNYCBuYO2h1yN2Q5DM1Dor2emZ5YcqcFZZPRI1V4pywS8Z/noH2iS6TpW1bSgRVY ifcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=lZrNxJGlqgUaDHQnK9I/BRLtj0BszRwKKYm+V7aoHac=; b=FqL+cmDzUwE1H1eNnUG3rMUCKIutSDiM+zpM1iN94n4DIrPoNSZFZO2iaycDLRoHSc sCerR/s0i9qRtZR1zJHuScEAae8UZBIBf1lcpdKXqhh1AFQXgiaBHiqjwWrvFTezWPWt gsO6ZnFbmqmxlRQOjraEH4T+iky2f3GZVNcFXKtu8hgaHZKsTUXG78JA/UKr2K4sV4UV /S1VxzCOie6hDMFL3uKK/n0B1G3cpCJrAgtUBfS6bO+kdgVwV0LVXujDsQF77AEMK/T3 X4kJ/jakTqrmvcx1BwNGsq9zfL2nL8mIVO+aGKBJseYSAn9Q6aO+WyFgKHU5V8BfHySS DcNQ== X-Gm-Message-State: ANoB5pk4xSIzGzJLIk7YBpVxclzoBIPTGDNeTmkgLuIQcguEZp+0Wd7S kz7MZF6oRzJ+vx5H5y+NlzNShFWsnsMppIkU X-Google-Smtp-Source: AA0mqf61TISQpIKj1BpRUEndyQkALRKzFIw1uO+P6Pz7tArejF3EbQNQiJ+VPfeTCI7J3bEk0USc1g== X-Received: by 2002:ac8:4e51:0:b0:3a5:2704:d4bd with SMTP id e17-20020ac84e51000000b003a52704d4bdmr30333044qtw.16.1670849869624; Mon, 12 Dec 2022 04:57:49 -0800 (PST) Received: from cplx1037.edegem.eu.thmulti.com ([2001:4158:f012:e81:3125:c8a2:267d:a061]) by smtp.gmail.com with ESMTPSA id ay42-20020a05620a17aa00b006ef1a8f1b81sm5730020qkb.5.2022.12.12.04.57.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Dec 2022 04:57:49 -0800 (PST) From: Alin Nastac <alin.nastac@gmail.com> To: Felix Fietkau <nbd@nbd.name> Cc: openwrt-devel@lists.openwrt.org Subject: [PATCH][netifd] vlandev: fix system_vlandev_add error triggered by multiple vlandev_set_up calls Date: Mon, 12 Dec 2022 13:57:38 +0100 Message-Id: <20221212125738.644468-1-alin.nastac@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221212_045756_841030_1F0690DD X-CRM114-Status: GOOD ( 11.77 ) 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: vlan devices can be switched up more than once, in which case this error will be traced: system_vlandev_add(1608): Error adding vlandev 'vlan_wan' over 'ptm0': -6 and interface that use this device wi [...] 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 [2607:f8b0:4864:20:0:0:0:832 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 [alin.nastac[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 <openwrt-devel.lists.openwrt.org> List-Unsubscribe: <https://lists.openwrt.org/mailman/options/openwrt-devel>, <mailto:openwrt-devel-request@lists.openwrt.org?subject=unsubscribe> List-Archive: <http://lists.openwrt.org/pipermail/openwrt-devel/> List-Post: <mailto:openwrt-devel@lists.openwrt.org> List-Help: <mailto:openwrt-devel-request@lists.openwrt.org?subject=help> List-Subscribe: <https://lists.openwrt.org/mailman/listinfo/openwrt-devel>, <mailto:openwrt-devel-request@lists.openwrt.org?subject=subscribe> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "openwrt-devel" <openwrt-devel-bounces@lists.openwrt.org> Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org |
Series |
[netifd] vlandev: fix system_vlandev_add error triggered by multiple vlandev_set_up calls
|
expand
|
diff --git a/vlandev.c b/vlandev.c index 31b82b1..4780ca3 100644 --- a/vlandev.c +++ b/vlandev.c @@ -163,9 +163,14 @@ vlandev_set_up(struct vlandev_device *mvdev) if (ret < 0) return ret; - ret = system_vlandev_add(&mvdev->dev, mvdev->parent.dev, &mvdev->config); - if (ret < 0) - goto release; + if (mvdev->dev.ifindex && mvdev->dev.ifindex != system_if_resolve(&mvdev->dev)) + mvdev->dev.ifindex = 0; /* previous instance of this vlan device was destroyed */ + + if (!mvdev->dev.ifindex) { + ret = system_vlandev_add(&mvdev->dev, mvdev->parent.dev, &mvdev->config); + if (ret < 0) + goto release; + } ret = mvdev->set_state(&mvdev->dev, true); if (ret)
vlan devices can be switched up more than once, in which case this error will be traced: system_vlandev_add(1608): Error adding vlandev 'vlan_wan' over 'ptm0': -6 and interface that use this device will fail to start with error code DEVICE_CLAIM_FAILED. This change will prevent calling system_vlandev_add() when vlan device was already created, thus solving the root cause of the issue. Signed-off-by: Alin Nastac <alin.nastac@gmail.com> --- vlandev.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)