Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp712068rwb; Sat, 17 Sep 2022 13:23:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM62gjfWl/gfOKeZ1ejr1V/f5Y28/Wsc6HM3IdTZMFo//m0qP8/6BAZ9dgY5mUCopJUy6Jgq X-Received: by 2002:a17:907:25c9:b0:77b:a343:bd62 with SMTP id ae9-20020a17090725c900b0077ba343bd62mr7945268ejc.660.1663446229739; Sat, 17 Sep 2022 13:23:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663446229; cv=none; d=google.com; s=arc-20160816; b=gIqn4/38l+dGdg8Z/uQpfHhPy57VcH8wHYBhPXOqIWsjUAUYkL4vlx92AuKeVWzglP OsBbiWhHOPO7iOcu9QmCNroaIUPknlvi8JXNUy6x0ccbMuzGqShZqEckuVB+TLXY3VxN Zc/QOeFfEqQizTN8oryXKJMLztEQeMibmtPp2AEUJ4cLA9n1qw7aMnwYOTnQmSg3pMJ0 nesB470tjzdQ3lZ+2B0UC/Jwp7aTEcOl3RXfrBE0Ri8qHfMbpa1p6wqGgOaFNGiBjW/6 vvz/d7yPhJxjIp6tYAHqwf5TmcrGVYVtt6cbout9tPWB7R5cyFD/cv8PUBu4qjgYjgRu Ib6A== 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=EnLNkzzS7uvp8qzIOHofbmM/lr6EdUZwCfdgBKsBFIA=; b=wkUeZwrRQH5EMkmefyQiMpwmsTJHg78NpAhLQQ8+vU9WfkywDl3LIwZlnnvgLiMUF5 zkg3QKGNzUWI6QRioDIeIDmv8oVUKTdGUDEOwAZNf7uXHr96napEgiXtCBPFHXnQrUtu y3A6ccI6ZH0gwuaS1UY3Pusv5xzhw/hB3A9GWiuOABzes0r4PErCN+ItbMqgIfhzmUn8 Lj/24YloHsPjmWMgDfNTBXsqqu4PY0XPgfo7An/lsSZkKrsV77VO4vzWgZGjyU6Js3vu tZDotuae+B+1HchLVFXljCrF7+kEtKZE0sXat2tGFp9XfTmHPLoQ0l/BTrFYmRH8Yky1 sE/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=WnJNpsrV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qb6-20020a1709077e8600b0077d32f74e3csi12060523ejc.530.2022.09.17.13.23.14; Sat, 17 Sep 2022 13:23:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=WnJNpsrV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-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 S229584AbiIQUSK (ORCPT + 99 others); Sat, 17 Sep 2022 16:18:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229492AbiIQUSI (ORCPT ); Sat, 17 Sep 2022 16:18:08 -0400 Received: from mail-qt1-x82c.google.com (mail-qt1-x82c.google.com [IPv6:2607:f8b0:4864:20::82c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64FAF2E9EE; Sat, 17 Sep 2022 13:18:07 -0700 (PDT) Received: by mail-qt1-x82c.google.com with SMTP id h21so18285162qta.3; Sat, 17 Sep 2022 13:18:07 -0700 (PDT) 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; bh=EnLNkzzS7uvp8qzIOHofbmM/lr6EdUZwCfdgBKsBFIA=; b=WnJNpsrV7HdjGnzo2nkpOIxfT2GxSQjATwHQe5v3dxoDnhipC0pkWqvbDRaaAkHUQl BjuI5IHPTPKLxcBGbBky4ToOKprKzwbMjyJdETPc++bA6kflYiSa0oVI5YALYKtStEuX s1AF/+zVhqgaqkyDkFWxaQAq6J2FxoK8ra3/X/7zVu9rmMsb+T//OX3VmA7rJq+gLfEe gOxjRTSUCB8XAqhqASuiItzDRhGM19ybGOKOn2CR581W61gTdJ96XBxuQCX63STtniZn E1DEGEdZCY7FTpS43bWkkxm1MTCoN7tiTtmtCzJmyvIzjeVwjJ6IEahZE+9GSiOCGeZT m3uA== 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; bh=EnLNkzzS7uvp8qzIOHofbmM/lr6EdUZwCfdgBKsBFIA=; b=lAekH1cEknlXhiFVU/lH+nJOLa1g0+I537s6mOYY6iYHJx9wO4S5E0dbWc2IF9uwjs IeFFz2QscCkIAJ1Sq82+KowRaiwWBWtvH5dVr7/IoPtdG1W3+Q6gwPQ1TRZCO69Gsoap pyIAs/On0jeGTYTnu1Xe0PhzDsQQKQiuJl6GSRT/Sl1t9ss7yRM3RCQiD5WbILHIBn6O elg/gvgB5oreF5EI19+w1eKlRtNdZf5Hzoc2hHkJ0D/r0KKfDfRiAB2hkjRVEzdzZBHv P/foMGW7/wAeYZnW2FAHd7hPulyxxHGRn0kTNXGlOuYfLGbjdgLyTtmLeBpAYFTNDHkg PKCw== X-Gm-Message-State: ACrzQf0d2jrCjT+lV4szkjenHSaImLP1xLuxxRR8kslTJo/XZvuqChKx wLT7OH2WXuHZUFO6bgWYI74= X-Received: by 2002:ac8:57ca:0:b0:35b:b51f:94fc with SMTP id w10-20020ac857ca000000b0035bb51f94fcmr9524213qta.276.1663445886429; Sat, 17 Sep 2022 13:18:06 -0700 (PDT) Received: from euclid ([71.58.109.160]) by smtp.gmail.com with ESMTPSA id l2-20020a37f902000000b006b9c355ed75sm8826647qkj.70.2022.09.17.13.18.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Sep 2022 13:18:06 -0700 (PDT) From: Sevinj Aghayeva To: netdev@vger.kernel.org Cc: "David S. Miller" , aroulin@nvidia.com, sbrivio@redhat.com, roopa@nvidia.com, Eric Dumazet , Jakub Kicinski , Paolo Abeni , Nikolay Aleksandrov , linux-kernel@vger.kernel.org, bridge@lists.linux-foundation.org, Sevinj Aghayeva Subject: [PATCH RFC net-next 0/5] net: vlan: fix bridge binding behavior and add selftests Date: Sat, 17 Sep 2022 16:17:56 -0400 Message-Id: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When bridge binding is enabled for a vlan interface, it is expected that the link state of the vlan interface will track the subset of the ports that are also members of the corresponding vlan, rather than that of all ports. Currently, this feature works as expected when a vlan interface is created with bridge binding enabled: ip link add link br name vlan10 type vlan id 10 protocol 802.1q \ bridge_binding on However, the feature does not work when a vlan interface is created with bridge binding disabled, and then enabled later: ip link add link br name vlan10 type vlan id 10 protocol 802.1q \ bridge_binding off ip link set vlan10 type vlan bridge_binding on After these two commands, the link state of the vlan interface continues to track that of all ports, which is inconsistent and confusing to users. This series fixes this bug and introduces two tests for the valid behavior. Sevinj Aghayeva (5): net: core: export call_netdevice_notifiers_info net: core: introduce a new notifier for link-type-specific changes net: 8021q: notify bridge module of bridge-binding flag change net: bridge: handle link-type-specific changes in the bridge module selftests: net: tests for bridge binding behavior include/linux/if_vlan.h | 4 + include/linux/netdevice.h | 3 + include/linux/notifier_info.h | 21 +++ net/8021q/vlan.h | 2 +- net/8021q/vlan_dev.c | 20 ++- net/bridge/br.c | 5 + net/bridge/br_private.h | 7 + net/bridge/br_vlan.c | 18 +++ net/core/dev.c | 7 +- tools/testing/selftests/net/Makefile | 1 + .../selftests/net/bridge_vlan_binding_test.sh | 143 ++++++++++++++++++ 11 files changed, 223 insertions(+), 8 deletions(-) create mode 100644 include/linux/notifier_info.h create mode 100755 tools/testing/selftests/net/bridge_vlan_binding_test.sh -- 2.34.1