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 if [ $TRACING -eq 1 ]; then
175 ovs_netns_spawn_daemon "$1" "$3" tcpdump -l -i any -s 6553
176 ovs_wait grep -q "listening on any" ${ovs_dir}/stderr
184 ovs_sbx "$1" python3 $ovs_base/ovs-dpctl.py add-flow "$2" "$3" "$4"
185 if [ $? -ne 0 ]; then
194 ovs_sbx "$1" python3 $ovs_base/ovs-dpctl.py del-flows "$2"
202 perf record -a -q -e skb:kfree_skb -o ${ovs_dir}/perf.data $* \
211 local perf_output=`perf script -i ${ovs_dir}/perf.data -F trace:event,trace`
214 return `echo "$perf_output" | grep "$pattern" | wc -l`
220 PRE_TEST=$(dmesg | grep -c "${ERR_MSG}")
222 POST_TEST=$(dmesg | grep -c "${ERR_MSG}")
233 echo "If no TEST argument is given, all tests will be run."
236 echo " -t: capture traffic via tcpdump"
237 echo " -v: verbose"
238 echo " -p: pause on failure"
246 # - use psample to observe packets
250 # Add a datapath with per-vport dispatching.
251 ovs_add_dp "test_psample" psample -V 2:1 || return 1
255 client c0 c1 172.31.110.10/24 -u || return 1
257 server s0 s1 172.31.110.20/24 -u || return 1
263 info "no support for psample - skipping"
276 "no group with cookie"*"psample(cookie=abcd)" \
277 "no group"*"psample()";
279 set -- $testcase;
282 info "failed - $1"
303 nlpid=$(grep -E "listening on upcall packet handler" \
304 $ovs_dir/s0.out | cut -d ":" -f 2 | tr -d ' ')
311 ovs_spawn_daemon "test_psample" python3 $ovs_base/ovs-dpctl.py psample-events
312 ovs_wait grep -q "listening for psample events" ${ovs_dir}/stdout
315 ovs_sbx "test_psample" ip netns exec client ping -I c1 172.31.110.20 -c 1 || return 1
318 ovs_wait grep -q "userspace action command" $ovs_dir/s0.out || return 1
320 # client -> server samples should only contain the first 14 bytes of the packet.
321 ovs_wait grep -qE "rate:4294967295,group:1,cookie:c0ffee data:[0-9a-f]{28}$" \
324 ovs_wait grep -q "rate:4294967295,group:2,cookie:eeff0c" $ovs_dir/stdout || return 1
330 # - drop packets and verify the right drop reason is reported
335 ovs_drop_subsys=$(pahole -C skb_drop_reason_subsys |
337 tr -d ,)
351 ip netns exec client ip link set c1 up
355 ip netns exec server ip link set s1 up
361 info "no support for drop reasons - skipping"
380 ovs_drop_record_and_run "test_drop_reason" ip netns exec client ping -c 2 172.31.110.20
382 if [[ "$?" -ne "2" ]]; then
391 # Drop UDP 7000 traffic with an explicit action with no error code.
397 "test_drop_reason" ip netns exec client nc -i 1 -zuv 172.31.110.20 6000
399 if [[ "$?" -ne "1" ]]; then
405 "test_drop_reason" ip netns exec client nc -i 1 -zuv 172.31.110.20 7000
407 if [[ "$?" -ne "1" ]]; then
416 # - client has 1500 byte MTU
417 # - server has 1500 byte MTU
418 # - send ARP ping between two ns
435 ip netns exec client ip link set c1 up
436 …HW_CLIENT=`ip netns exec client ip link show dev c1 | grep -E 'link/ether [0-9a-f:]+' | awk '{prin…
441 ip netns exec server ip link set s1 up
442 …HW_SERVER=`ip netns exec server ip link show dev s1 | grep -E 'link/ether [0-9a-f:]+' | awk '{prin…
450 ovs_sbx "test_arp_ping" ip netns exec client arping -I c1 172.31.110.20 -c 1 || return 1
456 # - client has 1500 byte MTU
457 # - server has 1500 byte MTU
458 # - use ICMP to ping in each direction
459 # - only allow CT state stuff to pass through new in c -> s
474 ip netns exec client ip link set c1 up
476 ip netns exec server ip link set s1 up
478 # Add forwarding for ARP and ip packets - completely wildcarded
484 'ct_state(-trk),eth(),eth_type(0x0800),ipv4()' \
500 ovs_sbx "test_ct_connect_v4" ip netns exec client ping 172.31.110.20 -c 3 || return 1
505 nc -lvnp 4443
506 ovs_sbx "test_ct_connect_v4" ip netns exec client nc -i 1 -zv 172.31.110.20 4443 || return 1
511 nc -lvnp 4443
512 ovs_sbx "test_ct_connect_v4" ip netns exec client nc -i 1 -zv 172.31.110.10 4443
523 # - client has 1500 byte MTU
524 # - server has 1500 byte MTU
525 # - use ICMP to ping in each direction
540 ip netns exec client ip link set c1 up
542 ip netns exec server ip link set s1 up
544 # Add forwarding for ARP and ip packets - completely wildcarded
555 ovs_sbx "test_connect_v4" ip netns exec client ping 172.31.110.20 -c 3 || return 1
562 # - client has 1500 byte MTU
563 # - server has 1500 byte MTU
564 # - use ICMP to ping in each direction
565 # - only allow CT state stuff to pass through new in c -> s
579 ip netns exec client ip link set c1 up
581 ip netns exec server ip link set s1 up
590 "ct_state(-trk),in_port(1),eth(),eth_type(0x0800),ipv4(dst=192.168.0.20)" \
593 "ct_state(-trk),in_port(2),eth(),eth_type(0x0800),ipv4()" \
597 "recirc_id(0x1),ct_state(+trk-inv),in_port(1),eth(),eth_type(0x0800),ipv4()" "2"
599 "recirc_id(0x2),ct_state(+trk-inv),in_port(2),eth(),eth_type(0x0800),ipv4()" "1"
602 ovs_sbx "test_nat_connect_v4" ip netns exec client ping 192.168.0.20 -c 3 || return 1
607 nc -lvnp 4443
608 ovs_sbx "test_nat_connect_v4" ip netns exec client nc -i 1 -zv 192.168.0.20 4443 || return 1
613 nc -lvnp 4443
614 ovs_sbx "test_nat_connect_v4" ip netns exec client nc -i 1 -zv 172.31.110.10 4443
625 # - client->server ip packets go via SNAT
626 # - client solicits ICMP destination unreachable packet from server
627 # - undo NAT for ICMP reply and test dst ip has been updated
641 ip netns exec client ip link set c1 up
643 ip netns exec server ip link set s1 up
653 # Allow IP traffic from client->server, rewrite source IP with SNAT to 192.168.0.20
655 "ct_state(-trk),in_port(1),eth(),eth_type(0x0800),ipv4(dst=172.31.110.20)" \
658 "recirc_id(0x1),ct_state(+trk-inv),in_port(1),eth(),eth_type(0x0800),ipv4()" \
664 "ct_state(-trk),in_port(2),eth(),eth_type(0x0800),ipv4()" \
675 bash -c "echo a | nc -u -w 1 172.31.110.20 10000"
677 # Check to make sure no packets matched the drop rule with incorrect dst ip
678 python3 "$ovs_base/ovs-dpctl.py" dump-flows natrelated4 \
686 # - Create a dp
687 # - check no warning with "old version" simulation
694 PRE_TEST=$(dmesg | grep -E "RIP: [0-9a-fA-Fx]+:ovs_dp_cmd_new\+")
695 ovs_add_dp "test_netlink_checks" nv0 -V 0 || return 1
696 POST_TEST=$(dmesg | grep -E "RIP: [0-9a-fA-Fx]+:ovs_dp_cmd_new\+")
698 info "failed - gen warning"
706 [ $(python3 $ovs_base/ovs-dpctl.py show nv0 | grep port | \
707 wc -l) == 3 ] || \
710 [ $(python3 $ovs_base/ovs-dpctl.py show nv0 | grep port | \
711 wc -l) == 2 ] || \
716 PRE_TEST=$(dmesg | grep -c "${ERR_MSG}")
721 POST_TEST=$(dmesg | grep -c "${ERR_MSG}")
724 info "failed - clone depth too large"
728 PRE_TEST=$(dmesg | grep -c "${ERR_MSG}")
732 POST_TEST=$(dmesg | grep -c "${ERR_MSG}")
734 info "failed - error not generated"
744 ovs_add_dp "test_upcall_interfaces" ui0 -V 2:1 || return 1
747 172.31.110.1/24 -u || return 1
749 ovs_wait grep -q "listening on upcall packet handler" ${ovs_dir}/left0.out
752 ip netns exec upc arping -I l0 172.31.110.20 -c 1 \
755 …grep -E "MISS upcall\[0/yes\]: .*arp\(sip=172.31.110.1,tip=172.31.110.20,op=1,sha=" $ovs_dir/left0…
764 if python3 ovs-dpctl.py -h 2>&1 | \
765 grep -E "Need to (install|upgrade) the python" >/dev/null 2>&1; then
766 stdbuf -o0 printf "TEST: %-60s [PYLIB]\n" "${tdesc}"
770 python3 ovs-dpctl.py show >/dev/null 2>&1 || \
774 stdbuf -o0 printf "TEST: %-60s [NOMOD]\n" "${tdesc}"
778 printf "TEST: %-60s [START]\n" "${tname}"
785 if [ $ret -eq 0 ]; then
786 printf "TEST: %-60s [ OK ]\n" "${tdesc}"
788 rm -rf "$ovs_dir"
789 elif [ $ret -eq 1 ]; then
790 printf "TEST: %-60s [FAIL]\n" "${tdesc}"
797 [ "${PAUSE_ON_FAIL}" = "yes" ] || rm -rf "$ovs_dir"
799 elif [ $ret -eq $ksft_skip ]; then
800 printf "TEST: %-60s [SKIP]\n" "${tdesc}"
801 elif [ $ret -eq 2 ]; then
802 rm -rf test_${tname}
845 shift $(($OPTIND-1))
852 command -v > /dev/null "test_${arg}" || { echo "=== Test ${arg} not found"; usage; }
863 [ "${arg}" != "${arg#--*}" ] && continue
867 if [ $run_this -eq 1 ]; then