Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3877799pxb; Sun, 24 Oct 2021 13:35:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8NXM5xg2qypgYVK/J5ZqYkSvlGMi5otRCb37oxiUXYR3VBEYzui3lXlVGVtcGz3h6DGcm X-Received: by 2002:a05:6402:40cd:: with SMTP id z13mr19863366edb.220.1635107730367; Sun, 24 Oct 2021 13:35:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635107730; cv=none; d=google.com; s=arc-20160816; b=xLW3zr+8Us07DIztNzdhTu6y+0wa1KW4hH+fzaj1urSc4mkX94Gunu7glvIYjXUrmk EkLxrhs3m/OMRPwYAZdyGJHfmnLF+d7lIAgViR2vtSHj2lXt3R9zij+3IglsnUBb6p5s KmoS83iZcL9VKlK3r07LfLztjXS8r8ararshg160EVOmUYGXpeJrq/Mct5T/UmiRhfUF NhGjC57hciIvTMkyGhDS/4jqF52ys5TSKOF2NPPRBdwMtSmEGTU/rzpFzs4cwhwQ83H0 8VBSRNYeB7lkHPXma34J6Goz7L+eUSg6oDa0B90h8cJTLcl6OHCKm7+GQz9ZSmyH4zEz 49TA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=59H4YP+8FVs7dxtAMpMerX1hrtP3cWNKONPn0AFnRV8=; b=plo9ng5ugR6AHzDTxPmRGNzUzlDAVa8xUmgoVyhmuWQ51/nNzOA4ib3wrtUfdRuElJ Ls4L4AosYyOErMYvmGkNSaimrXmud22xQAeUW/FE9CMBvBSK/AELHsSJWgCCdq0By8NH kSjwxF3elUvMx9j3dJ0spK5JZmthfBEseGK/bhZqLB7YBL3ncT02sR8X1I+DGQCfEBw4 d/oEy1uc8dKgYmX33HwW2GdFsl4sBTF47UCb1zY/AJ2zBt63CZBh5Ry2dQA7q33OeF2T MdabGITKoO/++E4gdV/K5ijroGd3Q2HaiO7iGGUWM9ocyvxuC7p0u3iA1W8tvKWT4jlq yfqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=B0rx8dGZ; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x99si817309ede.151.2021.10.24.13.35.08; Sun, 24 Oct 2021 13:35:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=B0rx8dGZ; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231859AbhJXUS0 (ORCPT + 65 others); Sun, 24 Oct 2021 16:18:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229638AbhJXUS0 (ORCPT ); Sun, 24 Oct 2021 16:18:26 -0400 Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CCC56C061745 for ; Sun, 24 Oct 2021 13:16:04 -0700 (PDT) Received: by mail-lj1-x22a.google.com with SMTP id f16so2984951ljo.12 for ; Sun, 24 Oct 2021 13:16:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=59H4YP+8FVs7dxtAMpMerX1hrtP3cWNKONPn0AFnRV8=; b=B0rx8dGZemSXdHtoaMr7ERCl7mOAaeO28H80xzhyug+9qKj/2yV6heJtldlr9+goPW uIOH11hKD1v4jprHC0nzDlc4J7Z2Lj1/1RtAG1ebeOVk54YPqWp8szI5MVhSPuneMXq8 Nbay79EHInJVvej334Cu+bJ8elmsKgCVzAwvQE6U670P9iIN7getQGL7DkC/IAGw8bnY 9xf4o/Slaxyy+Vr7OPyWmdTeFnXRREGHRg4/RYQ+alu5o9FEIKSPW/Um2Y+ImwRTGLPX Z5rMxpIz6SQqTVIHlXqygXct3cz71s4Qz7qVTXfi0jpAeR9iX7EmS9hc6PxgTvcov4H0 iw2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=59H4YP+8FVs7dxtAMpMerX1hrtP3cWNKONPn0AFnRV8=; b=qXIeMQYvfAomVEejnz7L9DvxaI8Jm+ZwurEtCHWvqM9njVzssVsWgBDf/+EkWARskW g/tVybFGL5e5nd6DtOtpxPapo7PQOnRUAg9iFrYTQgZdlA4WVxUTv1/OB2U7rpMQp5q5 r2rzsSgR2WaPzJ7gMhGG9V5QFsi4tidi5bKasZYPlf0S+ZhbDK+GkE+hfqxhs4MEx5ks NKjiDfHcY+R88okUVXBDvO81JP/pQLDHlUr6/rdytcWW5euc4dNx5j/Rs0mVRsa2R80V MNkMactvuoy4An/JA5JaBZ21u1qIIuL0e/yCqyK6NqR2h0KxbNcNtPLLaMx3R9+JbtvL NHyQ== X-Gm-Message-State: AOAM532rvtcwd9EAtjIzvH4WfKbUiOOww2vhi8w7rh368a/0R38qH3Kd Dp/pgZ5umUa5PFXN5XJ3zLZhPzuRf6s= X-Received: by 2002:a2e:9242:: with SMTP id v2mr14305060ljg.103.1635106563118; Sun, 24 Oct 2021 13:16:03 -0700 (PDT) Received: from localhost.localdomain ([62.141.192.106]) by smtp.gmail.com with ESMTPSA id u25sm1413689lfr.279.2021.10.24.13.16.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Oct 2021 13:16:02 -0700 (PDT) From: Janusz Dziedzic To: linux-wireless@vger.kernel.org Cc: johannes@sipsolutions.net, Janusz Dziedzic Subject: [PATCH] cfg80211: move bridge/4addr mode check Date: Sun, 24 Oct 2021 22:15:46 +0200 Message-Id: <20211024201546.614379-1-janusz.dziedzic@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Without the patch we failed: janusz@t2:~$ sudo brctl addbr br0 janusz@t2:~$ sudo brctl addif br0 wlp1s0 janusz@t2:~$ sudo iw wlp1s0 set 4addr on command failed: Device or resource busy (-16) Last command failed but iface was already in 4addr mode. Signed-off-by: Janusz Dziedzic --- net/wireless/util.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/net/wireless/util.c b/net/wireless/util.c index 18dba3d7c638..c0c87541326f 100644 --- a/net/wireless/util.c +++ b/net/wireless/util.c @@ -1028,14 +1028,14 @@ int cfg80211_change_iface(struct cfg80211_registered_device *rdev, !(rdev->wiphy.interface_modes & (1 << ntype))) return -EOPNOTSUPP; - /* if it's part of a bridge, reject changing type to station/ibss */ - if (netif_is_bridge_port(dev) && - (ntype == NL80211_IFTYPE_ADHOC || - ntype == NL80211_IFTYPE_STATION || - ntype == NL80211_IFTYPE_P2P_CLIENT)) - return -EBUSY; - if (ntype != otype) { + /* if it's part of a bridge, reject changing type to station/ibss */ + if (netif_is_bridge_port(dev) && + (ntype == NL80211_IFTYPE_ADHOC || + ntype == NL80211_IFTYPE_STATION || + ntype == NL80211_IFTYPE_P2P_CLIENT)) + return -EBUSY; + dev->ieee80211_ptr->use_4addr = false; dev->ieee80211_ptr->mesh_id_up_len = 0; wdev_lock(dev->ieee80211_ptr); -- 2.25.1