Lines Matching +full:no +full:- +full:ether +full:- +full:link

2 # SPDX-License-Identifier: GPL-2.0
8 # Kselftest framework requirement - SKIP code is 4.
11 PAUSE_ON_FAIL=no
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
33 echo "`date +"[%m-%d %H:%M:%S]"` $*" >> ${ovs_dir}/debug.log
45 # A quick re-check helps speed up small races in fast systems.
72 if [ -e $d ]; then
74 rm -rf "$d"
81 [ -e ${ovs_dir}/cleanup ] && . "$ovs_dir/cleanup"
95 test -e ${ovs_dir}/cleanup || : > ${ovs_dir}/cleanup
111 ovs_sbx "$sbxname" python3 $ovs_base/ovs-dpctl.py add-dp $*
112 on_exit "ovs_sbx $sbxname python3 $ovs_base/ovs-dpctl.py del-dp $1;"
117 if [ "$4" != "-u" ]; then
118 ovs_sbx "$1" python3 $ovs_base/ovs-dpctl.py add-if "$2" "$3" \
121 python3 $ovs_base/ovs-dpctl.py add-if \
122 -u "$2" "$3" >$ovs_dir/$3.out 2>$ovs_dir/$3.err &
124 on_exit "ovs_sbx $1 kill -TERM $pid 2>/dev/null"
130 ovs_sbx "$1" python3 $ovs_base/ovs-dpctl.py del-if "$2" "$3" || return 1
144 ovs_sbx "$sbx" on_exit "kill -TERM $pid 2>/dev/null"
157 ovs_sbx "$1" ip link add "$4" type veth peer name "$5" || return 1
158 on_exit "ovs_sbx $1 ip link del $4 >/dev/null 2>&1"
159 ovs_sbx "$1" ip link set "$4" up || return 1
160 ovs_sbx "$1" ip link set "$5" netns "$3" || return 1
161 ovs_sbx "$1" ip netns exec "$3" ip link set "$5" up || return 1
168 if [ "$7" != "-u" ]; then
171 ovs_add_if "$1" "$2" "$4" -u || return 1
174 [ $TRACING -eq 1 ] && ovs_netns_spawn_daemon "$1" "$ns" \
175 tcpdump -i any -s 65535
182 ovs_sbx "$1" python3 $ovs_base/ovs-dpctl.py add-flow "$2" "$3" "$4"
183 if [ $? -ne 0 ]; then
192 ovs_sbx "$1" python3 $ovs_base/ovs-dpctl.py del-flows "$2"
200 perf record -a -q -e skb:kfree_skb -o ${ovs_dir}/perf.data $* \
209 local perf_output=`perf script -i ${ovs_dir}/perf.data -F trace:event,trace`
212 return `echo "$perf_output" | grep "$pattern" | wc -l`
218 PRE_TEST=$(dmesg | grep -c "${ERR_MSG}")
220 POST_TEST=$(dmesg | grep -c "${ERR_MSG}")
231 echo "If no TEST argument is given, all tests will be run."
234 echo " -t: capture traffic via tcpdump"
235 echo " -v: verbose"
236 echo " -p: pause on failure"
244 # - use psample to observe packets
248 # Add a datapath with per-vport dispatching.
249 ovs_add_dp "test_psample" psample -V 2:1 || return 1
253 client c0 c1 172.31.110.10/24 -u || return 1
255 server s0 s1 172.31.110.20/24 -u || return 1
261 info "no support for psample - skipping"
274 "no group with cookie"*"psample(cookie=abcd)" \
275 "no group"*"psample()";
277 set -- $testcase;
280 info "failed - $1"
301 nlpid=$(grep -E "listening on upcall packet handler" \
302 $ovs_dir/s0.out | cut -d ":" -f 2 | tr -d ' ')
309 ovs_spawn_daemon "test_psample" python3 $ovs_base/ovs-dpctl.py psample-events
310 ovs_wait grep -q "listening for psample events" ${ovs_dir}/stdout
313 ovs_sbx "test_psample" ip netns exec client ping -I c1 172.31.110.20 -c 1 || return 1
316 ovs_wait grep -q "userspace action command" $ovs_dir/s0.out || return 1
318 # client -> server samples should only contain the first 14 bytes of the packet.
319 ovs_wait grep -qE "rate:4294967295,group:1,cookie:c0ffee data:[0-9a-f]{28}$" \
322 ovs_wait grep -q "rate:4294967295,group:2,cookie:eeff0c" $ovs_dir/stdout || return 1
328 # - drop packets and verify the right drop reason is reported
344 ip netns exec client ip link set c1 up
348 ip netns exec server ip link set s1 up
354 info "no support for drop reasons - skipping"
373 ovs_drop_record_and_run "test_drop_reason" ip netns exec client ping -c 2 172.31.110.20
375 if [[ "$?" -ne "2" ]]; then
384 # Drop UDP 7000 traffic with an explicit action with no error code.
390 "test_drop_reason" ip netns exec client nc -i 1 -zuv 172.31.110.20 6000
392 if [[ "$?" -ne "1" ]]; then
398 "test_drop_reason" ip netns exec client nc -i 1 -zuv 172.31.110.20 7000
400 if [[ "$?" -ne "1" ]]; then
409 # - client has 1500 byte MTU
410 # - server has 1500 byte MTU
411 # - send ARP ping between two ns
428 ip netns exec client ip link set c1 up
429 …HW_CLIENT=`ip netns exec client ip link show dev c1 | grep -E 'link/ether [0-9a-f:]+' | awk '{prin…
434 ip netns exec server ip link set s1 up
435 …HW_SERVER=`ip netns exec server ip link show dev s1 | grep -E 'link/ether [0-9a-f:]+' | awk '{prin…
443 ovs_sbx "test_arp_ping" ip netns exec client arping -I c1 172.31.110.20 -c 1 || return 1
449 # - client has 1500 byte MTU
450 # - server has 1500 byte MTU
451 # - use ICMP to ping in each direction
452 # - only allow CT state stuff to pass through new in c -> s
467 ip netns exec client ip link set c1 up
469 ip netns exec server ip link set s1 up
471 # Add forwarding for ARP and ip packets - completely wildcarded
477 'ct_state(-trk),eth(),eth_type(0x0800),ipv4()' \
493 ovs_sbx "test_ct_connect_v4" ip netns exec client ping 172.31.110.20 -c 3 || return 1
498 nc -lvnp 4443
499 ovs_sbx "test_ct_connect_v4" ip netns exec client nc -i 1 -zv 172.31.110.20 4443 || return 1
504 nc -lvnp 4443
505 ovs_sbx "test_ct_connect_v4" ip netns exec client nc -i 1 -zv 172.31.110.10 4443
516 # - client has 1500 byte MTU
517 # - server has 1500 byte MTU
518 # - use ICMP to ping in each direction
533 ip netns exec client ip link set c1 up
535 ip netns exec server ip link set s1 up
537 # Add forwarding for ARP and ip packets - completely wildcarded
548 ovs_sbx "test_connect_v4" ip netns exec client ping 172.31.110.20 -c 3 || return 1
555 # - client has 1500 byte MTU
556 # - server has 1500 byte MTU
557 # - use ICMP to ping in each direction
558 # - only allow CT state stuff to pass through new in c -> s
572 ip netns exec client ip link set c1 up
574 ip netns exec server ip link set s1 up
583 "ct_state(-trk),in_port(1),eth(),eth_type(0x0800),ipv4(dst=192.168.0.20)" \
586 "ct_state(-trk),in_port(2),eth(),eth_type(0x0800),ipv4()" \
590 "recirc_id(0x1),ct_state(+trk-inv),in_port(1),eth(),eth_type(0x0800),ipv4()" "2"
592 "recirc_id(0x2),ct_state(+trk-inv),in_port(2),eth(),eth_type(0x0800),ipv4()" "1"
595 ovs_sbx "test_nat_connect_v4" ip netns exec client ping 192.168.0.20 -c 3 || return 1
600 nc -lvnp 4443
601 ovs_sbx "test_nat_connect_v4" ip netns exec client nc -i 1 -zv 192.168.0.20 4443 || return 1
606 nc -lvnp 4443
607 ovs_sbx "test_nat_connect_v4" ip netns exec client nc -i 1 -zv 172.31.110.10 4443
618 # - client->server ip packets go via SNAT
619 # - client solicits ICMP destination unreachable packet from server
620 # - undo NAT for ICMP reply and test dst ip has been updated
634 ip netns exec client ip link set c1 up
636 ip netns exec server ip link set s1 up
646 # Allow IP traffic from client->server, rewrite source IP with SNAT to 192.168.0.20
648 "ct_state(-trk),in_port(1),eth(),eth_type(0x0800),ipv4(dst=172.31.110.20)" \
651 "recirc_id(0x1),ct_state(+trk-inv),in_port(1),eth(),eth_type(0x0800),ipv4()" \
657 "ct_state(-trk),in_port(2),eth(),eth_type(0x0800),ipv4()" \
668 bash -c "echo a | nc -u -w 1 172.31.110.20 10000"
670 # Check to make sure no packets matched the drop rule with incorrect dst ip
671 python3 "$ovs_base/ovs-dpctl.py" dump-flows natrelated4 \
679 # - Create a dp
680 # - check no warning with "old version" simulation
687 PRE_TEST=$(dmesg | grep -E "RIP: [0-9a-fA-Fx]+:ovs_dp_cmd_new\+")
688 ovs_add_dp "test_netlink_checks" nv0 -V 0 || return 1
689 POST_TEST=$(dmesg | grep -E "RIP: [0-9a-fA-Fx]+:ovs_dp_cmd_new\+")
691 info "failed - gen warning"
699 [ $(python3 $ovs_base/ovs-dpctl.py show nv0 | grep port | \
700 wc -l) == 3 ] || \
703 [ $(python3 $ovs_base/ovs-dpctl.py show nv0 | grep port | \
704 wc -l) == 2 ] || \
709 PRE_TEST=$(dmesg | grep -c "${ERR_MSG}")
714 POST_TEST=$(dmesg | grep -c "${ERR_MSG}")
717 info "failed - clone depth too large"
721 PRE_TEST=$(dmesg | grep -c "${ERR_MSG}")
725 POST_TEST=$(dmesg | grep -c "${ERR_MSG}")
727 info "failed - error not generated"
737 ovs_add_dp "test_upcall_interfaces" ui0 -V 2:1 || return 1
740 172.31.110.1/24 -u || return 1
742 ovs_wait grep -q "listening on upcall packet handler" ${ovs_dir}/left0.out
745 ip netns exec upc arping -I l0 172.31.110.20 -c 1 \
748 …grep -E "MISS upcall\[0/yes\]: .*arp\(sip=172.31.110.1,tip=172.31.110.20,op=1,sha=" $ovs_dir/left0…
757 if python3 ovs-dpctl.py -h 2>&1 | \
758 grep -E "Need to (install|upgrade) the python" >/dev/null 2>&1; then
759 stdbuf -o0 printf "TEST: %-60s [PYLIB]\n" "${tdesc}"
763 python3 ovs-dpctl.py show >/dev/null 2>&1 || \
767 stdbuf -o0 printf "TEST: %-60s [NOMOD]\n" "${tdesc}"
771 printf "TEST: %-60s [START]\n" "${tname}"
778 if [ $ret -eq 0 ]; then
779 printf "TEST: %-60s [ OK ]\n" "${tdesc}"
781 rm -rf "$ovs_dir"
782 elif [ $ret -eq 1 ]; then
783 printf "TEST: %-60s [FAIL]\n" "${tdesc}"
790 [ "${PAUSE_ON_FAIL}" = "yes" ] || rm -rf "$ovs_dir"
792 elif [ $ret -eq $ksft_skip ]; then
793 printf "TEST: %-60s [SKIP]\n" "${tdesc}"
794 elif [ $ret -eq 2 ]; then
795 rm -rf test_${tname}
838 shift $(($OPTIND-1))
845 command -v > /dev/null "test_${arg}" || { echo "=== Test ${arg} not found"; usage; }
856 [ "${arg}" != "${arg#--*}" ] && continue
860 if [ $run_this -eq 1 ]; then