From patchwork Tue Nov 3 17:23:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 315729 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2524EC2D0A3 for ; Tue, 3 Nov 2020 17:24:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D77E622226 for ; Tue, 3 Nov 2020 17:24:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=blackwall-org.20150623.gappssmtp.com header.i=@blackwall-org.20150623.gappssmtp.com header.b="MqzUiWrQ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728737AbgKCRYU (ORCPT ); Tue, 3 Nov 2020 12:24:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728550AbgKCRYT (ORCPT ); Tue, 3 Nov 2020 12:24:19 -0500 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1F9EC0617A6 for ; Tue, 3 Nov 2020 09:24:19 -0800 (PST) Received: by mail-wm1-x344.google.com with SMTP id p22so99244wmg.3 for ; Tue, 03 Nov 2020 09:24:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=blackwall-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xBm95jl2xW7HhQ7hwk4jZB0S0Y7wQfebO/eBHZqjNWo=; b=MqzUiWrQhY5xpB2YoBUurz8HpgeL4rD0U/WPxFKSRrv83ZBc6jSVrCVdx8rk/Pq3CS I8jdO2PTuajjv7UegAo7D6AnccQFOkWAOSDQ+SiLDG4OTFynJhx9izQO2/nbr1dQQBxE 3yoq7NqaeFfhln1CNJOI067Zqmcpd0Vy8xWAtJ0jGRx/BywDQHiGY1jnPA1cfSpUaV7m USgfyueHQ64pmPimxsOsz9h9IQYUzAOGDKAdXg+78ZOkiz++2HeXCnpf0C9Bb5z/Kleb lfYzoLM8Wk3DAGSHOTUjMsEumGKT7h5t7r4GuBb8e30w0K4wUi78bmE6r9QASRUP5L+L kvpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xBm95jl2xW7HhQ7hwk4jZB0S0Y7wQfebO/eBHZqjNWo=; b=UQFlzdgSnsDGYBxUjGTCfV9QT9YOXAwOS+btXLRGNNv+aZajx3raqsGN8bv42bib7M xDPa0JGfLnFd8uEEFnMSMahXAv17Mcdl8vGcIoSF+7a7AT1HHGu00gwR+Mf6z+umgepj z1T7Ir1eEStvN6w0Bf2tZ4r6YatiOAO0BHY6bA6akKxqwvZumjngZ1X2aN4wRrBXS4qq OOSerzexO7aJkL0t+iRTJvkce98CgqURSW93TqjUo0JUjqaI1+fcoeDU4CnqaJ0ltbum dOUifiZXNMbumSeKdS+gGhKYAe/pC6UDzxNEDbBFJgPTs7qqQ6HFbfJLnkRR/plR34Pm /j7w== X-Gm-Message-State: AOAM532xJaq9qyz0bHAUJcOvH7kvVbZHZJKbMmeTIZNeTw7+PPa3UlW7 656Ci+NLTiXQQrSrVjvNvZuNO7M9d+c5oaOr X-Google-Smtp-Source: ABdhPJwCmHQRlzOe8Sz/VWtIyaNseKz0zgnrUmtmbUdUByHCZrPtIFFD6fMCz/oy1M+X9RNK7nhj8A== X-Received: by 2002:a7b:cd92:: with SMTP id y18mr202822wmj.178.1604424258113; Tue, 03 Nov 2020 09:24:18 -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 a128sm2650795wmf.5.2020.11.03.09.24.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Nov 2020 09:24:17 -0800 (PST) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, kuba@kernel.org, bridge@lists.linux-foundation.org, Nikolay Aleksandrov Subject: [PATCH net-next 01/16] selftests: net: bridge: factor out mcast_packet_test Date: Tue, 3 Nov 2020 19:23:57 +0200 Message-Id: <20201103172412.1044840-2-razor@blackwall.org> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20201103172412.1044840-1-razor@blackwall.org> References: <20201103172412.1044840-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Nikolay Aleksandrov Factor out mcast_packet_test into lib.sh so it can be later extended and reused by MLDv2 tests. Signed-off-by: Nikolay Aleksandrov --- .../selftests/net/forwarding/bridge_igmp.sh | 32 ------------------- tools/testing/selftests/net/forwarding/lib.sh | 32 +++++++++++++++++++ 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/tools/testing/selftests/net/forwarding/bridge_igmp.sh b/tools/testing/selftests/net/forwarding/bridge_igmp.sh index 0e71abdd7a03..50a48ce16ba1 100755 --- a/tools/testing/selftests/net/forwarding/bridge_igmp.sh +++ b/tools/testing/selftests/net/forwarding/bridge_igmp.sh @@ -105,38 +105,6 @@ cleanup() vrf_cleanup } -# return 0 if the packet wasn't seen on host2_if or 1 if it was -mcast_packet_test() -{ - local mac=$1 - local src_ip=$2 - local ip=$3 - local host1_if=$4 - local host2_if=$5 - local seen=0 - - # Add an ACL on `host2_if` which will tell us whether the packet - # was received by it or not. - tc qdisc add dev $host2_if ingress - tc filter add dev $host2_if ingress protocol ip pref 1 handle 101 \ - flower ip_proto udp dst_mac $mac action drop - - $MZ $host1_if -c 1 -p 64 -b $mac -A $src_ip -B $ip -t udp "dp=4096,sp=2048" -q - sleep 1 - - tc -j -s filter show dev $host2_if ingress \ - | jq -e ".[] | select(.options.handle == 101) \ - | select(.options.actions[0].stats.packets == 1)" &> /dev/null - if [[ $? -eq 0 ]]; then - seen=1 - fi - - tc filter del dev $host2_if ingress protocol ip pref 1 handle 101 flower - tc qdisc del dev $host2_if ingress - - return $seen -} - v2reportleave_test() { RET=0 diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh index 927f9ba49e08..bb3ccc6d2165 100644 --- a/tools/testing/selftests/net/forwarding/lib.sh +++ b/tools/testing/selftests/net/forwarding/lib.sh @@ -1270,3 +1270,35 @@ tcpdump_show() { tcpdump -e -n -r $capfile 2>&1 } + +# return 0 if the packet wasn't seen on host2_if or 1 if it was +mcast_packet_test() +{ + local mac=$1 + local src_ip=$2 + local ip=$3 + local host1_if=$4 + local host2_if=$5 + local seen=0 + + # Add an ACL on `host2_if` which will tell us whether the packet + # was received by it or not. + tc qdisc add dev $host2_if ingress + tc filter add dev $host2_if ingress protocol ip pref 1 handle 101 \ + flower ip_proto udp dst_mac $mac action drop + + $MZ $host1_if -c 1 -p 64 -b $mac -A $src_ip -B $ip -t udp "dp=4096,sp=2048" -q + sleep 1 + + tc -j -s filter show dev $host2_if ingress \ + | jq -e ".[] | select(.options.handle == 101) \ + | select(.options.actions[0].stats.packets == 1)" &> /dev/null + if [[ $? -eq 0 ]]; then + seen=1 + fi + + tc filter del dev $host2_if ingress protocol ip pref 1 handle 101 flower + tc qdisc del dev $host2_if ingress + + return $seen +} From patchwork Tue Nov 3 17:23:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 315728 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5CC5EC2D0A3 for ; Tue, 3 Nov 2020 17:24:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0D35921556 for ; Tue, 3 Nov 2020 17:24:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=blackwall-org.20150623.gappssmtp.com header.i=@blackwall-org.20150623.gappssmtp.com header.b="FjUllosq" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728776AbgKCRY0 (ORCPT ); Tue, 3 Nov 2020 12:24:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728471AbgKCRYX (ORCPT ); Tue, 3 Nov 2020 12:24:23 -0500 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41E87C0613D1 for ; Tue, 3 Nov 2020 09:24:22 -0800 (PST) Received: by mail-wm1-x333.google.com with SMTP id v5so107249wmh.1 for ; Tue, 03 Nov 2020 09:24:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=blackwall-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=d4X+MzHPwavfeH5vks+WjS48DbZu9bbXsSeUnpDGMKQ=; b=FjUllosqkdGlWR4KVAlsTkE2uYTCktcrQdzP4gNWgWavgYG9TEwxOn6eDl8udqwaXs U47Y4QJz/MAkocHfT2qs7akapff+NyVsuVRt4g5Kz5dmz3bpAcYxhNyRuUC9GrZJ77jv Rx4a+Km3fr5vyy55b35jtNm5jDtKFmdl3+KkwVYPuHFsooLc/3XtsDBrmR9B5LKeNpVZ FoKf2Rbl5/UEOtQy2qrvKVSsnRhZege2DhSP/hXpKhuqw+8gmbOG37IUxofcJIhypj9v Fb8nFyoYcl34rfKvWOXfrcnKU5HBgfnbmLPwGQuh8+pq/cWMxZtGsk1LPOWVgyI1Iwe+ Q1rQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=d4X+MzHPwavfeH5vks+WjS48DbZu9bbXsSeUnpDGMKQ=; b=KVv36QnliEZQmZFj7DQgm3antplROjATxOaocY55AWMec6tLUI/VWgXMC/cLxHtBwx AiHkLUKExUCd1NHHJS5R5jvdO5K/sXx49QAltAVwSU452u/a9zvuEJpaLOAzoLxO/GOZ ecTglaOV5o6ZyR5GDyNhhhTkDj6HJA3twbWUZX1BQfKa9qi30MbJ7NH9VBW6nE7T3BcF MPJIMsQlNct8s34qhkOIujK2I8wsMa+hgjod3Ez5Kb6gwUvD4XfsVwNp/uZNneZli/QH nEGoQstus+YinC89ELNazO21d1YOaczpnICHOYxQOWn7CHY3/vguxUw8rXf7o+Wzp4Y9 3jxg== X-Gm-Message-State: AOAM530O4bANRNygLZzB83vfjYoS1tjYUSqYVmGLVVLK4TVqCTmhBSt4 tlt0TDxFg8gKqTz+MmEvOzx82gfSPEe8DKyh X-Google-Smtp-Source: ABdhPJwkGwPgfKhA7iokMUYPfVknlU1XqKX40mLt+0+gPLBCU2x8u/H2li//CaVOP24Phr+f7JeOJQ== X-Received: by 2002:a1c:4888:: with SMTP id v130mr218579wma.84.1604424260462; Tue, 03 Nov 2020 09:24:20 -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 a128sm2650795wmf.5.2020.11.03.09.24.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Nov 2020 09:24:19 -0800 (PST) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, kuba@kernel.org, bridge@lists.linux-foundation.org, Nikolay Aleksandrov Subject: [PATCH net-next 03/16] selftests: net: bridge: factor out and rename sg state functions Date: Tue, 3 Nov 2020 19:23:59 +0200 Message-Id: <20201103172412.1044840-4-razor@blackwall.org> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20201103172412.1044840-1-razor@blackwall.org> References: <20201103172412.1044840-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Nikolay Aleksandrov Factor out S,G entry state checking functions for existence, forwarding, blocking and timer to lib.sh so they can be later used by MLDv2 tests. Add brmcast_ suffix to their name to make the relation to the bridge explicit. Signed-off-by: Nikolay Aleksandrov --- .../selftests/net/forwarding/bridge_igmp.sh | 179 ++++++------------ tools/testing/selftests/net/forwarding/lib.sh | 67 +++++++ 2 files changed, 123 insertions(+), 123 deletions(-) diff --git a/tools/testing/selftests/net/forwarding/bridge_igmp.sh b/tools/testing/selftests/net/forwarding/bridge_igmp.sh index 50a48ce16ba1..675eff45b037 100755 --- a/tools/testing/selftests/net/forwarding/bridge_igmp.sh +++ b/tools/testing/selftests/net/forwarding/bridge_igmp.sh @@ -137,73 +137,6 @@ v2reportleave_test() log_test "IGMPv2 leave $TEST_GROUP" } -check_sg_entries() -{ - local report=$1; shift - local slist=("$@") - local sarg="" - - for src in "${slist[@]}"; do - sarg="${sarg} and .source_list[].address == \"$src\"" - done - bridge -j -d -s mdb show dev br0 \ - | jq -e ".[].mdb[] | \ - select(.grp == \"$TEST_GROUP\" and .source_list != null $sarg)" &>/dev/null - check_err $? "Wrong *,G entry source list after $report report" - - for sgent in "${slist[@]}"; do - bridge -j -d -s mdb show dev br0 \ - | jq -e ".[].mdb[] | \ - select(.grp == \"$TEST_GROUP\" and .src == \"$sgent\")" &>/dev/null - check_err $? "Missing S,G entry ($sgent, $TEST_GROUP)" - done -} - -check_sg_fwding() -{ - local should_fwd=$1; shift - local sources=("$@") - - for src in "${sources[@]}"; do - local retval=0 - - mcast_packet_test $TEST_GROUP_MAC $src $TEST_GROUP $h2 $h1 - retval=$? - if [ $should_fwd -eq 1 ]; then - check_fail $retval "Didn't forward traffic from S,G ($src, $TEST_GROUP)" - else - check_err $retval "Forwarded traffic for blocked S,G ($src, $TEST_GROUP)" - fi - done -} - -check_sg_state() -{ - local is_blocked=$1; shift - local sources=("$@") - local should_fail=1 - - if [ $is_blocked -eq 1 ]; then - should_fail=0 - fi - - for src in "${sources[@]}"; do - bridge -j -d -s mdb show dev br0 \ - | jq -e ".[].mdb[] | \ - select(.grp == \"$TEST_GROUP\" and .source_list != null) | - .source_list[] | - select(.address == \"$src\") | - select(.timer == \"0.00\")" &>/dev/null - check_err_fail $should_fail $? "Entry $src has zero timer" - - bridge -j -d -s mdb show dev br0 \ - | jq -e ".[].mdb[] | \ - select(.grp == \"$TEST_GROUP\" and .src == \"$src\" and \ - .flags[] == \"blocked\")" &>/dev/null - check_err_fail $should_fail $? "Entry $src has blocked flag" - done -} - v3include_prepare() { local host1_if=$1 @@ -225,7 +158,7 @@ v3include_prepare() select(.grp == \"$TEST_GROUP\" and \ .source_list != null and .filter_mode == \"include\")" &>/dev/null check_err $? "Wrong *,G entry filter mode" - check_sg_entries "is_include" "${X[@]}" + brmcast_check_sg_entries "is_include" "${X[@]}" } v3exclude_prepare() @@ -247,10 +180,10 @@ v3exclude_prepare() .source_list != null and .filter_mode == \"exclude\")" &>/dev/null check_err $? "Wrong *,G entry filter mode" - check_sg_entries "is_exclude" "${X[@]}" "${Y[@]}" + brmcast_check_sg_entries "is_exclude" "${X[@]}" "${Y[@]}" - check_sg_state 0 "${X[@]}" - check_sg_state 1 "${Y[@]}" + brmcast_check_sg_state 0 "${X[@]}" + brmcast_check_sg_state 1 "${Y[@]}" bridge -j -d -s mdb show dev br0 \ | jq -e ".[].mdb[] | \ @@ -276,10 +209,10 @@ v3include_test() v3include_prepare $h1 $ALL_MAC $ALL_GROUP - check_sg_state 0 "${X[@]}" + brmcast_check_sg_state 0 "${X[@]}" - check_sg_fwding 1 "${X[@]}" - check_sg_fwding 0 "192.0.2.100" + brmcast_check_sg_fwding 1 "${X[@]}" + brmcast_check_sg_fwding 0 "192.0.2.100" log_test "IGMPv3 report $TEST_GROUP is_include" @@ -295,12 +228,12 @@ v3inc_allow_test() $MZ $h1 -c 1 -b $ALL_MAC -B $ALL_GROUP -t ip "proto=2,p=$MZPKT_ALLOW" -q sleep 1 - check_sg_entries "allow" "${X[@]}" + brmcast_check_sg_entries "allow" "${X[@]}" - check_sg_state 0 "${X[@]}" + brmcast_check_sg_state 0 "${X[@]}" - check_sg_fwding 1 "${X[@]}" - check_sg_fwding 0 "192.0.2.100" + brmcast_check_sg_fwding 1 "${X[@]}" + brmcast_check_sg_fwding 0 "192.0.2.100" log_test "IGMPv3 report $TEST_GROUP include -> allow" @@ -316,12 +249,12 @@ v3inc_is_include_test() $MZ $h1 -c 1 -b $ALL_MAC -B $ALL_GROUP -t ip "proto=2,p=$MZPKT_IS_INC2" -q sleep 1 - check_sg_entries "is_include" "${X[@]}" + brmcast_check_sg_entries "is_include" "${X[@]}" - check_sg_state 0 "${X[@]}" + brmcast_check_sg_state 0 "${X[@]}" - check_sg_fwding 1 "${X[@]}" - check_sg_fwding 0 "192.0.2.100" + brmcast_check_sg_fwding 1 "${X[@]}" + brmcast_check_sg_fwding 0 "192.0.2.100" log_test "IGMPv3 report $TEST_GROUP include -> is_include" @@ -334,8 +267,8 @@ v3inc_is_exclude_test() v3exclude_prepare $h1 $ALL_MAC $ALL_GROUP - check_sg_fwding 1 "${X[@]}" 192.0.2.100 - check_sg_fwding 0 "${Y[@]}" + brmcast_check_sg_fwding 1 "${X[@]}" 192.0.2.100 + brmcast_check_sg_fwding 0 "${Y[@]}" log_test "IGMPv3 report $TEST_GROUP include -> is_exclude" @@ -361,10 +294,10 @@ v3inc_to_exclude_test() .source_list != null and .filter_mode == \"exclude\")" &>/dev/null check_err $? "Wrong *,G entry filter mode" - check_sg_entries "to_exclude" "${X[@]}" "${Y[@]}" + brmcast_check_sg_entries "to_exclude" "${X[@]}" "${Y[@]}" - check_sg_state 0 "${X[@]}" - check_sg_state 1 "${Y[@]}" + brmcast_check_sg_state 0 "${X[@]}" + brmcast_check_sg_state 1 "${Y[@]}" bridge -j -d -s mdb show dev br0 \ | jq -e ".[].mdb[] | \ @@ -379,8 +312,8 @@ v3inc_to_exclude_test() .source_list[].address == \"192.0.2.21\")" &>/dev/null check_fail $? "Wrong *,G entry source list, 192.0.2.21 entry still exists" - check_sg_fwding 1 "${X[@]}" 192.0.2.100 - check_sg_fwding 0 "${Y[@]}" + brmcast_check_sg_fwding 1 "${X[@]}" 192.0.2.100 + brmcast_check_sg_fwding 0 "${Y[@]}" log_test "IGMPv3 report $TEST_GROUP include -> to_exclude" @@ -399,13 +332,13 @@ v3exc_allow_test() $MZ $h1 -c 1 -b $ALL_MAC -B $ALL_GROUP -t ip "proto=2,p=$MZPKT_ALLOW2" -q sleep 1 - check_sg_entries "allow" "${X[@]}" "${Y[@]}" + brmcast_check_sg_entries "allow" "${X[@]}" "${Y[@]}" - check_sg_state 0 "${X[@]}" - check_sg_state 1 "${Y[@]}" + brmcast_check_sg_state 0 "${X[@]}" + brmcast_check_sg_state 1 "${Y[@]}" - check_sg_fwding 1 "${X[@]}" 192.0.2.100 - check_sg_fwding 0 "${Y[@]}" + brmcast_check_sg_fwding 1 "${X[@]}" 192.0.2.100 + brmcast_check_sg_fwding 0 "${Y[@]}" log_test "IGMPv3 report $TEST_GROUP exclude -> allow" @@ -422,13 +355,13 @@ v3exc_is_include_test() $MZ $h1 -c 1 -b $ALL_MAC -B $ALL_GROUP -t ip "proto=2,p=$MZPKT_IS_INC3" -q sleep 1 - check_sg_entries "is_include" "${X[@]}" "${Y[@]}" + brmcast_check_sg_entries "is_include" "${X[@]}" "${Y[@]}" - check_sg_state 0 "${X[@]}" - check_sg_state 1 "${Y[@]}" + brmcast_check_sg_state 0 "${X[@]}" + brmcast_check_sg_state 1 "${Y[@]}" - check_sg_fwding 1 "${X[@]}" 192.0.2.100 - check_sg_fwding 0 "${Y[@]}" + brmcast_check_sg_fwding 1 "${X[@]}" 192.0.2.100 + brmcast_check_sg_fwding 0 "${Y[@]}" log_test "IGMPv3 report $TEST_GROUP exclude -> is_include" @@ -445,13 +378,13 @@ v3exc_is_exclude_test() $MZ $h1 -c 1 -b $ALL_MAC -B $ALL_GROUP -t ip "proto=2,p=$MZPKT_IS_EXC2" -q sleep 1 - check_sg_entries "is_exclude" "${X[@]}" "${Y[@]}" + brmcast_check_sg_entries "is_exclude" "${X[@]}" "${Y[@]}" - check_sg_state 0 "${X[@]}" - check_sg_state 1 "${Y[@]}" + brmcast_check_sg_state 0 "${X[@]}" + brmcast_check_sg_state 1 "${Y[@]}" - check_sg_fwding 1 "${X[@]}" 192.0.2.100 - check_sg_fwding 0 "${Y[@]}" + brmcast_check_sg_fwding 1 "${X[@]}" 192.0.2.100 + brmcast_check_sg_fwding 0 "${Y[@]}" log_test "IGMPv3 report $TEST_GROUP exclude -> is_exclude" @@ -471,13 +404,13 @@ v3exc_to_exclude_test() $MZ $h1 -c 1 -b $ALL_MAC -B $ALL_GROUP -t ip "proto=2,p=$MZPKT_TO_EXC" -q sleep 1 - check_sg_entries "to_exclude" "${X[@]}" "${Y[@]}" + brmcast_check_sg_entries "to_exclude" "${X[@]}" "${Y[@]}" - check_sg_state 0 "${X[@]}" - check_sg_state 1 "${Y[@]}" + brmcast_check_sg_state 0 "${X[@]}" + brmcast_check_sg_state 1 "${Y[@]}" - check_sg_fwding 1 "${X[@]}" 192.0.2.100 - check_sg_fwding 0 "${Y[@]}" + brmcast_check_sg_fwding 1 "${X[@]}" 192.0.2.100 + brmcast_check_sg_fwding 0 "${Y[@]}" log_test "IGMPv3 report $TEST_GROUP exclude -> to_exclude" @@ -496,9 +429,9 @@ v3inc_block_test() $MZ $h1 -c 1 -b $ALL_MAC -B $ALL_GROUP -t ip "proto=2,p=$MZPKT_BLOCK" -q # make sure the lowered timers have expired (by default 2 seconds) sleep 3 - check_sg_entries "block" "${X[@]}" + brmcast_check_sg_entries "block" "${X[@]}" - check_sg_state 0 "${X[@]}" + brmcast_check_sg_state 0 "${X[@]}" bridge -j -d -s mdb show dev br0 \ | jq -e ".[].mdb[] | \ @@ -507,8 +440,8 @@ v3inc_block_test() .source_list[].address == \"192.0.2.1\")" &>/dev/null check_fail $? "Wrong *,G entry source list, 192.0.2.1 entry still exists" - check_sg_fwding 1 "${X[@]}" - check_sg_fwding 0 "192.0.2.100" + brmcast_check_sg_fwding 1 "${X[@]}" + brmcast_check_sg_fwding 0 "192.0.2.100" log_test "IGMPv3 report $TEST_GROUP include -> block" @@ -528,13 +461,13 @@ v3exc_block_test() $MZ $h1 -c 1 -b $ALL_MAC -B $ALL_GROUP -t ip "proto=2,p=$MZPKT_BLOCK" -q sleep 1 - check_sg_entries "block" "${X[@]}" "${Y[@]}" + brmcast_check_sg_entries "block" "${X[@]}" "${Y[@]}" - check_sg_state 0 "${X[@]}" - check_sg_state 1 "${Y[@]}" + brmcast_check_sg_state 0 "${X[@]}" + brmcast_check_sg_state 1 "${Y[@]}" - check_sg_fwding 1 "${X[@]}" 192.0.2.100 - check_sg_fwding 0 "${Y[@]}" + brmcast_check_sg_fwding 1 "${X[@]}" 192.0.2.100 + brmcast_check_sg_fwding 0 "${Y[@]}" log_test "IGMPv3 report $TEST_GROUP exclude -> block" @@ -574,12 +507,12 @@ v3exc_timeout_test() .source_list[].address == \"192.0.2.2\")" &>/dev/null check_fail $? "Wrong *,G entry source list, 192.0.2.2 entry still exists" - check_sg_entries "allow" "${X[@]}" + brmcast_check_sg_entries "allow" "${X[@]}" - check_sg_state 0 "${X[@]}" + brmcast_check_sg_state 0 "${X[@]}" - check_sg_fwding 1 "${X[@]}" - check_sg_fwding 0 192.0.2.100 + brmcast_check_sg_fwding 1 "${X[@]}" + brmcast_check_sg_fwding 0 192.0.2.100 log_test "IGMPv3 group $TEST_GROUP exclude timeout" @@ -610,7 +543,7 @@ v3star_ex_auto_add_test() .flags[] == \"added_by_star_ex\")" &>/dev/null check_err $? "Auto-added S,G entry doesn't have added_by_star_ex flag" - check_sg_fwding 1 192.0.2.3 + brmcast_check_sg_fwding 1 192.0.2.3 log_test "IGMPv3 S,G port entry automatic add to a *,G port" diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh index 0a427b8a039d..98ea37d26c44 100644 --- a/tools/testing/selftests/net/forwarding/lib.sh +++ b/tools/testing/selftests/net/forwarding/lib.sh @@ -1310,3 +1310,70 @@ mcast_packet_test() return $seen } + +brmcast_check_sg_entries() +{ + local report=$1; shift + local slist=("$@") + local sarg="" + + for src in "${slist[@]}"; do + sarg="${sarg} and .source_list[].address == \"$src\"" + done + bridge -j -d -s mdb show dev br0 \ + | jq -e ".[].mdb[] | \ + select(.grp == \"$TEST_GROUP\" and .source_list != null $sarg)" &>/dev/null + check_err $? "Wrong *,G entry source list after $report report" + + for sgent in "${slist[@]}"; do + bridge -j -d -s mdb show dev br0 \ + | jq -e ".[].mdb[] | \ + select(.grp == \"$TEST_GROUP\" and .src == \"$sgent\")" &>/dev/null + check_err $? "Missing S,G entry ($sgent, $TEST_GROUP)" + done +} + +brmcast_check_sg_fwding() +{ + local should_fwd=$1; shift + local sources=("$@") + + for src in "${sources[@]}"; do + local retval=0 + + mcast_packet_test $TEST_GROUP_MAC $src $TEST_GROUP $h2 $h1 + retval=$? + if [ $should_fwd -eq 1 ]; then + check_fail $retval "Didn't forward traffic from S,G ($src, $TEST_GROUP)" + else + check_err $retval "Forwarded traffic for blocked S,G ($src, $TEST_GROUP)" + fi + done +} + +brmcast_check_sg_state() +{ + local is_blocked=$1; shift + local sources=("$@") + local should_fail=1 + + if [ $is_blocked -eq 1 ]; then + should_fail=0 + fi + + for src in "${sources[@]}"; do + bridge -j -d -s mdb show dev br0 \ + | jq -e ".[].mdb[] | \ + select(.grp == \"$TEST_GROUP\" and .source_list != null) | + .source_list[] | + select(.address == \"$src\") | + select(.timer == \"0.00\")" &>/dev/null + check_err_fail $should_fail $? "Entry $src has zero timer" + + bridge -j -d -s mdb show dev br0 \ + | jq -e ".[].mdb[] | \ + select(.grp == \"$TEST_GROUP\" and .src == \"$src\" and \ + .flags[] == \"blocked\")" &>/dev/null + check_err_fail $should_fail $? "Entry $src has blocked flag" + done +} From patchwork Tue Nov 3 17:24:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 315722 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2CB78C388F7 for ; Tue, 3 Nov 2020 17:25:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E1E67216C4 for ; Tue, 3 Nov 2020 17:24:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=blackwall-org.20150623.gappssmtp.com header.i=@blackwall-org.20150623.gappssmtp.com header.b="CpoVo36j" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728947AbgKCRY7 (ORCPT ); Tue, 3 Nov 2020 12:24:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728768AbgKCRY0 (ORCPT ); Tue, 3 Nov 2020 12:24:26 -0500 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36D72C0613D1 for ; Tue, 3 Nov 2020 09:24:25 -0800 (PST) Received: by mail-wr1-x443.google.com with SMTP id w14so19339724wrs.9 for ; Tue, 03 Nov 2020 09:24:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=blackwall-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KO2EAh20S+jttJfdSLEE5yEDM/k15rSunKbDPOOTJes=; b=CpoVo36jIhGru423S6ZZ+KEA62pfHYhtHX75TAtU4d/iaaVq5dPgh4/L8M0cKeErIK 2wa4ureCWN9627FLkzzejE9Xvkc/S9VfMc2klxTpK28cT1mZUMPmLLFTmhsX1PazLoVy Z4sdZxl7Yp5lXCJlFTTot2JESnzWEZdxOMSlU/SsAagNgWIcSB+wi6RxNGNSXi0mAwJ1 4YeL1Jun58S7SeLe96iGpS4tHmRJ41aBfoSQJQSOUNQ9WAe0MaHbs6IayPNvOiMDyWFH g1JwFfKk+yxKQgcLmoaN4bZpv7X29zfiJbOWmmtIJuSz7sy5zHIOazYvmKhbVFSAn6T3 TbKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KO2EAh20S+jttJfdSLEE5yEDM/k15rSunKbDPOOTJes=; b=aH4UBms5vLcTm6CpD2m2bC4H9WKq7MQjj05H3McxcVa772ArrIga7bUY3PliZKTHy4 Phyqfc1O0kUSVCs07E7NgGLcMq7oO/wkXcd8ugWhEqNzQdJwlsigyxXVwcU8XE/+JhmF tod4rorw6wbGoaiZWM6l6NSbvquvUXn4BfE4jUf+QvPt43LwBECDo/UkBruKW13DpQGM P+e8EnsGm/mjIbSN/smMLgjjq/YvlqOLNs8IYAInlyU0POni47j/qHuc+9CiHkextpse 7e0i8oEbiW42IyGih3v2/xvICX+SOSJViWUf1Tmmsslqo+zz75QFREjuEKN5F6u/EQNb zjsg== X-Gm-Message-State: AOAM5303/GwSjCx9CVv0ErqW7Pm9IfHOSy05Pp2cmSKJvdGuTkD+7+rH tw6/t7SdKmJjl37C2ms2T8Na7ZoW+oBnH5RP X-Google-Smtp-Source: ABdhPJwT5K8GxkYFIBG0R5CzU/wqLGgy8JbIkUS1I0qVzBHyYisJ44b8UUHG8DkVq2dQQ0R3755n2w== X-Received: by 2002:adf:84a5:: with SMTP id 34mr27108832wrg.8.1604424263639; Tue, 03 Nov 2020 09:24: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 a128sm2650795wmf.5.2020.11.03.09.24.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Nov 2020 09:24:23 -0800 (PST) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, kuba@kernel.org, bridge@lists.linux-foundation.org, Nikolay Aleksandrov Subject: [PATCH net-next 06/16] selftests: net: bridge: add test for mldv2 inc -> is_include report Date: Tue, 3 Nov 2020 19:24:02 +0200 Message-Id: <20201103172412.1044840-7-razor@blackwall.org> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20201103172412.1044840-1-razor@blackwall.org> References: <20201103172412.1044840-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Nikolay Aleksandrov The test checks for the following case: Router State Report Received New Router State Actions INCLUDE (A) IS_IN (B) INCLUDE (A+B) (B)=MALI Signed-off-by: Nikolay Aleksandrov --- .../selftests/net/forwarding/bridge_mld.sh | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/net/forwarding/bridge_mld.sh b/tools/testing/selftests/net/forwarding/bridge_mld.sh index accc4ec2dcce..a93bf6fa6caa 100755 --- a/tools/testing/selftests/net/forwarding/bridge_mld.sh +++ b/tools/testing/selftests/net/forwarding/bridge_mld.sh @@ -1,7 +1,7 @@ #!/bin/bash # SPDX-License-Identifier: GPL-2.0 -ALL_TESTS="mldv2include_test mldv2inc_allow_test" +ALL_TESTS="mldv2include_test mldv2inc_allow_test mldv2inc_is_include_test" NUM_NETIFS=4 CHECK_TC="yes" TEST_GROUP="ff02::cc" @@ -13,6 +13,12 @@ MZPKT_IS_INC="33:33:00:00:00:01:fe:54:00:04:5e:ba:86:dd:60:0a:2d:ae:00:54:00:01: 00:05:02:00:00:00:00:8f:00:8e:d9:00:00:00:01:01:00:00:03:ff:02:00:00:00:00:00:00:00:00:00:\ 00:00:00:00:cc:20:01:0d:b8:00:01:00:00:00:00:00:00:00:00:00:01:20:01:0d:b8:00:01:00:00:00:\ 00:00:00:00:00:00:02:20:01:0d:b8:00:01:00:00:00:00:00:00:00:00:00:03" +# MLDv2 is_in report: grp ff02::cc is_include 2001:db8:1::10,2001:db8:1::11,2001:db8:1::12 +MZPKT_IS_INC2="33:33:00:00:00:01:fe:54:00:04:5e:ba:86:dd:60:0a:2d:ae:00:54:00:01:fe:80:00:\ +00:00:00:00:00:fc:54:00:ff:fe:04:5e:ba:ff:02:00:00:00:00:00:00:00:00:00:00:00:00:00:01:3a:00:\ +05:02:00:00:00:00:8f:00:8e:ac:00:00:00:01:01:00:00:03:ff:02:00:00:00:00:00:00:00:00:00:00:00:\ +00:00:cc:20:01:0d:b8:00:01:00:00:00:00:00:00:00:00:00:10:20:01:0d:b8:00:01:00:00:00:00:00:00:\ +00:00:00:11:20:01:0d:b8:00:01:00:00:00:00:00:00:00:00:00:12" # MLDv2 allow report: grp ff02::cc allow 2001:db8:1::10,2001:db8:1::11,2001:db8:1::12 MZPKT_ALLOW="33:33:00:00:00:01:fe:54:00:04:5e:ba:86:dd:60:0a:2d:ae:00:54:00:01:fe:80:00:00:\ 00:00:00:00:fc:54:00:ff:fe:04:5e:ba:ff:02:00:00:00:00:00:00:00:00:00:00:00:00:00:01:3a:00:05:\ @@ -163,6 +169,27 @@ mldv2inc_allow_test() mldv2cleanup $swp1 } +mldv2inc_is_include_test() +{ + RET=0 + local X=("2001:db8:1::10" "2001:db8:1::11" "2001:db8:1::12") + + mldv2include_prepare $h1 + + $MZ $h1 -c 1 $MZPKT_IS_INC2 -q + sleep 1 + brmcast_check_sg_entries "is_include" "${X[@]}" + + brmcast_check_sg_state 0 "${X[@]}" + + brmcast_check_sg_fwding 1 "${X[@]}" + brmcast_check_sg_fwding 0 "2001:db8:1::100" + + log_test "MLDv2 report $TEST_GROUP include -> is_include" + + mldv2cleanup $swp1 +} + trap cleanup EXIT setup_prepare From patchwork Tue Nov 3 17:24:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 315727 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7C8EC55179 for ; Tue, 3 Nov 2020 17:24:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5BA9F21556 for ; Tue, 3 Nov 2020 17:24:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=blackwall-org.20150623.gappssmtp.com header.i=@blackwall-org.20150623.gappssmtp.com header.b="1e+O5yiB" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728826AbgKCRYb (ORCPT ); Tue, 3 Nov 2020 12:24:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728805AbgKCRY2 (ORCPT ); Tue, 3 Nov 2020 12:24:28 -0500 Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33235C0617A6 for ; Tue, 3 Nov 2020 09:24:28 -0800 (PST) Received: by mail-wm1-x341.google.com with SMTP id c18so102450wme.2 for ; Tue, 03 Nov 2020 09:24:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=blackwall-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1i5q0YkqyzRPr4Kh/KGjP2SBAhGipIHGU89Hep2TGE0=; b=1e+O5yiBFEYPKp1Jd9+xgaLFeAjF+kkDWYgx4mFAh7dqU582fGfwPeIiFnvu79X4Mj 9tJKUhZonsunlHvi0qIwvJrqXvSyFXsiuxj2uvPt2HKGKYEb0Yxi74jThztzQt8vIH6q HjJCrvW500Ue1me2PhW5EmePy53bAUVbMMZgsBPmSLJ9GOUaGgmTXbYdImnf4LlcaL0g q8e7RP+ryroHh2Yu6PK4REjdmjFkdHFiupaYoS0wMdp7B7l5hx+9FFbKA3QSiWuRbGJI 7QZklcypiozBHFxIfbA6FkMfuaL7kV0MSw3H8mBsoW+OzH3bjPCttao0asgudyEZvJLH 1Fkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1i5q0YkqyzRPr4Kh/KGjP2SBAhGipIHGU89Hep2TGE0=; b=SxTfnce84HH2Fb3ikP1rCR6bFAmF+oeF4guBWGpYF2sXF4oBnzgmiH7q9XgI/+clhN zV4BVCzAZbc0KrYquVMeDkgHkyhrpWoFDUiDk5tvAnlCXhJW/rBHimjHCFNfZgj8XaFV IdsRYyfhyKI1uI0uJUuUcikSgTQ130T8wtrMyL9K5rIIl/aBc4QkEcRa/6PV6RLMyIkX TuOrKqmlukRGj/TtC/9DI4AtWESLUdapWUWmIGtwDUWjyWcl/Y3EIC9KWwGjzhgV5/nT D0Z8oIBXuRtWsUn9QPPYzWqcs0sx50MTO1LR/dVyukjt0QXgMMkcNcFsw5weRp/cxX/4 cGlg== X-Gm-Message-State: AOAM533M1mJiVdolWScOgfCqkSumLt5EA52gfxPz+NygjPXzyzWsI/zB aMCQoAUIm3Id/9AlJMMWiZ/MLsJRjQpBGMMk X-Google-Smtp-Source: ABdhPJzEHscs3jX6/BfAprDhr68pfn7/itqEpzTTrSfwePJ/Esz9/TA4fPMWGb3bzGgPCmqNNow1XQ== X-Received: by 2002:a1c:8194:: with SMTP id c142mr217506wmd.94.1604424266561; Tue, 03 Nov 2020 09:24: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 a128sm2650795wmf.5.2020.11.03.09.24.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Nov 2020 09:24:26 -0800 (PST) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, kuba@kernel.org, bridge@lists.linux-foundation.org, Nikolay Aleksandrov Subject: [PATCH net-next 09/16] selftests: net: bridge: add test for mldv2 exc -> allow report Date: Tue, 3 Nov 2020 19:24:05 +0200 Message-Id: <20201103172412.1044840-10-razor@blackwall.org> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20201103172412.1044840-1-razor@blackwall.org> References: <20201103172412.1044840-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Nikolay Aleksandrov The test checks for the following case: Router State Report Received New Router State Actions EXCLUDE (X,Y) ALLOW (A) EXCLUDE (X+A,Y-A) (A)=MALI Signed-off-by: Nikolay Aleksandrov --- .../selftests/net/forwarding/bridge_mld.sh | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/net/forwarding/bridge_mld.sh b/tools/testing/selftests/net/forwarding/bridge_mld.sh index 571b01ef672c..97882c13f278 100755 --- a/tools/testing/selftests/net/forwarding/bridge_mld.sh +++ b/tools/testing/selftests/net/forwarding/bridge_mld.sh @@ -2,7 +2,7 @@ # SPDX-License-Identifier: GPL-2.0 ALL_TESTS="mldv2include_test mldv2inc_allow_test mldv2inc_is_include_test mldv2inc_is_exclude_test \ - mldv2inc_to_exclude_test" + mldv2inc_to_exclude_test mldv2exc_allow_test" NUM_NETIFS=4 CHECK_TC="yes" TEST_GROUP="ff02::cc" @@ -26,6 +26,11 @@ MZPKT_ALLOW="33:33:00:00:00:01:fe:54:00:04:5e:ba:86:dd:60:0a:2d:ae:00:54:00:01:f 02:00:00:00:00:8f:00:8a:ac:00:00:00:01:05:00:00:03:ff:02:00:00:00:00:00:00:00:00:00:00:00:00:\ 00:cc:20:01:0d:b8:00:01:00:00:00:00:00:00:00:00:00:10:20:01:0d:b8:00:01:00:00:00:00:00:00:00:\ 00:00:11:20:01:0d:b8:00:01:00:00:00:00:00:00:00:00:00:12" +# MLDv2 allow report: grp ff02::cc allow 2001:db8:1::20,2001:db8:1::30 +MZPKT_ALLOW2="33:33:00:00:00:01:fe:54:00:04:5e:ba:86:dd:60:0a:2d:ae:00:44:00:01:fe:80:00:00:00:\ +00:00:00:fc:54:00:ff:fe:04:5e:ba:ff:02:00:00:00:00:00:00:00:00:00:00:00:00:00:01:3a:00:05:02:00:\ +00:00:00:8f:00:b8:5a:00:00:00:01:05:00:00:02:ff:02:00:00:00:00:00:00:00:00:00:00:00:00:00:cc:20:\ +01:0d:b8:00:01:00:00:00:00:00:00:00:00:00:20:20:01:0d:b8:00:01:00:00:00:00:00:00:00:00:00:30" # MLDv2 is_ex report: grp ff02::cc is_exclude 2001:db8:1::1,2001:db8:1::2,2001:db8:1::20,2001:db8:1::21 MZPKT_IS_EXC="33:33:00:00:00:01:fe:54:00:04:5e:ba:86:dd:60:0a:2d:ae:00:64:00:01:fe:80:00:00:00:\ 00:00:00:fc:54:00:ff:fe:04:5e:ba:ff:02:00:00:00:00:00:00:00:00:00:00:00:00:00:01:3a:00:05:02:00:\ @@ -296,6 +301,29 @@ mldv2inc_to_exclude_test() mldv2cleanup $swp1 } +mldv2exc_allow_test() +{ + RET=0 + local X=("2001:db8:1::1" "2001:db8:1::2" "2001:db8:1::20" "2001:db8:1::30") + local Y=("2001:db8:1::21") + + mldv2exclude_prepare $h1 + + $MZ $h1 -c 1 $MZPKT_ALLOW2 -q + sleep 1 + brmcast_check_sg_entries "allow" "${X[@]}" "${Y[@]}" + + brmcast_check_sg_state 0 "${X[@]}" + brmcast_check_sg_state 1 "${Y[@]}" + + brmcast_check_sg_fwding 1 "${X[@]}" 2001:db8:1::100 + brmcast_check_sg_fwding 0 "${Y[@]}" + + log_test "MLDv2 report $TEST_GROUP exclude -> allow" + + mldv2cleanup $swp1 +} + trap cleanup EXIT setup_prepare From patchwork Tue Nov 3 17:24:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 315726 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D74B6C2D0A3 for ; Tue, 3 Nov 2020 17:24:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8C09722264 for ; Tue, 3 Nov 2020 17:24:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=blackwall-org.20150623.gappssmtp.com header.i=@blackwall-org.20150623.gappssmtp.com header.b="PwZpr/Cg" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728853AbgKCRYe (ORCPT ); Tue, 3 Nov 2020 12:24:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728805AbgKCRYb (ORCPT ); Tue, 3 Nov 2020 12:24:31 -0500 Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 441B4C061A04 for ; Tue, 3 Nov 2020 09:24:31 -0800 (PST) Received: by mail-wm1-x341.google.com with SMTP id 205so85575wma.4 for ; Tue, 03 Nov 2020 09:24:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=blackwall-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5omufXisHiGeceucrVlpU04whsxgLcRcTFbs2Kn5Krg=; b=PwZpr/Cg4gZJf7QDpiN8c3rht0+scf85e7FTrVdSxG1DxBtvGNn771zi2rtjHbQLjc jAAPWayS9osj34H+tRvUj5W/LJjOtzVGz7+NO5g3lS9cOedTFZxZR/nSmakaxIa+8g07 k8GujvckHla5iZNh5hnB0vgf4AtOCKfyrJ6ZrmSMMzF3dCBkpylhOICfwcJjugXaRW/L 98GC5r6Q1yKiXB5dcjUSRDSNQ8V5SLcM7Saf2rSIxuP50PamOQlfWLw3TuysLZwCHczC n7LO7ErGEpfyY2hx+sa1hctfg4YL+vWtQrL2lOAxs2STUWGc6Kak0mxLqScLO+ekR4HP Cibw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5omufXisHiGeceucrVlpU04whsxgLcRcTFbs2Kn5Krg=; b=grcRtmTyGcYHbmrXkd1ESWOe8pWpI3tVEmnBBSQX7vRAkgR5CR+lOv4mlwkCug3U3j VQQV3IQ+L0k6GnXvcUAPsKXk2Y+xpyoyOxJbE6gy4Lz+Fddu2oFBUwUZjcaN/vQrzzXS F/S5wToVcnplkD5XUBvNPyx7cSFLNQTOxHniBHXLIP5VKXJABERjiZTT+okEnfXegxGA u86u+3ZEhLEpV0Bb6u1nVit/UzFIch62HjA+S5ZWDoXDn5yGew2bEzU2PmoRDMSV5Qlt /wUKPDUiqBAGZDzLnopV6TXM+fxxkhq/7FiHMHYVONVRg3vqDgDQaMZ0oy0ZbFb3lPDU voig== X-Gm-Message-State: AOAM530O56veKRL9iBeeJxKOxkzkU5IIi7lyUyHuePpE2b160SqWf8L5 AvlCvUUUazzTu0wQdNkHwQorh/63o5HgB+Nz X-Google-Smtp-Source: ABdhPJw7YQqxc9h1LI4jJ/h8YilAjdO7Rc52iqX6kaQXnBVSruC7At7I/tgH9CKGpoR/qOZ8NvJQOw== X-Received: by 2002:a1c:2c2:: with SMTP id 185mr178744wmc.103.1604424269694; Tue, 03 Nov 2020 09:24: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 a128sm2650795wmf.5.2020.11.03.09.24.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Nov 2020 09:24:29 -0800 (PST) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, kuba@kernel.org, bridge@lists.linux-foundation.org, Nikolay Aleksandrov Subject: [PATCH net-next 12/16] selftests: net: bridge: add test for mldv2 exc -> to_exclude report Date: Tue, 3 Nov 2020 19:24:08 +0200 Message-Id: <20201103172412.1044840-13-razor@blackwall.org> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20201103172412.1044840-1-razor@blackwall.org> References: <20201103172412.1044840-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Nikolay Aleksandrov The test checks for the following case: Router State Report Received New Router State Actions EXCLUDE (X,Y) TO_EX (A) EXCLUDE (A-Y,Y*A) (A-X-Y) = Filter Timer Delete (X-A) Delete (Y-A) Send Q(MA,A-Y) Filter Timer=MALI Signed-off-by: Nikolay Aleksandrov --- .../selftests/net/forwarding/bridge_mld.sh | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/net/forwarding/bridge_mld.sh b/tools/testing/selftests/net/forwarding/bridge_mld.sh index 0f48c8da041b..024fa22fa3c2 100755 --- a/tools/testing/selftests/net/forwarding/bridge_mld.sh +++ b/tools/testing/selftests/net/forwarding/bridge_mld.sh @@ -3,7 +3,7 @@ ALL_TESTS="mldv2include_test mldv2inc_allow_test mldv2inc_is_include_test mldv2inc_is_exclude_test \ mldv2inc_to_exclude_test mldv2exc_allow_test mldv2exc_is_include_test \ - mldv2exc_is_exclude_test" + mldv2exc_is_exclude_test mldv2exc_to_exclude_test" NUM_NETIFS=4 CHECK_TC="yes" TEST_GROUP="ff02::cc" @@ -381,6 +381,34 @@ mldv2exc_is_exclude_test() mldv2cleanup $swp1 } +mldv2exc_to_exclude_test() +{ + RET=0 + local X=("2001:db8:1::1" "2001:db8:1::30") + local Y=("2001:db8:1::20") + + mldv2exclude_prepare $h1 + + ip link set dev br0 type bridge mcast_last_member_interval 500 + check_err $? "Could not change mcast_last_member_interval to 5s" + + $MZ $h1 -c 1 $MZPKT_TO_EXC -q + sleep 1 + brmcast_check_sg_entries "to_exclude" "${X[@]}" "${Y[@]}" + + brmcast_check_sg_state 0 "${X[@]}" + brmcast_check_sg_state 1 "${Y[@]}" + + brmcast_check_sg_fwding 1 "${X[@]}" 2001:db8:1::100 + brmcast_check_sg_fwding 0 "${Y[@]}" + + log_test "MLDv2 report $TEST_GROUP exclude -> to_exclude" + + ip link set dev br0 type bridge mcast_last_member_interval 100 + + mldv2cleanup $swp1 +} + trap cleanup EXIT setup_prepare From patchwork Tue Nov 3 17:24:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 315725 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4FAEEC2D0A3 for ; Tue, 3 Nov 2020 17:24:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 07CD5216C4 for ; Tue, 3 Nov 2020 17:24:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=blackwall-org.20150623.gappssmtp.com header.i=@blackwall-org.20150623.gappssmtp.com header.b="X4427bX6" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728878AbgKCRYi (ORCPT ); Tue, 3 Nov 2020 12:24:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728833AbgKCRYc (ORCPT ); Tue, 3 Nov 2020 12:24:32 -0500 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43620C0613D1 for ; Tue, 3 Nov 2020 09:24:32 -0800 (PST) Received: by mail-wm1-x32e.google.com with SMTP id p22so99818wmg.3 for ; Tue, 03 Nov 2020 09:24:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=blackwall-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bc4VDKLFfRtDvy2e5Zsnlq8PlNzZNU+VRXlP4XcvGWU=; b=X4427bX6KLsZipwexz/bDyeMNMiQP7dxD1gBoGluxdYi4uUpRPahjavU8I2OPUbaLU CYNGUaBqR7oEu0AEqgLZgAh4ONIL3jiT+pCEO/YaLn88SBrNNr07dMHFEDowxZtTUcDs VmWswbOVWjzDaZmSaHhwUK+r5MFFv/n9AtV/dRWF+wnlEb8QRvM6GuEy6ZjMOf+UKqBX VW+uhzXEijsYEvQ+U4HPtFcfjEOeQHAi39ArEGi88eZEQLxwT1gaNIYeFnfbhm4KHGUa gT4AaKo38jLrPjdeGslVvnd56JcTXap7LpOvbh9GS8C6FhxfKWE/lqud+3nAF7Rg2Vdj Qq/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bc4VDKLFfRtDvy2e5Zsnlq8PlNzZNU+VRXlP4XcvGWU=; b=JYY7IF5RuDlleA6YV8v2IOVXgeD5GPiY1w6QAkaL/ttYjQl4DNzX0fzKkBKuEC0FrX 7XDwen3QxIn4Lh971LJoQJHXE0ebWpYONSxMg8A05OJQsmYiyLu3BGYbHqpM7NzTGQVa MV2PPsNavzB9N5ZFvhp8YGHHaDzv4zOODwkKQh2o9FCI93dZYt3cowNrtXA4ynWT4kme iiQQ55V7oke4sClr9zItwSWb/etQ8zK3Wm/e6QraqpHCm2aRztDMw9iEeVsJemIjJa/P /+7aFUOTvWRxFn/qVyWCaXA2DRWnjyv4Vjplo0SUEnm2euTd7WUOBW7UtAdu/7+TmHty Gi3Q== X-Gm-Message-State: AOAM530g3xwGTnVPcgOuTp1QXVp6MB+XoAPLMFtP/wn37FXO3bh7xgWl fKEqXRrynxQZTikgBuWBmGJOb/iln+K9qD69 X-Google-Smtp-Source: ABdhPJxFu4be/8zPQYWMfSKDaM79AsTb/5bF87GhkTA9eWGRnR31eTjQ3S1PzIeG+yZKSzv0Kj9+nA== X-Received: by 2002:a1c:3846:: with SMTP id f67mr200371wma.33.1604424270730; Tue, 03 Nov 2020 09:24:30 -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 a128sm2650795wmf.5.2020.11.03.09.24.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Nov 2020 09:24:30 -0800 (PST) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, kuba@kernel.org, bridge@lists.linux-foundation.org, Nikolay Aleksandrov Subject: [PATCH net-next 13/16] selftests: net: bridge: add test for mldv2 inc -> block report Date: Tue, 3 Nov 2020 19:24:09 +0200 Message-Id: <20201103172412.1044840-14-razor@blackwall.org> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20201103172412.1044840-1-razor@blackwall.org> References: <20201103172412.1044840-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Nikolay Aleksandrov The test checks for the following case: Router State Report Received New Router State Actions INCLUDE (A) BLOCK (B) INCLUDE (A) Send Q(MA,A*B) Signed-off-by: Nikolay Aleksandrov --- .../selftests/net/forwarding/bridge_mld.sh | 37 ++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/net/forwarding/bridge_mld.sh b/tools/testing/selftests/net/forwarding/bridge_mld.sh index 024fa22fa3c2..a3c405b2fd6f 100755 --- a/tools/testing/selftests/net/forwarding/bridge_mld.sh +++ b/tools/testing/selftests/net/forwarding/bridge_mld.sh @@ -3,7 +3,7 @@ ALL_TESTS="mldv2include_test mldv2inc_allow_test mldv2inc_is_include_test mldv2inc_is_exclude_test \ mldv2inc_to_exclude_test mldv2exc_allow_test mldv2exc_is_include_test \ - mldv2exc_is_exclude_test mldv2exc_to_exclude_test" + mldv2exc_is_exclude_test mldv2exc_to_exclude_test mldv2inc_block_test" NUM_NETIFS=4 CHECK_TC="yes" TEST_GROUP="ff02::cc" @@ -54,6 +54,12 @@ MZPKT_TO_EXC="33:33:00:00:00:01:fe:54:00:04:5e:ba:86:dd:60:0a:2d:ae:00:54:00:01: 00:00:00:8f:00:8b:8e:00:00:00:01:04:00:00:03:ff:02:00:00:00:00:00:00:00:00:00:00:00:00:00:cc:20:\ 01:0d:b8:00:01:00:00:00:00:00:00:00:00:00:01:20:01:0d:b8:00:01:00:00:00:00:00:00:00:00:00:20:20:\ 01:0d:b8:00:01:00:00:00:00:00:00:00:00:00:30" +# MLDv2 block report: grp ff02::cc block 2001:db8:1::1,2001:db8:1::20,2001:db8:1::30 +MZPKT_BLOCK="33:33:00:00:00:01:fe:54:00:04:5e:ba:86:dd:60:0a:2d:ae:00:54:00:01:fe:80:00:00:00:00:\ +00:00:fc:54:00:ff:fe:04:5e:ba:ff:02:00:00:00:00:00:00:00:00:00:00:00:00:00:01:3a:00:05:02:00:00:\ +00:00:8f:00:89:8e:00:00:00:01:06:00:00:03:ff:02:00:00:00:00:00:00:00:00:00:00:00:00:00:cc:20:01:\ +0d:b8:00:01:00:00:00:00:00:00:00:00:00:01:20:01:0d:b8:00:01:00:00:00:00:00:00:00:00:00:20:20:01:\ +0d:b8:00:01:00:00:00:00:00:00:00:00:00:30" source lib.sh @@ -409,6 +415,35 @@ mldv2exc_to_exclude_test() mldv2cleanup $swp1 } +mldv2inc_block_test() +{ + RET=0 + local X=("2001:db8:1::2" "2001:db8:1::3") + + mldv2include_prepare $h1 + + $MZ $h1 -c 1 $MZPKT_BLOCK -q + # make sure the lowered timers have expired (by default 2 seconds) + sleep 3 + brmcast_check_sg_entries "block" "${X[@]}" + + brmcast_check_sg_state 0 "${X[@]}" + + bridge -j -d -s mdb show dev br0 \ + | jq -e ".[].mdb[] | \ + select(.grp == \"$TEST_GROUP\" and \ + .source_list != null and + .source_list[].address == \"2001:db8:1::1\")" &>/dev/null + check_fail $? "Wrong *,G entry source list, 2001:db8:1::1 entry still exists" + + brmcast_check_sg_fwding 1 "${X[@]}" + brmcast_check_sg_fwding 0 2001:db8:1::100 + + log_test "MLDv2 report $TEST_GROUP include -> block" + + mldv2cleanup $swp1 +} + trap cleanup EXIT setup_prepare From patchwork Tue Nov 3 17:24:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 315724 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD620C2D0A3 for ; Tue, 3 Nov 2020 17:24:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 86C5021556 for ; Tue, 3 Nov 2020 17:24:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=blackwall-org.20150623.gappssmtp.com header.i=@blackwall-org.20150623.gappssmtp.com header.b="MVxyWoYM" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728895AbgKCRYm (ORCPT ); Tue, 3 Nov 2020 12:24:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728850AbgKCRYf (ORCPT ); Tue, 3 Nov 2020 12:24:35 -0500 Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3ABEDC0613D1 for ; Tue, 3 Nov 2020 09:24:34 -0800 (PST) Received: by mail-wm1-x341.google.com with SMTP id c18so102749wme.2 for ; Tue, 03 Nov 2020 09:24:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=blackwall-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gOOQHtOX6w4d/nnhTN7xuIIArAAXX7jfcR/5MZf9CcQ=; b=MVxyWoYMT/dNrrNoy0pKOM7oUG4gcNl0f7D/EXoZgrUK7eMdDa3wkQNasvjtRxHlju O0zIVwVyE4N+SRFeN9Lie40vPtXDqLSrNkhgiMEJz7kpPXDznc3xKDsUsJpuXlBsKpow 0ROekGogck6G+AaLClyE6EvuBQmj+A3TRKn5BnL2j+SHENh+/qK2L9Bw3pB4jXj4bhjR qjmHX55W+6CDuvdDrO6/xWYQ8bJWor57vWQudWp45oDDX+mwGGxQGD4Yht0vN6XdfFEx +32xRLunOOkxHblgEfFzDsPhn35PIp65Na+TJTvtB4khw2BhPH3OFaD1NM8tJelXgFV1 rFxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gOOQHtOX6w4d/nnhTN7xuIIArAAXX7jfcR/5MZf9CcQ=; b=ZoukKep8S6xj0EhsABvQVXxT8yh+fysD3IOTy7EfrAtFzPY8tt5PdmpgP/W8eI+CRb Z7jb9VpR5+UFTAJ8AIIueQYjJJMjw/ATJrV9RZusvNwRBJMSlAIcvhqc8Dh7sMlOh0x+ 6tktytmdGS4V93LakePNmFSpVTdQJZzqevFWOg35mtufkMp5yeN90Mp2O4QUMBxNI+hk gVMHIcHN0QdgBHBXwPaj4GS8AY6a2gcgZV35lQLfUhIurszkSM0oZrXz7STL6waMvFy6 UH9zyDAiXUwCxZg/6FVmpFyieHfK7uWIBFQDM7rDLWh7t8byEZMLlp65t1gOA1p2/vVH //Dw== X-Gm-Message-State: AOAM533743rmG8WFmqPoNeWw+2JaChFjGrCL0Wy00TgbWpcEeb4AzG5Y Rqtn/9chmOszvpsMuWpe3bAW3bHP+WYF95OT X-Google-Smtp-Source: ABdhPJwpIo7PahMGlPfdl8VLdYvwUQ68+oeROQ9Hgi5d4uO/c99jWh3GMWf9AmtP7f2aKwU3sdfpzQ== X-Received: by 2002:a1c:2d8f:: with SMTP id t137mr237414wmt.26.1604424272680; Tue, 03 Nov 2020 09:24:32 -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 a128sm2650795wmf.5.2020.11.03.09.24.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Nov 2020 09:24:32 -0800 (PST) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, kuba@kernel.org, bridge@lists.linux-foundation.org, Nikolay Aleksandrov Subject: [PATCH net-next 15/16] selftests: net: bridge: add test for mldv2 exclude timeout Date: Tue, 3 Nov 2020 19:24:11 +0200 Message-Id: <20201103172412.1044840-16-razor@blackwall.org> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20201103172412.1044840-1-razor@blackwall.org> References: <20201103172412.1044840-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Nikolay Aleksandrov Test that when a group in exclude mode expires it changes mode to include and the blocked entries are deleted. Signed-off-by: Nikolay Aleksandrov --- .../selftests/net/forwarding/bridge_mld.sh | 48 ++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/net/forwarding/bridge_mld.sh b/tools/testing/selftests/net/forwarding/bridge_mld.sh index c498e51b8d2b..b34cf4c6ceba 100755 --- a/tools/testing/selftests/net/forwarding/bridge_mld.sh +++ b/tools/testing/selftests/net/forwarding/bridge_mld.sh @@ -4,7 +4,7 @@ ALL_TESTS="mldv2include_test mldv2inc_allow_test mldv2inc_is_include_test mldv2inc_is_exclude_test \ mldv2inc_to_exclude_test mldv2exc_allow_test mldv2exc_is_include_test \ mldv2exc_is_exclude_test mldv2exc_to_exclude_test mldv2inc_block_test \ - mldv2exc_block_test" + mldv2exc_block_test mldv2exc_timeout_test" NUM_NETIFS=4 CHECK_TC="yes" TEST_GROUP="ff02::cc" @@ -473,6 +473,52 @@ mldv2exc_block_test() mldv2cleanup $swp1 } +mldv2exc_timeout_test() +{ + RET=0 + local X=("2001:db8:1::20" "2001:db8:1::30") + + # GMI should be 3 seconds + ip link set dev br0 type bridge mcast_query_interval 100 mcast_query_response_interval 100 + + mldv2exclude_prepare $h1 + ip link set dev br0 type bridge mcast_query_interval 500 mcast_query_response_interval 500 + $MZ $h1 -c 1 $MZPKT_ALLOW2 -q + sleep 3 + bridge -j -d -s mdb show dev br0 \ + | jq -e ".[].mdb[] | \ + select(.grp == \"$TEST_GROUP\" and \ + .source_list != null and .filter_mode == \"include\")" &>/dev/null + check_err $? "Wrong *,G entry filter mode" + + bridge -j -d -s mdb show dev br0 \ + | jq -e ".[].mdb[] | \ + select(.grp == \"$TEST_GROUP\" and \ + .source_list != null and + .source_list[].address == \"2001:db8:1::1\")" &>/dev/null + check_fail $? "Wrong *,G entry source list, 2001:db8:1::1 entry still exists" + bridge -j -d -s mdb show dev br0 \ + | jq -e ".[].mdb[] | \ + select(.grp == \"$TEST_GROUP\" and \ + .source_list != null and + .source_list[].address == \"2001:db8:1::2\")" &>/dev/null + check_fail $? "Wrong *,G entry source list, 2001:db8:1::2 entry still exists" + + brmcast_check_sg_entries "allow" "${X[@]}" + + brmcast_check_sg_state 0 "${X[@]}" + + brmcast_check_sg_fwding 1 "${X[@]}" + brmcast_check_sg_fwding 0 2001:db8:1::100 + + log_test "MLDv2 group $TEST_GROUP exclude timeout" + + ip link set dev br0 type bridge mcast_query_interval 12500 \ + mcast_query_response_interval 1000 + + mldv2cleanup $swp1 +} + trap cleanup EXIT setup_prepare From patchwork Tue Nov 3 17:24:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 315723 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB179C55178 for ; Tue, 3 Nov 2020 17:24:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A7A49216C4 for ; Tue, 3 Nov 2020 17:24:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=blackwall-org.20150623.gappssmtp.com header.i=@blackwall-org.20150623.gappssmtp.com header.b="g+69WtLf" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728915AbgKCRYp (ORCPT ); Tue, 3 Nov 2020 12:24:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728867AbgKCRYg (ORCPT ); Tue, 3 Nov 2020 12:24:36 -0500 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A02CC0617A6 for ; Tue, 3 Nov 2020 09:24:35 -0800 (PST) Received: by mail-wm1-x344.google.com with SMTP id 205so85705wma.4 for ; Tue, 03 Nov 2020 09:24:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=blackwall-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gJvu8f2jgbnJqs1NY6YsP4oxwkKYOvAd3eazDvKS0GI=; b=g+69WtLfjhgsl+7v0a3curceaiZQaK+hNEG0UuCK88gnmq2yKLMI9heFnt7ZKzGER2 Krxonchdb+j3nEXNS0BRqY2EaTllTf7rOwW+4up+hQ8B+OGtVmmoRnvw7HVjgY2Nkjgv magldk+KL2ncKXmYUK7YkFEYKcdfWrYzRjvAtYiqoDSjgKO/I3fMhfWecpefFk9yt6IL ixzvd6YWlVHWH4oEVmQ0iWY6oxqc3i45CSp72DJ/Q+gUmAl6VCJECo6z1WdpOMWtMzTF lPIazRPIzkQtePTpdEnEE9kdGG7axZtUHDsCaShXU9Q+5EWXLwsKnf3jEeXc2uRxwj+X xDHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gJvu8f2jgbnJqs1NY6YsP4oxwkKYOvAd3eazDvKS0GI=; b=gJ7DXEzXDQ9Njt8hmJa4R3wmkJArq+TBbJcNFGNn50jiboHJ9UHE4axsVRP9zmu8LW vEoJm1EZNB8bQ1rfZiSWQmGLm4lhdWhqofuzx/hzskGQ+Bqjr/7VBR8UVbtxzWUOpER8 HCV2Yc81Fu05I/V2jRw1hf4k9hE/1Olw+MpSJLZACQpoiUma2rWtGVfjybonYWco9T+l Lcm8VqqpStR0R1nHA98KJrqnmEZyjwYBUWQppYya30P/kKDaOT6A75rx6vM/oJ+smGaj ZK0Pph8R/GUZkDxwREbiV9pk0lFsRC30Krh+1X+9/synPe0FqaoAv11b0s6HbIId1fI6 8smQ== X-Gm-Message-State: AOAM530NjJ213hZ1JEZ0Za3Dq710Ml53nrQTZAWbnZC0cgm+xhluAAHF f2+FirO3sq59srvPy+MaLazrHFzkA4aHokgE X-Google-Smtp-Source: ABdhPJwZAIOV+nauKiS1IVebL2y9F3nncAa9ZEJ3reSeuzMIOvHbbW1qxa46xQmzLf+ycR3MG7CueQ== X-Received: by 2002:a1c:8194:: with SMTP id c142mr218010wmd.94.1604424273589; Tue, 03 Nov 2020 09:24:33 -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 a128sm2650795wmf.5.2020.11.03.09.24.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Nov 2020 09:24:33 -0800 (PST) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, kuba@kernel.org, bridge@lists.linux-foundation.org, Nikolay Aleksandrov Subject: [PATCH net-next 16/16] selftests: net: bridge: add test for mldv2 *, g auto-add Date: Tue, 3 Nov 2020 19:24:12 +0200 Message-Id: <20201103172412.1044840-17-razor@blackwall.org> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20201103172412.1044840-1-razor@blackwall.org> References: <20201103172412.1044840-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Nikolay Aleksandrov When we have *,G ports in exclude mode and a new S,G,port is added the kernel has to automatically create an S,G entry for each exclude port to get proper forwarding. Signed-off-by: Nikolay Aleksandrov --- .../selftests/net/forwarding/bridge_mld.sh | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/net/forwarding/bridge_mld.sh b/tools/testing/selftests/net/forwarding/bridge_mld.sh index b34cf4c6ceba..ffdcfa87ca2b 100755 --- a/tools/testing/selftests/net/forwarding/bridge_mld.sh +++ b/tools/testing/selftests/net/forwarding/bridge_mld.sh @@ -4,7 +4,7 @@ ALL_TESTS="mldv2include_test mldv2inc_allow_test mldv2inc_is_include_test mldv2inc_is_exclude_test \ mldv2inc_to_exclude_test mldv2exc_allow_test mldv2exc_is_include_test \ mldv2exc_is_exclude_test mldv2exc_to_exclude_test mldv2inc_block_test \ - mldv2exc_block_test mldv2exc_timeout_test" + mldv2exc_block_test mldv2exc_timeout_test mldv2star_ex_auto_add_test" NUM_NETIFS=4 CHECK_TC="yes" TEST_GROUP="ff02::cc" @@ -519,6 +519,35 @@ mldv2exc_timeout_test() mldv2cleanup $swp1 } +mldv2star_ex_auto_add_test() +{ + RET=0 + + mldv2exclude_prepare $h1 + + $MZ $h2 -c 1 $MZPKT_IS_INC -q + sleep 1 + bridge -j -d -s mdb show dev br0 \ + | jq -e ".[].mdb[] | \ + select(.grp == \"$TEST_GROUP\" and .src == \"2001:db8:1::3\" and \ + .port == \"$swp1\")" &>/dev/null + check_err $? "S,G entry for *,G port doesn't exist" + + bridge -j -d -s mdb show dev br0 \ + | jq -e ".[].mdb[] | \ + select(.grp == \"$TEST_GROUP\" and .src == \"2001:db8:1::3\" and \ + .port == \"$swp1\" and \ + .flags[] == \"added_by_star_ex\")" &>/dev/null + check_err $? "Auto-added S,G entry doesn't have added_by_star_ex flag" + + brmcast_check_sg_fwding 1 2001:db8:1::3 + + log_test "MLDv2 S,G port entry automatic add to a *,G port" + + mldv2cleanup $swp1 + mldv2cleanup $swp2 +} + trap cleanup EXIT setup_prepare