Commit 705d4bc7 authored by Petr Machata's avatar Petr Machata Committed by David S. Miller

selftests: forwarding: lib: Allow list of IPs for IGMPv3/MLDv2

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: default avatarPetr Machata <petrm@nvidia.com>
Acked-by: default avatarNikolay Aleksandrov <razor@blackwall.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 506a1ac9
...@@ -1768,11 +1768,12 @@ payload_template_nbytes() ...@@ -1768,11 +1768,12 @@ payload_template_nbytes()
igmpv3_is_in_get() igmpv3_is_in_get()
{ {
local GRP=$1; shift local GRP=$1; shift
local IP=$1; shift local sources=("$@")
local igmpv3 local igmpv3
local nsources=$(u16_to_bytes ${#sources[@]})
# IS_IN ( $IP ) # IS_IN ( $sources )
igmpv3=$(: igmpv3=$(:
)"22:"$( : Type - Membership Report )"22:"$( : Type - Membership Report
)"00:"$( : Reserved )"00:"$( : Reserved
...@@ -1781,9 +1782,12 @@ igmpv3_is_in_get() ...@@ -1781,9 +1782,12 @@ igmpv3_is_in_get()
)"00:01:"$( : Number of Group Records )"00:01:"$( : Number of Group Records
)"01:"$( : Record Type - IS_IN )"01:"$( : Record Type - IS_IN
)"00:"$( : Aux Data Len )"00:"$( : Aux Data Len
)"00:01:"$( : Number of Sources )"${nsources}:"$( : Number of Sources
)"$(ipv4_to_bytes $GRP):"$( : Multicast Address )"$(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") local checksum=$(payload_template_calc_checksum "$igmpv3")
...@@ -1794,10 +1798,11 @@ mldv2_is_in_get() ...@@ -1794,10 +1798,11 @@ mldv2_is_in_get()
{ {
local SIP=$1; shift local SIP=$1; shift
local GRP=$1; shift local GRP=$1; shift
local IP=$1; shift local sources=("$@")
local hbh local hbh
local icmpv6 local icmpv6
local nsources=$(u16_to_bytes ${#sources[@]})
hbh=$(: hbh=$(:
)"3a:"$( : Next Header - ICMPv6 )"3a:"$( : Next Header - ICMPv6
...@@ -1813,9 +1818,12 @@ mldv2_is_in_get() ...@@ -1813,9 +1818,12 @@ mldv2_is_in_get()
)"00:01:"$( : Number of Group Records )"00:01:"$( : Number of Group Records
)"01:"$( : Record Type - IS_IN )"01:"$( : Record Type - IS_IN
)"00:"$( : Aux Data Len )"00:"$( : Aux Data Len
)"00:01:"$( : Number of Sources )"${nsources}:"$( : Number of Sources
)"$(ipv6_to_bytes $GRP):"$( : Multicast address )"$(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)) local len=$(u16_to_bytes $(payload_template_nbytes $icmpv6))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment