From patchwork Thu Nov 25 14:08:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 12639217 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D96CDC433EF for ; Thu, 25 Nov 2021 14:11:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355657AbhKYOO3 (ORCPT ); Thu, 25 Nov 2021 09:14:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350403AbhKYOM2 (ORCPT ); Thu, 25 Nov 2021 09:12:28 -0500 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84893C061746 for ; Thu, 25 Nov 2021 06:09:16 -0800 (PST) Received: by mail-ed1-x532.google.com with SMTP id t5so26450351edd.0 for ; Thu, 25 Nov 2021 06:09:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=blackwall-org.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Rvlj2z02TvoZ0JtiYBU5m7HbtbPpDbjJufuKd8Zrdlw=; b=g60hvNNRt5j46HgOcpZc68bECQL+18z5jEhOoUl8LwH2PAEx+X1CDBqtOXuNK5qPta Y4gHlPKqwpcY3OxmaJ2L0IzPz4bS6MQJqgczq0LiVhHtfqhNQZUYU/vUsaLWmx6dC8xo SZHzLJElMNFcXu34sRzH38lVlnj28NvKo7WEZowsAsp1wbX83JiIH49keW6NBJRBYo0G TwMaIASetZYjq8XgVf4uLTzGbLYDDVr9aM6aWxwPZPFhTQY5lI6qJzTsHs9gh1bNVtmQ mpC2v/a/TfJQM3h/1/O1k3P+ZNkIC2vRyM8vc97A+YvNGhrgyqczaBHeF3pTfRS6oqsW pjZw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=Rvlj2z02TvoZ0JtiYBU5m7HbtbPpDbjJufuKd8Zrdlw=; b=2ajPQx1aBNfzRjc+sTgGiogbpj5DlXhL4rsg5YiArDPOskGAiaSGuOiutJaZhmA+HV 3pO+Sc73icuItkuAZW8fvzgaCaTZWx5fgFPKh8BFdw68C0T2eq1TEnRVb8oJ3rM7mTvU eLf2iQkYVMMH3USLVe5OC+8k/9KD4igcBqjYVpYO5aTR+T4H6yhAdNBdqcq/c2Cl7ZBD k6kmcAzsCJwRi7TXobUVZojjtYKnK8wwCqszJInaBE/mt58ybwPmMrrfp17u3UYB4L9+ yYUciGGCLmddazalo1KiUwVykKndCbBY2u3QOEhX5ESiKLD593JLvaQEAxROwFOvWkmw gqtQ== X-Gm-Message-State: AOAM532xH1t+ijhsOU31htgGbbEaFA30zCkrYU1Aobr3ueAAUwJSUs8O gQILTafX5yH3tpwpQzX+cHd5zmz6f42/sJKy X-Google-Smtp-Source: ABdhPJwlad71DK9gLrzJB964OkQYEjaCNI6ybh7zUXpE3ePKeZkjQnSlVdfi7t5/1fU6aFqQJWDZbg== X-Received: by 2002:a17:907:2da5:: with SMTP id gt37mr31666251ejc.316.1637849354846; Thu, 25 Nov 2021 06:09:14 -0800 (PST) Received: from debil.vdiclient.nvidia.com (84-238-136-197.ip.btc-net.bg. [84.238.136.197]) by smtp.gmail.com with ESMTPSA id sc7sm1889863ejc.50.2021.11.25.06.09.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Nov 2021 06:09:14 -0800 (PST) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, ivecera@redhat.com, bridge@lists.linux-foundation.org, davem@davemloft.net, kuba@kernel.org, Nikolay Aleksandrov Subject: [PATCH net-next 01/10] selftests: net: bridge: add vlan mcast snooping control test Date: Thu, 25 Nov 2021 16:08:49 +0200 Message-Id: <20211125140858.3639139-2-razor@blackwall.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211125140858.3639139-1-razor@blackwall.org> References: <20211125140858.3639139-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Nikolay Aleksandrov Add the first test for bridge per-vlan multicast snooping which checks if control of the global and per-vlan options work as expected, joins and leaves are tested at each option value. TEST: Vlan multicast snooping enable [ OK ] TEST: Vlan global options existence [ OK ] TEST: Vlan mcast_snooping global option default value [ OK ] TEST: Vlan 10 multicast snooping control [ OK ] Signed-off-by: Nikolay Aleksandrov --- .../net/forwarding/bridge_vlan_mcast.sh | 148 ++++++++++++++++++ 1 file changed, 148 insertions(+) create mode 100755 tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh diff --git a/tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh b/tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh new file mode 100755 index 000000000000..796e8f094e08 --- /dev/null +++ b/tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh @@ -0,0 +1,148 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 + +ALL_TESTS="vlmc_control_test" +NUM_NETIFS=4 +CHECK_TC="yes" +TEST_GROUP="239.10.10.10" + +source lib.sh + +h1_create() +{ + simple_if_init $h1 192.0.2.1/24 2001:db8:1::1/64 + ip link add l $h1 $h1.10 up type vlan id 10 +} + +h1_destroy() +{ + ip link del $h1.10 + simple_if_fini $h1 192.0.2.1/24 2001:db8:1::1/64 +} + +h2_create() +{ + simple_if_init $h2 192.0.2.2/24 2001:db8:1::2/64 + ip link add l $h2 $h2.10 up type vlan id 10 +} + +h2_destroy() +{ + ip link del $h2.10 + simple_if_fini $h2 192.0.2.2/24 2001:db8:1::2/64 +} + +switch_create() +{ + ip link add dev br0 type bridge mcast_snooping 1 mcast_querier 1 vlan_filtering 1 + + ip link set dev $swp1 master br0 + ip link set dev $swp2 master br0 + + ip link set dev br0 up + ip link set dev $swp1 up + ip link set dev $swp2 up + + bridge vlan add vid 10-11 dev $swp1 master + bridge vlan add vid 10-11 dev $swp2 master + + ip link set dev br0 type bridge mcast_vlan_snooping 1 + check_err $? "Could not enable global vlan multicast snooping" + log_test "Vlan multicast snooping enable" +} + +switch_destroy() +{ + ip link set dev $swp2 down + ip link set dev $swp1 down + + ip link del dev br0 +} + +setup_prepare() +{ + h1=${NETIFS[p1]} + swp1=${NETIFS[p2]} + + swp2=${NETIFS[p3]} + h2=${NETIFS[p4]} + + vrf_prepare + + h1_create + h2_create + + switch_create +} + +cleanup() +{ + pre_cleanup + + switch_destroy + + h2_destroy + h1_destroy + + vrf_cleanup +} + +vlmc_v2join_test() +{ + local expect=$1 + + RET=0 + ip address add dev $h2.10 $TEST_GROUP/32 autojoin + check_err $? "Could not join $TEST_GROUP" + + sleep 5 + bridge -j mdb show dev br0 | + jq -e ".[].mdb[] | select(.grp == \"$TEST_GROUP\" and .vid == 10)" &>/dev/null + if [ $expect -eq 0 ]; then + check_err $? "IGMPv2 report didn't create mdb entry for $TEST_GROUP" + else + check_fail $? "IGMPv2 report shouldn't have created mdb entry for $TEST_GROUP" + fi + + # check if we need to cleanup + if [ $RET -eq 0 ]; then + ip address del dev $h2.10 $TEST_GROUP/32 2>&1 1>/dev/null + sleep 5 + bridge -j mdb show dev br0 | + jq -e ".[].mdb[] | select(.grp == \"$TEST_GROUP\" and \ + .vid == 10)" &>/dev/null + check_fail $? "IGMPv2 leave didn't remove mdb entry for $TEST_GROUP" + fi +} + +vlmc_control_test() +{ + RET=0 + local goutput=`bridge -j vlan global show` + echo -n $goutput | + jq -e ".[].vlans[] | select(.vlan == 10)" &>/dev/null + check_err $? "Could not find vlan 10's global options" + log_test "Vlan global options existence" + + RET=0 + echo -n $goutput | + jq -e ".[].vlans[] | select(.vlan == 10 and .mcast_snooping == 1) " &>/dev/null + check_err $? "Wrong default mcast_snooping global option value" + log_test "Vlan mcast_snooping global option default value" + + RET=0 + vlmc_v2join_test 0 + bridge vlan global set vid 10 dev br0 mcast_snooping 0 + check_err $? "Could not disable multicast snooping in vlan 10" + vlmc_v2join_test 1 + log_test "Vlan 10 multicast snooping control" +} + +trap cleanup EXIT + +setup_prepare +setup_wait + +tests_run + +exit $EXIT_STATUS From patchwork Thu Nov 25 14:08:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 12639219 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47D72C4332F for ; Thu, 25 Nov 2021 14:11:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355659AbhKYOO3 (ORCPT ); Thu, 25 Nov 2021 09:14:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350536AbhKYOM2 (ORCPT ); Thu, 25 Nov 2021 09:12:28 -0500 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96356C061761 for ; Thu, 25 Nov 2021 06:09:17 -0800 (PST) Received: by mail-ed1-x52b.google.com with SMTP id r11so26168168edd.9 for ; Thu, 25 Nov 2021 06:09:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=blackwall-org.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BzpnEA37RXcLJueyhR+TEPx2gUPlYvWfPjF8B5Ruo4o=; b=FPTx/34hoPRAdbxsgFLIdI155A0LPiIo/mRhgeXxXtt1IjbIgq1imUUaLmpUl5sMtZ rFJDaaz1WS6JWUV9zyqWh2Ck6DJz9KRqhHJ7iQpGWKLvTQWMJOkKTzqx9L9CtEN8DZAe V9l0yHfxD7emaU1CZ0vGxvFQkdKVhmgbwd9OlV/K+z8eLJ2VS16xiT0Zw2H0YXZMuz7E O6MHedZceHXkhrtbqeMGy1jNp/NC/RepM0lqbB9qy2501h82q/vMcBAWoosq/VtHg61i JW0u6rwl4qaDs93b5i0TNH5dMVolCYenzAGLyfCWncBVdzHyuUd9Ak/2vBXCHOk6uD1G +l2Q== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=BzpnEA37RXcLJueyhR+TEPx2gUPlYvWfPjF8B5Ruo4o=; b=P/t+cpe9qgMn9sCzuIcGHduXcfgdfMRLdiEfIhHGX5BjvFV8ujXHs+vdG0liou55xE Sp2VXdasGVhfqvdjuRRhnvuInKdbrOVbwURd0oUXb6J9Q0ok2gI+YgXCmMNUjwF5gpVh C/S688u726JGrGmuC3l4/uRXF5PiOmLbBiixsBA/7v39e4xTm3w2J1oZtCs6d1TizgMW OmGLODS3Eqb77mOcVU7gxgjPDggOcxFOZwpmZxOTdt0K0MFeNHLdv0N+T0ds9Rnp/D8P LJOXy5YhVLWIEylnoLjXUxrBqmYYls73RAn/N2xua24nVNAYrIEFMpCX299+pIiGmSSV OpPA== X-Gm-Message-State: AOAM532GAbXRB9vkN4TnL5t+l+xgSNfiRkAMSTls1nx8xpvgMhNai2gY 7b8VAy3JRdA7uk6BdzyoL32uPIbNcpcduPZ0 X-Google-Smtp-Source: ABdhPJzfUWGSdET9KbbHVkXcP8/7y/JoCL9L5itv/p0ROdZM60h3Sp5IiOSbqUEu5fy/R/HVR5gqdA== X-Received: by 2002:a17:907:7f9e:: with SMTP id qk30mr31480904ejc.313.1637849355883; Thu, 25 Nov 2021 06:09:15 -0800 (PST) Received: from debil.vdiclient.nvidia.com (84-238-136-197.ip.btc-net.bg. [84.238.136.197]) by smtp.gmail.com with ESMTPSA id sc7sm1889863ejc.50.2021.11.25.06.09.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Nov 2021 06:09:15 -0800 (PST) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, ivecera@redhat.com, bridge@lists.linux-foundation.org, davem@davemloft.net, kuba@kernel.org, Nikolay Aleksandrov Subject: [PATCH net-next 02/10] selftests: net: bridge: add vlan mcast querier test Date: Thu, 25 Nov 2021 16:08:50 +0200 Message-Id: <20211125140858.3639139-3-razor@blackwall.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211125140858.3639139-1-razor@blackwall.org> References: <20211125140858.3639139-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Nikolay Aleksandrov Add a test to try the new global vlan mcast_querier control and also verify that tagged general query packets are properly generated when querier is enabled for a single vlan. TEST: Vlan mcast_querier global option default value [ OK ] TEST: Vlan 10 multicast querier enable [ OK ] TEST: Vlan 10 tagged IGMPv2 general query sent [ OK ] TEST: Vlan 10 tagged MLD general query sent [ OK ] Signed-off-by: Nikolay Aleksandrov --- .../net/forwarding/bridge_vlan_mcast.sh | 105 +++++++++++++++++- 1 file changed, 104 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh b/tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh index 796e8f094e08..aa23764a328b 100755 --- a/tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh +++ b/tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh @@ -1,7 +1,7 @@ #!/bin/bash # SPDX-License-Identifier: GPL-2.0 -ALL_TESTS="vlmc_control_test" +ALL_TESTS="vlmc_control_test vlmc_querier_test" NUM_NETIFS=4 CHECK_TC="yes" TEST_GROUP="239.10.10.10" @@ -43,6 +43,9 @@ switch_create() ip link set dev $swp1 up ip link set dev $swp2 up + tc qdisc add dev $swp1 clsact + tc qdisc add dev $swp2 clsact + bridge vlan add vid 10-11 dev $swp1 master bridge vlan add vid 10-11 dev $swp2 master @@ -138,6 +141,106 @@ vlmc_control_test() log_test "Vlan 10 multicast snooping control" } +# setup for general query counting +vlmc_query_cnt_xstats() +{ + local type=$1 + local version=$2 + local dev=$3 + + ip -j link xstats type bridge_slave dev $dev | \ + jq -e ".[].multicast.${type}_queries.tx_v${version}" +} + +vlmc_query_cnt_setup() +{ + local type=$1 + local dev=$2 + + if [[ $type == "igmp" ]]; then + tc filter add dev $dev egress pref 10 prot 802.1Q \ + flower vlan_id 10 vlan_ethtype ipv4 dst_ip 224.0.0.1 ip_proto 2 \ + action pass + else + tc filter add dev $dev egress pref 10 prot 802.1Q \ + flower vlan_id 10 vlan_ethtype ipv6 dst_ip ff02::1 ip_proto icmpv6 \ + action pass + fi + + ip link set dev br0 type bridge mcast_stats_enabled 1 +} + +vlmc_query_cnt_cleanup() +{ + local dev=$1 + + ip link set dev br0 type bridge mcast_stats_enabled 0 + tc filter del dev $dev egress pref 10 +} + +vlmc_check_query() +{ + local type=$1 + local version=$2 + local dev=$3 + local expect=$4 + local time=$5 + local ret=0 + + vlmc_query_cnt_setup $type $dev + + local pre_tx_xstats=$(vlmc_query_cnt_xstats $type $version $dev) + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_querier 1 + ret=$? + if [[ $ret -eq 0 ]]; then + sleep $time + + local tcstats=$(tc_rule_stats_get $dev 10 egress) + local post_tx_xstats=$(vlmc_query_cnt_xstats $type $version $dev) + + if [[ $tcstats != $expect || \ + $(($post_tx_xstats-$pre_tx_xstats)) != $expect || \ + $tcstats != $(($post_tx_xstats-$pre_tx_xstats)) ]]; then + ret=1 + fi + fi + + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_querier 0 + vlmc_query_cnt_cleanup $dev + + return $ret +} + +vlmc_querier_test() +{ + RET=0 + local goutput=`bridge -j vlan global show` + echo -n $goutput | + jq -e ".[].vlans[] | select(.vlan == 10)" &>/dev/null + check_err $? "Could not find vlan 10's global options" + + echo -n $goutput | + jq -e ".[].vlans[] | select(.vlan == 10 and .mcast_querier == 0) " &>/dev/null + check_err $? "Wrong default mcast_querier global vlan option value" + log_test "Vlan mcast_querier global option default value" + + RET=0 + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_querier 1 + check_err $? "Could not enable querier in vlan 10" + log_test "Vlan 10 multicast querier enable" + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_querier 0 + + RET=0 + vlmc_check_query igmp 2 $swp1 1 1 + check_err $? "No vlan tagged IGMPv2 general query packets sent" + log_test "Vlan 10 tagged IGMPv2 general query sent" + + RET=0 + vlmc_check_query mld 1 $swp1 1 1 + check_err $? "No vlan tagged MLD general query packets sent" + log_test "Vlan 10 tagged MLD general query sent" +} + trap cleanup EXIT setup_prepare From patchwork Thu Nov 25 14:08:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 12639221 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF438C433FE for ; Thu, 25 Nov 2021 14:11:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355661AbhKYOOa (ORCPT ); Thu, 25 Nov 2021 09:14:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231550AbhKYOMa (ORCPT ); Thu, 25 Nov 2021 09:12:30 -0500 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB55CC061763 for ; Thu, 25 Nov 2021 06:09:18 -0800 (PST) Received: by mail-ed1-x52d.google.com with SMTP id w1so26287339edc.6 for ; Thu, 25 Nov 2021 06:09:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=blackwall-org.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FzgAx/GM5UY7f5TX8VZkJRzCg4EVgCVxeMVd/CytlKU=; b=kVCq5pWtzAWSHFYGKKnoa+wROir6oCgaHq8S/t7k0/VnVWnx2tlLcVzoF/81ImvC2W L4LnH3d61VE8JTaMpI6aUcmjeqheIEboLwgiIlj6flPJLV55AwsIGXGHRx7TB/qeGfrg f28bpDm68q9KcAfybVWFNcXnxltwpEs/TwkSUtxZX1RZFo4zXgI1GKbXDU1jYyWoHlNu yqTKL4DBFI1SoVFJYCnAyBxk6ZwK4K6hiwgWauHgmRT47huWzRTDVlwD3L+/qNF0ygpf 5Jzjs8Now3cL+BgyMzgL++n0O/ptuouqzzYa4IKxVvV/4sTlhMRkarFdlxaesLq4e7gy pKzw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=FzgAx/GM5UY7f5TX8VZkJRzCg4EVgCVxeMVd/CytlKU=; b=aElxgqSxD3mNb/rt1X309pcCI0MwSihSp8EXzuHPPeeGrzcJluXyPfmtni+suE6521 55/0FDBBqZH6DAkQrObPb6Zm9q468/0wvStIyqODjn0BVwZxsaPqonmTP+CiyrL1FLxy ND0i84z69mVXYLcGeioQcawTCR/EtUCxQ37prHgq1fos+0Qbebci6ZXlaXm8FF+lgdwr Ph5b+f6Q3mtBLv7ubvqR1a1ATKircUE+zGZr8yGc7HvFG7fCN3fUpt3jsNnALyvAAkpm hBVb91D9drlIGp7zhs0xYTKsh+NZiDSGzOLt7W8pN83+r3Y2s4HaK0e7YLQ90PDCnxwg Hy0A== X-Gm-Message-State: AOAM533rsElWs49YNPeRyDPGRWz3kOBavU1/qy80IYjM3Qyy2YqVa6xB Ed8coAJuYKM22kxRowPBHmdf4/XcFOu8lnSD X-Google-Smtp-Source: ABdhPJybo0OICHJGzFirHRDPUPSja8NYuLoyAWJRXRl/kCcpxPylRZbw4iLn5N/myyLCw/hIbhSwhg== X-Received: by 2002:a17:907:86a1:: with SMTP id qa33mr31819212ejc.142.1637849356887; Thu, 25 Nov 2021 06:09:16 -0800 (PST) Received: from debil.vdiclient.nvidia.com (84-238-136-197.ip.btc-net.bg. [84.238.136.197]) by smtp.gmail.com with ESMTPSA id sc7sm1889863ejc.50.2021.11.25.06.09.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Nov 2021 06:09:16 -0800 (PST) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, ivecera@redhat.com, bridge@lists.linux-foundation.org, davem@davemloft.net, kuba@kernel.org, Nikolay Aleksandrov Subject: [PATCH net-next 03/10] selftests: net: bridge: add vlan mcast igmp/mld version tests Date: Thu, 25 Nov 2021 16:08:51 +0200 Message-Id: <20211125140858.3639139-4-razor@blackwall.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211125140858.3639139-1-razor@blackwall.org> References: <20211125140858.3639139-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Nikolay Aleksandrov Add tests which change the new per-vlan IGMP/MLD versions and verify that proper tagged general query packets are sent. TEST: Vlan mcast_igmp_version global option default value [ OK ] TEST: Vlan mcast_mld_version global option default value [ OK ] TEST: Vlan 10 mcast_igmp_version option changed to 3 [ OK ] TEST: Vlan 10 tagged IGMPv3 general query sent [ OK ] TEST: Vlan 10 mcast_mld_version option changed to 2 [ OK ] TEST: Vlan 10 tagged MLDv2 general query sent [ OK ] Signed-off-by: Nikolay Aleksandrov --- .../net/forwarding/bridge_vlan_mcast.sh | 45 ++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh b/tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh index aa23764a328b..1b91778fac2f 100755 --- a/tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh +++ b/tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh @@ -1,7 +1,7 @@ #!/bin/bash # SPDX-License-Identifier: GPL-2.0 -ALL_TESTS="vlmc_control_test vlmc_querier_test" +ALL_TESTS="vlmc_control_test vlmc_querier_test vlmc_igmp_mld_version_test" NUM_NETIFS=4 CHECK_TC="yes" TEST_GROUP="239.10.10.10" @@ -241,6 +241,49 @@ vlmc_querier_test() log_test "Vlan 10 tagged MLD general query sent" } +vlmc_igmp_mld_version_test() +{ + RET=0 + local goutput=`bridge -j vlan global show` + echo -n $goutput | + jq -e ".[].vlans[] | select(.vlan == 10)" &>/dev/null + check_err $? "Could not find vlan 10's global options" + + echo -n $goutput | + jq -e ".[].vlans[] | select(.vlan == 10 and .mcast_igmp_version == 2) " &>/dev/null + check_err $? "Wrong default mcast_igmp_version global vlan option value" + log_test "Vlan mcast_igmp_version global option default value" + + RET=0 + echo -n $goutput | + jq -e ".[].vlans[] | select(.vlan == 10 and .mcast_mld_version == 1) " &>/dev/null + check_err $? "Wrong default mcast_mld_version global vlan option value" + log_test "Vlan mcast_mld_version global option default value" + + RET=0 + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_igmp_version 3 + check_err $? "Could not set mcast_igmp_version in vlan 10" + log_test "Vlan 10 mcast_igmp_version option changed to 3" + + RET=0 + vlmc_check_query igmp 3 $swp1 1 1 + check_err $? "No vlan tagged IGMPv3 general query packets sent" + log_test "Vlan 10 tagged IGMPv3 general query sent" + + RET=0 + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_mld_version 2 + check_err $? "Could not set mcast_mld_version in vlan 10" + log_test "Vlan 10 mcast_mld_version option changed to 2" + + RET=0 + vlmc_check_query mld 2 $swp1 1 1 + check_err $? "No vlan tagged MLDv2 general query packets sent" + log_test "Vlan 10 tagged MLDv2 general query sent" + + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_igmp_version 2 + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_mld_version 1 +} + trap cleanup EXIT setup_prepare From patchwork Thu Nov 25 14:08:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 12639225 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D7F9C433EF for ; Thu, 25 Nov 2021 14:11:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355676AbhKYOOi (ORCPT ); Thu, 25 Nov 2021 09:14:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353039AbhKYOMh (ORCPT ); Thu, 25 Nov 2021 09:12:37 -0500 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51107C0613DD for ; Thu, 25 Nov 2021 06:09:26 -0800 (PST) Received: by mail-ed1-x52d.google.com with SMTP id z5so26317900edd.3 for ; Thu, 25 Nov 2021 06:09:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=blackwall-org.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2qBrpPJsVudI6ySyaIY5TvYiAoJvmZq0zlu3qsVbGJw=; b=zkTCHhDPo6CeblP4zt7GKTJrhkAYeyHazgOcLJLN1Oy5SxnoWqzP10cvSZmh6t1EdB UD3x1kc6WaksgP3/QN+U3lZoZZ86ae3yhTwj4bRZDW4osGRd4F0pXTr21jkAi4ORy9LR vU234HOsyTi1nLApmLURc2RP2XBWXuD2wFsGLdCU/bQEzFA8U7AqaR1zqfEdAluM78d0 pD3EHIRcNQZ6Q+gs8EKsIHxVu8014eFit2XUvfImxo5sbA2vz1giXpuOTnl6oUClTWil koFMY8GB5J1w1ITzMHNr90MvnSnFe4Osfetqqi7a1UuSWRopTqbMKSpEnFfXfblsDgdw /Fpw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=2qBrpPJsVudI6ySyaIY5TvYiAoJvmZq0zlu3qsVbGJw=; b=Kv/oIowvbaCeBZRJ78XhK1yjoAoaN6SE0eeR0ayfvF12B+BCU4AMR//VGz3e+hRuvF WmV4JNOY/+8I7lAzx9m1lzhDAwBSZ1yTaQsMXvIyXjKQvs89/ulXd29OJz1653ODgUlP jVLmixZkeLEp0Ly5E3D4Upcv9an946Jd2q2fGf9rT45+wvgVbQS21uJfKKULJV08tKCL iUELzXOHGj8Qq0G80uUWI5jUPw4ZQj3GKu0/V7mlGlD9UNOYh4x63GN8SZaEcMOifFUQ fEcPkxrCji6QonccQzv0DGZkznR3cQgQX6pFuEgcZcB9zgmm8RWy+Qn7VRW0Mm7cvrik N7yA== X-Gm-Message-State: AOAM530u/FzDoM3DcmV60dXfDQWq6l+MvCY3Xhb1XM6RgWF4/gLl966N cSSByq2o3+kbAkLnkTSSZVrsZdJmRKLM9r7o X-Google-Smtp-Source: ABdhPJx9pJ1h5f1zet4iWkjJRsBMnfn84hmVUiJ+4VBsrzm9yqnDq0Jpeo2MiBWwKJnuv5HjppC1Eg== X-Received: by 2002:a17:907:7f8f:: with SMTP id qk15mr31334914ejc.455.1637849357975; Thu, 25 Nov 2021 06:09:17 -0800 (PST) Received: from debil.vdiclient.nvidia.com (84-238-136-197.ip.btc-net.bg. [84.238.136.197]) by smtp.gmail.com with ESMTPSA id sc7sm1889863ejc.50.2021.11.25.06.09.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Nov 2021 06:09:17 -0800 (PST) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, ivecera@redhat.com, bridge@lists.linux-foundation.org, davem@davemloft.net, kuba@kernel.org, Nikolay Aleksandrov Subject: [PATCH net-next 04/10] selftests: net: bridge: add vlan mcast_last_member_count/interval tests Date: Thu, 25 Nov 2021 16:08:52 +0200 Message-Id: <20211125140858.3639139-5-razor@blackwall.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211125140858.3639139-1-razor@blackwall.org> References: <20211125140858.3639139-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Nikolay Aleksandrov Add tests which verify the default values of mcast_last_member_count mcast_last_member_count and also try to change them. TEST: Vlan mcast_last_member_count global option default value [ OK ] TEST: Vlan mcast_last_member_interval global option default value [ OK ] TEST: Vlan 10 mcast_last_member_count option changed to 3 [ OK ] TEST: Vlan 10 mcast_last_member_interval option changed to 200 [ OK ] Signed-off-by: Nikolay Aleksandrov --- .../net/forwarding/bridge_vlan_mcast.sh | 36 ++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh b/tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh index 1b91778fac2f..85146c998316 100755 --- a/tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh +++ b/tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh @@ -1,7 +1,7 @@ #!/bin/bash # SPDX-License-Identifier: GPL-2.0 -ALL_TESTS="vlmc_control_test vlmc_querier_test vlmc_igmp_mld_version_test" +ALL_TESTS="vlmc_control_test vlmc_querier_test vlmc_igmp_mld_version_test vlmc_last_member_test" NUM_NETIFS=4 CHECK_TC="yes" TEST_GROUP="239.10.10.10" @@ -284,6 +284,40 @@ vlmc_igmp_mld_version_test() bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_mld_version 1 } +vlmc_last_member_test() +{ + RET=0 + local goutput=`bridge -j vlan global show` + echo -n $goutput | + jq -e ".[].vlans[] | select(.vlan == 10)" &>/dev/null + check_err $? "Could not find vlan 10's global options" + + echo -n $goutput | + jq -e ".[].vlans[] | select(.vlan == 10 and \ + .mcast_last_member_count == 2) " &>/dev/null + check_err $? "Wrong default mcast_last_member_count global vlan option value" + log_test "Vlan mcast_last_member_count global option default value" + + RET=0 + echo -n $goutput | + jq -e ".[].vlans[] | select(.vlan == 10 and \ + .mcast_last_member_interval == 100) " &>/dev/null + check_err $? "Wrong default mcast_last_member_interval global vlan option value" + log_test "Vlan mcast_last_member_interval global option default value" + + RET=0 + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_last_member_count 3 + check_err $? "Could not set mcast_last_member_count in vlan 10" + log_test "Vlan 10 mcast_last_member_count option changed to 3" + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_last_member_count 2 + + RET=0 + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_last_member_interval 200 + check_err $? "Could not set mcast_last_member_interval in vlan 10" + log_test "Vlan 10 mcast_last_member_interval option changed to 200" + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_last_member_interval 100 +} + trap cleanup EXIT setup_prepare From patchwork Thu Nov 25 14:08:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 12639223 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F02AFC433F5 for ; Thu, 25 Nov 2021 14:11:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355670AbhKYOOh (ORCPT ); Thu, 25 Nov 2021 09:14:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352322AbhKYOMh (ORCPT ); Thu, 25 Nov 2021 09:12:37 -0500 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9AA50C0613D7 for ; Thu, 25 Nov 2021 06:09:25 -0800 (PST) Received: by mail-ed1-x52b.google.com with SMTP id t5so26452187edd.0 for ; Thu, 25 Nov 2021 06:09:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=blackwall-org.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jDgbRWbHqWtsaVeh+4rNPIsENfs+qLEuUZMgVdJDcfw=; b=saZZVnYLTtWITiQYzBL+L1wPU01pMugwFRwS0HyBsP1zl2v+21xj2jCBo4f/PbOJXa qJNMR9Q4MJiXFwP7jjQdciNVRlQ5YX9ZS1ynXMM7OawOtAja/QjbjEhnCDXnO4mMsXSY 4evNrOuFgOc3cneku9JItIszBnxMDUcjsrva/RQb2maiCNZYrkwN+eZJIiU0vkPxgEDj meyLFRHSpaPGHzq3VfPDxGJghLKmK8yLzWZADTFt+p0wmFqQDpIKIS1Wq7bQbwAWbS6W zSiq3sL4EQUyqy/LkujM4pW4aOrp6tO+EqGCeh3F54KEajRU56pg5gaIaettRnoVi5it aeQA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=jDgbRWbHqWtsaVeh+4rNPIsENfs+qLEuUZMgVdJDcfw=; b=ld2ZwHbznVzp3ZZ+3/avUiRw1Cu9VIK+z35C9dojdh3VoIEUITNYSeF1YKzpbgNf2C 5rpSELjEbanASRVZ52XbDr0Ji9J43JbG22Ik+KQuEOmOu2bm+eP0LYGsR2wWvs1GC7zW kCcg2AxubYGYUvmrm/YZ+JlAdpJHX0j+QB8aLA0c4wqk2dBvKIzHrrjx2Y2tDnE4sh97 oXY1H9DSfrcsWuMd/65TvRvYtDQkHTPfGskEKZz/kZJiWjaj9vRCflRO4EyL0hknRU6r Lh6ut1CCZFnOjUy/RvZOwKUs3f6sX8ogqRMUKfjRhtGf1TzYqxYpa1gLGcG74JzCJ5i0 77EQ== X-Gm-Message-State: AOAM530T0KZHCqGOvZ4VLOK8qcCzCozlbO93emvtReuoGOSUwM0EfoNl b5siOBFEhBiI+DgfbXfB4+wQBz7yC0rYfIfs X-Google-Smtp-Source: ABdhPJzS3zkpWwrd4BGX0vjMO9TWZvqGd1SYTeFWh8DZbwcd2s91LHv1BUqrr6YYd2MK1GXTyWWj2g== X-Received: by 2002:a17:907:1c15:: with SMTP id nc21mr32003003ejc.510.1637849363872; Thu, 25 Nov 2021 06:09:23 -0800 (PST) Received: from debil.vdiclient.nvidia.com (84-238-136-197.ip.btc-net.bg. [84.238.136.197]) by smtp.gmail.com with ESMTPSA id sc7sm1889863ejc.50.2021.11.25.06.09.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Nov 2021 06:09:23 -0800 (PST) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, ivecera@redhat.com, bridge@lists.linux-foundation.org, davem@davemloft.net, kuba@kernel.org, Nikolay Aleksandrov Subject: [PATCH net-next 05/10] selftests: net: bridge: add vlan mcast_startup_query_count/interval tests Date: Thu, 25 Nov 2021 16:08:53 +0200 Message-Id: <20211125140858.3639139-6-razor@blackwall.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211125140858.3639139-1-razor@blackwall.org> References: <20211125140858.3639139-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Nikolay Aleksandrov Add tests which change the new per-vlan startup query count/interval options and verify the proper number of queries are sent in the expected interval. TEST: Vlan mcast_startup_query_interval global option default value [ OK ] TEST: Vlan mcast_startup_query_count global option default value [ OK ] TEST: Vlan 10 mcast_startup_query_interval option changed to 100 [ OK ] TEST: Vlan 10 mcast_startup_query_count option changed to 3 [ OK ] Signed-off-by: Nikolay Aleksandrov --- .../net/forwarding/bridge_vlan_mcast.sh | 42 ++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh b/tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh index 85146c998316..0070d8292569 100755 --- a/tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh +++ b/tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh @@ -1,7 +1,8 @@ #!/bin/bash # SPDX-License-Identifier: GPL-2.0 -ALL_TESTS="vlmc_control_test vlmc_querier_test vlmc_igmp_mld_version_test vlmc_last_member_test" +ALL_TESTS="vlmc_control_test vlmc_querier_test vlmc_igmp_mld_version_test \ + vlmc_last_member_test vlmc_startup_query_test" NUM_NETIFS=4 CHECK_TC="yes" TEST_GROUP="239.10.10.10" @@ -318,6 +319,45 @@ vlmc_last_member_test() bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_last_member_interval 100 } +vlmc_startup_query_test() +{ + RET=0 + local goutput=`bridge -j vlan global show` + echo -n $goutput | + jq -e ".[].vlans[] | select(.vlan == 10)" &>/dev/null + check_err $? "Could not find vlan 10's global options" + + echo -n $goutput | + jq -e ".[].vlans[] | select(.vlan == 10 and \ + .mcast_startup_query_interval == 3125) " &>/dev/null + check_err $? "Wrong default mcast_startup_query_interval global vlan option value" + log_test "Vlan mcast_startup_query_interval global option default value" + + RET=0 + echo -n $goutput | + jq -e ".[].vlans[] | select(.vlan == 10 and \ + .mcast_startup_query_count == 2) " &>/dev/null + check_err $? "Wrong default mcast_startup_query_count global vlan option value" + log_test "Vlan mcast_startup_query_count global option default value" + + RET=0 + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_startup_query_interval 100 + check_err $? "Could not set mcast_startup_query_interval in vlan 10" + vlmc_check_query igmp 2 $swp1 2 3 + check_err $? "Wrong number of tagged IGMPv2 general queries sent" + log_test "Vlan 10 mcast_startup_query_interval option changed to 100" + + RET=0 + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_startup_query_count 3 + check_err $? "Could not set mcast_startup_query_count in vlan 10" + vlmc_check_query igmp 2 $swp1 3 4 + check_err $? "Wrong number of tagged IGMPv2 general queries sent" + log_test "Vlan 10 mcast_startup_query_count option changed to 3" + + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_startup_query_interval 3125 + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_startup_query_count 2 +} + trap cleanup EXIT setup_prepare From patchwork Thu Nov 25 14:08:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 12639227 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9080C433FE for ; Thu, 25 Nov 2021 14:11:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355680AbhKYOOi (ORCPT ); Thu, 25 Nov 2021 09:14:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354702AbhKYOMi (ORCPT ); Thu, 25 Nov 2021 09:12:38 -0500 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14CF2C0613E0 for ; Thu, 25 Nov 2021 06:09:27 -0800 (PST) Received: by mail-ed1-x536.google.com with SMTP id o20so25928930eds.10 for ; Thu, 25 Nov 2021 06:09:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=blackwall-org.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zYFf5rleB9ec1h6L5Rsg6C85Sz0GkYn54vaAI/sfBKM=; b=TZ4dGHtEEfqktYYq6EH4whBPY2645fhRxPiV/i9ULpr6ozh9oLTyJ4GXOSpkcT0IyA pEWrfUX5fWk6L5QENIVhdpd3+TXwh/SAzZSDFKX06XcNNYospIL4eEPKBBzcyYnoqfhQ 1Z9D+zD3BoVGjiWsZIu//sCxU+jxOBVfdzWX5EFgBldvOGJYobXOZ9FnYRoqZQH0spq4 ZhAqxcqLXfezrGJJL5/yaRcNyEK7OADcIjdOABNNAntNRm9xjA3OK2Aok2xumniYRfcf e3jjNq+nvx8IqA2VFa/04bovWO6A8SkSMEAzDuY+3RBL0q984PWfpEhyNkXqfv2R8cxR 6EqA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=zYFf5rleB9ec1h6L5Rsg6C85Sz0GkYn54vaAI/sfBKM=; b=qZNRIPgIe4ortturHDIBoEIqZldlZhX5Ng5RZfSsazDv3h89LJlD1N6GTv7tE6HMZW QUV3aopnyWbhdJBIvzShWy/CNzAtp92+BavccE8/jE0PdWyDYxjYXmwaUqe0NVzP94XE CrBUDbpTa8OolICqyDn0CShdip4ypB+YDZStJMMn2V/OlUELt8s8cQyprFR0gFDqwCuJ VLDsbfxNDTk7ltTSP+SBb6qG8crFkvgPUPyMk5ZWrx7fKs1h/ATEi2ajPoolMjUjUhOV VfARbLjZZea5HMroap7XZIgTjBxqdjlSYbO8Ons8ECWJHMk5NIl+eSlRS5rRpl1S97IL AoTA== X-Gm-Message-State: AOAM531JNTnZfR11OZPwFj6x9ahLAJAsny5lTNIzFxH2pYL54GGp9PBN hKiZFb/cNhYs4Lt+daJ9MdE1hO6neIZ8R+g6 X-Google-Smtp-Source: ABdhPJzVR17R/4LvQ9RZgjUp76vKCtEMbSLHQAs27urE23gUQgCXvgHXevUiptGreLeIBrA9X4qbUA== X-Received: by 2002:a17:907:7da8:: with SMTP id oz40mr31380601ejc.105.1637849364878; Thu, 25 Nov 2021 06:09:24 -0800 (PST) Received: from debil.vdiclient.nvidia.com (84-238-136-197.ip.btc-net.bg. [84.238.136.197]) by smtp.gmail.com with ESMTPSA id sc7sm1889863ejc.50.2021.11.25.06.09.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Nov 2021 06:09:24 -0800 (PST) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, ivecera@redhat.com, bridge@lists.linux-foundation.org, davem@davemloft.net, kuba@kernel.org, Nikolay Aleksandrov Subject: [PATCH net-next 06/10] selftests: net: bridge: add vlan mcast_membership_interval test Date: Thu, 25 Nov 2021 16:08:54 +0200 Message-Id: <20211125140858.3639139-7-razor@blackwall.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211125140858.3639139-1-razor@blackwall.org> References: <20211125140858.3639139-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Nikolay Aleksandrov Add a test which changes the new per-vlan mcast_membership_interval and verifies that a newly learned mdb entry would expire in that interval. TEST: Vlan mcast_membership_interval global option default value [ OK ] TEST: Vlan 10 mcast_membership_interval option changed to 200 [ OK ] TEST: Vlan 10 mcast_membership_interval mdb entry expire [ OK ] Signed-off-by: Nikolay Aleksandrov --- .../net/forwarding/bridge_vlan_mcast.sh | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh b/tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh index 0070d8292569..87dcd49b0a8d 100755 --- a/tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh +++ b/tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh @@ -2,7 +2,7 @@ # SPDX-License-Identifier: GPL-2.0 ALL_TESTS="vlmc_control_test vlmc_querier_test vlmc_igmp_mld_version_test \ - vlmc_last_member_test vlmc_startup_query_test" + vlmc_last_member_test vlmc_startup_query_test vlmc_membership_test" NUM_NETIFS=4 CHECK_TC="yes" TEST_GROUP="239.10.10.10" @@ -358,6 +358,32 @@ vlmc_startup_query_test() bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_startup_query_count 2 } +vlmc_membership_test() +{ + RET=0 + local goutput=`bridge -j vlan global show` + echo -n $goutput | + jq -e ".[].vlans[] | select(.vlan == 10)" &>/dev/null + check_err $? "Could not find vlan 10's global options" + + echo -n $goutput | + jq -e ".[].vlans[] | select(.vlan == 10 and \ + .mcast_membership_interval == 26000) " &>/dev/null + check_err $? "Wrong default mcast_membership_interval global vlan option value" + log_test "Vlan mcast_membership_interval global option default value" + + RET=0 + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_membership_interval 200 + check_err $? "Could not set mcast_membership_interval in vlan 10" + log_test "Vlan 10 mcast_membership_interval option changed to 200" + + RET=0 + vlmc_v2join_test 1 + log_test "Vlan 10 mcast_membership_interval mdb entry expire" + + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_membership_interval 26000 +} + trap cleanup EXIT setup_prepare From patchwork Thu Nov 25 14:08:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 12639229 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22D4AC433EF for ; Thu, 25 Nov 2021 14:11:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355714AbhKYOOz (ORCPT ); Thu, 25 Nov 2021 09:14:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355611AbhKYOMy (ORCPT ); Thu, 25 Nov 2021 09:12:54 -0500 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE076C0613E1 for ; Thu, 25 Nov 2021 06:09:27 -0800 (PST) Received: by mail-ed1-x52f.google.com with SMTP id r25so26155089edq.7 for ; Thu, 25 Nov 2021 06:09:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=blackwall-org.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DYxPRHRLEYcQrka7MbONriR7V5sW93K2rC+A+CbWUo0=; b=16Km5yqD1Jq7DqqEExTSa8dTgydtuWXkbRI5Ua4QUtOuXqQSDk5JBX9Kk+rxevcQDN k+xgovQkOr0B9aF8hdIj9f6KCj9srlwk0EmuIYDCBqQ7dCA759Rlo831pOZek6OViGie nzORFaOJDeHw9EtShM7FVXaEw4tHSWGa0dSoNA0+7LCrL8phbzO2DisADNWu9nI6uVM/ Ff1cnAuwnDtcX+pfb+tCm2V58UQBwDtzplViNpHLL4Pa6SOsmQGXOM8RQLSg+pW6ZsGC YqT88vZLmuI9D4gufEHFMqx8a1+paH+s35KH4LtVjNIGy+NKxulKQCsAqCwni3W8JPhd 0jBQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=DYxPRHRLEYcQrka7MbONriR7V5sW93K2rC+A+CbWUo0=; b=og7B0u/3Gn2xs1W4p64kDtCuIjQGVhcUu3mDbJ24oDjzBRhuWnuPLdIOkCMI4r4R+w VnuM5rFO/G1AHcSNW/2okFWU/6uShWKNaTWdpsEppruohjpxjZk4UXJA5d+P48JBnwSU XEs89qQr0/bLgu9sv3HXj6mP7169+yd34ZLgGeW8WGtcsEpD/HH2B72OZ4Wbhk3221Ku RA4MKS7hW8K4EsnUKjjQ/ds1nMcToBZ3gu+VtIXbjZdaG8AeVQPZMNEJU07V9pT8mxfx dOtH2aK4SQD9I8nEmKFCFwl2iarvu5ip6xguu8IMPUJj2L/9kvoNcOyUc2vorcHOEqkE R0BA== X-Gm-Message-State: AOAM533m8MEuGhvXw4yoeug3SSImblSQBJpa5OhW610APRZWn6HtThrT Wy2c15jqCAjE47jnT9obYOmjYK2cLO48u7pa X-Google-Smtp-Source: ABdhPJzlFtYQnVuZVy5yHi28cZn17LwIKrH5XB4Kpl+/O4mXZh1KAREofI4NpQNHAV7OqqaIwJxb4Q== X-Received: by 2002:a05:6402:84f:: with SMTP id b15mr37664622edz.323.1637849366194; Thu, 25 Nov 2021 06:09:26 -0800 (PST) Received: from debil.vdiclient.nvidia.com (84-238-136-197.ip.btc-net.bg. [84.238.136.197]) by smtp.gmail.com with ESMTPSA id sc7sm1889863ejc.50.2021.11.25.06.09.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Nov 2021 06:09:25 -0800 (PST) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, ivecera@redhat.com, bridge@lists.linux-foundation.org, davem@davemloft.net, kuba@kernel.org, Nikolay Aleksandrov Subject: [PATCH net-next 07/10] selftests: net: bridge: add vlan mcast_querier_interval tests Date: Thu, 25 Nov 2021 16:08:55 +0200 Message-Id: <20211125140858.3639139-8-razor@blackwall.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211125140858.3639139-1-razor@blackwall.org> References: <20211125140858.3639139-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Nikolay Aleksandrov Add tests which change the new per-vlan mcast_querier_interval and verify that it is taken into account when an outside querier is present. TEST: Vlan mcast_querier_interval global option default value [ OK ] TEST: Vlan 10 mcast_querier_interval option changed to 100 [ OK ] TEST: Vlan 10 mcast_querier_interval expire after outside query [ OK ] Signed-off-by: Nikolay Aleksandrov --- .../net/forwarding/bridge_vlan_mcast.sh | 40 ++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh b/tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh index 87dcd49b0a8d..9a68d56fd74c 100755 --- a/tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh +++ b/tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh @@ -2,7 +2,8 @@ # SPDX-License-Identifier: GPL-2.0 ALL_TESTS="vlmc_control_test vlmc_querier_test vlmc_igmp_mld_version_test \ - vlmc_last_member_test vlmc_startup_query_test vlmc_membership_test" + vlmc_last_member_test vlmc_startup_query_test vlmc_membership_test \ + vlmc_querier_intvl_test" NUM_NETIFS=4 CHECK_TC="yes" TEST_GROUP="239.10.10.10" @@ -384,6 +385,43 @@ vlmc_membership_test() bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_membership_interval 26000 } +vlmc_querier_intvl_test() +{ + RET=0 + local goutput=`bridge -j vlan global show` + echo -n $goutput | + jq -e ".[].vlans[] | select(.vlan == 10)" &>/dev/null + check_err $? "Could not find vlan 10's global options" + + echo -n $goutput | + jq -e ".[].vlans[] | select(.vlan == 10 and \ + .mcast_querier_interval == 25500) " &>/dev/null + check_err $? "Wrong default mcast_querier_interval global vlan option value" + log_test "Vlan mcast_querier_interval global option default value" + + RET=0 + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_querier_interval 100 + check_err $? "Could not set mcast_querier_interval in vlan 10" + log_test "Vlan 10 mcast_querier_interval option changed to 100" + + RET=0 + ip link add dev br1 type bridge mcast_snooping 1 mcast_querier 1 vlan_filtering 1 \ + mcast_vlan_snooping 1 + bridge vlan add vid 10 dev br1 self pvid untagged + ip link set dev $h1 master br1 + ip link set dev br1 up + bridge vlan add vid 10 dev $h1 master + bridge vlan global set vid 10 dev br1 mcast_snooping 1 mcast_querier 1 + sleep 2 + ip link del dev br1 + ip addr replace 2001:db8:1::1/64 dev $h1 + vlmc_check_query igmp 2 $swp1 1 1 + check_err $? "Wrong number of IGMPv2 general queries after querier interval" + log_test "Vlan 10 mcast_querier_interval expire after outside query" + + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_querier_interval 25500 +} + trap cleanup EXIT setup_prepare From patchwork Thu Nov 25 14:08:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 12639231 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 021BCC433F5 for ; Thu, 25 Nov 2021 14:11:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355717AbhKYOO4 (ORCPT ); Thu, 25 Nov 2021 09:14:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355613AbhKYOMz (ORCPT ); Thu, 25 Nov 2021 09:12:55 -0500 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C40FDC0613ED for ; Thu, 25 Nov 2021 06:09:28 -0800 (PST) Received: by mail-ed1-x534.google.com with SMTP id t5so26452971edd.0 for ; Thu, 25 Nov 2021 06:09:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=blackwall-org.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MKmLffX+pWU4FoGNzKjM0jOIw2aMhpVyY+HZhQGjnqg=; b=vd141DjmUJYTiCdsz/2wy8xA6ToZUseMArv0IPAnwB33JcVmD1P7Egx4igtP6nHk7I L63haVNgajhvJcUOyK79pW4cXv5dDb2diGLW/ginf6KSt/Trk2ZsK0fnfAJ9NeoDaiTE ULVHgWXIxT9MSFApIgDJ5TnzBEgbKTxkaejeH9VYisrleBVxr+o8/Qy1rjaf/84mys6M ypxIMEZwowA6JgNik8J77MaXrviVEf/ZurQhQ9+tshwSGkwaYvbnf3uLvmx03CSAIWAo gMsyj/XBfkSRLA/qTUBqGxgpFmHLEs9r/Udp/Wao1WiLNkaS9jaAF9FZPeQx3xJFxCuD TbyQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=MKmLffX+pWU4FoGNzKjM0jOIw2aMhpVyY+HZhQGjnqg=; b=D1HAyuauMj/x4d1A1+2Vo/OP3jCOLWx/qQgsY2X0tnU8emabmwFAntvj+8xC2uPS4a nskX3sqZ2kn3el2QieyN8q0hZvI1frB6mNUob/559LZUkM4Mxg8Brkqi7alBZSr8ANcH wOjHMzsoE69i1hugOmFnwTNsPAVwEIFEH7A7zsmRMc/4HB26NdW1c5X2Bs0ycjJJWcI3 OR/j3OCHpnAlUbchiRH1Oq9tUjSUvKgzN0zkemSH/5i3hDNMMqDiD4C+31Z1i8MDBduz VhyakvY43ValKPJaTAVgV/bmHq7g24+RtR8qB1ctWOj7KWavRpMhyA7GaH2mEy+zk+I9 2TwQ== X-Gm-Message-State: AOAM532InjRKMEjGgEJBLSIsg66WakaPF8xOXtX9E7oqrqNdpSzFYgHc l6QY3zx1gdIls/qWPoyzFkOoyBLIe5AOhGLc X-Google-Smtp-Source: ABdhPJwniuJBKU+PVv6obhV3udo2IGHvk1LZKXEkE/eNwX+erbMBETrUkSC8jFxwpI/TeCqrolsh4A== X-Received: by 2002:a50:e683:: with SMTP id z3mr39673718edm.206.1637849367088; Thu, 25 Nov 2021 06:09:27 -0800 (PST) Received: from debil.vdiclient.nvidia.com (84-238-136-197.ip.btc-net.bg. [84.238.136.197]) by smtp.gmail.com with ESMTPSA id sc7sm1889863ejc.50.2021.11.25.06.09.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Nov 2021 06:09:26 -0800 (PST) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, ivecera@redhat.com, bridge@lists.linux-foundation.org, davem@davemloft.net, kuba@kernel.org, Nikolay Aleksandrov Subject: [PATCH net-next 08/10] selftests: net: bridge: add vlan mcast query and query response interval tests Date: Thu, 25 Nov 2021 16:08:56 +0200 Message-Id: <20211125140858.3639139-9-razor@blackwall.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211125140858.3639139-1-razor@blackwall.org> References: <20211125140858.3639139-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Nikolay Aleksandrov Add tests which change the new per-vlan mcast_query_interval and verify the new value is in effect, also add a test to change mcast_query_response_interval's value. TEST: Vlan mcast_query_interval global option default value [ OK ] TEST: Vlan 10 mcast_query_interval option changed to 200 [ OK ] TEST: Vlan mcast_query_response_interval global option default value [ OK ] TEST: Vlan 10 mcast_query_response_interval option changed to 200 [ OK ] Signed-off-by: Nikolay Aleksandrov --- .../net/forwarding/bridge_vlan_mcast.sh | 51 ++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh b/tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh index 9a68d56fd74c..fbc7f5045b26 100755 --- a/tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh +++ b/tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh @@ -3,7 +3,7 @@ ALL_TESTS="vlmc_control_test vlmc_querier_test vlmc_igmp_mld_version_test \ vlmc_last_member_test vlmc_startup_query_test vlmc_membership_test \ - vlmc_querier_intvl_test" + vlmc_querier_intvl_test vlmc_query_intvl_test vlmc_query_response_intvl_test" NUM_NETIFS=4 CHECK_TC="yes" TEST_GROUP="239.10.10.10" @@ -422,6 +422,55 @@ vlmc_querier_intvl_test() bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_querier_interval 25500 } +vlmc_query_intvl_test() +{ + RET=0 + local goutput=`bridge -j vlan global show` + echo -n $goutput | + jq -e ".[].vlans[] | select(.vlan == 10)" &>/dev/null + check_err $? "Could not find vlan 10's global options" + + echo -n $goutput | + jq -e ".[].vlans[] | select(.vlan == 10 and \ + .mcast_query_interval == 12500) " &>/dev/null + check_err $? "Wrong default mcast_query_interval global vlan option value" + log_test "Vlan mcast_query_interval global option default value" + + RET=0 + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_startup_query_count 0 + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_query_interval 200 + check_err $? "Could not set mcast_query_interval in vlan 10" + # 1 is sent immediately, then 2 more in the next 5 seconds + vlmc_check_query igmp 2 $swp1 3 5 + check_err $? "Wrong number of tagged IGMPv2 general queries sent" + log_test "Vlan 10 mcast_query_interval option changed to 200" + + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_startup_query_count 2 + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_query_interval 12500 +} + +vlmc_query_response_intvl_test() +{ + RET=0 + local goutput=`bridge -j vlan global show` + echo -n $goutput | + jq -e ".[].vlans[] | select(.vlan == 10)" &>/dev/null + check_err $? "Could not find vlan 10's global options" + + echo -n $goutput | + jq -e ".[].vlans[] | select(.vlan == 10 and \ + .mcast_query_response_interval == 1000) " &>/dev/null + check_err $? "Wrong default mcast_query_response_interval global vlan option value" + log_test "Vlan mcast_query_response_interval global option default value" + + RET=0 + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_query_response_interval 200 + check_err $? "Could not set mcast_query_response_interval in vlan 10" + log_test "Vlan 10 mcast_query_response_interval option changed to 200" + + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_query_response_interval 1000 +} + trap cleanup EXIT setup_prepare From patchwork Thu Nov 25 14:08:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 12639233 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 582E2C433EF for ; Thu, 25 Nov 2021 14:12:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355626AbhKYOPj (ORCPT ); Thu, 25 Nov 2021 09:15:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355639AbhKYONj (ORCPT ); Thu, 25 Nov 2021 09:13:39 -0500 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB1C6C0613F1 for ; Thu, 25 Nov 2021 06:09:29 -0800 (PST) Received: by mail-ed1-x529.google.com with SMTP id r11so26170441edd.9 for ; Thu, 25 Nov 2021 06:09:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=blackwall-org.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rsXnOvd5nwBThD2qTg9D1pYE4X40JBYkDShPIF1srm0=; b=AuWU0dI8dq+Am1E5pw+6CORB6nijQMNR5dkWuKAcGZOilRKprNir0VkqxJGMJsJniP SMz3WfKNtQzQK03zbaRkGVGQFeI0FpCwG0YIlzCs2tlcJ5YnBDwrrtJcrndqJu/KUlZV 0CEAx/HfVOIwn8WOr1EPnpOUGyVAvUS3yrG873SuxG0UMYGBqKTV0YGIS/9AvFVVL1h4 ZATIIMEAn/teDTyn9+2uTH24RCY5GUs9mmXkeHwavtsgMdQvjXemrPxP0LmriDMldGJH wba/rZ7bbwVOtkfyneUtm2EPl2PscriY8HesZtwgeQCGs8BweoNz6dGsYH2Amubuoa12 gxcw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=rsXnOvd5nwBThD2qTg9D1pYE4X40JBYkDShPIF1srm0=; b=jEO11qNCW/4vXZpDwjzA8yshcM/Cm8anRJMWupc5Qq+IWvOlNLQI+ypr91TGbvV+0t yvSiYkVHFX/BzU5+gmE6E9Eh2eJgd5L/a54zqYuR5pl5HD6lQRIddTOhYL47wQMgYspk krkphVKLlw0BZ0ZpbEM7HMbGdY2/b2A1Hb1P56kHCPjreRNmBqI7pTqrgBmkQzsFWvbT NKeCO2/sN7206LIU+TJAk0Zph0HaVZZYajwFAD06EAheFXSrxi45pYPMH3oGq3IxyygS 6Dm+3UyAXLBoPiSexdo7eGidNmnpu2eJomVxbB4gioVWUldmQmPhv5yTWqVLHrv7BPoH 4cKQ== X-Gm-Message-State: AOAM533IBRRNh+joKOlv0sSr9U8xphaODbITxqk+1MUKXjXw9XxHmd3i 4wxDJ1ctVrrU8sdLo/00kORahaNElrvb1bUM X-Google-Smtp-Source: ABdhPJxblp2v2lk/tLcjsRDEZHAcXI6hscD+GNZOSNFDOZb7G4Ir17j6WzYkMv1keK3waViyJETafQ== X-Received: by 2002:a05:6402:40c3:: with SMTP id z3mr38076605edb.203.1637849368029; Thu, 25 Nov 2021 06:09:28 -0800 (PST) Received: from debil.vdiclient.nvidia.com (84-238-136-197.ip.btc-net.bg. [84.238.136.197]) by smtp.gmail.com with ESMTPSA id sc7sm1889863ejc.50.2021.11.25.06.09.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Nov 2021 06:09:27 -0800 (PST) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, ivecera@redhat.com, bridge@lists.linux-foundation.org, davem@davemloft.net, kuba@kernel.org, Nikolay Aleksandrov Subject: [PATCH net-next 09/10] selftests: net: bridge: add vlan mcast_router tests Date: Thu, 25 Nov 2021 16:08:57 +0200 Message-Id: <20211125140858.3639139-10-razor@blackwall.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211125140858.3639139-1-razor@blackwall.org> References: <20211125140858.3639139-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Nikolay Aleksandrov Add tests for the new per-port/vlan mcast_router option, verify that unknown multicast packets are flooded only to router ports. TEST: Port vlan 10 option mcast_router default value [ OK ] TEST: Port vlan 10 mcast_router option changed to 2 [ OK ] TEST: Flood unknown vlan multicast packets to router port only [ OK ] Signed-off-by: Nikolay Aleksandrov --- .../net/forwarding/bridge_vlan_mcast.sh | 54 ++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh b/tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh index fbc7f5045b26..898a70f4d226 100755 --- a/tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh +++ b/tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh @@ -3,7 +3,8 @@ ALL_TESTS="vlmc_control_test vlmc_querier_test vlmc_igmp_mld_version_test \ vlmc_last_member_test vlmc_startup_query_test vlmc_membership_test \ - vlmc_querier_intvl_test vlmc_query_intvl_test vlmc_query_response_intvl_test" + vlmc_querier_intvl_test vlmc_query_intvl_test vlmc_query_response_intvl_test \ + vlmc_router_port_test" NUM_NETIFS=4 CHECK_TC="yes" TEST_GROUP="239.10.10.10" @@ -471,6 +472,57 @@ vlmc_query_response_intvl_test() bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_query_response_interval 1000 } +vlmc_router_port_test() +{ + RET=0 + local goutput=`bridge -j -d vlan show` + echo -n $goutput | + jq -e ".[] | select(.ifname == \"$swp1\" and \ + .vlans[].vlan == 10)" &>/dev/null + check_err $? "Could not find port vlan 10's options" + + echo -n $goutput | + jq -e ".[] | select(.ifname == \"$swp1\" and \ + .vlans[].vlan == 10 and \ + .vlans[].mcast_router == 1)" &>/dev/null + check_err $? "Wrong default port mcast_router option value" + log_test "Port vlan 10 option mcast_router default value" + + RET=0 + bridge vlan set vid 10 dev $swp1 mcast_router 2 + check_err $? "Could not set port vlan 10's mcast_router option" + log_test "Port vlan 10 mcast_router option changed to 2" + + RET=0 + tc filter add dev $swp1 egress pref 10 prot 802.1Q \ + flower vlan_id 10 vlan_ethtype ipv4 dst_ip 239.1.1.1 ip_proto udp action pass + tc filter add dev $swp2 egress pref 10 prot 802.1Q \ + flower vlan_id 10 vlan_ethtype ipv4 dst_ip 239.1.1.1 ip_proto udp action pass + bridge vlan set vid 10 dev $swp2 mcast_router 0 + # we need to enable querier and disable query response interval to + # make sure packets are flooded only to router ports + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_querier 1 \ + mcast_query_response_interval 0 + bridge vlan add vid 10 dev br0 self + sleep 1 + mausezahn br0 -Q 10 -c 10 -p 128 -b 01:00:5e:01:01:01 -B 239.1.1.1 \ + -t udp "dp=1024" &>/dev/null + local swp1_tcstats=$(tc_rule_stats_get $swp1 10 egress) + if [[ $swp1_tcstats != 10 ]]; then + check_err 1 "Wrong number of vlan 10 multicast packets flooded" + fi + local swp2_tcstats=$(tc_rule_stats_get $swp2 10 egress) + check_err $swp2_tcstats "Vlan 10 multicast packets flooded to non-router port" + log_test "Flood unknown vlan multicast packets to router port only" + + tc filter del dev $swp2 egress pref 10 + tc filter del dev $swp1 egress pref 10 + bridge vlan del vid 10 dev br0 self + bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_query_response_interval 1000 + bridge vlan set vid 10 dev $swp2 mcast_router 1 + bridge vlan set vid 10 dev $swp1 mcast_router 1 +} + trap cleanup EXIT setup_prepare From patchwork Thu Nov 25 14:08:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 12639235 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 02ADAC433F5 for ; Thu, 25 Nov 2021 14:12:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355462AbhKYOPz (ORCPT ); Thu, 25 Nov 2021 09:15:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355645AbhKYONz (ORCPT ); Thu, 25 Nov 2021 09:13:55 -0500 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D69A5C0613F4 for ; Thu, 25 Nov 2021 06:09:30 -0800 (PST) Received: by mail-ed1-x52a.google.com with SMTP id x15so26153985edv.1 for ; Thu, 25 Nov 2021 06:09:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=blackwall-org.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nmr06pA0TokKoR6jlJic1Isl4JZia+uZ96LV+9m0Xfk=; b=qCilOhgU1ExKEZEIAxoiLKHqAkukOP07ZzUuPqR52J7FfCdWqISFFzn//+tHX35VLi RTThkXPJTbMU2L4plslbTzWY8aRPsH0tF24AoD+R5TuceouHuzSXojqeuLnfdL9/x297 iLH3EirHXGckKJC9VJfEUHeyWfSFH7keERCCZ5F2xROX24SOF9/bqptMxXahfbAwAgn5 2QvuQ3DzhYD1V3SxKgsjSm/ytjfj1Lw+E1EMb0vc7oPeSMNHYUi8CglzsT07EVhyfFw7 6dNDrYZjmwUV2QHs/Vr2txD/Mx65Bywp5Qu26JlUKHkLwKKw/4ghpJ4rDMU0aO+EEVmL iOxw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=nmr06pA0TokKoR6jlJic1Isl4JZia+uZ96LV+9m0Xfk=; b=l4ur3shVFg/EGdqoAS6hjOz9gh/HE2YanHk9ZMLGXSVfAUknz4XYo1qzl8uKY/CrmR TbJGU/ALmq6qBcMMClq2c9Va6AyrLJdPblMLgGMUs+N3hmf5guj+C/iGW3EfYQLHivNR 7vE5idKj24xqmU9TNQj45BaqiLXRhunrMTOqS4rY0dRdgVPhUt1VOtVKYHdgF+Y1x+08 7HnXpy98aB4ZCE5E/nYyrGvGdvU+g3MaxV07yB4BF/VmnLODIl3RBH7iN/t0HZO4mat+ Q6iAG4XszMM3c+O8AFherTvo36qBB7/S86VmkvYjvFT8itts86rWmORCVY71iY8ds8X/ MFAg== X-Gm-Message-State: AOAM533UK/VTYR/tIOxqUdXRM11dPu/IvGfStp/dHU18VjXIO1NhQutF irwYi6tsI6QkezMeO0vBy/Cdnnoyb/v9c/CO X-Google-Smtp-Source: ABdhPJxMes8ylLjzMUDK+c/dgBnadUX26SaFHqYxu1GjpM7dPtC1eSEH2LWv4cw+Wn2XVLbyiSgjxA== X-Received: by 2002:a05:6402:124e:: with SMTP id l14mr39092087edw.74.1637849369093; Thu, 25 Nov 2021 06:09:29 -0800 (PST) Received: from debil.vdiclient.nvidia.com (84-238-136-197.ip.btc-net.bg. [84.238.136.197]) by smtp.gmail.com with ESMTPSA id sc7sm1889863ejc.50.2021.11.25.06.09.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Nov 2021 06:09:28 -0800 (PST) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, ivecera@redhat.com, bridge@lists.linux-foundation.org, davem@davemloft.net, kuba@kernel.org, Nikolay Aleksandrov Subject: [PATCH net-next 10/10] selftests: net: bridge: add test for vlan_filtering dependency Date: Thu, 25 Nov 2021 16:08:58 +0200 Message-Id: <20211125140858.3639139-11-razor@blackwall.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211125140858.3639139-1-razor@blackwall.org> References: <20211125140858.3639139-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Nikolay Aleksandrov Add a test for dependency of mcast_vlan_snooping on vlan_filtering. If vlan_filtering gets disabled, then mcast_vlan_snooping must be automatically disabled as well. TEST: Disable multicast vlan snooping when vlan filtering is disabled [ OK ] Signed-off-by: Nikolay Aleksandrov --- .../selftests/net/forwarding/bridge_vlan_mcast.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh b/tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh index 898a70f4d226..5224a5a8595b 100755 --- a/tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh +++ b/tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh @@ -4,7 +4,7 @@ ALL_TESTS="vlmc_control_test vlmc_querier_test vlmc_igmp_mld_version_test \ vlmc_last_member_test vlmc_startup_query_test vlmc_membership_test \ vlmc_querier_intvl_test vlmc_query_intvl_test vlmc_query_response_intvl_test \ - vlmc_router_port_test" + vlmc_router_port_test vlmc_filtering_test" NUM_NETIFS=4 CHECK_TC="yes" TEST_GROUP="239.10.10.10" @@ -523,6 +523,16 @@ vlmc_router_port_test() bridge vlan set vid 10 dev $swp1 mcast_router 1 } +vlmc_filtering_test() +{ + RET=0 + ip link set dev br0 type bridge vlan_filtering 0 + ip -j -d link show dev bridge | \ + jq -e "select(.[0].linkinfo.info_data.mcast_vlan_snooping == 1)" &>/dev/null + check_fail $? "Vlan filtering is disabled but multicast vlan snooping is still enabled" + log_test "Disable multicast vlan snooping when vlan filtering is disabled" +} + trap cleanup EXIT setup_prepare