Skip to content

Commit 4261fa3

Browse files
vladimirolteandavem330
authored andcommitted
selftests: net: local_termination: parameterize sending interface
In future changes we will want to subject the DUT, $h2, to additional VLAN-tagged traffic. For that, we need to run the tests using $h1.100 as a sending interface, rather than the currently hardcoded $h1. Add a parameter to run_test() and modify its 2 callers to explicitly pass $h1, as was implicit before. Signed-off-by: Vladimir Oltean <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 8d019b1 commit 4261fa3

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed

tools/testing/selftests/net/forwarding/local_termination.sh

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -104,44 +104,45 @@ mc_route_destroy()
104104

105105
run_test()
106106
{
107-
local rcv_if_name=$1
108-
local smac=$(mac_get $h1)
107+
local send_if_name=$1; shift
108+
local rcv_if_name=$1; shift
109+
local smac=$(mac_get $send_if_name)
109110
local rcv_dmac=$(mac_get $rcv_if_name)
110111

111112
tcpdump_start $rcv_if_name
112113

113-
mc_route_prepare $h1
114+
mc_route_prepare $send_if_name
114115
mc_route_prepare $rcv_if_name
115116

116-
send_uc_ipv4 $h1 $rcv_dmac
117-
send_uc_ipv4 $h1 $MACVLAN_ADDR
118-
send_uc_ipv4 $h1 $UNKNOWN_UC_ADDR1
117+
send_uc_ipv4 $send_if_name $rcv_dmac
118+
send_uc_ipv4 $send_if_name $MACVLAN_ADDR
119+
send_uc_ipv4 $send_if_name $UNKNOWN_UC_ADDR1
119120

120121
ip link set dev $rcv_if_name promisc on
121-
send_uc_ipv4 $h1 $UNKNOWN_UC_ADDR2
122-
mc_send $h1 $UNKNOWN_IPV4_MC_ADDR2
123-
mc_send $h1 $UNKNOWN_IPV6_MC_ADDR2
122+
send_uc_ipv4 $send_if_name $UNKNOWN_UC_ADDR2
123+
mc_send $send_if_name $UNKNOWN_IPV4_MC_ADDR2
124+
mc_send $send_if_name $UNKNOWN_IPV6_MC_ADDR2
124125
ip link set dev $rcv_if_name promisc off
125126

126127
mc_join $rcv_if_name $JOINED_IPV4_MC_ADDR
127-
mc_send $h1 $JOINED_IPV4_MC_ADDR
128+
mc_send $send_if_name $JOINED_IPV4_MC_ADDR
128129
mc_leave
129130

130131
mc_join $rcv_if_name $JOINED_IPV6_MC_ADDR
131-
mc_send $h1 $JOINED_IPV6_MC_ADDR
132+
mc_send $send_if_name $JOINED_IPV6_MC_ADDR
132133
mc_leave
133134

134-
mc_send $h1 $UNKNOWN_IPV4_MC_ADDR1
135-
mc_send $h1 $UNKNOWN_IPV6_MC_ADDR1
135+
mc_send $send_if_name $UNKNOWN_IPV4_MC_ADDR1
136+
mc_send $send_if_name $UNKNOWN_IPV6_MC_ADDR1
136137

137138
ip link set dev $rcv_if_name allmulticast on
138-
send_uc_ipv4 $h1 $UNKNOWN_UC_ADDR3
139-
mc_send $h1 $UNKNOWN_IPV4_MC_ADDR3
140-
mc_send $h1 $UNKNOWN_IPV6_MC_ADDR3
139+
send_uc_ipv4 $send_if_name $UNKNOWN_UC_ADDR3
140+
mc_send $send_if_name $UNKNOWN_IPV4_MC_ADDR3
141+
mc_send $send_if_name $UNKNOWN_IPV6_MC_ADDR3
141142
ip link set dev $rcv_if_name allmulticast off
142143

143144
mc_route_destroy $rcv_if_name
144-
mc_route_destroy $h1
145+
mc_route_destroy $send_if_name
145146

146147
sleep 1
147148

@@ -267,7 +268,7 @@ standalone()
267268
h2_create
268269
macvlan_create $h2
269270

270-
run_test $h2
271+
run_test $h1 $h2
271272

272273
macvlan_destroy
273274
h2_destroy
@@ -280,7 +281,7 @@ bridge()
280281
bridge_create
281282
macvlan_create br0
282283

283-
run_test br0
284+
run_test $h1 br0
284285

285286
macvlan_destroy
286287
bridge_destroy

0 commit comments

Comments
 (0)