1#!/bin/bash 2# SPDX-License-Identifier: GPL-2.0 3# 4# OVS kernel module self tests 5 6trap ovs_exit_sig EXIT TERM INT ERR 7 8# Kselftest framework requirement - SKIP code is 4. 9ksft_skip=4 10 11PAUSE_ON_FAIL=no 12VERBOSE=0 13TRACING=0 14WAIT_TIMEOUT=5 15 16if test "X$KSFT_MACHINE_SLOW" == "Xyes"; then 17 WAIT_TIMEOUT=10 18fi 19 20tests=" 21 arp_ping eth-arp: Basic arp ping between two NS 22 ct_connect_v4 ip4-ct-xon: Basic ipv4 tcp connection using ct 23 connect_v4 ip4-xon: Basic ipv4 ping between two NS 24 nat_connect_v4 ip4-nat-xon: Basic ipv4 tcp connection via NAT 25 nat_related_v4 ip4-nat-related: ICMP related matches work with SNAT 26 netlink_checks ovsnl: validate netlink attrs and settings 27 upcall_interfaces ovs: test the upcall interfaces 28 tunnel_metadata ovs: test extraction of tunnel metadata 29 tunnel_refcount ovs: test tunnel vport reference cleanup 30 drop_reason drop: test drop reasons are emitted 31 pop_vlan vlan: POP_VLAN action strips tag 32 dec_ttl ttl: dec_ttl decrements IP TTL 33 psample psample: Sampling packets with psample" 34 35info() { 36 [ "${ovs_dir}" != "" ] && 37 echo "`date +"[%m-%d %H:%M:%S]"` $*" >> ${ovs_dir}/debug.log 38 [ $VERBOSE = 0 ] || echo $* 39} 40 41ovs_wait() { 42 info "waiting $WAIT_TIMEOUT s for: $@" 43 44 if "$@" ; then 45 info "wait succeeded immediately" 46 return 0 47 fi 48 49 # A quick re-check helps speed up small races in fast systems. 50 # However, fractional sleeps might not necessarily work. 51 local start=0 52 sleep 0.1 || { sleep 1; start=1; } 53 54 for (( i=start; i<WAIT_TIMEOUT; i++ )); do 55 if "$@" ; then 56 info "wait succeeded after $i seconds" 57 return 0 58 fi 59 sleep 1 60 done 61 info "wait failed after $i seconds" 62 return 1 63} 64 65ovs_base=`pwd` 66sbxs= 67sbx_add () { 68 info "adding sandbox '$1'" 69 70 sbxs="$sbxs $1" 71 72 NO_BIN=0 73 74 # Create sandbox. 75 local d="$ovs_base"/$1 76 if [ -e $d ]; then 77 info "removing $d" 78 rm -rf "$d" 79 fi 80 mkdir "$d" || return 1 81 ovs_setenv $1 82} 83 84ovs_exit_sig() { 85 [ -e ${ovs_dir}/cleanup ] && . "$ovs_dir/cleanup" 86} 87 88on_exit() { 89 echo "$1" > ${ovs_dir}/cleanup.tmp 90 cat ${ovs_dir}/cleanup >> ${ovs_dir}/cleanup.tmp 91 mv ${ovs_dir}/cleanup.tmp ${ovs_dir}/cleanup 92} 93 94ovs_setenv() { 95 sandbox=$1 96 97 ovs_dir=$ovs_base${1:+/$1}; export ovs_dir 98 99 test -e ${ovs_dir}/cleanup || : > ${ovs_dir}/cleanup 100} 101 102ovs_sbx() { 103 if test "X$2" != X; then 104 (ovs_setenv $1; shift; 105 info "run cmd: $@"; "$@" >> ${ovs_dir}/debug.log) 106 else 107 ovs_setenv $1 108 fi 109} 110 111ovs_add_dp () { 112 info "Adding DP/Bridge IF: sbx:$1 dp:$2 {$3, $4, $5}" 113 sbxname="$1" 114 shift 115 ovs_sbx "$sbxname" python3 $ovs_base/ovs-dpctl.py add-dp $* 116 on_exit "ovs_sbx $sbxname python3 $ovs_base/ovs-dpctl.py del-dp $1;" 117} 118 119ovs_add_if () { 120 info "Adding IF to DP: br:$3 if:$4 ($2)" 121 if [ "$5" != "-u" ]; then 122 ovs_sbx "$1" python3 $ovs_base/ovs-dpctl.py add-if \ 123 -t "$2" "$3" "$4" || return 1 124 else 125 python3 $ovs_base/ovs-dpctl.py add-if \ 126 -u -t "$2" "$3" "$4" >$ovs_dir/$4.out 2>$ovs_dir/$4.err & 127 pid=$! 128 on_exit "ovs_sbx $1 kill -TERM $pid 2>/dev/null" 129 fi 130} 131 132ovs_del_if () { 133 info "Deleting IF from DP: br:$2 if:$3" 134 ovs_sbx "$1" python3 $ovs_base/ovs-dpctl.py del-if "$2" "$3" || return 1 135} 136 137ovs_netns_spawn_daemon() { 138 sbx=$1 139 shift 140 netns=$1 141 shift 142 if [ "$netns" == "_default" ]; then 143 $* >> $ovs_dir/stdout 2>> $ovs_dir/stderr & 144 else 145 ip netns exec $netns $* >> $ovs_dir/stdout 2>> $ovs_dir/stderr & 146 fi 147 pid=$! 148 ovs_sbx "$sbx" on_exit "kill -TERM $pid 2>/dev/null" 149} 150 151ovs_spawn_daemon() { 152 sbx=$1 153 shift 154 ovs_netns_spawn_daemon $sbx "_default" $* 155} 156 157ovs_add_netns_and_veths () { 158 info "Adding netns attached: sbx:$1 dp:$2 {$3, $4, $5}" 159 ovs_sbx "$1" ip netns add "$3" || return 1 160 on_exit "ovs_sbx $1 ip netns del $3" 161 ovs_sbx "$1" ip link add "$4" type veth peer name "$5" || return 1 162 on_exit "ovs_sbx $1 ip link del $4 >/dev/null 2>&1" 163 ovs_sbx "$1" ip link set "$4" up || return 1 164 ovs_sbx "$1" ip link set "$5" netns "$3" || return 1 165 ovs_sbx "$1" ip netns exec "$3" ip link set "$5" up || return 1 166 167 if [ "$6" != "" ]; then 168 ovs_sbx "$1" ip netns exec "$3" ip addr add "$6" dev "$5" \ 169 || return 1 170 fi 171 172 if [ "$7" != "-u" ]; then 173 ovs_add_if "$1" "netdev" "$2" "$4" || return 1 174 else 175 ovs_add_if "$1" "netdev" "$2" "$4" -u || return 1 176 fi 177 178 if [ $TRACING -eq 1 ]; then 179 ovs_netns_spawn_daemon "$1" "$3" tcpdump -l -i any -s 6553 180 ovs_wait grep -q "listening on any" ${ovs_dir}/stderr 181 fi 182 183 return 0 184} 185 186ovs_add_flow () { 187 info "Adding flow to DP: sbx:$1 br:$2 flow:$3 act:$4" 188 ovs_sbx "$1" python3 $ovs_base/ovs-dpctl.py add-flow "$2" "$3" "$4" 189 if [ $? -ne 0 ]; then 190 info "Flow [ $3 : $4 ] failed" 191 return 1 192 fi 193 return 0 194} 195 196ovs_del_flows () { 197 info "Deleting all flows from DP: sbx:$1 br:$2" 198 ovs_sbx "$1" python3 $ovs_base/ovs-dpctl.py del-flows "$2" 199 return 0 200} 201 202ovs_drop_record_and_run () { 203 local sbx=$1 204 shift 205 206 perf record -a -q -e skb:kfree_skb -o ${ovs_dir}/perf.data $* \ 207 >> ${ovs_dir}/stdout 2>> ${ovs_dir}/stderr 208 return $? 209} 210 211ovs_drop_reason_count() 212{ 213 local reason=$1 214 215 local perf_output=`perf script -i ${ovs_dir}/perf.data -F trace:event,trace` 216 local pattern="skb:kfree_skb:.*reason: $reason" 217 218 return `echo "$perf_output" | grep "$pattern" | wc -l` 219} 220 221ovs_test_flow_fails () { 222 ERR_MSG="Flow actions may not be safe on all matching packets" 223 224 PRE_TEST=$(dmesg | grep -c "${ERR_MSG}") 225 ovs_add_flow $@ &> /dev/null $@ && return 1 226 POST_TEST=$(dmesg | grep -c "${ERR_MSG}") 227 228 if [ "$PRE_TEST" == "$POST_TEST" ]; then 229 return 1 230 fi 231 return 0 232} 233 234usage() { 235 echo 236 echo "$0 [OPTIONS] [TEST]..." 237 echo "If no TEST argument is given, all tests will be run." 238 echo 239 echo "Options" 240 echo " -t: capture traffic via tcpdump" 241 echo " -v: verbose" 242 echo " -p: pause on failure" 243 echo 244 echo "Available tests${tests}" 245 exit 1 246} 247 248 249test_dec_ttl() { 250 sbx_add "test_dec_ttl" || return $? 251 ovs_add_dp "test_dec_ttl" decttl || return 1 252 253 info "create namespaces" 254 for ns in client server; do 255 ovs_add_netns_and_veths "test_dec_ttl" "decttl" "$ns" \ 256 "${ns:0:1}0" "${ns:0:1}1" || return 1 257 done 258 259 ip netns exec client ip addr add 10.0.0.1/24 dev c1 260 ip netns exec client ip link set c1 up 261 ip netns exec server ip addr add 10.0.0.2/24 dev s1 262 ip netns exec server ip link set s1 up 263 264 # Probe: check if kernel supports dec_ttl action. 265 ovs_add_flow "test_dec_ttl" decttl \ 266 'in_port(1),eth(),eth_type(0x0800),ipv4()' \ 267 'dec_ttl(le_1())' &>/dev/null 268 if [ $? -ne 0 ]; then 269 info "no support for dec_ttl - skipping" 270 ovs_exit_sig 271 return $ksft_skip 272 fi 273 274 ovs_del_flows "test_dec_ttl" decttl 275 276 # ARP flows (bidirectional) 277 ovs_add_flow "test_dec_ttl" decttl \ 278 'in_port(1),eth(),eth_type(0x0806),arp()' '2' || return 1 279 ovs_add_flow "test_dec_ttl" decttl \ 280 'in_port(2),eth(),eth_type(0x0806),arp()' '1' || return 1 281 282 # IP flows with dec_ttl action 283 ovs_add_flow "test_dec_ttl" decttl \ 284 'in_port(1),eth(),eth_type(0x0800),ipv4()' \ 285 'dec_ttl(le_1()),2' || return 1 286 ovs_add_flow "test_dec_ttl" decttl \ 287 'in_port(2),eth(),eth_type(0x0800),ipv4()' \ 288 'dec_ttl(le_1()),1' || return 1 289 290 info "verify connectivity with dec_ttl" 291 ovs_sbx "test_dec_ttl" ip netns exec client ping -c 1 -W 2 \ 292 10.0.0.2 || return 1 293 294 info "verify TTL=1 is dropped by dec_ttl" 295 ovs_sbx "test_dec_ttl" ip netns exec client ping -c 1 -W 2 \ 296 -t 1 10.0.0.2 >/dev/null 2>&1 \ 297 && { info "FAIL: ping should fail with TTL=1 and dec_ttl" 298 return 1; } 299 300 return 0 301} 302 303# psample test 304# - use psample to observe packets 305test_psample() { 306 sbx_add "test_psample" || return $? 307 308 # Add a datapath with per-vport dispatching. 309 ovs_add_dp "test_psample" psample -V 2:1 || return 1 310 311 info "create namespaces" 312 ovs_add_netns_and_veths "test_psample" "psample" \ 313 client c0 c1 172.31.110.10/24 -u || return 1 314 ovs_add_netns_and_veths "test_psample" "psample" \ 315 server s0 s1 172.31.110.20/24 -u || return 1 316 317 # Check if psample actions can be configured. 318 ovs_add_flow "test_psample" psample \ 319 'in_port(1),eth(),eth_type(0x0806),arp()' 'psample(group=1)' &> /dev/null 320 if [ $? == 1 ]; then 321 info "no support for psample - skipping" 322 ovs_exit_sig 323 return $ksft_skip 324 fi 325 326 ovs_del_flows "test_psample" psample 327 328 # Test action verification. 329 OLDIFS=$IFS 330 IFS='*' 331 min_key='in_port(1),eth(),eth_type(0x0800),ipv4()' 332 for testcase in \ 333 "cookie to large"*"psample(group=1,cookie=1615141312111009080706050403020100)" \ 334 "no group with cookie"*"psample(cookie=abcd)" \ 335 "no group"*"psample()"; 336 do 337 set -- $testcase; 338 ovs_test_flow_fails "test_psample" psample $min_key $2 339 if [ $? == 1 ]; then 340 info "failed - $1" 341 return 1 342 fi 343 done 344 IFS=$OLDIFS 345 346 ovs_del_flows "test_psample" psample 347 # Allow ARP 348 ovs_add_flow "test_psample" psample \ 349 'in_port(1),eth(),eth_type(0x0806),arp()' '2' || return 1 350 ovs_add_flow "test_psample" psample \ 351 'in_port(2),eth(),eth_type(0x0806),arp()' '1' || return 1 352 353 # Sample first 14 bytes of all traffic. 354 ovs_add_flow "test_psample" psample \ 355 "in_port(1),eth(),eth_type(0x0800),ipv4()" \ 356 "trunc(14),psample(group=1,cookie=c0ffee),2" 357 358 # Sample all traffic. In this case, use a sample() action with both 359 # psample and an upcall emulating simultaneous local sampling and 360 # sFlow / IPFIX. 361 nlpid=$(grep -E "listening on upcall packet handler" \ 362 $ovs_dir/s0.out | cut -d ":" -f 2 | tr -d ' ') 363 [ -z "$nlpid" ] && \ 364 { info "failed to get upcall PID"; return 1; } 365 366 ovs_add_flow "test_psample" psample \ 367 "in_port(2),eth(),eth_type(0x0800),ipv4()" \ 368 "sample(sample=100%,actions(psample(group=2,cookie=eeff0c),userspace(pid=${nlpid},userdata=eeff0c))),1" 369 370 # Record psample data. 371 ovs_spawn_daemon "test_psample" python3 $ovs_base/ovs-dpctl.py psample-events 372 ovs_wait grep -q "listening for psample events" ${ovs_dir}/stdout 373 374 # Send a single ping. 375 ovs_sbx "test_psample" ip netns exec client ping -I c1 172.31.110.20 -c 1 || return 1 376 377 # We should have received one userspace action upcall and 2 psample packets. 378 ovs_wait grep -q "userspace action command" $ovs_dir/s0.out || return 1 379 380 # client -> server samples should only contain the first 14 bytes of the packet. 381 ovs_wait grep -qE "rate:4294967295,group:1,cookie:c0ffee data:[0-9a-f]{28}$" \ 382 $ovs_dir/stdout || return 1 383 384 ovs_wait grep -q "rate:4294967295,group:2,cookie:eeff0c" $ovs_dir/stdout || return 1 385 386 return 0 387} 388 389# drop_reason test 390# - drop packets and verify the right drop reason is reported 391test_drop_reason() { 392 which perf >/dev/null 2>&1 || return $ksft_skip 393 which pahole >/dev/null 2>&1 || return $ksft_skip 394 395 ovs_drop_subsys=$(pahole -C skb_drop_reason_subsys | 396 awk '/OPENVSWITCH/ { print $3; }' | 397 tr -d ,) 398 if [ -z "$ovs_drop_subsys" ]; then 399 info "failed to get OVS drop subsys ID" 400 return $ksft_skip 401 fi 402 403 sbx_add "test_drop_reason" || return $? 404 405 ovs_add_dp "test_drop_reason" dropreason || return 1 406 407 info "create namespaces" 408 for ns in client server; do 409 ovs_add_netns_and_veths "test_drop_reason" "dropreason" "$ns" \ 410 "${ns:0:1}0" "${ns:0:1}1" || return 1 411 done 412 413 # Setup client namespace 414 ip netns exec client ip addr add 172.31.110.10/24 dev c1 415 ip netns exec client ip link set c1 up 416 417 # Setup server namespace 418 ip netns exec server ip addr add 172.31.110.20/24 dev s1 419 ip netns exec server ip link set s1 up 420 421 # Check if drop reasons can be sent 422 ovs_add_flow "test_drop_reason" dropreason \ 423 'in_port(1),eth(),eth_type(0x0806),arp()' 'drop(10)' 2>/dev/null 424 if [ $? == 1 ]; then 425 info "no support for drop reasons - skipping" 426 ovs_exit_sig 427 return $ksft_skip 428 fi 429 430 ovs_del_flows "test_drop_reason" dropreason 431 432 # Allow ARP 433 ovs_add_flow "test_drop_reason" dropreason \ 434 'in_port(1),eth(),eth_type(0x0806),arp()' '2' || return 1 435 ovs_add_flow "test_drop_reason" dropreason \ 436 'in_port(2),eth(),eth_type(0x0806),arp()' '1' || return 1 437 438 # Allow client ICMP traffic but drop return path 439 ovs_add_flow "test_drop_reason" dropreason \ 440 "in_port(1),eth(),eth_type(0x0800),ipv4(src=172.31.110.10,proto=1),icmp()" '2' 441 ovs_add_flow "test_drop_reason" dropreason \ 442 "in_port(2),eth(),eth_type(0x0800),ipv4(src=172.31.110.20,proto=1),icmp()" 'drop' 443 444 ovs_drop_record_and_run "test_drop_reason" ip netns exec client ping -c 2 172.31.110.20 445 ovs_drop_reason_count 0x${ovs_drop_subsys}0001 # OVS_DROP_FLOW_ACTION 446 if [[ "$?" -ne "2" ]]; then 447 info "Did not detect expected drops: $?" 448 return 1 449 fi 450 451 # Drop UDP 6000 traffic with an explicit action and an error code. 452 ovs_add_flow "test_drop_reason" dropreason \ 453 "in_port(1),eth(),eth_type(0x0800),ipv4(src=172.31.110.10,proto=17),udp(dst=6000)" \ 454 'drop(42)' 455 # Drop UDP 7000 traffic with an explicit action with no error code. 456 ovs_add_flow "test_drop_reason" dropreason \ 457 "in_port(1),eth(),eth_type(0x0800),ipv4(src=172.31.110.10,proto=17),udp(dst=7000)" \ 458 'drop(0)' 459 460 ovs_drop_record_and_run \ 461 "test_drop_reason" ip netns exec client nc -i 1 -zuv 172.31.110.20 6000 462 ovs_drop_reason_count 0x${ovs_drop_subsys}0004 # OVS_DROP_EXPLICIT_ACTION_ERROR 463 if [[ "$?" -ne "1" ]]; then 464 info "Did not detect expected explicit error drops: $?" 465 return 1 466 fi 467 468 ovs_drop_record_and_run \ 469 "test_drop_reason" ip netns exec client nc -i 1 -zuv 172.31.110.20 7000 470 ovs_drop_reason_count 0x${ovs_drop_subsys}0003 # OVS_DROP_EXPLICIT_ACTION 471 if [[ "$?" -ne "1" ]]; then 472 info "Did not detect expected explicit drops: $?" 473 return 1 474 fi 475 476 return 0 477} 478 479# arp_ping test 480# - client has 1500 byte MTU 481# - server has 1500 byte MTU 482# - send ARP ping between two ns 483test_arp_ping () { 484 485 which arping >/dev/null 2>&1 || return $ksft_skip 486 487 sbx_add "test_arp_ping" || return $? 488 489 ovs_add_dp "test_arp_ping" arpping || return 1 490 491 info "create namespaces" 492 for ns in client server; do 493 ovs_add_netns_and_veths "test_arp_ping" "arpping" "$ns" \ 494 "${ns:0:1}0" "${ns:0:1}1" || return 1 495 done 496 497 # Setup client namespace 498 ip netns exec client ip addr add 172.31.110.10/24 dev c1 499 ip netns exec client ip link set c1 up 500 HW_CLIENT=$(ip netns exec client ip link show dev c1 \ 501 | awk '/link\/ether/ {print $2}') 502 [ -z "$HW_CLIENT" ] && \ 503 { info "failed to get client hwaddr"; return 1; } 504 info "Client hwaddr: $HW_CLIENT" 505 506 # Setup server namespace 507 ip netns exec server ip addr add 172.31.110.20/24 dev s1 508 ip netns exec server ip link set s1 up 509 HW_SERVER=$(ip netns exec server ip link show dev s1 \ 510 | awk '/link\/ether/ {print $2}') 511 [ -z "$HW_SERVER" ] && \ 512 { info "failed to get server hwaddr"; return 1; } 513 info "Server hwaddr: $HW_SERVER" 514 515 ovs_add_flow "test_arp_ping" arpping \ 516 "in_port(1),eth(),eth_type(0x0806),arp(sip=172.31.110.10,tip=172.31.110.20,sha=$HW_CLIENT,tha=ff:ff:ff:ff:ff:ff)" '2' || return 1 517 ovs_add_flow "test_arp_ping" arpping \ 518 "in_port(2),eth(),eth_type(0x0806),arp()" '1' || return 1 519 520 ovs_sbx "test_arp_ping" ip netns exec client arping -I c1 172.31.110.20 -c 1 || return 1 521 522 return 0 523} 524 525# ct_connect_v4 test 526# - client has 1500 byte MTU 527# - server has 1500 byte MTU 528# - use ICMP to ping in each direction 529# - only allow CT state stuff to pass through new in c -> s 530test_ct_connect_v4 () { 531 532 which nc >/dev/null 2>/dev/null || return $ksft_skip 533 534 sbx_add "test_ct_connect_v4" || return $? 535 536 ovs_add_dp "test_ct_connect_v4" ct4 || return 1 537 info "create namespaces" 538 for ns in client server; do 539 ovs_add_netns_and_veths "test_ct_connect_v4" "ct4" "$ns" \ 540 "${ns:0:1}0" "${ns:0:1}1" || return 1 541 done 542 543 ip netns exec client ip addr add 172.31.110.10/24 dev c1 544 ip netns exec client ip link set c1 up 545 ip netns exec server ip addr add 172.31.110.20/24 dev s1 546 ip netns exec server ip link set s1 up 547 548 # Add forwarding for ARP and ip packets - completely wildcarded 549 ovs_add_flow "test_ct_connect_v4" ct4 \ 550 'in_port(1),eth(),eth_type(0x0806),arp()' '2' || return 1 551 ovs_add_flow "test_ct_connect_v4" ct4 \ 552 'in_port(2),eth(),eth_type(0x0806),arp()' '1' || return 1 553 ovs_add_flow "test_ct_connect_v4" ct4 \ 554 'ct_state(-trk),eth(),eth_type(0x0800),ipv4()' \ 555 'ct(commit),recirc(0x1)' || return 1 556 ovs_add_flow "test_ct_connect_v4" ct4 \ 557 'recirc_id(0x1),ct_state(+trk+new),in_port(1),eth(),eth_type(0x0800),ipv4(src=172.31.110.10)' \ 558 '2' || return 1 559 ovs_add_flow "test_ct_connect_v4" ct4 \ 560 'recirc_id(0x1),ct_state(+trk+est),in_port(1),eth(),eth_type(0x0800),ipv4(src=172.31.110.10)' \ 561 '2' || return 1 562 ovs_add_flow "test_ct_connect_v4" ct4 \ 563 'recirc_id(0x1),ct_state(+trk+est),in_port(2),eth(),eth_type(0x0800),ipv4(dst=172.31.110.10)' \ 564 '1' || return 1 565 ovs_add_flow "test_ct_connect_v4" ct4 \ 566 'recirc_id(0x1),ct_state(+trk+inv),eth(),eth_type(0x0800),ipv4()' 'drop' || \ 567 return 1 568 569 # do a ping 570 ovs_sbx "test_ct_connect_v4" ip netns exec client ping 172.31.110.20 -c 3 || return 1 571 572 # create an echo server in 'server' 573 echo "server" | \ 574 ovs_netns_spawn_daemon "test_ct_connect_v4" "server" \ 575 nc -lvnp 4443 576 ovs_sbx "test_ct_connect_v4" ip netns exec client nc -i 1 -zv 172.31.110.20 4443 || return 1 577 578 # Now test in the other direction (should fail) 579 echo "client" | \ 580 ovs_netns_spawn_daemon "test_ct_connect_v4" "client" \ 581 nc -lvnp 4443 582 ovs_sbx "test_ct_connect_v4" ip netns exec client nc -i 1 -zv 172.31.110.10 4443 583 if [ $? == 0 ]; then 584 info "ct connect to client was successful" 585 return 1 586 fi 587 588 info "done..." 589 return 0 590} 591 592# connect_v4 test 593# - client has 1500 byte MTU 594# - server has 1500 byte MTU 595# - use ICMP to ping in each direction 596test_connect_v4 () { 597 598 sbx_add "test_connect_v4" || return $? 599 600 ovs_add_dp "test_connect_v4" cv4 || return 1 601 602 info "create namespaces" 603 for ns in client server; do 604 ovs_add_netns_and_veths "test_connect_v4" "cv4" "$ns" \ 605 "${ns:0:1}0" "${ns:0:1}1" || return 1 606 done 607 608 609 ip netns exec client ip addr add 172.31.110.10/24 dev c1 610 ip netns exec client ip link set c1 up 611 ip netns exec server ip addr add 172.31.110.20/24 dev s1 612 ip netns exec server ip link set s1 up 613 614 # Add forwarding for ARP and ip packets - completely wildcarded 615 ovs_add_flow "test_connect_v4" cv4 \ 616 'in_port(1),eth(),eth_type(0x0806),arp()' '2' || return 1 617 ovs_add_flow "test_connect_v4" cv4 \ 618 'in_port(2),eth(),eth_type(0x0806),arp()' '1' || return 1 619 ovs_add_flow "test_connect_v4" cv4 \ 620 'in_port(1),eth(),eth_type(0x0800),ipv4(src=172.31.110.10)' '2' || return 1 621 ovs_add_flow "test_connect_v4" cv4 \ 622 'in_port(2),eth(),eth_type(0x0800),ipv4(src=172.31.110.20)' '1' || return 1 623 624 # do a ping 625 ovs_sbx "test_connect_v4" ip netns exec client ping 172.31.110.20 -c 3 || return 1 626 627 info "done..." 628 return 0 629} 630 631# nat_connect_v4 test 632# - client has 1500 byte MTU 633# - server has 1500 byte MTU 634# - use ICMP to ping in each direction 635# - only allow CT state stuff to pass through new in c -> s 636test_nat_connect_v4 () { 637 which nc >/dev/null 2>/dev/null || return $ksft_skip 638 639 sbx_add "test_nat_connect_v4" || return $? 640 641 ovs_add_dp "test_nat_connect_v4" nat4 || return 1 642 info "create namespaces" 643 for ns in client server; do 644 ovs_add_netns_and_veths "test_nat_connect_v4" "nat4" "$ns" \ 645 "${ns:0:1}0" "${ns:0:1}1" || return 1 646 done 647 648 ip netns exec client ip addr add 172.31.110.10/24 dev c1 649 ip netns exec client ip link set c1 up 650 ip netns exec server ip addr add 172.31.110.20/24 dev s1 651 ip netns exec server ip link set s1 up 652 653 ip netns exec client ip route add default via 172.31.110.20 654 655 ovs_add_flow "test_nat_connect_v4" nat4 \ 656 'in_port(1),eth(),eth_type(0x0806),arp()' '2' || return 1 657 ovs_add_flow "test_nat_connect_v4" nat4 \ 658 'in_port(2),eth(),eth_type(0x0806),arp()' '1' || return 1 659 ovs_add_flow "test_nat_connect_v4" nat4 \ 660 "ct_state(-trk),in_port(1),eth(),eth_type(0x0800),ipv4(dst=192.168.0.20)" \ 661 "ct(commit,nat(dst=172.31.110.20)),recirc(0x1)" 662 ovs_add_flow "test_nat_connect_v4" nat4 \ 663 "ct_state(-trk),in_port(2),eth(),eth_type(0x0800),ipv4()" \ 664 "ct(commit,nat),recirc(0x2)" 665 666 ovs_add_flow "test_nat_connect_v4" nat4 \ 667 "recirc_id(0x1),ct_state(+trk-inv),in_port(1),eth(),eth_type(0x0800),ipv4()" "2" 668 ovs_add_flow "test_nat_connect_v4" nat4 \ 669 "recirc_id(0x2),ct_state(+trk-inv),in_port(2),eth(),eth_type(0x0800),ipv4()" "1" 670 671 # do a ping 672 ovs_sbx "test_nat_connect_v4" ip netns exec client ping 192.168.0.20 -c 3 || return 1 673 674 # create an echo server in 'server' 675 echo "server" | \ 676 ovs_netns_spawn_daemon "test_nat_connect_v4" "server" \ 677 nc -lvnp 4443 678 ovs_sbx "test_nat_connect_v4" ip netns exec client nc -i 1 -zv 192.168.0.20 4443 || return 1 679 680 # Now test in the other direction (should fail) 681 echo "client" | \ 682 ovs_netns_spawn_daemon "test_nat_connect_v4" "client" \ 683 nc -lvnp 4443 684 ovs_sbx "test_nat_connect_v4" ip netns exec client nc -i 1 -zv 172.31.110.10 4443 685 if [ $? == 0 ]; then 686 info "connect to client was successful" 687 return 1 688 fi 689 690 info "done..." 691 return 0 692} 693 694# nat_related_v4 test 695# - client->server ip packets go via SNAT 696# - client solicits ICMP destination unreachable packet from server 697# - undo NAT for ICMP reply and test dst ip has been updated 698test_nat_related_v4 () { 699 which nc >/dev/null 2>/dev/null || return $ksft_skip 700 701 sbx_add "test_nat_related_v4" || return $? 702 703 ovs_add_dp "test_nat_related_v4" natrelated4 || return 1 704 info "create namespaces" 705 for ns in client server; do 706 ovs_add_netns_and_veths "test_nat_related_v4" "natrelated4" "$ns" \ 707 "${ns:0:1}0" "${ns:0:1}1" || return 1 708 done 709 710 ip netns exec client ip addr add 172.31.110.10/24 dev c1 711 ip netns exec client ip link set c1 up 712 ip netns exec server ip addr add 172.31.110.20/24 dev s1 713 ip netns exec server ip link set s1 up 714 715 ip netns exec server ip route add 192.168.0.20/32 via 172.31.110.10 716 717 # Allow ARP 718 ovs_add_flow "test_nat_related_v4" natrelated4 \ 719 "in_port(1),eth(),eth_type(0x0806),arp()" "2" || return 1 720 ovs_add_flow "test_nat_related_v4" natrelated4 \ 721 "in_port(2),eth(),eth_type(0x0806),arp()" "1" || return 1 722 723 # Allow IP traffic from client->server, rewrite source IP with SNAT to 192.168.0.20 724 ovs_add_flow "test_nat_related_v4" natrelated4 \ 725 "ct_state(-trk),in_port(1),eth(),eth_type(0x0800),ipv4(dst=172.31.110.20)" \ 726 "ct(commit,nat(src=192.168.0.20)),recirc(0x1)" || return 1 727 ovs_add_flow "test_nat_related_v4" natrelated4 \ 728 "recirc_id(0x1),ct_state(+trk-inv),in_port(1),eth(),eth_type(0x0800),ipv4()" \ 729 "2" || return 1 730 731 # Allow related ICMP responses back from server and undo NAT to restore original IP 732 # Drop any ICMP related packets where dst ip hasn't been restored back to original IP 733 ovs_add_flow "test_nat_related_v4" natrelated4 \ 734 "ct_state(-trk),in_port(2),eth(),eth_type(0x0800),ipv4()" \ 735 "ct(commit,nat),recirc(0x2)" || return 1 736 ovs_add_flow "test_nat_related_v4" natrelated4 \ 737 "recirc_id(0x2),ct_state(+rel+trk),in_port(2),eth(),eth_type(0x0800),ipv4(src=172.31.110.20,dst=172.31.110.10,proto=1),icmp()" \ 738 "1" || return 1 739 ovs_add_flow "test_nat_related_v4" natrelated4 \ 740 "recirc_id(0x2),ct_state(+rel+trk),in_port(2),eth(),eth_type(0x0800),ipv4(dst=192.168.0.20,proto=1),icmp()" \ 741 "drop" || return 1 742 743 # Solicit destination unreachable response from server 744 ovs_sbx "test_nat_related_v4" ip netns exec client \ 745 bash -c "echo a | nc -u -w 1 172.31.110.20 10000" 746 747 # Check to make sure no packets matched the drop rule with incorrect dst ip 748 python3 "$ovs_base/ovs-dpctl.py" dump-flows natrelated4 \ 749 | grep "drop" | grep "packets:0" >/dev/null || return 1 750 751 info "done..." 752 return 0 753} 754 755# netlink_validation 756# - Create a dp 757# - check no warning with "old version" simulation 758test_netlink_checks () { 759 sbx_add "test_netlink_checks" || return 1 760 761 info "setting up new DP" 762 ovs_add_dp "test_netlink_checks" nv0 || return 1 763 # now try again 764 PRE_TEST=$(dmesg | grep -E "RIP: [0-9a-fA-Fx]+:ovs_dp_cmd_new\+") 765 ovs_add_dp "test_netlink_checks" nv0 -V 0 || return 1 766 POST_TEST=$(dmesg | grep -E "RIP: [0-9a-fA-Fx]+:ovs_dp_cmd_new\+") 767 if [ "$PRE_TEST" != "$POST_TEST" ]; then 768 info "failed - gen warning" 769 return 1 770 fi 771 772 ovs_add_netns_and_veths "test_netlink_checks" nv0 left left0 l0 || \ 773 return 1 774 ovs_add_netns_and_veths "test_netlink_checks" nv0 right right0 r0 || \ 775 return 1 776 [ $(python3 $ovs_base/ovs-dpctl.py show nv0 | grep port | \ 777 wc -l) == 3 ] || \ 778 return 1 779 ovs_del_if "test_netlink_checks" nv0 right0 || return 1 780 [ $(python3 $ovs_base/ovs-dpctl.py show nv0 | grep port | \ 781 wc -l) == 2 ] || \ 782 return 1 783 784 info "Checking clone depth" 785 ERR_MSG="Flow actions may not be safe on all matching packets" 786 PRE_TEST=$(dmesg | grep -c "${ERR_MSG}") 787 ovs_add_flow "test_netlink_checks" nv0 \ 788 'in_port(1),eth(),eth_type(0x800),ipv4()' \ 789 'clone(clone(clone(clone(clone(clone(clone(clone(clone(clone(clone(clone(clone(clone(clone(clone(clone(drop)))))))))))))))))' \ 790 >/dev/null 2>&1 && return 1 791 POST_TEST=$(dmesg | grep -c "${ERR_MSG}") 792 793 if [ "$PRE_TEST" == "$POST_TEST" ]; then 794 info "failed - clone depth too large" 795 return 1 796 fi 797 798 PRE_TEST=$(dmesg | grep -c "${ERR_MSG}") 799 ovs_add_flow "test_netlink_checks" nv0 \ 800 'in_port(1),eth(),eth_type(0x0806),arp()' 'drop(0),2' \ 801 &> /dev/null && return 1 802 POST_TEST=$(dmesg | grep -c "${ERR_MSG}") 803 if [ "$PRE_TEST" == "$POST_TEST" ]; then 804 info "failed - error not generated" 805 return 1 806 fi 807 return 0 808} 809 810test_upcall_interfaces() { 811 sbx_add "test_upcall_interfaces" || return 1 812 813 info "setting up new DP" 814 ovs_add_dp "test_upcall_interfaces" ui0 -V 2:1 || return 1 815 816 ovs_add_netns_and_veths "test_upcall_interfaces" ui0 upc left0 l0 \ 817 172.31.110.1/24 -u || return 1 818 819 ovs_wait grep -q "listening on upcall packet handler" ${ovs_dir}/left0.out 820 821 info "sending arping" 822 ip netns exec upc arping -I l0 172.31.110.20 -c 1 \ 823 >$ovs_dir/arping.stdout 2>$ovs_dir/arping.stderr 824 825 grep -E "MISS upcall\[0/yes\]: .*arp\(sip=172.31.110.1,tip=172.31.110.20,op=1,sha=" $ovs_dir/left0.out >/dev/null 2>&1 || return 1 826 return 0 827} 828 829ovs_add_kernel_tunnel() { 830 local sbxname=$1; shift 831 local ns=$1; shift 832 local tnl_type=$1; shift 833 local name=$1; shift 834 local addr=$1; shift 835 836 info "setting up kernel ${tnl_type} tunnel ${name}" 837 ovs_sbx "${sbxname}" ip -netns ${ns} link add dev ${name} type ${tnl_type} $* || return 1 838 on_exit "ovs_sbx ${sbxname} ip -netns ${ns} link del ${name} >/dev/null 2>&1" 839 ovs_sbx "${sbxname}" ip -netns ${ns} addr add dev ${name} ${addr} || return 1 840 ovs_sbx "${sbxname}" ip -netns ${ns} link set dev ${name} mtu 1450 up || return 1 841} 842 843test_tunnel_metadata() { 844 which arping >/dev/null 2>&1 || return $ksft_skip 845 846 sbxname="test_tunnel_metadata" 847 sbx_add "${sbxname}" || return 1 848 849 info "setting up new DP" 850 ovs_add_dp "${sbxname}" tdp0 -V 2:1 || return 1 851 852 ovs_add_netns_and_veths "${sbxname}" tdp0 tns left0 l0 \ 853 172.31.110.1/24 || return 1 854 855 info "removing veth interface from openvswitch and setting IP" 856 ovs_del_if "${sbxname}" tdp0 left0 || return 1 857 ovs_sbx "${sbxname}" ip addr add 172.31.110.2/24 dev left0 || return 1 858 ovs_sbx "${sbxname}" ip link set left0 up || return 1 859 860 info "setting up tunnel port in openvswitch" 861 ovs_add_if "${sbxname}" "vxlan" tdp0 ovs-vxlan0 -u || return 1 862 on_exit "ovs_sbx ${sbxname} ip link del ovs-vxlan0" 863 ovs_wait ip link show ovs-vxlan0 &>/dev/null || return 1 864 ovs_sbx "${sbxname}" ip link set ovs-vxlan0 up || return 1 865 866 configs=$(echo ' 867 1 172.31.221.1/24 1155332 32 set udpcsum flags\(df\|csum\) 868 2 172.31.222.1/24 1234567 45 set noudpcsum flags\(df\) 869 3 172.31.223.1/24 1020304 23 unset udpcsum flags\(csum\) 870 4 172.31.224.1/24 1357986 15 unset noudpcsum' | sed '/^$/d') 871 872 while read -r i addr id ttl df csum flags; do 873 ovs_add_kernel_tunnel "${sbxname}" tns vxlan vxlan${i} ${addr} \ 874 remote 172.31.110.2 id ${id} dstport 4789 \ 875 ttl ${ttl} df ${df} ${csum} || return 1 876 done <<< "${configs}" 877 878 ovs_wait grep -q 'listening on upcall packet handler' \ 879 ${ovs_dir}/ovs-vxlan0.out || return 1 880 881 info "sending arping" 882 for i in 1 2 3 4; do 883 ovs_sbx "${sbxname}" ip netns exec tns \ 884 arping -I vxlan${i} 172.31.22${i}.2 -c 1 \ 885 >${ovs_dir}/arping.stdout 2>${ovs_dir}/arping.stderr 886 done 887 888 info "checking that received decapsulated packets carry correct metadata" 889 while read -r i addr id ttl df csum flags; do 890 arp_hdr="arp\\(sip=172.31.22${i}.1,tip=172.31.22${i}.2,op=1,sha=" 891 addrs="src=172.31.110.1,dst=172.31.110.2" 892 ports="tp_src=[0-9]*,tp_dst=4789" 893 tnl_md="tunnel\\(tun_id=${id},${addrs},ttl=${ttl},${ports},${flags}\\)" 894 895 ovs_sbx "${sbxname}" grep -qE "MISS upcall.*${tnl_md}.*${arp_hdr}" \ 896 ${ovs_dir}/ovs-vxlan0.out || return 1 897 done <<< "${configs}" 898 899 return 0 900} 901 902test_tunnel_refcount() { 903 sbxname="test_tunnel_refcount" 904 sbx_add "${sbxname}" || return 1 905 906 ovs_sbx "${sbxname}" ip netns add trefns || return 1 907 on_exit "ovs_sbx ${sbxname} ip netns del trefns" 908 909 for tun_type in gre vxlan geneve; do 910 info "testing ${tun_type} tunnel vport refcount" 911 912 ovs_sbx "${sbxname}" ip netns exec trefns \ 913 python3 $ovs_base/ovs-dpctl.py \ 914 add-dp dp-${tun_type} || return 1 915 916 ovs_sbx "${sbxname}" ip netns exec trefns \ 917 python3 $ovs_base/ovs-dpctl.py \ 918 add-if --no-lwt -t ${tun_type} \ 919 dp-${tun_type} ovs-${tun_type}0 || return 1 920 921 ovs_wait ip -netns trefns link show \ 922 ovs-${tun_type}0 >/dev/null 2>&1 || return 1 923 924 info "deleting dp - may hang if reference counting is broken" 925 ovs_sbx "${sbxname}" ip netns exec trefns \ 926 python3 $ovs_base/ovs-dpctl.py \ 927 del-dp dp-${tun_type} & 928 929 dev_removed() { 930 ! ip -netns trefns link show "$1" >/dev/null 2>&1 931 } 932 ovs_wait dev_removed dp-${tun_type} || return 1 933 ovs_wait dev_removed ovs-${tun_type}0 || return 1 934 done 935 936 return 0 937} 938 939test_pop_vlan() { 940 local sbx="test_pop_vlan" 941 sbx_add "$sbx" || return $? 942 ovs_add_dp "$sbx" vlandp || return 1 943 944 ovs_add_netns_and_veths "$sbx" vlandp \ 945 ns1 veth1 ns1veth 192.0.2.1/24 || return 1 946 ovs_add_netns_and_veths "$sbx" vlandp \ 947 ns2 veth2 ns2veth 192.0.2.2/24 || return 1 948 949 # Baseline: untagged bidirectional forwarding 950 ovs_add_flow "$sbx" vlandp \ 951 'in_port(1),eth(),eth_type(0x0806),arp()' '2' || return 1 952 ovs_add_flow "$sbx" vlandp \ 953 'in_port(2),eth(),eth_type(0x0806),arp()' '1' || return 1 954 ovs_add_flow "$sbx" vlandp \ 955 'in_port(1),eth(),eth_type(0x0800),ipv4()' '2' || return 1 956 ovs_add_flow "$sbx" vlandp \ 957 'in_port(2),eth(),eth_type(0x0800),ipv4()' '1' || return 1 958 ovs_sbx "$sbx" ip netns exec ns1 ping -c 3 -W 2 \ 959 192.0.2.2 || return 1 960 961 # VLAN topology: ns1 uses VLAN sub-interface, ns2 is plain 962 ip -n ns1 link add link ns1veth name ns1veth.10 \ 963 type vlan id 10 || return 1 964 on_exit "ip -n ns1 link del ns1veth.10 2>/dev/null" 965 ip -n ns1 addr add 198.51.100.1/24 dev ns1veth.10 || return 1 966 ip -n ns1 link set ns1veth.10 up || return 1 967 ip -n ns2 addr add 198.51.100.2/24 dev ns2veth || return 1 968 969 ovs_del_flows "$sbx" vlandp 970 971 # Static ARP: avoids VLAN-tagged ARP complexity 972 local ns1veth10mac ns2mac 973 ns1veth10mac=$(ip -n ns1 link show ns1veth.10 \ 974 | awk '/link\/ether/ {print $2}') 975 [ -z "$ns1veth10mac" ] && \ 976 { info "failed to get ns1veth10mac"; return 1; } 977 ns2mac=$(ip -n ns2 link show ns2veth \ 978 | awk '/link\/ether/ {print $2}') 979 [ -z "$ns2mac" ] && \ 980 { info "failed to get ns2mac"; return 1; } 981 ip -n ns1 neigh replace 198.51.100.2 lladdr "$ns2mac" \ 982 dev ns1veth.10 nud permanent || return 1 983 ip -n ns2 neigh replace 198.51.100.1 \ 984 lladdr "$ns1veth10mac" \ 985 dev ns2veth nud permanent || return 1 986 987 local vlan_match='in_port(1),eth(),eth_type(0x8100),' 988 vlan_match+='vlan(vid=10),' 989 vlan_match+='encap(eth_type(0x0800),' 990 vlan_match+='ipv4(src=198.51.100.1,proto=1),icmp())' 991 992 # Negative: forward without pop_vlan -- tagged frame 993 # is invisible to ns2 (no VLAN sub-interface), ping fails 994 ovs_add_flow "$sbx" vlandp "$vlan_match" '2' || return 1 995 ovs_sbx "$sbx" ip netns exec ns1 ping -I ns1veth.10 \ 996 -c 3 -W 1 198.51.100.2 >/dev/null 2>&1 \ 997 && { info "FAIL: ping should fail without pop_vlan" 998 return 1; } 999 1000 ovs_del_flows "$sbx" vlandp 1001 1002 # Positive: pop_vlan strips tag on forward path, 1003 # push_vlan restores tag on return path -- ping succeeds 1004 ovs_add_flow "$sbx" vlandp \ 1005 "$vlan_match" 'pop_vlan,2' || return 1 1006 ovs_add_flow "$sbx" vlandp \ 1007 'in_port(2),eth(),eth_type(0x0800),ipv4()' \ 1008 'push_vlan(vid=10,pcp=0,tpid=0x8100),1' || return 1 1009 ovs_sbx "$sbx" ip netns exec ns1 ping -I ns1veth.10 \ 1010 -c 3 -W 2 198.51.100.2 || return 1 1011 1012 return 0 1013} 1014 1015run_test() { 1016 ( 1017 tname="$1" 1018 tdesc="$2" 1019 1020 if python3 ovs-dpctl.py -h 2>&1 | \ 1021 grep -E "Need to (install|upgrade) the python" >/dev/null 2>&1; then 1022 stdbuf -o0 printf "TEST: %-60s [PYLIB]\n" "${tdesc}" 1023 return $ksft_skip 1024 fi 1025 1026 python3 ovs-dpctl.py show >/dev/null 2>&1 || \ 1027 echo "[DPCTL] show exception." 1028 1029 if ! lsmod | grep openvswitch >/dev/null 2>&1; then 1030 stdbuf -o0 printf "TEST: %-60s [NOMOD]\n" "${tdesc}" 1031 return $ksft_skip 1032 fi 1033 1034 printf "TEST: %-60s [START]\n" "${tname}" 1035 1036 unset IFS 1037 1038 eval test_${tname} 1039 ret=$? 1040 1041 if [ $ret -eq 0 ]; then 1042 printf "TEST: %-60s [ OK ]\n" "${tdesc}" 1043 ovs_exit_sig 1044 rm -rf "$ovs_dir" 1045 elif [ $ret -eq 1 ]; then 1046 printf "TEST: %-60s [FAIL]\n" "${tdesc}" 1047 if [ "${PAUSE_ON_FAIL}" = "yes" ]; then 1048 echo 1049 echo "Pausing. Logs in $ovs_dir/. Hit enter to continue" 1050 read a 1051 fi 1052 ovs_exit_sig 1053 [ "${PAUSE_ON_FAIL}" = "yes" ] || rm -rf "$ovs_dir" 1054 exit 1 1055 elif [ $ret -eq $ksft_skip ]; then 1056 printf "TEST: %-60s [SKIP]\n" "${tdesc}" 1057 elif [ $ret -eq 2 ]; then 1058 rm -rf test_${tname} 1059 run_test "$1" "$2" 1060 fi 1061 1062 return $ret 1063 ) 1064 ret=$? 1065 case $ret in 1066 0) 1067 [ $all_skipped = true ] && [ $exitcode=$ksft_skip ] && exitcode=0 1068 all_skipped=false 1069 ;; 1070 $ksft_skip) 1071 [ $all_skipped = true ] && exitcode=$ksft_skip 1072 ;; 1073 *) 1074 all_skipped=false 1075 exitcode=1 1076 ;; 1077 esac 1078 1079 return $ret 1080} 1081 1082 1083exitcode=0 1084desc=0 1085all_skipped=true 1086 1087while getopts :pvt o 1088do 1089 case $o in 1090 p) PAUSE_ON_FAIL=yes;; 1091 v) VERBOSE=1;; 1092 t) if which tcpdump > /dev/null 2>&1; then 1093 TRACING=1 1094 else 1095 echo "=== tcpdump not available, tracing disabled" 1096 fi 1097 ;; 1098 *) usage;; 1099 esac 1100done 1101shift $(($OPTIND-1)) 1102 1103IFS=" 1104" 1105 1106for arg do 1107 # Check first that all requested tests are available before running any 1108 command -v > /dev/null "test_${arg}" || { echo "=== Test ${arg} not found"; usage; } 1109done 1110 1111name="" 1112desc="" 1113for t in ${tests}; do 1114 [ "${name}" = "" ] && name="${t}" && continue 1115 [ "${desc}" = "" ] && desc="${t}" 1116 1117 run_this=1 1118 for arg do 1119 [ "${arg}" != "${arg#--*}" ] && continue 1120 [ "${arg}" = "${name}" ] && run_this=1 && break 1121 run_this=0 1122 done 1123 if [ $run_this -eq 1 ]; then 1124 run_test "${name}" "${desc}" 1125 fi 1126 name="" 1127 desc="" 1128done 1129 1130exit ${exitcode} 1131