File tree Expand file tree Collapse file tree 2 files changed +39
-29
lines changed
tools/testing/selftests/net/forwarding Expand file tree Collapse file tree 2 files changed +39
-29
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ declare -A NETIFS=(
37
37
: " ${TEAMD:= teamd} "
38
38
: " ${MCD:= smcrouted} "
39
39
: " ${MC_CLI:= smcroutectl} "
40
+ : " ${MCD_TABLE_NAME:= selftests} "
40
41
41
42
# Constants for netdevice bring-up:
42
43
# Default time in seconds to wait for an interface to come up before giving up
@@ -1757,6 +1758,38 @@ mc_send()
1757
1758
msend -g $groups -I $if_name -c 1 > /dev/null 2>&1
1758
1759
}
1759
1760
1761
+ adf_mcd_start ()
1762
+ {
1763
+ local table_name=" $MCD_TABLE_NAME "
1764
+ local smcroutedir
1765
+ local pid
1766
+ local i
1767
+
1768
+ check_command " $MCD " || return 1
1769
+ check_command " $MC_CLI " || return 1
1770
+
1771
+ smcroutedir=$( mktemp -d)
1772
+ defer rm -rf " $smcroutedir "
1773
+
1774
+ for (( i = 1 ; i <= NUM_NETIFS; ++ i)) ; do
1775
+ echo " phyint ${NETIFS[p$i]} enable" >> \
1776
+ " $smcroutedir /$table_name .conf"
1777
+ done
1778
+
1779
+ " $MCD " -N -I " $table_name " -f " $smcroutedir /$table_name .conf" \
1780
+ -P " $smcroutedir /$table_name .pid"
1781
+ busywait " $BUSYWAIT_TIMEOUT " test -e " $smcroutedir /$table_name .pid"
1782
+ pid=$( cat " $smcroutedir /$table_name .pid" )
1783
+ defer kill_process " $pid "
1784
+ }
1785
+
1786
+ mc_cli ()
1787
+ {
1788
+ local table_name=" $MCD_TABLE_NAME "
1789
+
1790
+ " $MC_CLI " -I " $table_name " " $@ "
1791
+ }
1792
+
1760
1793
start_ip_monitor ()
1761
1794
{
1762
1795
local mtype=$1 ; shift
Original file line number Diff line number Diff line change @@ -33,10 +33,6 @@ NUM_NETIFS=6
33
33
source lib.sh
34
34
source tc_common.sh
35
35
36
- require_command $MCD
37
- require_command $MC_CLI
38
- table_name=selftests
39
-
40
36
h1_create ()
41
37
{
42
38
simple_if_init $h1 198.51.100.2/28 2001:db8:1::2/64
@@ -149,25 +145,6 @@ router_destroy()
149
145
ip link set dev $rp1 down
150
146
}
151
147
152
- start_mcd ()
153
- {
154
- SMCROUTEDIR=" $( mktemp -d) "
155
-
156
- for (( i = 1 ; i <= $NUM_NETIFS ; ++ i)) ; do
157
- echo " phyint ${NETIFS[p$i]} enable" >> \
158
- $SMCROUTEDIR /$table_name .conf
159
- done
160
-
161
- $MCD -N -I $table_name -f $SMCROUTEDIR /$table_name .conf \
162
- -P $SMCROUTEDIR /$table_name .pid
163
- }
164
-
165
- kill_mcd ()
166
- {
167
- pkill $MCD
168
- rm -rf $SMCROUTEDIR
169
- }
170
-
171
148
setup_prepare ()
172
149
{
173
150
h1=${NETIFS[p1]}
@@ -179,7 +156,7 @@ setup_prepare()
179
156
rp3=${NETIFS[p5]}
180
157
h3=${NETIFS[p6]}
181
158
182
- start_mcd
159
+ adf_mcd_start || exit " $EXIT_STATUS "
183
160
184
161
vrf_prepare
185
162
@@ -206,27 +183,27 @@ cleanup()
206
183
207
184
vrf_cleanup
208
185
209
- kill_mcd
186
+ defer_scopes_cleanup
210
187
}
211
188
212
189
create_mcast_sg ()
213
190
{
214
191
local if_name=$1 ; shift
215
192
local s_addr=$1 ; shift
216
193
local mcast=$1 ; shift
217
- local dest_ifs=${@ }
194
+ local dest_ifs=( " ${@ } " )
218
195
219
- $MC_CLI -I $table_name add $if_name $s_addr $mcast $ dest_ifs
196
+ mc_cli add " $if_name " " $s_addr " " $mcast " " ${ dest_ifs[@]} "
220
197
}
221
198
222
199
delete_mcast_sg ()
223
200
{
224
201
local if_name=$1 ; shift
225
202
local s_addr=$1 ; shift
226
203
local mcast=$1 ; shift
227
- local dest_ifs=${@ }
204
+ local dest_ifs=( " ${@ } " )
228
205
229
- $MC_CLI -I $table_name remove $if_name $s_addr $mcast $ dest_ifs
206
+ mc_cli remove " $if_name " " $s_addr " " $mcast " " ${ dest_ifs[@]} "
230
207
}
231
208
232
209
mcast_v4 ()
You can’t perform that action at this time.
0 commit comments