bridge.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Petr Machata <petrm@nvidia.com>
To: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Roopa Prabhu <roopa@nvidia.com>,
	Nikolay Aleksandrov <razor@blackwall.org>,
	netdev@vger.kernel.org
Cc: Petr Machata <petrm@nvidia.com>, Ido Schimmel <idosch@nvidia.com>,
	bridge@lists.linux-foundation.org
Subject: [Bridge] [PATCH net-next mlxsw v2 14/16] selftests: forwarding: lib: Allow list of IPs for IGMPv3/MLDv2
Date: Wed, 1 Feb 2023 18:28:47 +0100	[thread overview]
Message-ID: <c23017aace3d1c5f7746f0a2a54c7bcb60851c85.1675271084.git.petrm@nvidia.com> (raw)
In-Reply-To: <cover.1675271084.git.petrm@nvidia.com>

The testsuite that checks for mcast_max_groups functionality will need
to generate IGMP and MLD packets with configurable number of (S,G)
addresses. To that end, further extend igmpv3_is_in_get() and
mldv2_is_in_get() to allow a list of IP addresses instead of one
address.

Signed-off-by: Petr Machata <petrm@nvidia.com>
Acked-by: Nikolay Aleksandrov <razor@blackwall.org>
---
 tools/testing/selftests/net/forwarding/lib.sh | 22 +++++++++++++------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh
index 190e49e60508..12ef34ebcbbf 100755
--- a/tools/testing/selftests/net/forwarding/lib.sh
+++ b/tools/testing/selftests/net/forwarding/lib.sh
@@ -1789,11 +1789,12 @@ payload_template_nbytes()
 igmpv3_is_in_get()
 {
 	local GRP=$1; shift
-	local IP=$1; shift
+	local sources=("$@")
 
 	local igmpv3
+	local nsources=$(u16_to_bytes ${#sources[@]})
 
-	# IS_IN ( $IP )
+	# IS_IN ( $sources )
 	igmpv3=$(:
 		)"22:"$(			: Type - Membership Report
 		)"00:"$(			: Reserved
@@ -1802,9 +1803,12 @@ igmpv3_is_in_get()
 		)"00:01:"$(			: Number of Group Records
 		)"01:"$(			: Record Type - IS_IN
 		)"00:"$(			: Aux Data Len
-		)"00:01:"$(			: Number of Sources
+		)"${nsources}:"$(		: Number of Sources
 		)"$(ipv4_to_bytes $GRP):"$(	: Multicast Address
-		)"$(ipv4_to_bytes $IP)"$(	: Source Address
+		)"$(for src in "${sources[@]}"; do
+			ipv4_to_bytes $src
+			echo -n :
+		    done)"$(			: Source Addresses
 		)
 	local checksum=$(payload_template_calc_checksum "$igmpv3")
 
@@ -1815,10 +1819,11 @@ mldv2_is_in_get()
 {
 	local SIP=$1; shift
 	local GRP=$1; shift
-	local IP=$1; shift
+	local sources=("$@")
 
 	local hbh
 	local icmpv6
+	local nsources=$(u16_to_bytes ${#sources[@]})
 
 	hbh=$(:
 		)"3a:"$(			: Next Header - ICMPv6
@@ -1834,9 +1839,12 @@ mldv2_is_in_get()
 		)"00:01:"$(			: Number of Group Records
 		)"01:"$(			: Record Type - IS_IN
 		)"00:"$(			: Aux Data Len
-		)"00:01:"$(			: Number of Sources
+		)"${nsources}:"$(		: Number of Sources
 		)"$(ipv6_to_bytes $GRP):"$(	: Multicast address
-		)"$(ipv6_to_bytes $IP):"$(	: Source Address
+		)"$(for src in "${sources[@]}"; do
+			ipv6_to_bytes $src
+			echo -n :
+		    done)"$(			: Source Addresses
 		)
 
 	local len=$(u16_to_bytes $(payload_template_nbytes $icmpv6))
-- 
2.39.0


  parent reply	other threads:[~2023-02-01 17:28 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-01 17:28 [Bridge] [PATCH net-next mlxsw v2 00/16] bridge: Limit number of MDB entries per port, port-vlan Petr Machata
2023-02-01 17:28 ` [Bridge] [PATCH net-next mlxsw v2 01/16] net: bridge: Set strict_start_type at two policies Petr Machata
2023-02-01 17:28 ` [Bridge] [PATCH net-next mlxsw v2 02/16] net: bridge: Add extack to br_multicast_new_port_group() Petr Machata
2023-02-01 17:28 ` [Bridge] [PATCH net-next mlxsw v2 03/16] net: bridge: Move extack-setting " Petr Machata
2023-02-01 17:28 ` [Bridge] [PATCH net-next mlxsw v2 04/16] net: bridge: Add br_multicast_del_port_group() Petr Machata
2023-02-01 17:28 ` [Bridge] [PATCH net-next mlxsw v2 05/16] net: bridge: Change a cleanup in br_multicast_new_port_group() to goto Petr Machata
2023-02-01 17:28 ` [Bridge] [PATCH net-next mlxsw v2 06/16] net: bridge: Add a tracepoint for MDB overflows Petr Machata
2023-02-02 16:22   ` Steven Rostedt
2023-02-01 17:28 ` [Bridge] [PATCH net-next mlxsw v2 07/16] net: bridge: Maintain number of MDB entries in net_bridge_mcast_port Petr Machata
2023-02-02  8:56   ` Nikolay Aleksandrov
2023-02-02  8:57     ` Nikolay Aleksandrov
2023-02-02 10:09     ` Petr Machata
2023-02-01 17:28 ` [Bridge] [PATCH net-next mlxsw v2 08/16] net: bridge: Add netlink knobs for number / maximum MDB entries Petr Machata
2023-02-02  8:52   ` Nikolay Aleksandrov
2023-02-02  9:02     ` Nikolay Aleksandrov
2023-02-02 15:02       ` Petr Machata
2023-02-01 17:28 ` [Bridge] [PATCH net-next mlxsw v2 09/16] selftests: forwarding: Move IGMP- and MLD-related functions to lib Petr Machata
2023-02-01 17:28 ` [Bridge] [PATCH net-next mlxsw v2 10/16] selftests: forwarding: bridge_mdb: Fix a typo Petr Machata
2023-02-01 17:28 ` [Bridge] [PATCH net-next mlxsw v2 11/16] selftests: forwarding: lib: Add helpers for IP address handling Petr Machata
2023-02-01 17:28 ` [Bridge] [PATCH net-next mlxsw v2 12/16] selftests: forwarding: lib: Add helpers for checksum handling Petr Machata
2023-02-01 17:28 ` [Bridge] [PATCH net-next mlxsw v2 13/16] selftests: forwarding: lib: Parameterize IGMPv3/MLDv2 generation Petr Machata
2023-02-01 17:28 ` Petr Machata [this message]
2023-02-01 17:28 ` [Bridge] [PATCH net-next mlxsw v2 15/16] selftests: forwarding: lib: Add helpers to build IGMP/MLD leave packets Petr Machata
2023-02-01 17:28 ` [Bridge] [PATCH net-next mlxsw v2 16/16] selftests: forwarding: bridge_mdb_max: Add a new selftest Petr Machata
2023-02-01 18:25 ` [Bridge] [PATCH net-next mlxsw v2 00/16] bridge: Limit number of MDB entries per port, port-vlan Jakub Kicinski
2023-02-02 10:07   ` Petr Machata

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c23017aace3d1c5f7746f0a2a54c7bcb60851c85.1675271084.git.petrm@nvidia.com \
    --to=petrm@nvidia.com \
    --cc=bridge@lists.linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=idosch@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=razor@blackwall.org \
    --cc=roopa@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).