CVS commit: src/tests/net/altq
Module Name:src Committed By: ozaki-r Date: Fri Jul 16 02:33:32 UTC 2021 Modified Files: src/tests/net/altq: t_cbq.sh Log Message: tests, altq: fix checks of altqd startup Hopefully the fix stabilizes test results on qemu/anita. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/net/altq/t_cbq.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/altq/t_cbq.sh diff -u src/tests/net/altq/t_cbq.sh:1.2 src/tests/net/altq/t_cbq.sh:1.3 --- src/tests/net/altq/t_cbq.sh:1.2 Wed Jul 14 08:33:47 2021 +++ src/tests/net/altq/t_cbq.sh Fri Jul 16 02:33:32 2021 @@ -1,4 +1,4 @@ -# $NetBSD: t_cbq.sh,v 1.2 2021/07/14 08:33:47 ozaki-r Exp $ +# $NetBSD: t_cbq.sh,v 1.3 2021/07/16 02:33:32 ozaki-r Exp $ # # Copyright (c) 2021 Internet Initiative Japan Inc. # All rights reserved. @@ -45,6 +45,23 @@ IP_REMOTE21=10.0.1.2 IP_REMOTE22=10.0.1.22 ALTQD_PIDFILE=./pid +start_altqd() +{ + + $HIJACKING_ALTQ altqd + + sleep 0.1 + if $HIJACKING_ALTQ test ! -f /var/run/altqd.pid; then + sleep 1 + fi + + $HIJACKING_ALTQ test -f /var/run/altqd.pid + if [ $? != 0 ]; then + atf_fail "starting altqd failed" + fi + + $HIJACKING_ALTQ cat /var/run/altqd.pid > $ALTQD_PIDFILE +} start_altqd_basic() { @@ -64,18 +81,9 @@ start_altqd_basic() EOF $DEBUG && cat ./altq.conf atf_check -s exit:0 $HIJACKING_ALTQ cp ./altq.conf /rump/etc/altq.conf - $HIJACKING_ALTQ test -f /rump/etc/altq.conf - - #atf_check -s exit:0 $HIJACKING_ALTQ altqd - $HIJACKING_ALTQ altqd - - $HIJACKING_ALTQ test -f /var/run/altqd.pid - if [ $? != 0 ]; then - atf_check -s exit:0 $HIJACKING_ALTQ altqd -d - # Should abort - fi + atf_check -s exit:0 $HIJACKING_ALTQ test -f /rump/etc/altq.conf - $HIJACKING_ALTQ cat /var/run/altqd.pid > $ALTQD_PIDFILE + start_altqd $DEBUG && $HIJACKING_ALTQ altqstat -s $HIJACKING_ALTQ altqstat -c 1 >./out @@ -196,16 +204,7 @@ start_altqd_multi_ifaces() atf_check -s exit:0 $HIJACKING_ALTQ cp ./altq.conf /rump/etc/altq.conf $HIJACKING_ALTQ test -f /rump/etc/altq.conf - #atf_check -s exit:0 $HIJACKING_ALTQ altqd - $HIJACKING_ALTQ altqd - - $HIJACKING_ALTQ test -f /var/run/altqd.pid - if [ $? != 0 ]; then - atf_check -s exit:0 $HIJACKING_ALTQ altqd -d - # Should abort - fi - - $HIJACKING_ALTQ cat /var/run/altqd.pid > $ALTQD_PIDFILE + start_altqd $DEBUG && $HIJACKING_ALTQ altqstat -s @@ -335,15 +334,7 @@ start_altqd_options() atf_check -s exit:0 $HIJACKING_ALTQ cp ./altq.conf /rump/etc/altq.conf $HIJACKING_ALTQ test -f /rump/etc/altq.conf - $HIJACKING_ALTQ altqd - - $HIJACKING_ALTQ test -f /var/run/altqd.pid - if [ $? != 0 ]; then - atf_check -s exit:0 $HIJACKING_ALTQ altqd -d - # Should abort - fi - - $HIJACKING_ALTQ cat /var/run/altqd.pid > $ALTQD_PIDFILE + start_altqd $DEBUG && $HIJACKING_ALTQ altqstat -s $HIJACKING_ALTQ altqstat -c 1 >./out
CVS commit: src/tests/net/if_vlan
Module Name:src Committed By: yamaguchi Date: Wed Jul 14 08:51:51 UTC 2021 Modified Files: src/tests/net/if_vlan: t_vlan.sh Log Message: vlan: Added missing $HIJACKING before brconfig To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/tests/net/if_vlan/t_vlan.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_vlan/t_vlan.sh diff -u src/tests/net/if_vlan/t_vlan.sh:1.22 src/tests/net/if_vlan/t_vlan.sh:1.23 --- src/tests/net/if_vlan/t_vlan.sh:1.22 Wed Jul 14 08:50:24 2021 +++ src/tests/net/if_vlan/t_vlan.sh Wed Jul 14 08:51:51 2021 @@ -1,4 +1,4 @@ -# $NetBSD: t_vlan.sh,v 1.22 2021/07/14 08:50:24 yamaguchi Exp $ +# $NetBSD: t_vlan.sh,v 1.23 2021/07/14 08:51:51 yamaguchi Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -723,7 +723,7 @@ vlan_bridge_body_common() atf_check -s exit:0 -o match:'mtu 1496' rump.ifconfig vlan0 $atf_brconfig bridge0 add vlan0 - $DEBUG && brconfig bridge0 + $DEBUG && $HIJACKING /sbin/brconfig bridge0 atf_check -s exit:0 -o match:'mtu 1495' rump.ifconfig vlan0 $atf_brconfig bridge0 delete vlan0 @@ -734,13 +734,13 @@ vlan_bridge_body_common() $atf_ifconfig vlan0 mtu 1495 $atf_brconfig bridge0 add vlan0 - $DEBUG && brconfig bridge0 + $DEBUG && $HIJACKING /sbin/brconfig bridge0 atf_check -s exit:0 -o match:'mtu 1496' rump.ifconfig vlan0 $atf_brconfig bridge0 delete vlan0 $atf_ifconfig bridge0 mtu 1497 atf_check -s not-exit:0 -o ignore -e ignore \ - /sbin/brconfig bridge0 add vlan0 + $HIJACKING /sbin/brconfig bridge0 add vlan0 # # Destroy a vlan interface that is bridge member
CVS commit: src/tests/net/if_vlan
Module Name:src Committed By: yamaguchi Date: Wed Jul 14 08:50:24 UTC 2021 Modified Files: src/tests/net/if_vlan: t_vlan.sh Log Message: Added tests for adding vlan(4) to a bridge and deleting from it - add vlan(4) that has no parent interface to a bridge member - the vlan(4) cannot be added to a bridge member - detach the parent interface of vlan(4) that is in a bridge member - vlan(4) is deleted from a bridge member at the detaching To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/tests/net/if_vlan/t_vlan.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_vlan/t_vlan.sh diff -u src/tests/net/if_vlan/t_vlan.sh:1.21 src/tests/net/if_vlan/t_vlan.sh:1.22 --- src/tests/net/if_vlan/t_vlan.sh:1.21 Wed Jul 14 06:35:59 2021 +++ src/tests/net/if_vlan/t_vlan.sh Wed Jul 14 08:50:24 2021 @@ -1,4 +1,4 @@ -# $NetBSD: t_vlan.sh,v 1.21 2021/07/14 06:35:59 yamaguchi Exp $ +# $NetBSD: t_vlan.sh,v 1.22 2021/07/14 08:50:24 yamaguchi Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -681,8 +681,6 @@ vlan_bridge_body_common() $atf_ifconfig shmif0 up $atf_ifconfig vlan0 create - $atf_ifconfig vlan0 vlan 10 vlanif shmif0 - $atf_ifconfig vlan0 up $DEBUG && rump.ifconfig vlan0 $atf_ifconfig bridge0 create @@ -692,16 +690,36 @@ vlan_bridge_body_common() # Add vlan to bridge member # $atf_ifconfig bridge0 mtu 1496 + + # vlan0 can not add to bridge member + # because it is not an ethernet device + atf_check -s not-exit:0 -e match:'Invalid argument' \ + $HIJACKING /sbin/brconfig bridge0 add vlan0 + + $atf_ifconfig vlan0 vlan 10 vlanif shmif0 + $atf_ifconfig vlan0 up atf_check -s exit:0 -o match:'mtu 1496' rump.ifconfig vlan0 + # vlan0 becomes an ethernet device + # after attaching the parent interface $atf_brconfig bridge0 add vlan0 - $DEBUG && brconfig bridge0 + $DEBUG && $HIJACKING /sbin/brconfig bridge0 + $atf_brconfig bridge0 delete vlan0 + $atf_brconfig bridge0 add vlan0 + $atf_ifconfig vlan0 -vlanif + atf_check -s exit:0 -o not-match:'vlan0' \ + $HIJACKING /sbin/brconfig bridge0 + atf_check -s not-exit:0 -e match:'No such' \ + $HIJACKING /sbin/brconfig bridge0 delete vlan0 + # # decrease MTU on adding to bridge member # $atf_ifconfig bridge0 mtu 1495 + $atf_ifconfig vlan0 vlan 10 vlanif shmif0 + $atf_ifconfig vlan0 up atf_check -s exit:0 -o match:'mtu 1496' rump.ifconfig vlan0 $atf_brconfig bridge0 add vlan0
CVS commit: src/tests/net/altq
Module Name:src Committed By: ozaki-r Date: Wed Jul 14 08:33:47 UTC 2021 Modified Files: src/tests/net/altq: t_cbq.sh Log Message: tests, altq: test new options To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/net/altq/t_cbq.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/altq/t_cbq.sh diff -u src/tests/net/altq/t_cbq.sh:1.1 src/tests/net/altq/t_cbq.sh:1.2 --- src/tests/net/altq/t_cbq.sh:1.1 Wed Jul 14 03:22:33 2021 +++ src/tests/net/altq/t_cbq.sh Wed Jul 14 08:33:47 2021 @@ -1,4 +1,4 @@ -# $NetBSD: t_cbq.sh,v 1.1 2021/07/14 03:22:33 ozaki-r Exp $ +# $NetBSD: t_cbq.sh,v 1.2 2021/07/14 08:33:47 ozaki-r Exp $ # # Copyright (c) 2021 Internet Initiative Japan Inc. # All rights reserved. @@ -40,6 +40,7 @@ IP_LOCAL1=10.0.0.1 IP_LOCAL2=10.0.1.1 IP_REMOTE11=10.0.0.2 IP_REMOTE12=10.0.0.22 +IP_REMOTE13=10.0.0.23 IP_REMOTE21=10.0.1.2 IP_REMOTE22=10.0.1.22 ALTQD_PIDFILE=./pid @@ -312,6 +313,118 @@ test_altq_cbq_multi_ifaces_ipv4() rump_server_destroy_ifaces } +start_altqd_options() +{ + + export RUMP_SERVER=$SOCK_LOCAL + + $HIJACKING_ALTQ mkdir -p /rump/etc + $HIJACKING_ALTQ mkdir -p /rump/var/run + + # - no-tbr and no-control are specified + # - root_class is the default class + cat > ./altq.conf <<-EOF + interface shmif0 cbq no-tbr no-control + class cbq shmif0 root_class NULL pbandwidth 100 default + class cbq shmif0 normal_class root_class pbandwidth 50 + filter shmif0 normal_class $IP_REMOTE11 0 0 0 0 + class cbq shmif0 drop_class root_class pbandwidth 0 + filter shmif0 drop_class $IP_REMOTE12 0 0 0 0 + EOF + $DEBUG && cat ./altq.conf + atf_check -s exit:0 $HIJACKING_ALTQ cp ./altq.conf /rump/etc/altq.conf + $HIJACKING_ALTQ test -f /rump/etc/altq.conf + + $HIJACKING_ALTQ altqd + + $HIJACKING_ALTQ test -f /var/run/altqd.pid + if [ $? != 0 ]; then + atf_check -s exit:0 $HIJACKING_ALTQ altqd -d + # Should abort + fi + + $HIJACKING_ALTQ cat /var/run/altqd.pid > $ALTQD_PIDFILE + + $DEBUG && $HIJACKING_ALTQ altqstat -s + $HIJACKING_ALTQ altqstat -c 1 >./out + $DEBUG && cat ./out + atf_check -s exit:0 \ + -o match:"altqstat: cbq on interface shmif0" \ + -o match:'Class 1 on Interface shmif0: root_class' \ + -o match:'Class 2 on Interface shmif0: normal_class' \ + -o match:'Class 3 on Interface shmif0: drop_class' \ + cat ./out + atf_check -s exit:0 -o not-match:'shmif0: ctl_class' cat ./out + + rm -f ./out +} + +test_altq_cbq_options_ipv4() +{ + local ifconfig="atf_check -s exit:0 rump.ifconfig" + local ping="atf_check -s exit:0 -o ignore rump.ping" + local opts="-q -c 1 -w 1" + + rump_server_fs_start $SOCK_LOCAL local altq + rump_server_start $SOCK_REMOTE + + rump_server_add_iface $SOCK_LOCAL shmif0 $BUS + rump_server_add_iface $SOCK_REMOTE shmif0 $BUS + + export RUMP_SERVER=$SOCK_LOCAL + $ifconfig shmif0 inet $IP_LOCAL1/24 + export RUMP_SERVER=$SOCK_REMOTE + $ifconfig shmif0 inet $IP_REMOTE11/24 + $ifconfig shmif0 inet $IP_REMOTE12/24 alias + $ifconfig shmif0 inet $IP_REMOTE13/24 alias + $ifconfig -w 10 + + export RUMP_SERVER=$SOCK_LOCAL + # Invoke ARP + $ping $opts $IP_REMOTE11 + $ping $opts $IP_REMOTE12 + $ping $opts $IP_REMOTE13 + + start_altqd_options + + export RUMP_SERVER=$SOCK_LOCAL + $ping $opts $IP_REMOTE11 + + $HIJACKING_ALTQ altqstat -c 1 >./out + $DEBUG && cat ./out + + check_counter ./out normal 'pkts: 1' + check_counter ./out root 'pkts: 1' + check_counter ./out drop 'pkts: 0' + + atf_check -s not-exit:0 -o ignore -e match:"No buffer space available" \ + rump.ping $opts $IP_REMOTE12 + + $HIJACKING_ALTQ altqstat -c 1 >./out + $DEBUG && cat ./out + + check_counter ./out drop 'drops: 1' + check_counter ./out drop 'pkts: 0' + check_counter ./out normal 'pkts: 1' + check_counter ./out root 'pkts: 1' + + # The packet goes to the default class + $ping $opts $IP_REMOTE13 + + $HIJACKING_ALTQ altqstat -c 1 >./out + $DEBUG && cat ./out + + check_counter ./out drop 'pkts: 0' + check_counter ./out normal 'pkts: 1' + check_counter ./out root 'pkts: 2' + + rm -f ./out + + shutdown_altqd + + rump_server_destroy_ifaces +} + add_test_case() { local algo=$1 @@ -344,4 +457,5 @@ atf_init_test_cases() add_test_case cbq basicipv4 add_test_case cbq multi_ifaces ipv4 + add_test_case cbq options ipv4 }
CVS commit: src/tests/net/if_vlan
Module Name:src Committed By: yamaguchi Date: Wed Jul 14 06:36:00 UTC 2021 Modified Files: src/tests/net/if_vlan: t_vlan.sh Log Message: Added a test about clearing IFF_PROMISC at vlan_unconfig This test is related to PR/49196 To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/tests/net/if_vlan/t_vlan.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_vlan/t_vlan.sh diff -u src/tests/net/if_vlan/t_vlan.sh:1.20 src/tests/net/if_vlan/t_vlan.sh:1.21 --- src/tests/net/if_vlan/t_vlan.sh:1.20 Fri Jul 9 05:54:11 2021 +++ src/tests/net/if_vlan/t_vlan.sh Wed Jul 14 06:35:59 2021 @@ -1,4 +1,4 @@ -# $NetBSD: t_vlan.sh,v 1.20 2021/07/09 05:54:11 yamaguchi Exp $ +# $NetBSD: t_vlan.sh,v 1.21 2021/07/14 06:35:59 yamaguchi Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -986,6 +986,27 @@ vlan_promisc_body() atf_check -s exit:0 -o not-match:'PROMISC' rump.ifconfig vlan0 atf_check -s exit:0 -o not-match:'PROMISC' rump.ifconfig shmif0 + $atf_ifconfig vlan0 -vlanif + + # + # clear IFF_PROMISC after bpf_detach called from ether_ifdetach + # + $atf_ifconfig vlan0 vlan 1 vlanif shmif0 + $atf_ifconfig vlan0 up + + $bpfopen -r vlan0 & + pid=$! + + atf_check -s exit:0 -o match:'PROMISC' rump.ifconfig vlan0 + atf_check -s exit:0 -o match:'PROMISC' rump.ifconfig shmif0 + + $atf_ifconfig vlan0 -vlanif + + atf_check -s exit:0 -o not-match:'PROMISC' rump.ifconfig vlan0 + atf_check -s exit:0 -o not-match:'PROMISC' rump.ifconfig shmif0 + + kill -TERM $pid + atf_check -s exit:0 -o not-match:'PROMISC' rump.ifconfig vlan0 } vlan_promisc_cleanup()
CVS commit: src/tests/net/if_vlan
Module Name:src Committed By: yamaguchi Date: Tue Jul 6 01:18:22 UTC 2021 Modified Files: src/tests/net/if_vlan: t_vlan.sh Log Message: vlan: added checks of linkstate To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/tests/net/if_vlan/t_vlan.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_vlan/t_vlan.sh diff -u src/tests/net/if_vlan/t_vlan.sh:1.18 src/tests/net/if_vlan/t_vlan.sh:1.19 --- src/tests/net/if_vlan/t_vlan.sh:1.18 Fri Jul 2 04:38:10 2021 +++ src/tests/net/if_vlan/t_vlan.sh Tue Jul 6 01:18:22 2021 @@ -1,4 +1,4 @@ -# $NetBSD: t_vlan.sh,v 1.18 2021/07/02 04:38:10 yamaguchi Exp $ +# $NetBSD: t_vlan.sh,v 1.19 2021/07/06 01:18:22 yamaguchi Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -589,8 +589,12 @@ vlan_configs_body_common() $atf_ifconfig shmif1 link b0:a0:75:00:01:01 active $atf_ifconfig vlan0 create + atf_check -s exit:0 -o match:'status: +down' \ + rump.ifconfig vlan0 $atf_ifconfig vlan0 vlan 10 vlanif shmif0 $atf_ifconfig vlan0 -vlanif + atf_check -s exit:0 -o match:'status: +down' \ + rump.ifconfig vlan0 $atf_ifconfig vlan0 vlan 10 vlanif shmif0 $atf_ifconfig vlan0 -vlanif shmif0
CVS commit: src/tests/net/if_vlan
Module Name:src Committed By: yamaguchi Date: Fri Jul 2 04:38:11 UTC 2021 Modified Files: src/tests/net/if_vlan: t_vlan.sh Log Message: Added tests for changing a MTU when the vlan(4) is added to bridge(4) The tests is for PR kern/56292 To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/tests/net/if_vlan/t_vlan.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_vlan/t_vlan.sh diff -u src/tests/net/if_vlan/t_vlan.sh:1.17 src/tests/net/if_vlan/t_vlan.sh:1.18 --- src/tests/net/if_vlan/t_vlan.sh:1.17 Sun Mar 8 09:05:33 2020 +++ src/tests/net/if_vlan/t_vlan.sh Fri Jul 2 04:38:10 2021 @@ -1,4 +1,4 @@ -# $NetBSD: t_vlan.sh,v 1.17 2020/03/08 09:05:33 nisimura Exp $ +# $NetBSD: t_vlan.sh,v 1.18 2021/07/02 04:38:10 yamaguchi Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -669,6 +669,7 @@ vlan_configs6_cleanup() vlan_bridge_body_common() { local atf_ifconfig="atf_check -s exit:0 rump.ifconfig" + local atf_brconfig="atf_check -s exit:0 $HIJACKING /sbin/brconfig" rump_server_add_iface $SOCK_LOCAL shmif0 $BUS @@ -681,17 +682,49 @@ vlan_bridge_body_common() $DEBUG && rump.ifconfig vlan0 $atf_ifconfig bridge0 create - # Adjust to the MTU of a vlan on a shmif - $atf_ifconfig bridge0 mtu 1496 $atf_ifconfig bridge0 up - # Test brconfig add - atf_check -s exit:0 $HIJACKING brconfig bridge0 add vlan0 + + # + # Add vlan to bridge member + # + $atf_ifconfig bridge0 mtu 1496 + atf_check -s exit:0 -o match:'mtu 1496' rump.ifconfig vlan0 + + $atf_brconfig bridge0 add vlan0 + $DEBUG && brconfig bridge0 + $atf_brconfig bridge0 delete vlan0 + + # + # decrease MTU on adding to bridge member + # + $atf_ifconfig bridge0 mtu 1495 + atf_check -s exit:0 -o match:'mtu 1496' rump.ifconfig vlan0 + + $atf_brconfig bridge0 add vlan0 + $DEBUG && brconfig bridge0 + atf_check -s exit:0 -o match:'mtu 1495' rump.ifconfig vlan0 + $atf_brconfig bridge0 delete vlan0 + + # + # increase MTU on adding to bridge member + # + $atf_ifconfig bridge0 mtu 1496 + $atf_ifconfig vlan0 mtu 1495 + $atf_brconfig bridge0 add vlan0 + $DEBUG && brconfig bridge0 - # Test brconfig delete - atf_check -s exit:0 $HIJACKING brconfig bridge0 delete vlan0 + atf_check -s exit:0 -o match:'mtu 1496' rump.ifconfig vlan0 + $atf_brconfig bridge0 delete vlan0 - atf_check -s exit:0 $HIJACKING brconfig bridge0 add vlan0 - # Test vlan destruction with bridge + $atf_ifconfig bridge0 mtu 1497 + atf_check -s not-exit:0 -o ignore -e ignore \ + /sbin/brconfig bridge0 add vlan0 + + # + # Destroy a vlan interface that is bridge member + # + $atf_ifconfig bridge0 mtu 1496 + $atf_brconfig bridge0 add vlan0 $atf_ifconfig vlan0 destroy rump_server_destroy_ifaces
CVS commit: src/tests/net/if_wg
Module Name:src Committed By: riastradh Date: Thu Jun 17 12:45:59 UTC 2021 Modified Files: src/tests/net/if_wg: t_misc.sh Log Message: tests/net/if_wg: Only expect this to fail once! Not sure how that happened, weird artefact of applying fuzzy patch twice or something. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/tests/net/if_wg/t_misc.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_wg/t_misc.sh diff -u src/tests/net/if_wg/t_misc.sh:1.9 src/tests/net/if_wg/t_misc.sh:1.10 --- src/tests/net/if_wg/t_misc.sh:1.9 Thu Jun 17 12:16:09 2021 +++ src/tests/net/if_wg/t_misc.sh Thu Jun 17 12:45:58 2021 @@ -1,4 +1,4 @@ -# $NetBSD: t_misc.sh,v 1.9 2021/06/17 12:16:09 riastradh Exp $ +# $NetBSD: t_misc.sh,v 1.10 2021/06/17 12:45:58 riastradh Exp $ # # Copyright (c) 2018 Ryota Ozaki # All rights reserved. @@ -88,8 +88,6 @@ wg_rekey_body() atf_expect_fail "PR kern/56252" - atf_expect_fail "PR kern/56252" - # No reinitiation is performed atf_check -s exit:0 -o match:"$latest_handshake" \ $HIJACKING wgconfig wg0 show peer peer0
CVS commit: src/tests/net/if_wg
Module Name:src Committed By: riastradh Date: Thu Jun 17 12:16:09 UTC 2021 Modified Files: src/tests/net/if_wg: t_misc.sh Log Message: tests/net/if_wg: Mark as flaky (PR kern/56252). To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/tests/net/if_wg/t_misc.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_wg/t_misc.sh diff -u src/tests/net/if_wg/t_misc.sh:1.8 src/tests/net/if_wg/t_misc.sh:1.9 --- src/tests/net/if_wg/t_misc.sh:1.8 Wed Jun 16 23:45:52 2021 +++ src/tests/net/if_wg/t_misc.sh Thu Jun 17 12:16:09 2021 @@ -1,4 +1,4 @@ -# $NetBSD: t_misc.sh,v 1.8 2021/06/16 23:45:52 riastradh Exp $ +# $NetBSD: t_misc.sh,v 1.9 2021/06/17 12:16:09 riastradh Exp $ # # Copyright (c) 2018 Ryota Ozaki # All rights reserved. @@ -86,6 +86,10 @@ wg_rekey_body() $ping $ip_wg_peer + atf_expect_fail "PR kern/56252" + + atf_expect_fail "PR kern/56252" + # No reinitiation is performed atf_check -s exit:0 -o match:"$latest_handshake" \ $HIJACKING wgconfig wg0 show peer peer0 @@ -113,6 +117,8 @@ wg_rekey_body() $HIJACKING wgconfig wg0 show peer peer0 destroy_wg_interfaces + + atf_fail "failed to trigger PR kern/56252" } wg_rekey_cleanup() @@ -202,6 +208,8 @@ wg_handshake_timeout_body() export RUMP_SERVER=$SOCK_LOCAL destroy_wg_interfaces + + atf_fail "failed to trigger PR kern/56252" } wg_handshake_timeout_cleanup() @@ -263,6 +271,8 @@ wg_cookie_body() # and a session doesn't start $ping_fail $ip_wg_peer + atf_expect_fail "PR kern/56252" + extract_new_packets $BUS > $outfile $DEBUG && cat $outfile # XXX length 64 indicates the message is a cookie message @@ -286,6 +296,8 @@ wg_cookie_body() $HIJACKING wgconfig wg0 destroy_wg_interfaces + + atf_fail "failed to trigger PR kern/56252" } wg_cookie_cleanup() @@ -342,6 +354,8 @@ wg_mobility_body() export RUMP_SERVER=$SOCK_LOCAL $ping_fail $ip_wg_peer + atf_expect_fail "PR kern/56252" + extract_new_packets $BUS > $outfile $DEBUG && cat $outfile @@ -380,6 +394,8 @@ wg_mobility_body() atf_check -s exit:0 -o not-match:"$ip_local.$port > $ip_peer.$port" cat $outfile destroy_wg_interfaces + + atf_fail "failed to trigger PR kern/56252" } wg_mobility_cleanup()
CVS commit: src/tests/net/if_wg
Module Name:src Committed By: riastradh Date: Wed Jun 16 23:45:53 UTC 2021 Modified Files: src/tests/net/if_wg: t_misc.sh Log Message: tests/net/if_wg: Fix typo: $ifconfig, not $ifconfg. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/tests/net/if_wg/t_misc.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_wg/t_misc.sh diff -u src/tests/net/if_wg/t_misc.sh:1.7 src/tests/net/if_wg/t_misc.sh:1.8 --- src/tests/net/if_wg/t_misc.sh:1.7 Thu Nov 5 20:03:56 2020 +++ src/tests/net/if_wg/t_misc.sh Wed Jun 16 23:45:52 2021 @@ -1,4 +1,4 @@ -# $NetBSD: t_misc.sh,v 1.7 2020/11/05 20:03:56 martin Exp $ +# $NetBSD: t_misc.sh,v 1.8 2021/06/16 23:45:52 riastradh Exp $ # # Copyright (c) 2018 Ryota Ozaki # All rights reserved. @@ -420,7 +420,7 @@ wg_keepalive_body() setup_common shmif0 inet $ip_local 24 setup_wg_common wg0 inet $ip_wg_local 24 $port "$key_priv_local" add_peer wg0 peer0 $key_pub_peer $ip_peer:$port $ip_wg_peer/32 - $ifconfg -w 10 + $ifconfig -w 10 export RUMP_SERVER=$SOCK_PEER setup_common shmif0 inet $ip_peer 24
CVS commit: src/tests/net/if_pppoe
Module Name:src Committed By: yamaguchi Date: Tue Jun 1 05:18:33 UTC 2021 Modified Files: src/tests/net/if_pppoe: t_pppoe.sh Log Message: Update test case. The state of IPCP and IPv6CP is Closed when those are disabled. To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/tests/net/if_pppoe/t_pppoe.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_pppoe/t_pppoe.sh diff -u src/tests/net/if_pppoe/t_pppoe.sh:1.32 src/tests/net/if_pppoe/t_pppoe.sh:1.33 --- src/tests/net/if_pppoe/t_pppoe.sh:1.32 Thu May 13 03:37:58 2021 +++ src/tests/net/if_pppoe/t_pppoe.sh Tue Jun 1 05:18:33 2021 @@ -1,4 +1,4 @@ -# $NetBSD: t_pppoe.sh,v 1.32 2021/05/13 03:37:58 yamaguchi Exp $ +# $NetBSD: t_pppoe.sh,v 1.33 2021/06/01 05:18:33 yamaguchi Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -743,7 +743,7 @@ pppoe_params_body() atf_pppoectl pppoe0 noipv6cp atf_ifconfig pppoe0 up wait_for_opened "IPCP" - atf_check -s exit:0 -o match:'IPv6CP state: initial' \ + atf_check -s exit:0 -o match:'IPv6CP state: closed' \ -x "$HIJACKING pppoectl -dd pppoe0" atf_ifconfig pppoe0 down @@ -755,7 +755,7 @@ pppoe_params_body() atf_pppoectl pppoe0 noipcp ipv6cp atf_ifconfig pppoe0 up wait_for_opened "IPv6CP" - atf_check -s exit:0 -o match:'IPCP state: initial' \ + atf_check -s exit:0 -o match:'IPCP state: closed' \ -x "$HIJACKING pppoectl -dd pppoe0" }
CVS commit: src/tests/net/if_lagg
Module Name:src Committed By: yamaguchi Date: Tue May 25 00:38:30 UTC 2021 Modified Files: src/tests/net/if_lagg: t_lagg.sh Log Message: Added missing cleanup option Fixes PR/56206 To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/net/if_lagg/t_lagg.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_lagg/t_lagg.sh diff -u src/tests/net/if_lagg/t_lagg.sh:1.1 src/tests/net/if_lagg/t_lagg.sh:1.2 --- src/tests/net/if_lagg/t_lagg.sh:1.1 Mon May 17 04:07:44 2021 +++ src/tests/net/if_lagg/t_lagg.sh Tue May 25 00:38:30 2021 @@ -1,4 +1,4 @@ -# $NetBSD: t_lagg.sh,v 1.1 2021/05/17 04:07:44 yamaguchi Exp $ +# $NetBSD: t_lagg.sh,v 1.2 2021/05/25 00:38:30 yamaguchi Exp $ # # Copyright (c) 2021 Internet Initiative Japan Inc. # All rights reserved. @@ -500,7 +500,7 @@ lagg_lacp_ipv4_cleanup() cleanup } -atf_test_case lagg_lacp_ipv6 +atf_test_case lagg_lacp_ipv6 cleanup lagg_lacp_ipv6_head() {
CVS commit: src/tests/net/if_pppoe
Module Name:src Committed By: yamaguchi Date: Thu May 13 03:37:58 UTC 2021 Modified Files: src/tests/net/if_pppoe: t_pppoe.sh Log Message: Fix the wrong state check After disconnection from PPPoE server, the client waits for reconnection in initial state or reconnects in PADI state. To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/tests/net/if_pppoe/t_pppoe.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_pppoe/t_pppoe.sh diff -u src/tests/net/if_pppoe/t_pppoe.sh:1.31 src/tests/net/if_pppoe/t_pppoe.sh:1.32 --- src/tests/net/if_pppoe/t_pppoe.sh:1.31 Tue May 11 05:57:02 2021 +++ src/tests/net/if_pppoe/t_pppoe.sh Thu May 13 03:37:58 2021 @@ -1,4 +1,4 @@ -# $NetBSD: t_pppoe.sh,v 1.31 2021/05/11 05:57:02 yamaguchi Exp $ +# $NetBSD: t_pppoe.sh,v 1.32 2021/05/13 03:37:58 yamaguchi Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -204,7 +204,8 @@ run_test() wait_for_disconnected atf_check -s not-exit:0 -o ignore -e ignore \ rump.ping -c 1 -w $TIMEOUT $SERVER_IP - atf_check -s exit:0 -o match:'PADI sent' -x "$HIJACKING pppoectl -d pppoe0" + atf_check -s exit:0 -o match:'(PADI sent)|(initial)' \ + -x "$HIJACKING pppoectl -d pppoe0" unset RUMP_SERVER # test for reconnecting
CVS commit: src/tests/net/if_pppoe
Module Name:src Committed By: yamaguchi Date: Tue May 11 05:57:02 UTC 2021 Modified Files: src/tests/net/if_pppoe: t_pppoe.sh Log Message: Add tests for "pppoectl {no}[ipcp|ipv6cp]" To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/tests/net/if_pppoe/t_pppoe.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_pppoe/t_pppoe.sh diff -u src/tests/net/if_pppoe/t_pppoe.sh:1.30 src/tests/net/if_pppoe/t_pppoe.sh:1.31 --- src/tests/net/if_pppoe/t_pppoe.sh:1.30 Tue May 11 00:55:51 2021 +++ src/tests/net/if_pppoe/t_pppoe.sh Tue May 11 05:57:02 2021 @@ -1,4 +1,4 @@ -# $NetBSD: t_pppoe.sh,v 1.30 2021/05/11 00:55:51 yamaguchi Exp $ +# $NetBSD: t_pppoe.sh,v 1.31 2021/05/11 05:57:02 yamaguchi Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -725,6 +725,37 @@ pppoe_params_body() -x "${dumpcmd} | grep PADR" atf_check -s exit:0 -o not-match:'\[AC-Name "ACNAME-TEST5\]"' -e ignore \ -x "${dumpcmd} | grep PADI" + + export RUMP_SERVER=$CLIENT + atf_ifconfig pppoe0 down + export RUMP_SERVER=$SERVER + wait_for_disconnected + + # ipcp & ipv6cp are enabled by default + export RUMP_SERVER=$CLIENT + atf_check -s exit:0 -o match:'ipcp: enable' \ + -x "$HIJACKING pppoectl pppoe0" + atf_check -s exit:0 -o match:'ipv6cp: enable' \ + -x "$HIJACKING pppoectl pppoe0" + + # ipcp enable & ipv6cp disable + atf_pppoectl pppoe0 noipv6cp + atf_ifconfig pppoe0 up + wait_for_opened "IPCP" + atf_check -s exit:0 -o match:'IPv6CP state: initial' \ + -x "$HIJACKING pppoectl -dd pppoe0" + + atf_ifconfig pppoe0 down + export RUMP_SERVER=$SERVER + wait_for_disconnected + + # ipcp disable & ipv6cp enable + export RUMP_SERVER=$CLIENT + atf_pppoectl pppoe0 noipcp ipv6cp + atf_ifconfig pppoe0 up + wait_for_opened "IPv6CP" + atf_check -s exit:0 -o match:'IPCP state: initial' \ + -x "$HIJACKING pppoectl -dd pppoe0" } pppoe_params_cleanup()
CVS commit: src/tests/net/if_pppoe
Module Name:src Committed By: yamaguchi Date: Tue May 11 00:55:51 UTC 2021 Modified Files: src/tests/net/if_pppoe: t_pppoe.sh Log Message: Added missing '$' To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/tests/net/if_pppoe/t_pppoe.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_pppoe/t_pppoe.sh diff -u src/tests/net/if_pppoe/t_pppoe.sh:1.29 src/tests/net/if_pppoe/t_pppoe.sh:1.30 --- src/tests/net/if_pppoe/t_pppoe.sh:1.29 Thu May 6 01:09:43 2021 +++ src/tests/net/if_pppoe/t_pppoe.sh Tue May 11 00:55:51 2021 @@ -1,4 +1,4 @@ -# $NetBSD: t_pppoe.sh,v 1.29 2021/05/06 01:09:43 yamaguchi Exp $ +# $NetBSD: t_pppoe.sh,v 1.30 2021/05/11 00:55:51 yamaguchi Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -238,7 +238,7 @@ run_test() atf_ifconfig -w 10 atf_check -s exit:0 -o ignore rump.ping -c 1 -w $TIMEOUT $CLIENT_IP atf_check -s exit:0 -o match:'session' -x "$HIJACKING pppoectl -d pppoe0" - $DEBUG && HIJACKING pppoectl -d pppoe0 + $DEBUG && $HIJACKING pppoectl -d pppoe0 unset RUMP_SERVER # test for invalid password
CVS commit: src/tests/net/if_pppoe
Module Name:src Committed By: yamaguchi Date: Thu May 6 01:09:43 UTC 2021 Modified Files: src/tests/net/if_pppoe: t_pppoe.sh Log Message: Added missing waiting for DAD completion To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/tests/net/if_pppoe/t_pppoe.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_pppoe/t_pppoe.sh diff -u src/tests/net/if_pppoe/t_pppoe.sh:1.28 src/tests/net/if_pppoe/t_pppoe.sh:1.29 --- src/tests/net/if_pppoe/t_pppoe.sh:1.28 Fri Apr 23 03:41:55 2021 +++ src/tests/net/if_pppoe/t_pppoe.sh Thu May 6 01:09:43 2021 @@ -1,4 +1,4 @@ -# $NetBSD: t_pppoe.sh,v 1.28 2021/04/23 03:41:55 yamaguchi Exp $ +# $NetBSD: t_pppoe.sh,v 1.29 2021/05/06 01:09:43 yamaguchi Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -760,6 +760,7 @@ pppoe_passiveauthproto() atf_ifconfig pppoe0 up $DEBUG && rump.ifconfig wait_for_opened $cp + atf_ifconfig -w 10 atf_check -s exit:0 -o ignore rump.ping -c 1 -w $TIMEOUT $SERVER_IP }
CVS commit: src/tests/net/if_pppoe
Module Name:src Committed By: yamaguchi Date: Fri Apr 23 03:41:55 UTC 2021 Modified Files: src/tests/net/if_pppoe: t_pppoe.sh Log Message: Added a test case for MTU of pppoe(4) To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/tests/net/if_pppoe/t_pppoe.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_pppoe/t_pppoe.sh diff -u src/tests/net/if_pppoe/t_pppoe.sh:1.27 src/tests/net/if_pppoe/t_pppoe.sh:1.28 --- src/tests/net/if_pppoe/t_pppoe.sh:1.27 Fri Apr 23 03:40:05 2021 +++ src/tests/net/if_pppoe/t_pppoe.sh Fri Apr 23 03:41:55 2021 @@ -1,4 +1,4 @@ -# $NetBSD: t_pppoe.sh,v 1.27 2021/04/23 03:40:05 yamaguchi Exp $ +# $NetBSD: t_pppoe.sh,v 1.28 2021/04/23 03:41:55 yamaguchi Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -805,6 +805,74 @@ pppoe_passiveauthproto_chap_cleanup() cleanup } +atf_test_case pppoe_mtu cleanup +pppoe_mtu_head() +{ + + atf_set "descr" "Test for mtu" + atf_set "require.progs" "rump_server" +} + +pppoe_mtu_body() +{ + local auth=chap + local cp="IPCP" + setup + + export RUMP_SERVER=$SERVER + atf_pppoectl pppoe0 \ + "hisauthname=$AUTHNAME" "hisauthsecret=$SECRET" \ + "hisauthproto=$auth" "myauthproto=none" \ + norechallenge + atf_ifconfig pppoe0 mtu 1400 + atf_ifconfig pppoe0 up + + export RUMP_SERVER=$CLIENT + atf_pppoectl pppoe0 \ + "myauthname=$AUTHNAME" "myauthsecret=$SECRET" \ + "myauthproto=$auth" "hisauthproto=none" + atf_ifconfig pppoe0 mtu 1450 + atf_ifconfig pppoe0 up + + wait_for_opened $cp + atf_ifconfig -w 10 + + export RUMP_SERVER=$SERVER + atf_check -s exit:0 -o match:'mtu 1400' rump.ifconfig pppoe0 + + export RUMP_SERVER=$CLIENT + atf_check -s exit:0 -o match:'mtu 1400' rump.ifconfig pppoe0 + + # mtu can set to 1460 but it is not applied. + atf_ifconfig pppoe0 mtu 1460 + atf_check -s exit:0 -o match:'mtu 1400' rump.ifconfig pppoe0 + + export RUMP_SERVER=$SERVER + atf_ifconfig pppoe0 mtu 1470 + atf_ifconfig pppoe0 down + atf_ifconfig pppoe0 up + wait_for_opened $cp + atf_ifconfig -w 10 + + # mtu 1460 is applied after LCP negotiation + atf_check -s exit:0 -o match:'mtu 1460' rump.ifconfig pppoe0 + + export RUMP_SERVER=$CLIENT + atf_check -s exit:0 -o match:'mtu 1460' rump.ifconfig pppoe0 + + rump.ifconfig pppoe0 mtu 1500 + atf_check -s exit:0 -o ignore \ + -e match:'SIOCSIFMTU: Invalid argument' \ + rump.ifconfig pppoe0 mtu 1501 +} + +pppoe_mtu_cleanup() +{ + + $DEBUG && dump + cleanup +} + atf_init_test_cases() { @@ -816,4 +884,5 @@ atf_init_test_cases() atf_add_test_case pppoe6_chap atf_add_test_case pppoe_passiveauthproto_pap atf_add_test_case pppoe_passiveauthproto_chap + atf_add_test_case pppoe_mtu }
CVS commit: src/tests/net/if_pppoe
Module Name:src Committed By: yamaguchi Date: Fri Apr 23 03:40:05 UTC 2021 Modified Files: src/tests/net/if_pppoe: t_pppoe.sh Log Message: Make IFF_DEBUG enabled if $DEBUG is true To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/tests/net/if_pppoe/t_pppoe.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_pppoe/t_pppoe.sh diff -u src/tests/net/if_pppoe/t_pppoe.sh:1.26 src/tests/net/if_pppoe/t_pppoe.sh:1.27 --- src/tests/net/if_pppoe/t_pppoe.sh:1.26 Fri Apr 23 03:38:19 2021 +++ src/tests/net/if_pppoe/t_pppoe.sh Fri Apr 23 03:40:05 2021 @@ -1,4 +1,4 @@ -# $NetBSD: t_pppoe.sh,v 1.26 2021/04/23 03:38:19 yamaguchi Exp $ +# $NetBSD: t_pppoe.sh,v 1.27 2021/04/23 03:40:05 yamaguchi Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -88,6 +88,7 @@ setup_ifaces() inet $SERVER_IP $CLIENT_IP down atf_ifconfig pppoe0 link0 + $DEBUG && rump.ifconfig pppoe0 debug $DEBUG && rump.ifconfig $DEBUG && $HIJACKING pppoectl -d pppoe0 unset RUMP_SERVER @@ -98,6 +99,7 @@ setup_ifaces() $inet && atf_ifconfig pppoe0 \ inet 0.0.0.0 0.0.0.1 down + $DEBUG && rump.ifconfig pppoe0 debug $DEBUG && rump.ifconfig $DEBUG && $HIJACKING pppoectl -d pppoe0 unset RUMP_SERVER
CVS commit: src/tests/net/if_pppoe
Module Name:src Committed By: yamaguchi Date: Fri Apr 23 03:38:19 UTC 2021 Modified Files: src/tests/net/if_pppoe: t_pppoe.sh Log Message: functionalize rump.ifconfig and pppoectl for clearer test code To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/tests/net/if_pppoe/t_pppoe.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_pppoe/t_pppoe.sh diff -u src/tests/net/if_pppoe/t_pppoe.sh:1.25 src/tests/net/if_pppoe/t_pppoe.sh:1.26 --- src/tests/net/if_pppoe/t_pppoe.sh:1.25 Fri Apr 23 03:07:19 2021 +++ src/tests/net/if_pppoe/t_pppoe.sh Fri Apr 23 03:38:19 2021 @@ -1,4 +1,4 @@ -# $NetBSD: t_pppoe.sh,v 1.25 2021/04/23 03:07:19 yamaguchi Exp $ +# $NetBSD: t_pppoe.sh,v 1.26 2021/04/23 03:38:19 yamaguchi Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -39,6 +39,18 @@ TIMEOUT=3 WAITTIME=10 DEBUG=${DEBUG:-false} +atf_ifconfig() +{ + + atf_check -s exit:0 rump.ifconfig $* +} + +atf_pppoectl() +{ + + atf_check -s exit:0 -x "$HIJACKING pppoectl $*" +} + atf_test_case pppoe_create_destroy cleanup pppoe_create_destroy_head() { @@ -71,19 +83,19 @@ setup_ifaces() rump_server_add_iface $CLIENT pppoe0 export RUMP_SERVER=$SERVER - atf_check -s exit:0 rump.ifconfig shmif0 up - $inet && atf_check -s exit:0 rump.ifconfig pppoe0 \ + atf_ifconfig shmif0 up + $inet && atf_ifconfig pppoe0 \ inet $SERVER_IP $CLIENT_IP down - atf_check -s exit:0 rump.ifconfig pppoe0 link0 + atf_ifconfig pppoe0 link0 $DEBUG && rump.ifconfig $DEBUG && $HIJACKING pppoectl -d pppoe0 unset RUMP_SERVER export RUMP_SERVER=$CLIENT - atf_check -s exit:0 rump.ifconfig shmif0 up + atf_ifconfig shmif0 up - $inet && atf_check -s exit:0 rump.ifconfig pppoe0 \ + $inet && atf_ifconfig pppoe0 \ inet 0.0.0.0 0.0.0.1 down $DEBUG && rump.ifconfig @@ -105,11 +117,11 @@ setup() setup_ifaces export RUMP_SERVER=$SERVER - atf_check -s exit:0 -x "$HIJACKING pppoectl -e shmif0 pppoe0" + atf_pppoectl -e shmif0 pppoe0 unset RUMP_SERVER export RUMP_SERVER=$CLIENT - atf_check -s exit:0 -x "$HIJACKING pppoectl -e shmif0 pppoe0" + atf_pppoectl -e shmif0 pppoe0 unset RUMP_SERVER } @@ -166,22 +178,17 @@ run_test() fi export RUMP_SERVER=$SERVER - local setup_serverparam="pppoectl pppoe0 hisauthproto=$auth \ -'hisauthname=$AUTHNAME' \ -'hisauthsecret=$SECRET' \ -'myauthproto=none' \ -$server_optparam" - atf_check -s exit:0 -x "$HIJACKING $setup_serverparam" - atf_check -s exit:0 rump.ifconfig pppoe0 up + atf_pppoectl pppoe0 "hisauthproto=$auth" \ + "hisauthname=$AUTHNAME" "hisauthsecret=$SECRET" \ + "myauthproto=none" $server_optparam + atf_ifconfig pppoe0 up unset RUMP_SERVER export RUMP_SERVER=$CLIENT - local setup_clientparam="pppoectl pppoe0 myauthproto=$auth \ -'myauthname=$AUTHNAME' \ -'myauthsecret=$SECRET' \ -'hisauthproto=none'" - atf_check -s exit:0 -x "$HIJACKING $setup_clientparam" - atf_check -s exit:0 rump.ifconfig pppoe0 up + atf_pppoectl pppoe0 \ + "myauthname=$AUTHNAME" "myauthsecret=$SECRET" \ + "myauthproto=$auth" "hisauthproto=none" + atf_ifconfig pppoe0 up $DEBUG && rump.ifconfig wait_for_opened $cp atf_check -s exit:0 -o ignore rump.ping -c 1 -w $TIMEOUT $SERVER_IP @@ -189,7 +196,7 @@ run_test() # test for disconnection from server export RUMP_SERVER=$SERVER - atf_check -s exit:0 rump.ifconfig pppoe0 down + atf_ifconfig pppoe0 down wait_for_disconnected export RUMP_SERVER=$CLIENT wait_for_disconnected @@ -207,7 +214,7 @@ run_test() # test for disconnection from client export RUMP_SERVER=$CLIENT - atf_check -s exit:0 -x rump.ifconfig pppoe0 down + atf_ifconfig pppoe0 down wait_for_disconnected export RUMP_SERVER=$SERVER wait_for_disconnected @@ -219,14 +226,14 @@ run_test() # test for reconnecting export RUMP_SERVER=$CLIENT - atf_check -s exit:0 -x rump.ifconfig pppoe0 up + atf_ifconfig pppoe0 up wait_for_opened $cp $DEBUG && rump.ifconfig pppoe0 $DEBUG && $HIJACKING pppoectl -d pppoe0 unset RUMP_SERVER export RUMP_SERVER=$SERVER - atf_check -s exit:0 rump.ifconfig -w 10 + atf_ifconfig -w 10 atf_check -s exit:0 -o ignore rump.ping -c 1 -w $TIMEOUT $CLIENT_IP atf_check -s exit:0 -o match:'session' -x "$HIJACKING pppoectl -d pppoe0" $DEBUG && HIJACKING pppoectl -d pppoe0 @@ -234,15 +241,14 @@ run_test() # test for invalid password export RUMP_SERVER=$CLIENT - atf_check -s exit:0 rump.ifconfig pppoe0 down + atf_ifconfig pppoe0 down wait_for_disconnected - local setup_clientparam="pppoectl pppoe0 myauthproto=$auth \ -'myauthname=$AUTHNAME' \ -'myauthsecret=invalidsecret' \ -'hisauthproto=none' \ -'max-auth-failure=1'" - atf_check -s exit:0 -x "$HIJACKING $setup_clientparam" - atf_check -s exit:0 rump.ifconfig pppoe0 up + atf_pppoectl pppoe0
CVS commit: src/tests/net/if_pppoe
Module Name:src Committed By: yamaguchi Date: Fri Apr 23 03:07:19 UTC 2021 Modified Files: src/tests/net/if_pppoe: t_pppoe.sh Log Message: Added test cases for "pppoectl passiveauthproto" To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/tests/net/if_pppoe/t_pppoe.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_pppoe/t_pppoe.sh diff -u src/tests/net/if_pppoe/t_pppoe.sh:1.24 src/tests/net/if_pppoe/t_pppoe.sh:1.25 --- src/tests/net/if_pppoe/t_pppoe.sh:1.24 Wed Nov 25 10:35:07 2020 +++ src/tests/net/if_pppoe/t_pppoe.sh Fri Apr 23 03:07:19 2021 @@ -1,4 +1,4 @@ -# $NetBSD: t_pppoe.sh,v 1.24 2020/11/25 10:35:07 yamaguchi Exp $ +# $NetBSD: t_pppoe.sh,v 1.25 2021/04/23 03:07:19 yamaguchi Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -739,6 +739,82 @@ pppoe_params_cleanup() $DEBUG && dump cleanup } + +pppoe_passiveauthproto() +{ + local auth=$1 + local cp="IPCP" + setup + + local server_optparam="" + if [ $auth = "chap" ]; then + server_optparam="norechallenge" + fi + + export RUMP_SERVER=$SERVER + local setup_serverparam="pppoectl pppoe0 hisauthproto=$auth \ +'hisauthname=$AUTHNAME' \ +'hisauthsecret=$SECRET' \ +'myauthproto=none' \ +$server_optparam" + atf_check -s exit:0 -x "$HIJACKING $setup_serverparam" + atf_check -s exit:0 rump.ifconfig pppoe0 up + + export RUMP_SERVER=$CLIENT + local setup_clientparam="pppoectl pppoe0 myauthproto=none \ +'myauthname=$AUTHNAME' \ +'myauthsecret=$SECRET' \ +'hisauthproto=none' \ +'passiveauthproto'" + atf_check -s exit:0 -x "$HIJACKING $setup_clientparam" + atf_check -s exit:0 rump.ifconfig pppoe0 up + $DEBUG && rump.ifconfig + wait_for_opened $cp + atf_check -s exit:0 -o ignore rump.ping -c 1 -w $TIMEOUT $SERVER_IP +} + +atf_test_case pppoe_passiveauthproto_pap cleanup +pppoe_passiveauthproto_pap_head() +{ + + atf_set "descr" "Test for passiveauthproto option on PAP" + atf_set "require.progs" "rump_server" +} + +pppoe_passiveauthproto_pap_body() +{ + + pppoe_passiveauthproto "pap" +} + +pppoe_passiveauthproto_pap_cleanup() +{ + + $DEBUG && dump + cleanup +} + +atf_test_case pppoe_passiveauthproto_chap cleanup +pppoe_passiveauthproto_chap_head() +{ + + atf_set "descr" "Test for passiveauthproto option on chap" + atf_set "require.progs" "rump_server" +} + +pppoe_passiveauthproto_chap_body() +{ + + pppoe_passiveauthproto "chap" +} + +pppoe_passiveauthproto_chap_cleanup() +{ + + $DEBUG && dump + cleanup +} + atf_init_test_cases() { @@ -748,4 +824,6 @@ atf_init_test_cases() atf_add_test_case pppoe_chap atf_add_test_case pppoe6_pap atf_add_test_case pppoe6_chap + atf_add_test_case pppoe_passiveauthproto_pap + atf_add_test_case pppoe_passiveauthproto_chap }
CVS commit: src/tests/net/if_wg
Module Name:src Committed By: simonb Date: Tue Mar 2 07:16:24 UTC 2021 Modified Files: src/tests/net/if_wg: t_basic.sh Log Message: Revert previous, 11th time failed after commit. Problem must be elsewhere. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/net/if_wg/t_basic.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_wg/t_basic.sh diff -u src/tests/net/if_wg/t_basic.sh:1.3 src/tests/net/if_wg/t_basic.sh:1.4 --- src/tests/net/if_wg/t_basic.sh:1.3 Tue Mar 2 07:02:14 2021 +++ src/tests/net/if_wg/t_basic.sh Tue Mar 2 07:16:24 2021 @@ -1,4 +1,4 @@ -# $NetBSD: t_basic.sh,v 1.3 2021/03/02 07:02:14 simonb Exp $ +# $NetBSD: t_basic.sh,v 1.4 2021/03/02 07:16:24 simonb Exp $ # # Copyright (c) 2018 Ryota Ozaki # All rights reserved. @@ -93,13 +93,13 @@ test_common() setup_common shmif0 $outer_proto $ip_local $outer_prefix setup_wg_common wg0 $inner_proto $ip_wg_local $inner_prefix $port "$key_priv_local" add_peer wg0 peer0 $key_pub_peer $ip_peer:$port $ip_wg_peer/$inner_prefixall - $ifconfig -w 20 + $ifconfig -w 10 export RUMP_SERVER=$SOCK_PEER setup_common shmif0 $outer_proto $ip_peer $outer_prefix setup_wg_common wg0 $inner_proto $ip_wg_peer $inner_prefix $port "$key_priv_peer" add_peer wg0 peer0 $key_pub_local $ip_local:$port $ip_wg_local/$inner_prefixall - $ifconfig -w 20 + $ifconfig -w 10 if [ $type = basic ]; then export RUMP_SERVER=$SOCK_LOCAL @@ -327,19 +327,19 @@ wg_multiple_interfaces_body() setup_wg_common wg1 inet $ip_wg_local2 24 $port2 "$key_priv_local" add_peer wg0 peer0 $key_pub_peer $ip_peer:$port $ip_wg_peer/32 add_peer wg1 peer0 $key_pub_peer2 $ip_peer2:$port2 $ip_wg_peer2/32 - $ifconfig -w 20 + $ifconfig -w 10 export RUMP_SERVER=$SOCK_PEER setup_common shmif0 inet $ip_peer 24 setup_wg_common wg0 inet $ip_wg_peer 24 $port "$key_priv_peer" add_peer wg0 peer0 $key_pub_local $ip_local:$port $ip_wg_local/32 - $ifconfig -w 20 + $ifconfig -w 10 export RUMP_SERVER=$SOCK_PEER2 setup_common shmif0 inet $ip_peer2 24 setup_wg_common wg0 inet $ip_wg_peer2 24 $port2 "$key_priv_peer2" add_peer wg0 peer0 $key_pub_local $ip_local2:$port2 $ip_wg_local2/32 - $ifconfig -w 20 + $ifconfig -w 10 export RUMP_SERVER=$SOCK_LOCAL @@ -412,19 +412,19 @@ wg_multiple_peers_body() setup_wg_common wg0 inet $ip_wg_local 24 $port "$key_priv_local" add_peer wg0 peer0 $key_pub_peer $ip_peer:$port $ip_wg_peer/32 add_peer wg0 peer1 $key_pub_peer2 $ip_peer2:$port $ip_wg_peer2/32 - $ifconfig -w 20 + $ifconfig -w 10 export RUMP_SERVER=$SOCK_PEER setup_common shmif0 inet $ip_peer 24 setup_wg_common wg0 inet $ip_wg_peer 24 $port "$key_priv_peer" add_peer wg0 peer0 $key_pub_local $ip_local:$port $ip_wg_local/32 - $ifconfig -w 20 + $ifconfig -w 10 export RUMP_SERVER=$SOCK_PEER2 setup_common shmif0 inet $ip_peer2 24 setup_wg_common wg0 inet $ip_wg_peer2 24 $port "$key_priv_peer2" add_peer wg0 peer0 $key_pub_local $ip_local:$port $ip_wg_local/32 - $ifconfig -w 20 + $ifconfig -w 10 export RUMP_SERVER=$SOCK_LOCAL
CVS commit: src/tests/net/if_wg
Module Name:src Committed By: simonb Date: Tue Mar 2 07:02:15 UTC 2021 Modified Files: src/tests/net/if_wg: t_basic.sh Log Message: Bump tentative flag timeout (-w) from 10 to 20 seconds. Changes this test from failing roughly half the time to working 100% over 10 tests on evbmips er4. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/net/if_wg/t_basic.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_wg/t_basic.sh diff -u src/tests/net/if_wg/t_basic.sh:1.2 src/tests/net/if_wg/t_basic.sh:1.3 --- src/tests/net/if_wg/t_basic.sh:1.2 Fri Oct 16 16:17:23 2020 +++ src/tests/net/if_wg/t_basic.sh Tue Mar 2 07:02:14 2021 @@ -1,4 +1,4 @@ -# $NetBSD: t_basic.sh,v 1.2 2020/10/16 16:17:23 roy Exp $ +# $NetBSD: t_basic.sh,v 1.3 2021/03/02 07:02:14 simonb Exp $ # # Copyright (c) 2018 Ryota Ozaki # All rights reserved. @@ -93,13 +93,13 @@ test_common() setup_common shmif0 $outer_proto $ip_local $outer_prefix setup_wg_common wg0 $inner_proto $ip_wg_local $inner_prefix $port "$key_priv_local" add_peer wg0 peer0 $key_pub_peer $ip_peer:$port $ip_wg_peer/$inner_prefixall - $ifconfig -w 10 + $ifconfig -w 20 export RUMP_SERVER=$SOCK_PEER setup_common shmif0 $outer_proto $ip_peer $outer_prefix setup_wg_common wg0 $inner_proto $ip_wg_peer $inner_prefix $port "$key_priv_peer" add_peer wg0 peer0 $key_pub_local $ip_local:$port $ip_wg_local/$inner_prefixall - $ifconfig -w 10 + $ifconfig -w 20 if [ $type = basic ]; then export RUMP_SERVER=$SOCK_LOCAL @@ -327,19 +327,19 @@ wg_multiple_interfaces_body() setup_wg_common wg1 inet $ip_wg_local2 24 $port2 "$key_priv_local" add_peer wg0 peer0 $key_pub_peer $ip_peer:$port $ip_wg_peer/32 add_peer wg1 peer0 $key_pub_peer2 $ip_peer2:$port2 $ip_wg_peer2/32 - $ifconfig -w 10 + $ifconfig -w 20 export RUMP_SERVER=$SOCK_PEER setup_common shmif0 inet $ip_peer 24 setup_wg_common wg0 inet $ip_wg_peer 24 $port "$key_priv_peer" add_peer wg0 peer0 $key_pub_local $ip_local:$port $ip_wg_local/32 - $ifconfig -w 10 + $ifconfig -w 20 export RUMP_SERVER=$SOCK_PEER2 setup_common shmif0 inet $ip_peer2 24 setup_wg_common wg0 inet $ip_wg_peer2 24 $port2 "$key_priv_peer2" add_peer wg0 peer0 $key_pub_local $ip_local2:$port2 $ip_wg_local2/32 - $ifconfig -w 10 + $ifconfig -w 20 export RUMP_SERVER=$SOCK_LOCAL @@ -412,19 +412,19 @@ wg_multiple_peers_body() setup_wg_common wg0 inet $ip_wg_local 24 $port "$key_priv_local" add_peer wg0 peer0 $key_pub_peer $ip_peer:$port $ip_wg_peer/32 add_peer wg0 peer1 $key_pub_peer2 $ip_peer2:$port $ip_wg_peer2/32 - $ifconfig -w 10 + $ifconfig -w 20 export RUMP_SERVER=$SOCK_PEER setup_common shmif0 inet $ip_peer 24 setup_wg_common wg0 inet $ip_wg_peer 24 $port "$key_priv_peer" add_peer wg0 peer0 $key_pub_local $ip_local:$port $ip_wg_local/32 - $ifconfig -w 10 + $ifconfig -w 20 export RUMP_SERVER=$SOCK_PEER2 setup_common shmif0 inet $ip_peer2 24 setup_wg_common wg0 inet $ip_wg_peer2 24 $port "$key_priv_peer2" add_peer wg0 peer0 $key_pub_local $ip_local:$port $ip_wg_local/32 - $ifconfig -w 10 + $ifconfig -w 20 export RUMP_SERVER=$SOCK_LOCAL
CVS commit: src/tests/net/if_pppoe
Module Name:src Committed By: yamaguchi Date: Wed Nov 25 10:35:07 UTC 2020 Modified Files: src/tests/net/if_pppoe: t_pppoe.sh Log Message: Use a state of IPCP and IPv6CP to wait for connection established To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/tests/net/if_pppoe/t_pppoe.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_pppoe/t_pppoe.sh diff -u src/tests/net/if_pppoe/t_pppoe.sh:1.23 src/tests/net/if_pppoe/t_pppoe.sh:1.24 --- src/tests/net/if_pppoe/t_pppoe.sh:1.23 Fri Sep 25 06:15:30 2020 +++ src/tests/net/if_pppoe/t_pppoe.sh Wed Nov 25 10:35:07 2020 @@ -1,4 +1,4 @@ -# $NetBSD: t_pppoe.sh,v 1.23 2020/09/25 06:15:30 yamaguchi Exp $ +# $NetBSD: t_pppoe.sh,v 1.24 2020/11/25 10:35:07 yamaguchi Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -113,14 +113,18 @@ setup() unset RUMP_SERVER } -wait_for_session_established() +wait_for_opened() { - local dontfail=$1 + local cp=$1 + local dontfail=$2 local n=$WAITTIME for i in $(seq $n); do - $HIJACKING pppoectl -d pppoe0 |grep -q "state = session" - [ $? = 0 ] && return + $HIJACKING pppoectl -dd pppoe0 | grep -q "$cp state: opened" + if [ $? = 0 ]; then + rump.ifconfig -w 10 + return + fi sleep 1 done @@ -135,12 +139,10 @@ wait_for_disconnected() local n=$WAITTIME for i in $(seq $n); do - $HIJACKING pppoectl -d pppoe0 | grep -q "state = initial" - [ $? = 0 ] && return - # If PPPoE client is disconnected by PPPoE server and then - # the client kicks callout of pppoe_timeout(), the client - # state is changed to PPPOE_STATE_PADI_SENT while padi retrying. - $HIJACKING pppoectl -d pppoe0 | grep -q "state = PADI sent" + # If PPPoE client is disconnected by PPPoE server, then + # the LCP state will of the client is in a starting to send PADI. + $HIJACKING pppoectl -dd pppoe0 | grep -q \ + -e "LCP state: initial" -e "LCP state: starting" [ $? = 0 ] && return sleep 1 @@ -154,6 +156,7 @@ wait_for_disconnected() run_test() { local auth=$1 + local cp="IPCP" setup # As pppoe client doesn't support rechallenge yet. @@ -180,7 +183,7 @@ run_test() atf_check -s exit:0 -x "$HIJACKING $setup_clientparam" atf_check -s exit:0 rump.ifconfig pppoe0 up $DEBUG && rump.ifconfig - wait_for_session_established + wait_for_opened $cp atf_check -s exit:0 -o ignore rump.ping -c 1 -w $TIMEOUT $SERVER_IP unset RUMP_SERVER @@ -198,7 +201,7 @@ run_test() # test for reconnecting atf_check -s exit:0 -x "env RUMP_SERVER=$SERVER rump.ifconfig pppoe0 up" export RUMP_SERVER=$CLIENT - wait_for_session_established + wait_for_opened $cp atf_check -s exit:0 -o ignore rump.ping -c 1 -w $TIMEOUT $SERVER_IP unset RUMP_SERVER @@ -217,7 +220,7 @@ run_test() # test for reconnecting export RUMP_SERVER=$CLIENT atf_check -s exit:0 -x rump.ifconfig pppoe0 up - wait_for_session_established + wait_for_opened $cp $DEBUG && rump.ifconfig pppoe0 $DEBUG && $HIJACKING pppoectl -d pppoe0 unset RUMP_SERVER @@ -240,7 +243,7 @@ run_test() 'max-auth-failure=1'" atf_check -s exit:0 -x "$HIJACKING $setup_clientparam" atf_check -s exit:0 rump.ifconfig pppoe0 up - wait_for_session_established dontfail + wait_for_opened $cp dontfail atf_check -s not-exit:0 -o ignore -e ignore \ rump.ping -c 1 -w $TIMEOUT $SERVER_IP atf_check -s exit:0 -o match:'DETACHED' rump.ifconfig pppoe0 @@ -290,6 +293,7 @@ pppoe_chap_cleanup() run_test6() { local auth=$1 + local cp="IPv6CP" setup "inet=false" # As pppoe client doesn't support rechallenge yet. @@ -318,7 +322,7 @@ run_test6() atf_check -s exit:0 rump.ifconfig pppoe0 inet6 $CLIENT_IP6/64 down atf_check -s exit:0 rump.ifconfig pppoe0 up $DEBUG && rump.ifconfig - wait_for_session_established + wait_for_opened $cp atf_check -s exit:0 -o ignore rump.ifconfig -w 10 export RUMP_SERVER=$SERVER atf_check -s exit:0 -o ignore rump.ifconfig -w 10 @@ -341,7 +345,7 @@ run_test6() # test for reconnecting export RUMP_SERVER=$SERVER atf_check -s exit:0 rump.ifconfig pppoe0 up - wait_for_session_established + wait_for_opened $cp atf_check -s exit:0 rump.ifconfig -w 10 $DEBUG && $HIJACKING pppoectl -d pppoe0 $DEBUG && rump.ifconfig pppoe0 @@ -366,7 +370,7 @@ run_test6() # test for reconnecting export RUMP_SERVER=$CLIENT atf_check -s exit:0 rump.ifconfig pppoe0 up - wait_for_session_established + wait_for_opened $cp atf_check -s exit:0 rump.ifconfig -w 10 $DEBUG && rump.ifconfig pppoe0 @@ -391,7 +395,7 @@ run_test6() 'max-auth-failure=1'" atf_check -s exit:0 -x "$HIJACKING $setup_clientparam" atf_check -s exit:0 rump.ifconfig pppoe0 up - wait_for_session_established dontfail + wait_for_opened $cp dontfail atf_check -s not-exit:0 -o ignore -e ignore \ rump.ping6 -c 1 -X $TIMEOUT $SERVER_IP6 atf_check -s exit:0 -o match:'DETACHED'
CVS commit: src/tests/net/if_wg
Module Name:src Committed By: martin Date: Thu Nov 5 20:03:56 UTC 2020 Modified Files: src/tests/net/if_wg: t_misc.sh Log Message: Fix typo To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/tests/net/if_wg/t_misc.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_wg/t_misc.sh diff -u src/tests/net/if_wg/t_misc.sh:1.6 src/tests/net/if_wg/t_misc.sh:1.7 --- src/tests/net/if_wg/t_misc.sh:1.6 Fri Oct 16 16:17:23 2020 +++ src/tests/net/if_wg/t_misc.sh Thu Nov 5 20:03:56 2020 @@ -1,4 +1,4 @@ -# $NetBSD: t_misc.sh,v 1.6 2020/10/16 16:17:23 roy Exp $ +# $NetBSD: t_misc.sh,v 1.7 2020/11/05 20:03:56 martin Exp $ # # Copyright (c) 2018 Ryota Ozaki # All rights reserved. @@ -66,7 +66,7 @@ wg_rekey_body() setup_common shmif0 inet $ip_local 24 setup_wg_common wg0 inet $ip_wg_local 24 $port "$key_priv_local" add_peer wg0 peer0 $key_pub_peer $ip_peer:$port $ip_wg_peer/32 - $fconfig -w 10 + $ifconfig -w 10 export RUMP_SERVER=$SOCK_PEER setup_common shmif0 inet $ip_peer 24
CVS commit: src/tests/net/if_wg
Module Name:src Committed By: roy Date: Fri Oct 16 16:17:23 UTC 2020 Modified Files: src/tests/net/if_wg: t_basic.sh t_misc.sh Log Message: wg: Fix tests by sprinkling ifconfig -w 10 So protocols have time to finish setup. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/net/if_wg/t_basic.sh cvs rdiff -u -r1.5 -r1.6 src/tests/net/if_wg/t_misc.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_wg/t_basic.sh diff -u src/tests/net/if_wg/t_basic.sh:1.1 src/tests/net/if_wg/t_basic.sh:1.2 --- src/tests/net/if_wg/t_basic.sh:1.1 Wed Aug 26 16:03:42 2020 +++ src/tests/net/if_wg/t_basic.sh Fri Oct 16 16:17:23 2020 @@ -1,4 +1,4 @@ -# $NetBSD: t_basic.sh,v 1.1 2020/08/26 16:03:42 riastradh Exp $ +# $NetBSD: t_basic.sh,v 1.2 2020/10/16 16:17:23 roy Exp $ # # Copyright (c) 2018 Ryota Ozaki # All rights reserved. @@ -92,16 +92,14 @@ test_common() export RUMP_SERVER=$SOCK_LOCAL setup_common shmif0 $outer_proto $ip_local $outer_prefix setup_wg_common wg0 $inner_proto $ip_wg_local $inner_prefix $port "$key_priv_local" + add_peer wg0 peer0 $key_pub_peer $ip_peer:$port $ip_wg_peer/$inner_prefixall + $ifconfig -w 10 export RUMP_SERVER=$SOCK_PEER setup_common shmif0 $outer_proto $ip_peer $outer_prefix setup_wg_common wg0 $inner_proto $ip_wg_peer $inner_prefix $port "$key_priv_peer" - - export RUMP_SERVER=$SOCK_LOCAL - add_peer wg0 peer0 $key_pub_peer $ip_peer:$port $ip_wg_peer/$inner_prefixall - - export RUMP_SERVER=$SOCK_PEER add_peer wg0 peer0 $key_pub_local $ip_local:$port $ip_wg_local/$inner_prefixall + $ifconfig -w 10 if [ $type = basic ]; then export RUMP_SERVER=$SOCK_LOCAL @@ -327,24 +325,21 @@ wg_multiple_interfaces_body() setup_common shmif1 inet $ip_local2 24 setup_wg_common wg0 inet $ip_wg_local 24 $port "$key_priv_local" setup_wg_common wg1 inet $ip_wg_local2 24 $port2 "$key_priv_local" + add_peer wg0 peer0 $key_pub_peer $ip_peer:$port $ip_wg_peer/32 + add_peer wg1 peer0 $key_pub_peer2 $ip_peer2:$port2 $ip_wg_peer2/32 + $ifconfig -w 10 export RUMP_SERVER=$SOCK_PEER setup_common shmif0 inet $ip_peer 24 setup_wg_common wg0 inet $ip_wg_peer 24 $port "$key_priv_peer" + add_peer wg0 peer0 $key_pub_local $ip_local:$port $ip_wg_local/32 + $ifconfig -w 10 export RUMP_SERVER=$SOCK_PEER2 setup_common shmif0 inet $ip_peer2 24 setup_wg_common wg0 inet $ip_wg_peer2 24 $port2 "$key_priv_peer2" - - export RUMP_SERVER=$SOCK_LOCAL - add_peer wg0 peer0 $key_pub_peer $ip_peer:$port $ip_wg_peer/32 - add_peer wg1 peer0 $key_pub_peer2 $ip_peer2:$port2 $ip_wg_peer2/32 - - export RUMP_SERVER=$SOCK_PEER - add_peer wg0 peer0 $key_pub_local $ip_local:$port $ip_wg_local/32 - - export RUMP_SERVER=$SOCK_PEER2 add_peer wg0 peer0 $key_pub_local $ip_local2:$port2 $ip_wg_local2/32 + $ifconfig -w 10 export RUMP_SERVER=$SOCK_LOCAL @@ -415,24 +410,21 @@ wg_multiple_peers_body() export RUMP_SERVER=$SOCK_LOCAL setup_common shmif0 inet $ip_local 24 setup_wg_common wg0 inet $ip_wg_local 24 $port "$key_priv_local" + add_peer wg0 peer0 $key_pub_peer $ip_peer:$port $ip_wg_peer/32 + add_peer wg0 peer1 $key_pub_peer2 $ip_peer2:$port $ip_wg_peer2/32 + $ifconfig -w 10 export RUMP_SERVER=$SOCK_PEER setup_common shmif0 inet $ip_peer 24 setup_wg_common wg0 inet $ip_wg_peer 24 $port "$key_priv_peer" + add_peer wg0 peer0 $key_pub_local $ip_local:$port $ip_wg_local/32 + $ifconfig -w 10 export RUMP_SERVER=$SOCK_PEER2 setup_common shmif0 inet $ip_peer2 24 setup_wg_common wg0 inet $ip_wg_peer2 24 $port "$key_priv_peer2" - - export RUMP_SERVER=$SOCK_LOCAL - add_peer wg0 peer0 $key_pub_peer $ip_peer:$port $ip_wg_peer/32 - add_peer wg0 peer1 $key_pub_peer2 $ip_peer2:$port $ip_wg_peer2/32 - - export RUMP_SERVER=$SOCK_PEER - add_peer wg0 peer0 $key_pub_local $ip_local:$port $ip_wg_local/32 - - export RUMP_SERVER=$SOCK_PEER2 add_peer wg0 peer0 $key_pub_local $ip_local:$port $ip_wg_local/32 + $ifconfig -w 10 export RUMP_SERVER=$SOCK_LOCAL Index: src/tests/net/if_wg/t_misc.sh diff -u src/tests/net/if_wg/t_misc.sh:1.5 src/tests/net/if_wg/t_misc.sh:1.6 --- src/tests/net/if_wg/t_misc.sh:1.5 Mon Aug 31 20:32:58 2020 +++ src/tests/net/if_wg/t_misc.sh Fri Oct 16 16:17:23 2020 @@ -1,4 +1,4 @@ -# $NetBSD: t_misc.sh,v 1.5 2020/08/31 20:32:58 riastradh Exp $ +# $NetBSD: t_misc.sh,v 1.6 2020/10/16 16:17:23 roy Exp $ # # Copyright (c) 2018 Ryota Ozaki # All rights reserved. @@ -65,16 +65,14 @@ wg_rekey_body() export RUMP_SERVER=$SOCK_LOCAL setup_common shmif0 inet $ip_local 24 setup_wg_common wg0 inet $ip_wg_local 24 $port "$key_priv_local" + add_peer wg0 peer0 $key_pub_peer $ip_peer:$port $ip_wg_peer/32 + $fconfig -w 10 export RUMP_SERVER=$SOCK_PEER setup_common shmif0 inet $ip_peer 24 setup_wg_common wg0 inet $ip_wg_peer 24 $port "$key_priv_peer" - - export RUMP_SERVER=$SOCK_LOCAL - add_peer wg0 peer0 $key_pub_peer $ip_peer:$port
CVS commit: src/tests/net/if_tap
Module Name:src Committed By: rin Date: Thu Oct 1 13:49:18 UTC 2020 Modified Files: src/tests/net/if_tap: Makefile Log Message: Link librumpclient explicitly. Fix sun2, i.e., MKPIC=no build. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/tests/net/if_tap/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_tap/Makefile diff -u src/tests/net/if_tap/Makefile:1.5 src/tests/net/if_tap/Makefile:1.6 --- src/tests/net/if_tap/Makefile:1.5 Wed Sep 30 17:14:11 2020 +++ src/tests/net/if_tap/Makefile Thu Oct 1 13:49:18 2020 @@ -1,12 +1,12 @@ -# $NetBSD: Makefile,v 1.5 2020/09/30 17:14:11 roy Exp $ +# $NetBSD: Makefile,v 1.6 2020/10/01 13:49:18 rin Exp $ # .include PROG= rump_open_tap MAN= # empty -DPADD= ${LIBRUMPRES} -LDADD= -lrumpres +DPADD= ${LIBRUMPRES} ${LIBRUMPCLIENT} +LDADD= -lrumpres -lrumpclient BINDIR.rump_open_tap= ${TESTSDIR} TESTSDIR= ${TESTSBASE}/net/if_tap
CVS commit: src/tests/net/if_tap
Module Name:src Committed By: roy Date: Wed Sep 30 17:14:11 UTC 2020 Modified Files: src/tests/net/if_tap: Makefile Log Message: Be like other tests and speciy the binary name we install To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/tests/net/if_tap/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_tap/Makefile diff -u src/tests/net/if_tap/Makefile:1.4 src/tests/net/if_tap/Makefile:1.5 --- src/tests/net/if_tap/Makefile:1.4 Wed Sep 30 17:05:59 2020 +++ src/tests/net/if_tap/Makefile Wed Sep 30 17:14:11 2020 @@ -1,15 +1,15 @@ -# $NetBSD: Makefile,v 1.4 2020/09/30 17:05:59 roy Exp $ +# $NetBSD: Makefile,v 1.5 2020/09/30 17:14:11 roy Exp $ # .include -PROG= rump_open_tap -MAN= # empty -DPADD= ${LIBRUMPRES} -LDADD= -lrumpres -BINDIR= ${TESTSDIR} +PROG= rump_open_tap +MAN= # empty +DPADD= ${LIBRUMPRES} +LDADD= -lrumpres +BINDIR.rump_open_tap= ${TESTSDIR} -TESTSDIR= ${TESTSBASE}/net/if_tap +TESTSDIR= ${TESTSBASE}/net/if_tap .for name in tap TESTS_SH+= t_${name}
CVS commit: src/tests/net/if_tap
Module Name:src Committed By: roy Date: Wed Sep 30 17:05:59 UTC 2020 Modified Files: src/tests/net/if_tap: Makefile Log Message: Fix prior To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/net/if_tap/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_tap/Makefile diff -u src/tests/net/if_tap/Makefile:1.3 src/tests/net/if_tap/Makefile:1.4 --- src/tests/net/if_tap/Makefile:1.3 Wed Sep 30 14:43:15 2020 +++ src/tests/net/if_tap/Makefile Wed Sep 30 17:05:59 2020 @@ -1,12 +1,13 @@ -# $NetBSD: Makefile,v 1.3 2020/09/30 14:43:15 roy Exp $ +# $NetBSD: Makefile,v 1.4 2020/09/30 17:05:59 roy Exp $ # .include PROG= rump_open_tap -MAN= +MAN= # empty DPADD= ${LIBRUMPRES} LDADD= -lrumpres +BINDIR= ${TESTSDIR} TESTSDIR= ${TESTSBASE}/net/if_tap
CVS commit: src/tests/net/if_tap
Module Name:src Committed By: roy Date: Wed Sep 30 14:43:15 UTC 2020 Modified Files: src/tests/net/if_tap: Makefile t_tap.sh Added Files: src/tests/net/if_tap: rump_open_tap.c Log Message: tap(4): update the test so that we can open the tap to ping across a bridge ping with tap closed to ensure it fails ping with tap open to ensure it works To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/net/if_tap/Makefile cvs rdiff -u -r0 -r1.1 src/tests/net/if_tap/rump_open_tap.c cvs rdiff -u -r1.10 -r1.11 src/tests/net/if_tap/t_tap.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_tap/Makefile diff -u src/tests/net/if_tap/Makefile:1.2 src/tests/net/if_tap/Makefile:1.3 --- src/tests/net/if_tap/Makefile:1.2 Fri Nov 25 08:51:16 2016 +++ src/tests/net/if_tap/Makefile Wed Sep 30 14:43:15 2020 @@ -1,8 +1,13 @@ -# $NetBSD: Makefile,v 1.2 2016/11/25 08:51:16 ozaki-r Exp $ +# $NetBSD: Makefile,v 1.3 2020/09/30 14:43:15 roy Exp $ # .include +PROG= rump_open_tap +MAN= +DPADD= ${LIBRUMPRES} +LDADD= -lrumpres + TESTSDIR= ${TESTSBASE}/net/if_tap .for name in tap Index: src/tests/net/if_tap/t_tap.sh diff -u src/tests/net/if_tap/t_tap.sh:1.10 src/tests/net/if_tap/t_tap.sh:1.11 --- src/tests/net/if_tap/t_tap.sh:1.10 Mon Aug 19 03:22:05 2019 +++ src/tests/net/if_tap/t_tap.sh Wed Sep 30 14:43:15 2020 @@ -1,4 +1,4 @@ -# $NetBSD: t_tap.sh,v 1.10 2019/08/19 03:22:05 ozaki-r Exp $ +# $NetBSD: t_tap.sh,v 1.11 2020/09/30 14:43:15 roy Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -34,6 +34,7 @@ IP4_REMOTE=10.0.0.3 IP6_LOCAL=fc00::1 IP6_TAP=fc00::2 IP6_REMOTE=fc00::3 +TAP_PID=./.__tap.pid DEBUG=${DEBUG:-false} TIMEOUT=1 @@ -130,6 +131,7 @@ tap_bridged_head() tap_bridged_body() { + local src="$(atf_get_srcdir)" rump_server_fs_start $SOCK_LOCAL netinet6 tap bridge rump_server_fs_start $SOCK_REMOTE netinet6 tap @@ -146,7 +148,6 @@ tap_bridged_body() atf_check -s exit:0 rump.ifconfig tap0 $IP4_TAP atf_check -s exit:0 rump.ifconfig tap0 inet6 $IP6_TAP atf_check -s exit:0 rump.ifconfig tap0 up - atf_check -s exit:0 rump.ifconfig -w 10 rump_server_add_iface $SOCK_LOCAL bridge0 atf_check -s exit:0 rump.ifconfig bridge0 up @@ -155,6 +156,8 @@ tap_bridged_body() atf_check -s exit:0 brconfig bridge0 add tap0 unset LD_PRELOAD + atf_check -s exit:0 rump.ifconfig -w 10 + export RUMP_SERVER=${SOCK_REMOTE} atf_check -s exit:0 rump.ifconfig shmif0 $IP4_REMOTE @@ -162,10 +165,22 @@ tap_bridged_body() atf_check -s exit:0 rump.ifconfig shmif0 up atf_check -s exit:0 rump.ifconfig -w 10 + # shmif0 on the server bridge is active, we expect this to work atf_check -s exit:0 -o ignore rump.ping -n -w $TIMEOUT -c 1 $IP4_LOCAL - atf_check -s exit:0 -o ignore rump.ping -n -w $TIMEOUT -c 1 $IP4_TAP - atf_check -s exit:0 -o ignore rump.ping6 -n -X $TIMEOUT -c 1 $IP6_LOCAL + + # The tap is not open, we expect this to fail + atf_check -s not-exit:0 -o ignore rump.ping -n -w $TIMEOUT -c 1 $IP4_TAP + atf_check -s not-exit:0 -o ignore rump.ping6 -n -X $TIMEOUT -c 1 $IP6_TAP + + # Open the tap on the server + export RUMP_SERVER=${SOCK_LOCAL} + atf_check -s exit:0 "$src"/rump_open_tap /dev/tap0 $TAP_PID + atf_check -s exit:0 rump.ifconfig -w 10 + + # Now we can ping the tap address + export RUMP_SERVER=${SOCK_LOCAL} + atf_check -s exit:0 -o ignore rump.ping -n -w $TIMEOUT -c 1 $IP4_TAP atf_check -s exit:0 -o ignore rump.ping6 -n -X $TIMEOUT -c 1 $IP6_TAP rump_server_destroy_ifaces @@ -174,6 +189,11 @@ tap_bridged_body() tap_bridged_cleanup() { +if [ -f $TAP_PID ]; then + kill -9 $(cat $TAP_PID) + rm -f $TAP_PID + sleep 1 + fi $DEBUG && dump cleanup } Added files: Index: src/tests/net/if_tap/rump_open_tap.c diff -u /dev/null src/tests/net/if_tap/rump_open_tap.c:1.1 --- /dev/null Wed Sep 30 14:43:15 2020 +++ src/tests/net/if_tap/rump_open_tap.c Wed Sep 30 14:43:15 2020 @@ -0,0 +1,79 @@ +/* $NetBSD: rump_open_tap.c,v 1.1 2020/09/30 14:43:15 roy Exp $ */ + +/* + * Copyright (c) 2020 The NetBSD Foundation, Inc. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Roy Marples. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF
CVS commit: src/tests/net/if_pppoe
Module Name:src Committed By: yamaguchi Date: Fri Sep 25 06:15:30 UTC 2020 Modified Files: src/tests/net/if_pppoe: t_pppoe.sh Log Message: update test cases for AC-Name and Service-Name To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/tests/net/if_pppoe/t_pppoe.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_pppoe/t_pppoe.sh diff -u src/tests/net/if_pppoe/t_pppoe.sh:1.22 src/tests/net/if_pppoe/t_pppoe.sh:1.23 --- src/tests/net/if_pppoe/t_pppoe.sh:1.22 Fri Sep 25 06:07:31 2020 +++ src/tests/net/if_pppoe/t_pppoe.sh Fri Sep 25 06:15:30 2020 @@ -1,4 +1,4 @@ -# $NetBSD: t_pppoe.sh,v 1.22 2020/09/25 06:07:31 yamaguchi Exp $ +# $NetBSD: t_pppoe.sh,v 1.23 2020/09/25 06:15:30 yamaguchi Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -556,7 +556,7 @@ pppoe_params_body() atf_check -s exit:0 rump.ifconfig pppoe0 down wait_for_disconnected atf_check -s exit:0 -x "$HIJACKING pppoectl -a ACNAME-TEST2 -e shmif0 pppoe0" - atf_check -s exit:0 -x "$HIJACKING pppoectl -a \"\" -e shmif0 pppoe0" + atf_check -s exit:0 -x "$HIJACKING pppoectl -e shmif0 pppoe0" atf_check -s exit:0 rump.ifconfig pppoe0 up $DEBUG && rump.ifconfig wait_for_session_established @@ -567,6 +567,19 @@ pppoe_params_body() -x "${dumpcmd} | grep PADI" atf_check -s exit:0 -o match:'\[Service-Name\]' -e ignore \ -x "${dumpcmd} | grep PADR" + atf_check -s exit:0 -o not-match:'AC-Name' -e ignore \ + -x "${dumpcmd} | grep PADI" + + # store 0 length string in AC-NAME + export RUMP_SERVER=$CLIENT + atf_check -s exit:0 rump.ifconfig pppoe0 down + wait_for_disconnected + atf_check -s exit:0 -x "$HIJACKING pppoectl -a \"\" -e shmif0 pppoe0" + atf_check -s exit:0 rump.ifconfig pppoe0 up + $DEBUG && rump.ifconfig + wait_for_session_established + unset RUMP_SERVER + atf_check -s exit:0 -o match:'\[AC-Name\]' -e ignore \ -x "${dumpcmd} | grep PADI" @@ -629,7 +642,7 @@ pppoe_params_body() atf_check -s exit:0 rump.ifconfig pppoe0 down wait_for_disconnected atf_check -s exit:0 -x "$HIJACKING pppoectl -s SNAME-TEST2 -e shmif0 pppoe0" - atf_check -s exit:0 -x "$HIJACKING pppoectl -s \"\" -e shmif0 pppoe0" + atf_check -s exit:0 -x "$HIJACKING pppoectl -e shmif0 pppoe0" atf_check -s exit:0 rump.ifconfig pppoe0 up $DEBUG && rump.ifconfig wait_for_session_established @@ -685,10 +698,10 @@ pppoe_params_body() $DEBUG && dump_bus atf_check -s exit:0 \ - -o match:'\[Service-Name "SNAME-TEST3"\] \[AC-Name "ACNAME-TEST4"\]' \ + -o match:'\[Service-Name\] \[AC-Name "ACNAME-TEST4"\]' \ -e ignore \ -x "${dumpcmd} | grep PADI" - atf_check -s exit:0 -o match:'\[Service-Name "SNAME-TEST3"\]' -e ignore \ + atf_check -s exit:0 -o match:'\[Service-Name\]' -e ignore \ -x "${dumpcmd} | grep PADR" # change Service-Name @@ -696,7 +709,9 @@ pppoe_params_body() atf_check -s exit:0 rump.ifconfig pppoe0 down wait_for_disconnected atf_check -s exit:0 -x \ - "$HIJACKING pppoectl -e shmif0 -s SNAME-TEST4 pppoe0" + "$HIJACKING pppoectl -e shmif0 -a ACNAME-TEST5 -s SNAME-TEST5 pppoe0" + atf_check -s exit:0 -x \ + "$HIJACKING pppoectl -e shmif0 -s SNAME-TEST6 pppoe0" atf_check -s exit:0 rump.ifconfig pppoe0 up $DEBUG && rump.ifconfig wait_for_session_established @@ -704,11 +719,13 @@ pppoe_params_body() $DEBUG && dump_bus atf_check -s exit:0 \ - -o match:'\[Service-Name "SNAME-TEST4"\] \[AC-Name "ACNAME-TEST4"\]' \ + -o match:'\[Service-Name "SNAME-TEST6"\]' \ -e ignore \ -x "${dumpcmd} | grep PADI" - atf_check -s exit:0 -o match:'\[Service-Name "SNAME-TEST3"\]' -e ignore \ + atf_check -s exit:0 -o match:'\[Service-Name "SNAME-TEST6"\]' -e ignore \ -x "${dumpcmd} | grep PADR" + atf_check -s exit:0 -o not-match:'\[AC-Name "ACNAME-TEST5\]"' -e ignore \ + -x "${dumpcmd} | grep PADI" } pppoe_params_cleanup()
CVS commit: src/tests/net/if_pppoe
Module Name:src Committed By: yamaguchi Date: Fri Sep 25 06:07:31 UTC 2020 Modified Files: src/tests/net/if_pppoe: t_pppoe.sh Log Message: Add test cases for AC-Name and Service-Name To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/tests/net/if_pppoe/t_pppoe.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_pppoe/t_pppoe.sh diff -u src/tests/net/if_pppoe/t_pppoe.sh:1.21 src/tests/net/if_pppoe/t_pppoe.sh:1.22 --- src/tests/net/if_pppoe/t_pppoe.sh:1.21 Wed Sep 23 06:18:20 2020 +++ src/tests/net/if_pppoe/t_pppoe.sh Fri Sep 25 06:07:31 2020 @@ -1,4 +1,4 @@ -# $NetBSD: t_pppoe.sh,v 1.21 2020/09/23 06:18:20 yamaguchi Exp $ +# $NetBSD: t_pppoe.sh,v 1.22 2020/09/25 06:07:31 yamaguchi Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -62,41 +62,53 @@ pppoe_create_destroy_cleanup() cleanup } -setup() +setup_ifaces() { - inet=true - - if [ $# -ne 0 ]; then - eval $@ - fi - - rump_server_start $SERVER netinet6 pppoe - rump_server_start $CLIENT netinet6 pppoe rump_server_add_iface $SERVER shmif0 $BUS rump_server_add_iface $CLIENT shmif0 $BUS + rump_server_add_iface $SERVER pppoe0 + rump_server_add_iface $CLIENT pppoe0 export RUMP_SERVER=$SERVER atf_check -s exit:0 rump.ifconfig shmif0 up - - rump_server_add_iface $SERVER pppoe0 $inet && atf_check -s exit:0 rump.ifconfig pppoe0 \ inet $SERVER_IP $CLIENT_IP down atf_check -s exit:0 rump.ifconfig pppoe0 link0 $DEBUG && rump.ifconfig $DEBUG && $HIJACKING pppoectl -d pppoe0 - - atf_check -s exit:0 -x "$HIJACKING pppoectl -e shmif0 pppoe0" unset RUMP_SERVER export RUMP_SERVER=$CLIENT atf_check -s exit:0 rump.ifconfig shmif0 up - rump_server_add_iface $CLIENT pppoe0 $inet && atf_check -s exit:0 rump.ifconfig pppoe0 \ inet 0.0.0.0 0.0.0.1 down + $DEBUG && rump.ifconfig + $DEBUG && $HIJACKING pppoectl -d pppoe0 + unset RUMP_SERVER +} + +setup() +{ + inet=true + + if [ $# -ne 0 ]; then + eval $@ + fi + + rump_server_start $SERVER netinet6 pppoe + rump_server_start $CLIENT netinet6 pppoe + + setup_ifaces + + export RUMP_SERVER=$SERVER + atf_check -s exit:0 -x "$HIJACKING pppoectl -e shmif0 pppoe0" + unset RUMP_SERVER + + export RUMP_SERVER=$CLIENT atf_check -s exit:0 -x "$HIJACKING pppoectl -e shmif0 pppoe0" unset RUMP_SERVER } @@ -426,10 +438,290 @@ pppoe6_chap_cleanup() cleanup } +atf_test_case pppoe_params cleanup + +dump_bus() +{ + + shmif_dumpbus -p - ${BUS} | tcpdump -n -e -r - +} + +setup_auth_conf() +{ + local auth=chap + + export RUMP_SERVER=$SERVER + local setup_serverparam="pppoectl pppoe0 hisauthproto=$auth \ +'hisauthname=$AUTHNAME' \ +'hisauthsecret=$SECRET' \ +'myauthproto=none' \ +$server_optparam" + + atf_check -s exit:0 rump.ifconfig pppoe0 link0 + atf_check -s exit:0 -x "$HIJACKING $setup_serverparam" + unset RUMP_SERVER + + local setup_clientparam="pppoectl pppoe0 myauthproto=$auth \ +'myauthname=$AUTHNAME' \ +'myauthsecret=$SECRET' \ +'hisauthproto=none'" + + export RUMP_SERVER=$CLIENT + $inet && atf_check -s exit:0 rump.ifconfig pppoe0 \ + inet 0.0.0.0 0.0.0.1 down + atf_check -s exit:0 -x "$HIJACKING $setup_clientparam" + $DEBUG && rump.ifconfig + unset RUMP_SERVER +} + +pppoe_params_head() +{ + atf_set "descr" "Set and clear access concentrator name and service name" + atf_set "require.progs" "rump_server pppoectl" +} + +pppoe_params_body() +{ + local dumpcmd + + dumpcmd="shmif_dumpbus -p - ${BUS}" + dumpcmd="${dumpcmd} | tcpdump -n -e -r -" + + rump_server_start $SERVER netinet6 pppoe + rump_server_start $CLIENT netinet6 pppoe + + setup_ifaces + setup_auth_conf + + export RUMP_SERVER=$SERVER + atf_check -s exit:0 -x "$HIJACKING pppoectl -e shmif0 pppoe0" + atf_check -s exit:0 rump.ifconfig pppoe0 up + unset RUMP_SERVER + + export RUMP_SERVER=$CLIENT + atf_check -s exit:0 -x "$HIJACKING pppoectl -e shmif0 pppoe0" + atf_check -s exit:0 rump.ifconfig pppoe0 up + $DEBUG && rump.ifconfig + wait_for_session_established + unset RUMP_SERVER + + $DEBUG && dump_bus + atf_check -s exit:0 -o match:'\[Service-Name\]' -e ignore \ + -x "${dumpcmd} | grep PADI" + atf_check -s exit:0 -o match:'\[Service-Name\]' -e ignore \ + -x "${dumpcmd} | grep PADR" + atf_check -s exit:0 -o not-match:'AC-Name' -e ignore \ + -x "${dumpcmd} | grep PADI" + + # set Remote access concentrator name (AC-NAME, -a option) + export RUMP_SERVER=$CLIENT + atf_check -s exit:0 rump.ifconfig pppoe0 down + wait_for_disconnected + atf_check -s exit:0 -x "$HIJACKING pppoectl -e shmif0 -a ACNAME-TEST0 pppoe0" + atf_check -s exit:0 rump.ifconfig pppoe0 up + $DEBUG && rump.ifconfig + wait_for_session_established + unset RUMP_SERVER + + $DEBUG && dump_bus + atf_check -s exit:0 -o match:'\[AC-Name "ACNAME-TEST0"\]' -e ignore \ + -x "${dumpcmd} | grep PADI" + + # change AC-NAME +
CVS commit: src/tests/net/if_pppoe
Module Name:src Committed By: yamaguchi Date: Wed Sep 23 06:18:20 UTC 2020 Modified Files: src/tests/net/if_pppoe: t_pppoe.sh Log Message: Add a limit for auth at a test for invalid account To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/tests/net/if_pppoe/t_pppoe.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_pppoe/t_pppoe.sh diff -u src/tests/net/if_pppoe/t_pppoe.sh:1.20 src/tests/net/if_pppoe/t_pppoe.sh:1.21 --- src/tests/net/if_pppoe/t_pppoe.sh:1.20 Wed Sep 23 05:56:55 2020 +++ src/tests/net/if_pppoe/t_pppoe.sh Wed Sep 23 06:18:20 2020 @@ -1,4 +1,4 @@ -# $NetBSD: t_pppoe.sh,v 1.20 2020/09/23 05:56:55 yamaguchi Exp $ +# $NetBSD: t_pppoe.sh,v 1.21 2020/09/23 06:18:20 yamaguchi Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -224,7 +224,8 @@ run_test() local setup_clientparam="pppoectl pppoe0 myauthproto=$auth \ 'myauthname=$AUTHNAME' \ 'myauthsecret=invalidsecret' \ -'hisauthproto=none'" +'hisauthproto=none' \ +'max-auth-failure=1'" atf_check -s exit:0 -x "$HIJACKING $setup_clientparam" atf_check -s exit:0 rump.ifconfig pppoe0 up wait_for_session_established dontfail @@ -374,7 +375,8 @@ run_test6() local setup_clientparam="pppoectl pppoe0 myauthproto=$auth \ 'myauthname=$AUTHNAME' \ 'myauthsecret=invalidsecret' \ -'hisauthproto=none'" +'hisauthproto=none' \ +'max-auth-failure=1'" atf_check -s exit:0 -x "$HIJACKING $setup_clientparam" atf_check -s exit:0 rump.ifconfig pppoe0 up wait_for_session_established dontfail
CVS commit: src/tests/net/if_pppoe
Module Name:src Committed By: yamaguchi Date: Wed Sep 23 05:56:55 UTC 2020 Modified Files: src/tests/net/if_pppoe: t_pppoe.sh Log Message: Fix typo To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/tests/net/if_pppoe/t_pppoe.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_pppoe/t_pppoe.sh diff -u src/tests/net/if_pppoe/t_pppoe.sh:1.19 src/tests/net/if_pppoe/t_pppoe.sh:1.20 --- src/tests/net/if_pppoe/t_pppoe.sh:1.19 Mon Aug 19 03:22:05 2019 +++ src/tests/net/if_pppoe/t_pppoe.sh Wed Sep 23 05:56:55 2020 @@ -1,4 +1,4 @@ -# $NetBSD: t_pppoe.sh,v 1.19 2019/08/19 03:22:05 ozaki-r Exp $ +# $NetBSD: t_pppoe.sh,v 1.20 2020/09/23 05:56:55 yamaguchi Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -183,7 +183,7 @@ run_test() atf_check -s exit:0 -o match:'PADI sent' -x "$HIJACKING pppoectl -d pppoe0" unset RUMP_SERVER - # test for recoonecting + # test for reconnecting atf_check -s exit:0 -x "env RUMP_SERVER=$SERVER rump.ifconfig pppoe0 up" export RUMP_SERVER=$CLIENT wait_for_session_established @@ -325,7 +325,7 @@ run_test6() atf_check -s exit:0 -o not-match:"$session_id" -x "$HIJACKING pppoectl -d pppoe0" unset RUMP_SERVER - # test for recoonecting + # test for reconnecting export RUMP_SERVER=$SERVER atf_check -s exit:0 rump.ifconfig pppoe0 up wait_for_session_established
CVS commit: src/tests/net/arp
Module Name:src Committed By: roy Date: Fri Sep 18 16:33:49 UTC 2020 Modified Files: src/tests/net/arp: t_arp.sh Log Message: arp tests: Delete ARP entry after failed ping test As it might hang around in WAITDELETE for a few seconds. To generate a diff of this commit: cvs rdiff -u -r1.44 -r1.45 src/tests/net/arp/t_arp.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/arp/t_arp.sh diff -u src/tests/net/arp/t_arp.sh:1.44 src/tests/net/arp/t_arp.sh:1.45 --- src/tests/net/arp/t_arp.sh:1.44 Thu Sep 17 11:51:01 2020 +++ src/tests/net/arp/t_arp.sh Fri Sep 18 16:33:49 2020 @@ -1,4 +1,4 @@ -# $NetBSD: t_arp.sh,v 1.44 2020/09/17 11:51:01 roy Exp $ +# $NetBSD: t_arp.sh,v 1.45 2020/09/18 16:33:49 roy Exp $ # # Copyright (c) 2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -491,6 +491,8 @@ test_proxy_arp() export RUMP_SERVER=$SOCKSRC atf_check -s not-exit:0 -o ignore -e ignore \ rump.ping -n -w 1 -c 1 $IP4DST_PROXYARP1 + # Remove ARP entry as it may hang around in WAITDELETE a few seconds + atf_check -s ignore rump.arp -d $IP4DST_PROXYARP1 # Flushing extract_new_packets bus1 > ./out @@ -525,6 +527,8 @@ test_proxy_arp() export RUMP_SERVER=$SOCKSRC atf_check -s not-exit:0 -o ignore -e ignore \ rump.ping -n -w 1 -c 1 $IP4DST_PROXYARP2 + # Remove ARP entry as it may hang around in WAITDELETE a few seconds + atf_check -s ignore rump.arp -d $IP4DST_PROXYARP2 extract_new_packets bus1 > ./out $DEBUG && cat ./out
CVS commit: src/tests/net/ndp
Module Name:src Committed By: roy Date: Thu Sep 17 11:56:35 UTC 2020 Modified Files: src/tests/net/ndp: t_ndp.sh Log Message: ndp_rtm: Only ping once Pointless doing 3 pings. On a slow system, it's possible that many RTM_MISS messages could overflow into the next test. To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 src/tests/net/ndp/t_ndp.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/ndp/t_ndp.sh diff -u src/tests/net/ndp/t_ndp.sh:1.38 src/tests/net/ndp/t_ndp.sh:1.39 --- src/tests/net/ndp/t_ndp.sh:1.38 Sun Mar 15 21:15:25 2020 +++ src/tests/net/ndp/t_ndp.sh Thu Sep 17 11:56:35 2020 @@ -1,4 +1,4 @@ -# $NetBSD: t_ndp.sh,v 1.38 2020/03/15 21:15:25 roy Exp $ +# $NetBSD: t_ndp.sh,v 1.39 2020/09/17 11:56:35 roy Exp $ # # Copyright (c) 2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -464,9 +464,8 @@ ndp_rtm_body() rump.route -n monitor -c 1 > $file & pid=$! sleep 1 - # nd6_mmaxtries = 3, second between each try atf_check -s exit:1 -o ignore -e ignore \ - rump.ping6 -n -X 3 -c 3 $IP6DST_FAIL1 + rump.ping6 -n -X 1 -c 1 $IP6DST_FAIL1 wait $pid $DEBUG && cat $file
CVS commit: src/tests/net/arp
Module Name:src Committed By: roy Date: Thu Sep 17 11:51:01 UTC 2020 Modified Files: src/tests/net/arp: t_arp.sh Log Message: arp_rtm: Only ping once Pointless doing 10 pings. On a slow system, it's possible that many RTM_MISS messages could overflow into the next test. To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 src/tests/net/arp/t_arp.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/arp/t_arp.sh diff -u src/tests/net/arp/t_arp.sh:1.43 src/tests/net/arp/t_arp.sh:1.44 --- src/tests/net/arp/t_arp.sh:1.43 Tue Sep 15 11:19:10 2020 +++ src/tests/net/arp/t_arp.sh Thu Sep 17 11:51:01 2020 @@ -1,4 +1,4 @@ -# $NetBSD: t_arp.sh,v 1.43 2020/09/15 11:19:10 roy Exp $ +# $NetBSD: t_arp.sh,v 1.44 2020/09/17 11:51:01 roy Exp $ # # Copyright (c) 2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -717,9 +717,8 @@ arp_rtm_body() rump.route -n monitor -c 1 > $file & pid=$! sleep 1 - # arp_maxtries = 5, second between each try atf_check -s exit:2 -o ignore -e ignore \ - rump.ping -n -w 10 -c 10 $IP4DST_FAIL1 + rump.ping -n -w 1 -c 1 $IP4DST_FAIL1 wait $pid $DEBUG && cat $file
CVS commit: src/tests/net/arp
Module Name:src Committed By: roy Date: Tue Sep 15 11:19:10 UTC 2020 Modified Files: src/tests/net/arp: t_arp.sh Log Message: Don't check lifetime when testing published To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 src/tests/net/arp/t_arp.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/arp/t_arp.sh diff -u src/tests/net/arp/t_arp.sh:1.42 src/tests/net/arp/t_arp.sh:1.43 --- src/tests/net/arp/t_arp.sh:1.42 Sun Sep 13 14:36:32 2020 +++ src/tests/net/arp/t_arp.sh Tue Sep 15 11:19:10 2020 @@ -1,4 +1,4 @@ -# $NetBSD: t_arp.sh,v 1.42 2020/09/13 14:36:32 roy Exp $ +# $NetBSD: t_arp.sh,v 1.43 2020/09/15 11:19:10 roy Exp $ # # Copyright (c) 2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -477,7 +477,7 @@ test_proxy_arp() opts="pub proxy" fi # Always proxy only since migrating to lltable/llentry - title='permanent published \(proxy only\)' + title='published \(proxy only\)' # # Test#1: First setup an endpoint then create proxy arp entry
CVS commit: src/tests/net/arp
Module Name:src Committed By: roy Date: Sun Sep 13 14:36:32 UTC 2020 Modified Files: src/tests/net/arp: t_arp.sh Log Message: arp test: Use the ndp cache expiration test in place of the old one As the logic is the same. While here, GC some variables and comment out a redundant sleep. To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 src/tests/net/arp/t_arp.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/arp/t_arp.sh diff -u src/tests/net/arp/t_arp.sh:1.41 src/tests/net/arp/t_arp.sh:1.42 --- src/tests/net/arp/t_arp.sh:1.41 Wed Mar 11 08:52:13 2020 +++ src/tests/net/arp/t_arp.sh Sun Sep 13 14:36:32 2020 @@ -1,4 +1,4 @@ -# $NetBSD: t_arp.sh,v 1.41 2020/03/11 08:52:13 roy Exp $ +# $NetBSD: t_arp.sh,v 1.42 2020/09/13 14:36:32 roy Exp $ # # Copyright (c) 2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -39,8 +39,7 @@ IP4DST_FAIL2=10.0.99.99 DEBUG=${DEBUG:-false} TIMEOUT=1 -atf_test_case arp_cache_expiration_5s cleanup -atf_test_case arp_cache_expiration_10s cleanup +atf_test_case arp_cache_expiration cleanup atf_test_case arp_command cleanup atf_test_case arp_garp cleanup atf_test_case arp_garp_without_dad cleanup @@ -50,15 +49,9 @@ atf_test_case arp_proxy_arp_pubproxy cle atf_test_case arp_link_activation cleanup atf_test_case arp_static cleanup -arp_cache_expiration_5s_head() +arp_cache_expiration_head() { - atf_set "descr" "Tests for ARP cache expiration (5s)" - atf_set "require.progs" "rump_server" -} - -arp_cache_expiration_10s_head() -{ - atf_set "descr" "Tests for ARP cache expiration (10s)" + atf_set "descr" "Tests for ARP cache expiration" atf_set "require.progs" "rump_server" } @@ -132,10 +125,12 @@ setup_src_server() export RUMP_SERVER=$SOCKSRC - # Adjust ARP parameters + # Shorten the expire time of cache entries if [ $keep != 0 ]; then + # Convert to ms + keep=$(($keep * 1000)) atf_check -s exit:0 -o ignore \ - rump.sysctl -w net.inet.arp.keep=$keep + rump.sysctl -w net.inet.arp.nd_reachable=$keep fi # Setup an interface @@ -152,10 +147,17 @@ setup_src_server() atf_check -s not-exit:0 -e match:'no entry' rump.arp -n $IP4DST } -test_cache_expiration() +get_timeout() { - local arp_keep=$1 - local bonus=2 + local addr="$1" + local timeout=$(env RUMP_SERVER=$SOCKSRC rump.arp -n $addr |grep $addr|awk '{print $7;}') + timeout=${timeout%s} + echo $timeout +} + +arp_cache_expiration_body() +{ + local arp_keep=7 rump_server_start $SOCKSRC rump_server_start $SOCKDST @@ -163,38 +165,33 @@ test_cache_expiration() setup_dst_server setup_src_server $arp_keep + # Make a permanent cache entry to avoid sending an NS packet disturbing + # the test + macaddr=$(get_macaddr $SOCKSRC shmif0) + export RUMP_SERVER=$SOCKDST + atf_check -s exit:0 -o ignore rump.arp -s $IP4SRC $macaddr + + export RUMP_SERVER=$SOCKSRC + # # Check if a cache is expired expectedly # - export RUMP_SERVER=$SOCKSRC atf_check -s exit:0 -o ignore rump.ping -n -w $TIMEOUT -c 1 $IP4DST $DEBUG && rump.arp -n -a - atf_check -s not-exit:0 -e match:'no entry' rump.arp -n $IP4SRC + atf_check -s not-exit:0 -o ignore -e match:'no entry' rump.arp -n $IP4SRC # Should be cached - atf_check -s exit:0 -o ignore rump.arp -n $IP4DST - $DEBUG && rump.netstat -nr -f inet - atf_check -s exit:0 -o match:"$IP4DST" rump.netstat -nr -f inet + atf_check -s exit:0 -o not-match:'permanent' rump.arp -n $IP4DST - atf_check -s exit:0 sleep $(($arp_keep + $bonus)) + timeout=$(get_timeout $IP4DST) - $DEBUG && rump.arp -n -a - atf_check -s not-exit:0 -e match:'no entry' rump.arp -n $IP4SRC - # Should be expired - atf_check -s not-exit:0 -e match:'no entry' rump.arp -n $IP4DST -} - -arp_cache_expiration_5s_body() -{ + atf_check -s exit:0 sleep $(($timeout + 1)) - test_cache_expiration 5 - rump_server_destroy_ifaces -} - -arp_cache_expiration_10s_body() -{ + $DEBUG && rump.arp -n -a + atf_check -s not-exit:0 -o ignore -e match:'no entry' rump.arp -n $IP4SRC + # Expired but remains until GC sweaps it (1 day) + atf_check -s exit:0 -o match:"$ONEDAYISH" rump.arp -n $IP4DST - test_cache_expiration 10 rump_server_destroy_ifaces } @@ -290,9 +287,9 @@ arp_command_body() check_arp_static_entry 10.0.1.10 'b2:a0:20:00:00:10' temp # Hm? the cache doesn't expire... - atf_check -s exit:0 sleep $(($arp_keep + $bonus)) - $DEBUG && rump.arp -n -a - $DEBUG && rump.netstat -nr -f inet + #atf_check -s exit:0 sleep $(($arp_keep + $bonus)) + #$DEBUG && rump.arp -n -a + #$DEBUG && rump.netstat -nr -f inet #atf_check -s not-exit:0 -e ignore rump.arp -n 10.0.1.10 rump_server_destroy_ifaces @@ -403,7 +400,6 @@ arp_garp_without_dad_body() arp_cache_overwriting_body() { - local bonus=2 rump_server_start $SOCKSRC rump_server_start $SOCKDST @@ -563,7 +559,6 @@ arp_proxy_arp_pubproxy_body() arp_link_activation_body() { - local bonus=2
CVS commit: src/tests/net/net
Module Name:src Committed By: christos Date: Tue Sep 8 14:13:50 UTC 2020 Modified Files: src/tests/net/net: Makefile Added Files: src/tests/net/net: t_bind.c Log Message: Add tests for IP_BINDANY, IPV6_BINDANY To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/tests/net/net/Makefile cvs rdiff -u -r0 -r1.1 src/tests/net/net/t_bind.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/net/Makefile diff -u src/tests/net/net/Makefile:1.24 src/tests/net/net/Makefile:1.25 --- src/tests/net/net/Makefile:1.24 Mon Jul 6 14:45:25 2020 +++ src/tests/net/net/Makefile Tue Sep 8 10:13:50 2020 @@ -1,11 +1,12 @@ -# $NetBSD: Makefile,v 1.24 2020/07/06 18:45:25 christos Exp $ +# $NetBSD: Makefile,v 1.25 2020/09/08 14:13:50 christos Exp $ # .include TESTSDIR= ${TESTSBASE}/net/net -TESTS_C= t_unix +TESTS_C= t_bind +TESTS_C+= t_unix TESTS_C+= t_mapped TESTS_C+= t_tcp TESTS_C+= t_udp Added files: Index: src/tests/net/net/t_bind.c diff -u /dev/null src/tests/net/net/t_bind.c:1.1 --- /dev/null Tue Sep 8 10:13:50 2020 +++ src/tests/net/net/t_bind.c Tue Sep 8 10:13:50 2020 @@ -0,0 +1,180 @@ +/* $NetBSD: t_bind.c,v 1.1 2020/09/08 14:13:50 christos Exp $ */ + +/*- + * Copyright (c) 2020 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Christos Zoulas. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#define _GNU_SOURCE + +#include +#ifdef __RCSID +__RCSID("$Id: t_bind.c,v 1.1 2020/09/08 14:13:50 christos Exp $"); +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "util.h" + +#include "test.h" + +static int +mksocket(int sfam) +{ + int o, p; + switch (sfam) { + case AF_INET: + o = IP_BINDANY; + p = IPPROTO_IP; + break; + case AF_INET6: + o = IPV6_BINDANY; + p = IPPROTO_IPV6; + break; + default: + FAIL("family"); + } + int fd = socket(sfam, SOCK_STREAM, 0); + if (fd == -1) + FAIL("socket"); + int f = 1; + if (setsockopt(fd, p, o, , sizeof(f)) == -1) { + close(fd); + FAIL("setsockopt"); + } + return fd; +fail: + return -1; +} + +static socklen_t +mkserver(int sfam, struct sockaddr_storage *ss) +{ + struct sockaddr_in *sin; + struct sockaddr_in6 *sin6; + + memset(ss, 0, sizeof(*ss)); + ss->ss_family = sfam; + switch (sfam) { + case AF_INET: + sin = (struct sockaddr_in *)ss; + sin->sin_port = htons(12345); +#ifdef BSD4_4 + sin->sin_len = sizeof(*sin); +#endif + inet_pton(sfam, "1.1.1.1", >sin_addr); + return sizeof(*sin); + case AF_INET6: + sin6 = (struct sockaddr_in6 *)ss; + sin6->sin6_port = htons(12345); +#ifdef BSD4_4 + sin6->sin6_len = sizeof(*sin6); +#endif + inet_pton(sfam, "2010:2020:2030:2040:2050:2060:2070:2080", + >sin6_addr); + return sizeof(*sin6); + default: + FAIL("bad family"); + } +fail: + return -1; +} + +static int +test(int sfam) +{ + int sfd = -1; + struct sockaddr_storage saddr; + socklen_t slen; + + sfd = mksocket(sfam); + slen = mkserver(sfam, ); + + if (bind(sfd, (struct sockaddr *), slen) == -1) { + FAIL("bind"); + } + return 0; +fail: + return -1; +} + +#ifndef TEST + +ATF_TC(bindany_4); +ATF_TC_HEAD(bindany_4, tc) +{ + + atf_tc_set_md_var(tc, "descr", "Check AF_INET bindany"); +} + +ATF_TC_BODY(bindany_4, tc) +{ + test(AF_INET); +} + +ATF_TC(bindany_6); +ATF_TC_HEAD(bindany_6, tc) +{ + + atf_tc_set_md_var(tc, "descr", "Check AF_INET6 bindany"); +} + +ATF_TC_BODY(bindany_6, tc) +{ + test(AF_INET6); +} +
CVS commit: src/tests/net/if_wg
Module Name:src Committed By: riastradh Date: Mon Aug 31 20:32:58 UTC 2020 Modified Files: src/tests/net/if_wg: t_misc.sh Log Message: tests/net/if_wg: Allow one second of leeway for rekey. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/tests/net/if_wg/t_misc.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_wg/t_misc.sh diff -u src/tests/net/if_wg/t_misc.sh:1.4 src/tests/net/if_wg/t_misc.sh:1.5 --- src/tests/net/if_wg/t_misc.sh:1.4 Sat Aug 29 07:22:49 2020 +++ src/tests/net/if_wg/t_misc.sh Mon Aug 31 20:32:58 2020 @@ -1,4 +1,4 @@ -# $NetBSD: t_misc.sh,v 1.4 2020/08/29 07:22:49 tih Exp $ +# $NetBSD: t_misc.sh,v 1.5 2020/08/31 20:32:58 riastradh Exp $ # # Copyright (c) 2018 Ryota Ozaki # All rights reserved. @@ -106,7 +106,7 @@ wg_rekey_body() $DEBUG && echo $latest_handshake # Wait for a reinitiation to be performed again - sleep $rekey_after_time + sleep $((rekey_after_time+1)) $ping $ip_wg_peer
CVS commit: src/tests/net/ipsec
Module Name:src Committed By: martin Date: Mon Aug 31 14:03:56 UTC 2020 Modified Files: src/tests/net/ipsec: t_ipsec_misc.sh Log Message: Skip timeout tests, pointing to PR 55632. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/tests/net/ipsec/t_ipsec_misc.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/ipsec/t_ipsec_misc.sh diff -u src/tests/net/ipsec/t_ipsec_misc.sh:1.23 src/tests/net/ipsec/t_ipsec_misc.sh:1.24 --- src/tests/net/ipsec/t_ipsec_misc.sh:1.23 Tue Jul 23 04:31:25 2019 +++ src/tests/net/ipsec/t_ipsec_misc.sh Mon Aug 31 14:03:56 2020 @@ -1,4 +1,4 @@ -# $NetBSD: t_ipsec_misc.sh,v 1.23 2019/07/23 04:31:25 ozaki-r Exp $ +# $NetBSD: t_ipsec_misc.sh,v 1.24 2020/08/31 14:03:56 martin Exp $ # # Copyright (c) 2017 Internet Initiative Japan Inc. # All rights reserved. @@ -565,6 +565,10 @@ test_spi() local spistr= local longtime= shorttime= + if [ $method = timeout ]; then + atf_skip \ + "PR 55632: test fails randomly, leaving spurious rump_server around" + fi if [ $method = timeout -a $preferred = new ]; then skip_if_qemu fi
CVS commit: src/tests/net/if_wg
Module Name:src Committed By: tih Date: Sat Aug 29 07:22:49 UTC 2020 Modified Files: src/tests/net/if_wg: t_misc.sh t_tunnel.sh Log Message: Update the if_wg tests for the human readable 'latest-handshake' output of wgconfig. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/net/if_wg/t_misc.sh cvs rdiff -u -r1.1 -r1.2 src/tests/net/if_wg/t_tunnel.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_wg/t_misc.sh diff -u src/tests/net/if_wg/t_misc.sh:1.3 src/tests/net/if_wg/t_misc.sh:1.4 --- src/tests/net/if_wg/t_misc.sh:1.3 Thu Aug 27 02:52:33 2020 +++ src/tests/net/if_wg/t_misc.sh Sat Aug 29 07:22:49 2020 @@ -1,4 +1,4 @@ -# $NetBSD: t_misc.sh,v 1.3 2020/08/27 02:52:33 riastradh Exp $ +# $NetBSD: t_misc.sh,v 1.4 2020/08/29 07:22:49 tih Exp $ # # Copyright (c) 2018 Ryota Ozaki # All rights reserved. @@ -81,7 +81,7 @@ wg_rekey_body() $ping $ip_wg_peer latest_handshake=$($HIJACKING wgconfig wg0 show peer peer0 \ - | awk -F : '/latest-handshake/ {print $2;}') + | awk -F ': ' '/latest-handshake/ {print $2;}') $DEBUG && echo $latest_handshake sleep 1 @@ -102,7 +102,7 @@ wg_rekey_body() $HIJACKING wgconfig wg0 show peer peer0 latest_handshake=$($HIJACKING wgconfig wg0 show peer peer0 \ - | awk -F : '/latest-handshake/ {print $2;}') + | awk -F ': ' '/latest-handshake/ {print $2;}') $DEBUG && echo $latest_handshake # Wait for a reinitiation to be performed again @@ -142,7 +142,6 @@ wg_handshake_timeout_body() local ip_wg_peer=10.0.0.2 local port=51820 local rekey_after_time=3 - local latest_handshake= local outfile=./out local rekey_timeout=3 local rekey_attempt_time=8 @@ -278,7 +277,7 @@ wg_cookie_body() cat $outfile $DEBUG && $HIJACKING wgconfig wg0 show all - atf_check -s exit:0 -o match:"latest-handshake: 0" \ + atf_check -s exit:0 -o match:"latest-handshake: \(never\)" \ $HIJACKING wgconfig wg0 # Wait for restarting a session @@ -289,7 +288,7 @@ wg_cookie_body() $ping $ip_wg_peer $DEBUG && $HIJACKING wgconfig wg0 show all - atf_check -s exit:0 -o not-match:"latest-handshake: 0" \ + atf_check -s exit:0 -o not-match:"latest-handshake: \(never\)" \ $HIJACKING wgconfig wg0 destroy_wg_interfaces Index: src/tests/net/if_wg/t_tunnel.sh diff -u src/tests/net/if_wg/t_tunnel.sh:1.1 src/tests/net/if_wg/t_tunnel.sh:1.2 --- src/tests/net/if_wg/t_tunnel.sh:1.1 Wed Aug 26 16:03:42 2020 +++ src/tests/net/if_wg/t_tunnel.sh Sat Aug 29 07:22:49 2020 @@ -1,4 +1,4 @@ -# $NetBSD: t_tunnel.sh,v 1.1 2020/08/26 16:03:42 riastradh Exp $ +# $NetBSD: t_tunnel.sh,v 1.2 2020/08/29 07:22:49 tih Exp $ # # Copyright (c) 2018 Ryota Ozaki # All rights reserved. @@ -267,14 +267,14 @@ wg_tunnel_common() $ip_wg_local/$inner_prefixall,$subnet_local export RUMP_SERVER=$SOCK_TUN_LOCAL - atf_check -s exit:0 -o match:"latest-handshake: 0" \ + atf_check -s exit:0 -o match:"latest-handshake: \(never\)" \ $HIJACKING wgconfig wg0 show peer peer0 export RUMP_SERVER=$SOCK_LOCAL check_ping $inner_proto $ip_peer export RUMP_SERVER=$SOCK_TUN_LOCAL - atf_check -s exit:0 -o not-match:"latest-handshake: 0" \ + atf_check -s exit:0 -o not-match:"latest-handshake: \(never\)" \ $HIJACKING wgconfig wg0 show peer peer0 export RUMP_SERVER=$SOCK_LOCAL
CVS commit: src/tests/net/net
Module Name:src Committed By: riastradh Date: Fri Aug 28 14:18:29 UTC 2020 Modified Files: src/tests/net/net: t_unix.c Log Message: Nix trailing whitespace. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/tests/net/net/t_unix.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/net/t_unix.c diff -u src/tests/net/net/t_unix.c:1.23 src/tests/net/net/t_unix.c:1.24 --- src/tests/net/net/t_unix.c:1.23 Fri Aug 28 13:56:29 2020 +++ src/tests/net/net/t_unix.c Fri Aug 28 14:18:29 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: t_unix.c,v 1.23 2020/08/28 13:56:29 christos Exp $ */ +/* $NetBSD: t_unix.c,v 1.24 2020/08/28 14:18:29 riastradh Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -39,7 +39,7 @@ #define _GNU_SOURCE #include #ifdef __RCSID -__RCSID("$Id: t_unix.c,v 1.23 2020/08/28 13:56:29 christos Exp $"); +__RCSID("$Id: t_unix.c,v 1.24 2020/08/28 14:18:29 riastradh Exp $"); #else #define getprogname() argv[0] #endif @@ -208,7 +208,7 @@ check_cred(int fd, bool statit, pid_t ch } } fflush(stdout); - + CHECK_EQUAL(euid, uid, s); CHECK_EQUAL(egid, gid, s); CHECK_EQUAL(pid, checkpid, s); @@ -237,7 +237,7 @@ test(bool forkit, bool closeit, bool sta FAIL("socket(server)"); slen = len + OF + 1; - + if ((sun = calloc(1, slen)) == NULL) FAIL("calloc"); @@ -351,7 +351,7 @@ test(bool forkit, bool closeit, bool sta for (size_t i = 0; i < slen - OF; i++) if (sock_addr->sun_path[i] != sun->sun_path[i]) FAIL("sock_addr.sun_path[%zu] %d != " -"sun->sun_path[%zu] %d\n", i, +"sun->sun_path[%zu] %d\n", i, sock_addr->sun_path[i], i, sun->sun_path[i]);
CVS commit: src/tests/net/net
Module Name:src Committed By: christos Date: Fri Aug 28 13:56:30 UTC 2020 Modified Files: src/tests/net/net: t_unix.c Log Message: When running the tests with atf-run the directory we are running in is drwx-- so when we change to a different user, we can't find the socket we created. Make a directory and put the socket in there. Of course now atf can't record its results as a different user, but that is not fatal. tc-se:FATAL ERROR: Cannot create results file '/tmp/atf-run.9vOjFd/tcr': \ Permission denied To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/tests/net/net/t_unix.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/net/t_unix.c diff -u src/tests/net/net/t_unix.c:1.22 src/tests/net/net/t_unix.c:1.23 --- src/tests/net/net/t_unix.c:1.22 Fri Aug 28 07:46:05 2020 +++ src/tests/net/net/t_unix.c Fri Aug 28 09:56:29 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: t_unix.c,v 1.22 2020/08/28 11:46:05 christos Exp $ */ +/* $NetBSD: t_unix.c,v 1.23 2020/08/28 13:56:29 christos Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -39,7 +39,7 @@ #define _GNU_SOURCE #include #ifdef __RCSID -__RCSID("$Id: t_unix.c,v 1.22 2020/08/28 11:46:05 christos Exp $"); +__RCSID("$Id: t_unix.c,v 1.23 2020/08/28 13:56:29 christos Exp $"); #else #define getprogname() argv[0] #endif @@ -241,6 +241,12 @@ test(bool forkit, bool closeit, bool sta if ((sun = calloc(1, slen)) == NULL) FAIL("calloc"); + if (mkdir("sock", 0777) == -1) + FAIL("mkdir"); + + if (chdir("sock") == -1) + FAIL("chdir"); + memset(sun->sun_path, 'a', len); sun->sun_path[len] = '\0'; (void)unlink(sun->sun_path); @@ -251,6 +257,8 @@ test(bool forkit, bool closeit, bool sta #endif sun->sun_family = AF_UNIX; + unlink(sun->sun_path); + if (bind(srvr, (struct sockaddr *)sun, sl) == -1) { if (errno == EINVAL && sl >= 256) { close(srvr);
CVS commit: src/tests/net/net
Module Name:src Committed By: christos Date: Fri Aug 28 11:46:05 UTC 2020 Modified Files: src/tests/net/net: t_unix.c Log Message: Remove unneeded sete{u,g}id pointed out by kre. Remove dup unlink. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/tests/net/net/t_unix.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/net/t_unix.c diff -u src/tests/net/net/t_unix.c:1.21 src/tests/net/net/t_unix.c:1.22 --- src/tests/net/net/t_unix.c:1.21 Thu Aug 27 10:00:01 2020 +++ src/tests/net/net/t_unix.c Fri Aug 28 07:46:05 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: t_unix.c,v 1.21 2020/08/27 14:00:01 christos Exp $ */ +/* $NetBSD: t_unix.c,v 1.22 2020/08/28 11:46:05 christos Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -39,7 +39,7 @@ #define _GNU_SOURCE #include #ifdef __RCSID -__RCSID("$Id: t_unix.c,v 1.21 2020/08/27 14:00:01 christos Exp $"); +__RCSID("$Id: t_unix.c,v 1.22 2020/08/28 11:46:05 christos Exp $"); #else #define getprogname() argv[0] #endif @@ -251,8 +251,6 @@ test(bool forkit, bool closeit, bool sta #endif sun->sun_family = AF_UNIX; - unlink(sun->sun_path); - if (bind(srvr, (struct sockaddr *)sun, sl) == -1) { if (errno == EINVAL && sl >= 256) { close(srvr); @@ -272,23 +270,19 @@ test(bool forkit, bool closeit, bool sta srvrpid = getppid(); clntpid = getpid(); if (srvruid == 0) { -clntuid = UID; -clntgid = GID; -setgid(clntgid); -setegid(clntgid); -setuid(clntuid); -seteuid(clntuid); +setgid(clntgid = GID); +setuid(clntuid = UID); } else { -clntuid = srvruid; clntgid = srvrgid; +clntuid = srvruid; } break; case -1: FAIL("fork"); default: if (srvruid == 0) { -clntuid = UID; clntgid = GID; +clntuid = UID; } break; }
CVS commit: src/tests/net/net
Module Name:src Committed By: christos Date: Thu Aug 27 14:00:01 UTC 2020 Modified Files: src/tests/net/net: t_unix.c Log Message: - when running as root, create the socket under a different uid/gid to verify that it works properly with different users opening the socket. - verify that linux works the same for both getpeereid() and fstat() To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/tests/net/net/t_unix.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/net/t_unix.c diff -u src/tests/net/net/t_unix.c:1.20 src/tests/net/net/t_unix.c:1.21 --- src/tests/net/net/t_unix.c:1.20 Wed Aug 26 18:52:58 2020 +++ src/tests/net/net/t_unix.c Thu Aug 27 10:00:01 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: t_unix.c,v 1.20 2020/08/26 22:52:58 christos Exp $ */ +/* $NetBSD: t_unix.c,v 1.21 2020/08/27 14:00:01 christos Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -36,9 +36,10 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#define _GNU_SOURCE #include #ifdef __RCSID -__RCSID("$Id: t_unix.c,v 1.20 2020/08/26 22:52:58 christos Exp $"); +__RCSID("$Id: t_unix.c,v 1.21 2020/08/27 14:00:01 christos Exp $"); #else #define getprogname() argv[0] #endif @@ -58,12 +59,19 @@ __RCSID("$Id: t_unix.c,v 1.20 2020/08/26 #include #include #include +#include #include #include #include #include "test.h" +#define UID 666 +#define GID 999 + +uid_t srvruid, clntuid; +gid_t srvrgid, clntgid; + #define OF offsetof(struct sockaddr_un, sun_path) static void @@ -130,28 +138,42 @@ fail: static int peercred(int s, uid_t *euid, gid_t *egid, pid_t *pid) { +#ifdef SO_PEERCRED + /* Linux */ +# define unpcbid ucred +# define unp_euid uid +# define unp_egid gid +# define unp_pid pid +# define LOCAL_PEEREID SO_PEERCRED +# define LEVEL SOL_SOCKET +#else +# define LEVEL 0 +#endif + #ifdef LOCAL_PEEREID + /* NetBSD */ struct unpcbid cred; socklen_t crl; crl = sizeof(cred); - if (getsockopt(s, 0, LOCAL_PEEREID, , ) == -1) + if (getsockopt(s, LEVEL, LOCAL_PEEREID, , ) == -1) return -1; *euid = cred.unp_euid; *egid = cred.unp_egid; *pid = cred.unp_pid; return 0; #else + /* FreeBSD */ *pid = -1; return getpeereid(s, euid, egid); #endif } static int -check_cred(int fd, bool statit, pid_t checkpid, const char *s) +check_cred(int fd, bool statit, pid_t checkpid, pid_t otherpid, const char *s) { pid_t pid; - uid_t euid; - gid_t egid; + uid_t euid, uid; + gid_t egid, gid; if (statit) { struct stat st; @@ -167,8 +189,28 @@ check_cred(int fd, bool statit, pid_t ch printf("%s(%s) euid=%jd egid=%jd pid=%jd\n", statit ? "fstat" : "peercred", s, (intmax_t)euid, (intmax_t)egid, (intmax_t)pid); - CHECK_EQUAL(euid, geteuid(), s); - CHECK_EQUAL(egid, getegid(), s); + + if (statit) { + if (strcmp(s, "server") == 0) { + uid = srvruid; + gid = srvrgid; + } else { + uid = clntuid; + gid = clntgid; + } + } else { + if (checkpid != otherpid && strcmp(s, "server") == 0) { + uid = clntuid; + gid = clntgid; + } else { + uid = srvruid; + gid = srvrgid; + } + } + fflush(stdout); + + CHECK_EQUAL(euid, uid, s); + CHECK_EQUAL(egid, gid, s); CHECK_EQUAL(pid, checkpid, s); return 0; fail: @@ -187,6 +229,8 @@ test(bool forkit, bool closeit, bool sta socklen_t peer_addrlen; struct sockaddr_un peer_addr; + srvruid = geteuid(); + srvrgid = getegid(); srvrpid = clntpid = getpid(); srvr = socket(AF_UNIX, SOCK_STREAM, 0); if (srvr == -1) @@ -207,6 +251,8 @@ test(bool forkit, bool closeit, bool sta #endif sun->sun_family = AF_UNIX; + unlink(sun->sun_path); + if (bind(srvr, (struct sockaddr *)sun, sl) == -1) { if (errno == EINVAL && sl >= 256) { close(srvr); @@ -214,6 +260,8 @@ test(bool forkit, bool closeit, bool sta } FAIL("bind"); } + if (chmod(sun->sun_path, 0777) == -1) + FAIL("chmod `%s'", sun->sun_path); if (listen(srvr, SOMAXCONN) == -1) FAIL("listen"); @@ -223,10 +271,25 @@ test(bool forkit, bool closeit, bool sta case 0: /* child */ srvrpid = getppid(); clntpid = getpid(); + if (srvruid == 0) { +clntuid = UID; +clntgid = GID; +setgid(clntgid); +setegid(clntgid); +setuid(clntuid); +seteuid(clntuid); + } else { +clntuid = srvruid; +clntgid = srvrgid; + } break; case -1: FAIL("fork"); default: + if (srvruid == 0) { +clntuid = UID; +clntgid = GID; + } break; } } @@ -238,7 +301,7 @@ test(bool forkit, bool closeit, bool sta if (connect(clnt, (const struct sockaddr *)sun, sl) == -1) FAIL("connect"); - check_cred(clnt, statit, srvrpid, "client"); + check_cred(clnt, statit, srvrpid, clntpid, "client"); } @@ -261,7 +324,7 @@ test(bool forkit, bool closeit, bool sta } if (srvrpid == getpid()) { - check_cred(acpt, statit, clntpid, "server"); + check_cred(acpt, statit, clntpid, srvrpid,
CVS commit: src/tests/net/if_wg
Module Name:src Committed By: riastradh Date: Thu Aug 27 02:51:50 UTC 2020 Modified Files: src/tests/net/if_wg: t_misc.sh Log Message: Use wgconfig as intended to show diagnostics, not a usage message. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/net/if_wg/t_misc.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_wg/t_misc.sh diff -u src/tests/net/if_wg/t_misc.sh:1.1 src/tests/net/if_wg/t_misc.sh:1.2 --- src/tests/net/if_wg/t_misc.sh:1.1 Wed Aug 26 16:03:42 2020 +++ src/tests/net/if_wg/t_misc.sh Thu Aug 27 02:51:49 2020 @@ -1,4 +1,4 @@ -# $NetBSD: t_misc.sh,v 1.1 2020/08/26 16:03:42 riastradh Exp $ +# $NetBSD: t_misc.sh,v 1.2 2020/08/27 02:51:49 riastradh Exp $ # # Copyright (c) 2018 Ryota Ozaki # All rights reserved. @@ -277,7 +277,7 @@ wg_cookie_body() -o match:"$ip_peer.$port > $ip_local.$port: UDP, length 64" \ cat $outfile - $DEBUG && $HIJACKING wgconfig wg0 show + $DEBUG && $HIJACKING wgconfig wg0 show all atf_check -s exit:0 -o match:"latest-handshake: 0" \ $HIJACKING wgconfig wg0 @@ -288,7 +288,7 @@ wg_cookie_body() # a valid cookie. $ping $ip_wg_peer - $DEBUG && $HIJACKING wgconfig wg0 show + $DEBUG && $HIJACKING wgconfig wg0 show all atf_check -s exit:0 -o not-match:"latest-handshake: 0" \ $HIJACKING wgconfig wg0
CVS commit: src/tests/net/net
Module Name:src Committed By: christos Date: Wed Aug 26 22:52:58 UTC 2020 Modified Files: src/tests/net/net: t_unix.c Log Message: Check that fstat returns the correct socket owner To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/tests/net/net/t_unix.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/net/t_unix.c diff -u src/tests/net/net/t_unix.c:1.19 src/tests/net/net/t_unix.c:1.20 --- src/tests/net/net/t_unix.c:1.19 Mon Jul 6 12:24:06 2020 +++ src/tests/net/net/t_unix.c Wed Aug 26 18:52:58 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: t_unix.c,v 1.19 2020/07/06 16:24:06 christos Exp $ */ +/* $NetBSD: t_unix.c,v 1.20 2020/08/26 22:52:58 christos Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ #include #ifdef __RCSID -__RCSID("$Id: t_unix.c,v 1.19 2020/07/06 16:24:06 christos Exp $"); +__RCSID("$Id: t_unix.c,v 1.20 2020/08/26 22:52:58 christos Exp $"); #else #define getprogname() argv[0] #endif @@ -52,6 +52,7 @@ __RCSID("$Id: t_unix.c,v 1.19 2020/07/06 #include #include #include +#include #include #include #include @@ -146,13 +147,40 @@ peercred(int s, uid_t *euid, gid_t *egid } static int -test(bool forkit, bool closeit, size_t len) +check_cred(int fd, bool statit, pid_t checkpid, const char *s) +{ + pid_t pid; + uid_t euid; + gid_t egid; + + if (statit) { + struct stat st; + if (fstat(fd, ) == -1) + FAIL("fstat (%s)", s); + euid = st.st_uid; + egid = st.st_gid; + pid = checkpid; + } else { + if (peercred(fd, , , ) == -1) + FAIL("peercred (%s)", s); + } + printf("%s(%s) euid=%jd egid=%jd pid=%jd\n", + statit ? "fstat" : "peercred", s, + (intmax_t)euid, (intmax_t)egid, (intmax_t)pid); + CHECK_EQUAL(euid, geteuid(), s); + CHECK_EQUAL(egid, getegid(), s); + CHECK_EQUAL(pid, checkpid, s); + return 0; +fail: + return -1; +} + +static int +test(bool forkit, bool closeit, bool statit, size_t len) { size_t slen; socklen_t sl; int srvr = -1, clnt = -1, acpt = -1; - uid_t euid; - gid_t egid; pid_t srvrpid, clntpid; struct sockaddr_un *sock_addr = NULL, *sun = NULL; socklen_t sock_addrlen; @@ -204,26 +232,18 @@ test(bool forkit, bool closeit, size_t l } if (clntpid == getpid()) { - pid_t pid = srvrpid; clnt = socket(AF_UNIX, SOCK_STREAM, 0); if (clnt == -1) FAIL("socket(client)"); if (connect(clnt, (const struct sockaddr *)sun, sl) == -1) FAIL("connect"); + check_cred(clnt, statit, srvrpid, "client"); - if (peercred(clnt, , , ) == -1) - FAIL("peercred (client)"); - printf("peercred(client) euid=%jd egid=%jd pid=%jd\n", - (intmax_t)euid, (intmax_t)egid, (intmax_t)pid); - CHECK_EQUAL(euid, geteuid(), "client"); - CHECK_EQUAL(egid, getegid(), "client"); - CHECK_EQUAL(pid, srvrpid, "client"); } if (srvrpid == getpid()) { acpt = acc(srvr); - peer_addrlen = sizeof(peer_addr); memset(_addr, 0, sizeof(peer_addr)); if (getpeername(acpt, (struct sockaddr *)_addr, @@ -241,15 +261,7 @@ test(bool forkit, bool closeit, size_t l } if (srvrpid == getpid()) { - pid_t pid = clntpid; - if (peercred(acpt, , , ) == -1) - FAIL("peercred (server)"); - printf("peercred(server) euid=%jd egid=%jd pid=%jd\n", - (intmax_t)euid, (intmax_t)egid, (intmax_t)pid); - CHECK_EQUAL(euid, geteuid(), "server"); - CHECK_EQUAL(egid, getegid(), "server"); - CHECK_EQUAL(pid, clntpid, "server"); - + check_cred(acpt, statit, clntpid, "server"); if ((sock_addr = calloc(1, slen)) == NULL) FAIL("calloc"); sock_addrlen = slen; @@ -322,8 +334,8 @@ ATF_TC_HEAD(sockaddr_un_len_exceed, tc) ATF_TC_BODY(sockaddr_un_len_exceed, tc) { - ATF_REQUIRE_MSG(test(false, false, 254) == -1, - "test(false, false, 254): %s", strerror(errno)); + ATF_REQUIRE_MSG(test(false, false, false, 254) == -1, + "test(false, false, false, 254): %s", strerror(errno)); } ATF_TC(sockaddr_un_len_max); @@ -337,8 +349,8 @@ ATF_TC_HEAD(sockaddr_un_len_max, tc) ATF_TC_BODY(sockaddr_un_len_max, tc) { - ATF_REQUIRE_MSG(test(false, false, 253) == 0, - "test(false, false, 253): %s", strerror(errno)); + ATF_REQUIRE_MSG(test(false, false, false, 253) == 0, + "test(false, false, false, 253): %s", strerror(errno)); } ATF_TC(sockaddr_un_closed); @@ -351,8 +363,8 @@ ATF_TC_HEAD(sockaddr_un_closed, tc) ATF_TC_BODY(sockaddr_un_closed, tc) { - ATF_REQUIRE_MSG(test(false, true, 100) == 0, - "test(false, true, 100): %s", strerror(errno)); + ATF_REQUIRE_MSG(test(false, true, false, 100) == 0, + "test(false, true, false, 100): %s", strerror(errno)); } ATF_TC(sockaddr_un_local_peereid); @@ -365,8 +377,22 @@ ATF_TC_HEAD(sockaddr_un_local_peereid, t ATF_TC_BODY(sockaddr_un_local_peereid, tc) { - ATF_REQUIRE_MSG(test(true, true, 100) == 0, - "test(true, true, 100): %s", strerror(errno)); + ATF_REQUIRE_MSG(test(true, true, false, 100) == 0, + "test(true,
CVS commit: src/tests/net/if_ipsec
Module Name:src Committed By: knakahara Date: Wed Aug 5 01:10:50 UTC 2020 Modified Files: src/tests/net/if_ipsec: t_ipsec.sh t_ipsec_pfil.sh Log Message: Fix missing "-m tranport" options. Pointed out by k-goda@IIJ. Using any mode SA causes unepected call path, that is, ipsec4_common_input_cb() calls ip_input() directly instead of ipsecif4_input(). To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/tests/net/if_ipsec/t_ipsec.sh cvs rdiff -u -r1.2 -r1.3 src/tests/net/if_ipsec/t_ipsec_pfil.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_ipsec/t_ipsec.sh diff -u src/tests/net/if_ipsec/t_ipsec.sh:1.10 src/tests/net/if_ipsec/t_ipsec.sh:1.11 --- src/tests/net/if_ipsec/t_ipsec.sh:1.10 Mon Aug 19 03:22:05 2019 +++ src/tests/net/if_ipsec/t_ipsec.sh Wed Aug 5 01:10:50 2020 @@ -1,4 +1,4 @@ -# $NetBSD: t_ipsec.sh,v 1.10 2019/08/19 03:22:05 ozaki-r Exp $ +# $NetBSD: t_ipsec.sh,v 1.11 2020/08/05 01:10:50 knakahara Exp $ # # Copyright (c) 2017 Internet Initiative Japan Inc. # All rights reserved. @@ -300,8 +300,8 @@ setup_if_ipsec_sa() fi cat > $tmpfile <<-EOF - add $dst $src $proto $inid -u $inunique $algo_args; - add $src $dst $proto $outid -u $outunique $algo_args; + add $dst $src $proto $inid -u $inunique -m transport $algo_args; + add $src $dst $proto $outid -u $outunique -m transport $algo_args; EOF $DEBUG && cat $tmpfile export RUMP_SERVER=$sock Index: src/tests/net/if_ipsec/t_ipsec_pfil.sh diff -u src/tests/net/if_ipsec/t_ipsec_pfil.sh:1.2 src/tests/net/if_ipsec/t_ipsec_pfil.sh:1.3 --- src/tests/net/if_ipsec/t_ipsec_pfil.sh:1.2 Mon Aug 19 03:22:05 2019 +++ src/tests/net/if_ipsec/t_ipsec_pfil.sh Wed Aug 5 01:10:50 2020 @@ -1,4 +1,4 @@ -# $NetBSD: t_ipsec_pfil.sh,v 1.2 2019/08/19 03:22:05 ozaki-r Exp $ +# $NetBSD: t_ipsec_pfil.sh,v 1.3 2020/08/05 01:10:50 knakahara Exp $ # # Copyright (c) 2019 Internet Initiative Japan Inc. # All rights reserved. @@ -115,8 +115,8 @@ setup_if_ipsec_sa() atf_check -s exit:0 test "X$outunique" != "X" cat > $tmpfile <<-EOF - add $dst $src $proto $inid -u $inunique $algo_args; - add $src $dst $proto $outid -u $outunique $algo_args; + add $dst $src $proto $inid -u $inunique -m transport $algo_args; + add $src $dst $proto $outid -u $outunique -m transport $algo_args; EOF $DEBUG && cat $tmpfile atf_check -s exit:0 -o empty $HIJACKING setkey -c < $tmpfile
CVS commit: src/tests/net/net
Module Name:src Committed By: christos Date: Mon Jul 6 18:45:26 UTC 2020 Modified Files: src/tests/net/net: Makefile Added Files: src/tests/net/net: t_mapped.c Log Message: add a test for v4 mapped addresses To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/tests/net/net/Makefile cvs rdiff -u -r0 -r1.1 src/tests/net/net/t_mapped.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/net/Makefile diff -u src/tests/net/net/Makefile:1.23 src/tests/net/net/Makefile:1.24 --- src/tests/net/net/Makefile:1.23 Sun Mar 1 13:08:16 2020 +++ src/tests/net/net/Makefile Mon Jul 6 14:45:25 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.23 2020/03/01 18:08:16 christos Exp $ +# $NetBSD: Makefile,v 1.24 2020/07/06 18:45:25 christos Exp $ # .include @@ -6,6 +6,7 @@ TESTSDIR= ${TESTSBASE}/net/net TESTS_C= t_unix +TESTS_C+= t_mapped TESTS_C+= t_tcp TESTS_C+= t_udp TESTS_C+= t_pktinfo @@ -26,4 +27,6 @@ LDADD.t_pktinfo_send+= ${LIBRUMPBASE} LDADD.t_raw+= -lrumpnet_local -lrumpnet_netinet -lrumpnet_net LDADD.t_raw+= -lrumpnet ${LIBRUMPBASE} +LDADD.t_mapped+= -lutil + .include Added files: Index: src/tests/net/net/t_mapped.c diff -u /dev/null src/tests/net/net/t_mapped.c:1.1 --- /dev/null Mon Jul 6 14:45:26 2020 +++ src/tests/net/net/t_mapped.c Mon Jul 6 14:45:25 2020 @@ -0,0 +1,320 @@ +/* $NetBSD: t_mapped.c,v 1.1 2020/07/06 18:45:25 christos Exp $ */ + +/*- + * Copyright (c) 2020 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Christos Zoulas. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#define _GNU_SOURCE + +#include +#ifdef __RCSID +__RCSID("$Id: t_mapped.c,v 1.1 2020/07/06 18:45:25 christos Exp $"); +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "util.h" + +#include "test.h" + +static char mymsg[] = "hi mom!"; + +static void +print(const char *msg, const struct sockaddr *addr) +{ + char buf[1024]; + + sockaddr_snprintf(buf, sizeof(buf), "%a:%p", addr); + printf("%s: %s\n", msg, buf); +} + +static int +mksocket(int sfam) +{ + int fd = socket(sfam, SOCK_STREAM, 0); + if (fd == -1) + FAIL("socket"); + if (sfam != AF_INET6) + return fd; + int f = 0; +#if 0 + /* crashes the kernel, should not be allowed kernel only? */ + if (setsockopt(fd, IPPROTO_IPV6, 24 /* IPV6_2292RTHDR */, + , sizeof(f)) == -1) + FAIL("setsockopt"); +#endif + if (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, , sizeof(f)) == -1) + FAIL("setsockopt"); + return fd; +fail: + return -1; +} + +static socklen_t +mkserver(int sfam, struct sockaddr_storage *ss) +{ + struct sockaddr_in *sin; + struct sockaddr_in6 *sin6; + + memset(ss, 0, sizeof(*ss)); + ss->ss_family = sfam; + switch (sfam) { + case AF_INET: + sin = (struct sockaddr_in *)ss; + sin->sin_port = htons(12345); +#ifdef BSD4_4 + sin->sin_len = sizeof(*sin); +#endif + return sizeof(*sin); + case AF_INET6: + sin6 = (struct sockaddr_in6 *)ss; + sin6->sin6_port = htons(12345); +#ifdef BSD4_4 + sin6->sin6_len = sizeof(*sin6); +#endif + return sizeof(*sin6); + default: + FAIL("bad family"); + } +fail: + return -1; +} + +#if 0 +static const struct in6_addr in6addr_loopback = IN6ADDR_LOOPBACK_INIT; +#endif +static socklen_t +mkclient(int sfam, struct sockaddr_storage *ss) +{ + struct sockaddr_in *sin; + struct sockaddr_in6 *sin6; + + memset(ss, 0, sizeof(*ss)); + ss->ss_family = sfam; + switch (sfam) { + case AF_INET: + sin =
CVS commit: src/tests/net/net
Module Name:src Committed By: christos Date: Mon Jul 6 16:24:06 UTC 2020 Modified Files: src/tests/net/net: t_unix.c Log Message: don't open the socket twice. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/tests/net/net/t_unix.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/net/t_unix.c diff -u src/tests/net/net/t_unix.c:1.18 src/tests/net/net/t_unix.c:1.19 --- src/tests/net/net/t_unix.c:1.18 Sat Apr 13 21:45:30 2019 +++ src/tests/net/net/t_unix.c Mon Jul 6 12:24:06 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: t_unix.c,v 1.18 2019/04/14 01:45:30 christos Exp $ */ +/* $NetBSD: t_unix.c,v 1.19 2020/07/06 16:24:06 christos Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ #include #ifdef __RCSID -__RCSID("$Id: t_unix.c,v 1.18 2019/04/14 01:45:30 christos Exp $"); +__RCSID("$Id: t_unix.c,v 1.19 2020/07/06 16:24:06 christos Exp $"); #else #define getprogname() argv[0] #endif @@ -162,17 +162,13 @@ test(bool forkit, bool closeit, size_t l srvrpid = clntpid = getpid(); srvr = socket(AF_UNIX, SOCK_STREAM, 0); if (srvr == -1) - FAIL("socket(srvrer)"); + FAIL("socket(server)"); slen = len + OF + 1; if ((sun = calloc(1, slen)) == NULL) FAIL("calloc"); - srvr = socket(AF_UNIX, SOCK_STREAM, 0); - if (srvr == -1) - FAIL("socket"); - memset(sun->sun_path, 'a', len); sun->sun_path[len] = '\0'; (void)unlink(sun->sun_path);
CVS commit: src/tests/net
Module Name:src Committed By: knakahara Date: Fri Jun 5 03:24:59 UTC 2020 Modified Files: src/tests/net/if_ipsec: t_ipsec_natt.sh src/tests/net/ipsec: common.sh t_ipsec_natt.sh Log Message: Refactor a little and follow new format of "npfctl list". Fix the below ATF failures. - net/if_ipsec/t_ipsec_natt:ipsecif_natt_transport_null - net/if_ipsec/t_ipsec_natt:ipsecif_natt_transport_rijndaelcbc - net/ipsec/t_ipsec_natt:ipsec_natt_transport_ipv4_null - net/ipsec/t_ipsec_natt:ipsec_natt_transport_ipv4_rijndaelcbc ok'ed by ozaki-r@n.o, thanks. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/tests/net/if_ipsec/t_ipsec_natt.sh cvs rdiff -u -r1.7 -r1.8 src/tests/net/ipsec/common.sh cvs rdiff -u -r1.4 -r1.5 src/tests/net/ipsec/t_ipsec_natt.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_ipsec/t_ipsec_natt.sh diff -u src/tests/net/if_ipsec/t_ipsec_natt.sh:1.4 src/tests/net/if_ipsec/t_ipsec_natt.sh:1.5 --- src/tests/net/if_ipsec/t_ipsec_natt.sh:1.4 Mon Jun 1 04:38:37 2020 +++ src/tests/net/if_ipsec/t_ipsec_natt.sh Fri Jun 5 03:24:58 2020 @@ -1,4 +1,4 @@ -# $NetBSD: t_ipsec_natt.sh,v 1.4 2020/06/01 04:38:37 martin Exp $ +# $NetBSD: t_ipsec_natt.sh,v 1.5 2020/06/05 03:24:58 knakahara Exp $ # # Copyright (c) 2018 Internet Initiative Japan Inc. # All rights reserved. @@ -33,7 +33,6 @@ BUS_LOCAL=./bus_ipsec_natt_local BUS_NAT=./bus_ipsec_natt_nat DEBUG=${DEBUG:-false} -HIJACKING_NPF="${HIJACKING},blanket=/dev/npf" setup_servers() { @@ -386,7 +385,7 @@ test_ipsecif_natt_transport() export RUMP_SERVER=$SOCK_NAT $DEBUG && $HIJACKING_NPF npfctl list # 192.168.0.2:4500 10.0.0.2:4500 via shmif1:65248 - port_a=$($HIJACKING_NPF npfctl list | grep $ip_local_a | awk -F 'shmif1:' '/4500/ {print $2;}') + port_a=$(get_natt_port $ip_local_a $ip_nat_remote) $DEBUG && echo port_a=$port_a if [ -z "$port_a" ]; then atf_fail "Failed to get a translated port on NAPT" @@ -441,7 +440,7 @@ test_ipsecif_natt_transport() export RUMP_SERVER=$SOCK_NAT $DEBUG && $HIJACKING_NPF npfctl list # 192.168.0.2:4500 10.0.0.2:4500 via shmif1:65248 - port_b=$($HIJACKING_NPF npfctl list | grep $ip_local_b | awk -F 'shmif1:' '/4500/ {print $2;}') + port_b=$(get_natt_port $ip_local_b $ip_nat_remote) $DEBUG && echo port_b=$port_b if [ -z "$port_b" ]; then atf_fail "Failed to get a translated port on NAPT" Index: src/tests/net/ipsec/common.sh diff -u src/tests/net/ipsec/common.sh:1.7 src/tests/net/ipsec/common.sh:1.8 --- src/tests/net/ipsec/common.sh:1.7 Fri Oct 20 03:43:51 2017 +++ src/tests/net/ipsec/common.sh Fri Jun 5 03:24:58 2020 @@ -1,4 +1,4 @@ -# $NetBSD: common.sh,v 1.7 2017/10/20 03:43:51 ozaki-r Exp $ +# $NetBSD: common.sh,v 1.8 2020/06/05 03:24:58 knakahara Exp $ # # Copyright (c) 2017 Internet Initiative Japan Inc. # All rights reserved. @@ -25,6 +25,8 @@ # POSSIBILITY OF SUCH DAMAGE. # +HIJACKING_NPF="${HIJACKING},blanket=/dev/npf" + test_flush_entries() { local sock=$1 @@ -83,3 +85,14 @@ generate_pktproto() echo $proto | tr 'a-z' 'A-Z' fi } + +get_natt_port() +{ + local local_addr=$1 + local remote_addr=$2 + local port="" + + # 10.0.1.2:4500 20.0.0.2:4500 shmif1 20.0.0.1:35574 + port=$($HIJACKING_NPF npfctl list | grep $local_addr | awk -F "${remote_addr}:" '/4500/ {print $2;}') + echo $port +} Index: src/tests/net/ipsec/t_ipsec_natt.sh diff -u src/tests/net/ipsec/t_ipsec_natt.sh:1.4 src/tests/net/ipsec/t_ipsec_natt.sh:1.5 --- src/tests/net/ipsec/t_ipsec_natt.sh:1.4 Mon Jun 1 04:38:37 2020 +++ src/tests/net/ipsec/t_ipsec_natt.sh Fri Jun 5 03:24:58 2020 @@ -1,4 +1,4 @@ -# $NetBSD: t_ipsec_natt.sh,v 1.4 2020/06/01 04:38:37 martin Exp $ +# $NetBSD: t_ipsec_natt.sh,v 1.5 2020/06/05 03:24:58 knakahara Exp $ # # Copyright (c) 2017 Internet Initiative Japan Inc. # All rights reserved. @@ -34,7 +34,6 @@ BUS_REMOTE=./bus_ipsec_natt_remote BUS_GLOBAL=./bus_ipsec_natt_global DEBUG=${DEBUG:-false} -HIJACKING_NPF="${HIJACKING},blanket=/dev/npf" setup_servers_ipv4() { @@ -325,7 +324,7 @@ test_ipsec_natt_transport_ipv4() export RUMP_SERVER=$SOCK_NAT $DEBUG && $HIJACKING_NPF npfctl list # 10.0.1.2:450020.0.0.2:4500 via shmif1:9696 - port=$($HIJACKING_NPF npfctl list | awk -F 'shmif1:' '/4500/ {print $2;}') + port=$(get_natt_port $ip_local $ip_nat_remote) $DEBUG && echo port=$port if [ -z "$port" ]; then atf_fail "Failed to get a translated port on NAPT"
CVS commit: src/tests/net/npf
Module Name:src Committed By: martin Date: Mon Jun 1 11:08:57 UTC 2020 Modified Files: src/tests/net/npf: t_npf.sh Log Message: Adjust to "npfctl debug" command line changes, from rmind@. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/net/npf/t_npf.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/npf/t_npf.sh diff -u src/tests/net/npf/t_npf.sh:1.3 src/tests/net/npf/t_npf.sh:1.4 --- src/tests/net/npf/t_npf.sh:1.3 Thu Aug 3 03:16:27 2017 +++ src/tests/net/npf/t_npf.sh Mon Jun 1 11:08:57 2020 @@ -1,4 +1,4 @@ -# $NetBSD: t_npf.sh,v 1.3 2017/08/03 03:16:27 ozaki-r Exp $ +# $NetBSD: t_npf.sh,v 1.4 2020/06/01 11:08:57 martin Exp $ # # Copyright (c) 2008, 2010 The NetBSD Foundation, Inc. # All rights reserved. @@ -29,7 +29,7 @@ run_test() { local name="${1}" - atf_check -o ignore -e ignore npfctl debug "$(atf_get_srcdir)/npftest.conf" ./npf.plist + atf_check -o ignore -e ignore npfctl debug -c "$(atf_get_srcdir)/npftest.conf" -o ./npf.plist atf_check -o ignore npftest -c npf.plist -T "${name}" }
CVS commit: src/tests/net
Module Name:src Committed By: martin Date: Mon Jun 1 04:38:37 UTC 2020 Modified Files: src/tests/net/if_ipsec: t_ipsec_natt.sh src/tests/net/ipsec: t_ipsec_natt.sh Log Message: Typo in error message To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/net/if_ipsec/t_ipsec_natt.sh cvs rdiff -u -r1.3 -r1.4 src/tests/net/ipsec/t_ipsec_natt.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_ipsec/t_ipsec_natt.sh diff -u src/tests/net/if_ipsec/t_ipsec_natt.sh:1.3 src/tests/net/if_ipsec/t_ipsec_natt.sh:1.4 --- src/tests/net/if_ipsec/t_ipsec_natt.sh:1.3 Mon Aug 19 03:22:05 2019 +++ src/tests/net/if_ipsec/t_ipsec_natt.sh Mon Jun 1 04:38:37 2020 @@ -1,4 +1,4 @@ -# $NetBSD: t_ipsec_natt.sh,v 1.3 2019/08/19 03:22:05 ozaki-r Exp $ +# $NetBSD: t_ipsec_natt.sh,v 1.4 2020/06/01 04:38:37 martin Exp $ # # Copyright (c) 2018 Internet Initiative Japan Inc. # All rights reserved. @@ -389,7 +389,7 @@ test_ipsecif_natt_transport() port_a=$($HIJACKING_NPF npfctl list | grep $ip_local_a | awk -F 'shmif1:' '/4500/ {print $2;}') $DEBUG && echo port_a=$port_a if [ -z "$port_a" ]; then - atf_fail "Failed to get a traslated port on NAPT" + atf_fail "Failed to get a translated port on NAPT" fi # Setup ESP-UDP ipsecif(4) for first client under NAPT @@ -444,7 +444,7 @@ test_ipsecif_natt_transport() port_b=$($HIJACKING_NPF npfctl list | grep $ip_local_b | awk -F 'shmif1:' '/4500/ {print $2;}') $DEBUG && echo port_b=$port_b if [ -z "$port_b" ]; then - atf_fail "Failed to get a traslated port on NAPT" + atf_fail "Failed to get a translated port on NAPT" fi # Setup ESP-UDP ipsecif(4) for first client under NAPT Index: src/tests/net/ipsec/t_ipsec_natt.sh diff -u src/tests/net/ipsec/t_ipsec_natt.sh:1.3 src/tests/net/ipsec/t_ipsec_natt.sh:1.4 --- src/tests/net/ipsec/t_ipsec_natt.sh:1.3 Mon Aug 19 03:22:05 2019 +++ src/tests/net/ipsec/t_ipsec_natt.sh Mon Jun 1 04:38:37 2020 @@ -1,4 +1,4 @@ -# $NetBSD: t_ipsec_natt.sh,v 1.3 2019/08/19 03:22:05 ozaki-r Exp $ +# $NetBSD: t_ipsec_natt.sh,v 1.4 2020/06/01 04:38:37 martin Exp $ # # Copyright (c) 2017 Internet Initiative Japan Inc. # All rights reserved. @@ -328,7 +328,7 @@ test_ipsec_natt_transport_ipv4() port=$($HIJACKING_NPF npfctl list | awk -F 'shmif1:' '/4500/ {print $2;}') $DEBUG && echo port=$port if [ -z "$port" ]; then - atf_fail "Failed to get a traslated port on NAPT" + atf_fail "Failed to get a translated port on NAPT" fi # Create ESP-UDP IPsec connections
CVS commit: src/tests/net/mpls
Module Name:src Committed By: christos Date: Wed Apr 1 01:51:02 UTC 2020 Modified Files: src/tests/net/mpls: t_ldp_regen.sh Log Message: more cleanup To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/tests/net/mpls/t_ldp_regen.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/mpls/t_ldp_regen.sh diff -u src/tests/net/mpls/t_ldp_regen.sh:1.9 src/tests/net/mpls/t_ldp_regen.sh:1.10 --- src/tests/net/mpls/t_ldp_regen.sh:1.9 Tue Mar 31 21:49:26 2020 +++ src/tests/net/mpls/t_ldp_regen.sh Tue Mar 31 21:51:02 2020 @@ -1,4 +1,4 @@ -# $NetBSD: t_ldp_regen.sh,v 1.9 2020/04/01 01:49:26 christos Exp $ +# $NetBSD: t_ldp_regen.sh,v 1.10 2020/04/01 01:51:02 christos Exp $ # # Copyright (c) 2013 The NetBSD Foundation, Inc. # All rights reserved. @@ -35,15 +35,6 @@ # Now: * R4 should install label IMPLNULL for that prefix # * R3 should realloc the target label from IMPLNULL to something else -export PATH=/sbin:/usr/sbin:/bin:/usr/bin - -RUMP_SERVER1=unix://./r1 -RUMP_SERVER2=unix://./r2 -RUMP_SERVER3=unix://./r3 -RUMP_SERVER4=unix://./r4 - -RUMP_LIBS="-lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpnet_netinet6 \ - -lrumpnet_netmpls -lrumpnet_shmif" LDP_FLAGS="" atf_test_case ldp_regen cleanup
CVS commit: src/tests/net/mpls
Module Name:src Committed By: christos Date: Wed Apr 1 01:49:26 UTC 2020 Modified Files: src/tests/net/mpls: Makefile t_ldp_regen.sh t_mpls_fw.sh t_mpls_fw6.sh t_mpls_fw64.sh t_rfc4182.sh Added Files: src/tests/net/mpls: mpls_common.sh Log Message: factor out common code and set the path. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/tests/net/mpls/Makefile \ src/tests/net/mpls/t_mpls_fw.sh cvs rdiff -u -r0 -r1.1 src/tests/net/mpls/mpls_common.sh cvs rdiff -u -r1.8 -r1.9 src/tests/net/mpls/t_ldp_regen.sh cvs rdiff -u -r1.4 -r1.5 src/tests/net/mpls/t_mpls_fw6.sh \ src/tests/net/mpls/t_mpls_fw64.sh cvs rdiff -u -r1.5 -r1.6 src/tests/net/mpls/t_rfc4182.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/mpls/Makefile diff -u src/tests/net/mpls/Makefile:1.6 src/tests/net/mpls/Makefile:1.7 --- src/tests/net/mpls/Makefile:1.6 Wed May 27 14:13:14 2015 +++ src/tests/net/mpls/Makefile Tue Mar 31 21:49:26 2020 @@ -1,10 +1,13 @@ -# $NetBSD: Makefile,v 1.6 2015/05/27 18:13:14 kefren Exp $ +# $NetBSD: Makefile,v 1.7 2020/04/01 01:49:26 christos Exp $ # .include TESTSDIR= ${TESTSBASE}/net/mpls -TESTS_SH= t_mpls_fw t_mpls_fw6 t_mpls_fw64 t_rfc4182 t_ldp_regen +.for name in t_mpls_fw t_mpls_fw6 t_mpls_fw64 t_rfc4182 t_ldp_regen +TESTS_SH+= ${name} +TESTS_SH_SRC_${name}= mpls_common.sh ${name}.sh +.endfor .include Index: src/tests/net/mpls/t_mpls_fw.sh diff -u src/tests/net/mpls/t_mpls_fw.sh:1.6 src/tests/net/mpls/t_mpls_fw.sh:1.7 --- src/tests/net/mpls/t_mpls_fw.sh:1.6 Mon May 13 13:55:09 2019 +++ src/tests/net/mpls/t_mpls_fw.sh Tue Mar 31 21:49:26 2020 @@ -1,4 +1,4 @@ -# $NetBSD: t_mpls_fw.sh,v 1.6 2019/05/13 17:55:09 bad Exp $ +# $NetBSD: t_mpls_fw.sh,v 1.7 2020/04/01 01:49:26 christos Exp $ # # Copyright (c) 2013 The NetBSD Foundation, Inc. # All rights reserved. @@ -36,15 +36,6 @@ # Do the same for the reverse direction (R4 to R1) # ping from R1 to R4 right hand side interface - -RUMP_SERVER1=unix://./r1 -RUMP_SERVER2=unix://./r2 -RUMP_SERVER3=unix://./r3 -RUMP_SERVER4=unix://./r4 - -RUMP_FLAGS="-lrumpnet -lrumpnet_net -lrumpnet_netinet \ --lrumpnet_netmpls -lrumpnet_shmif" - atf_test_case mplsfw4 cleanup mplsfw4_head() { @@ -53,16 +44,6 @@ mplsfw4_head() atf_set "require.progs" "rump_server" } -startservers() -{ - - ulimit -r 300 - atf_check -s exit:0 rump_server ${RUMP_FLAGS} ${RUMP_SERVER1} - atf_check -s exit:0 rump_server ${RUMP_FLAGS} ${RUMP_SERVER2} - atf_check -s exit:0 rump_server ${RUMP_FLAGS} ${RUMP_SERVER3} - atf_check -s exit:0 rump_server ${RUMP_FLAGS} ${RUMP_SERVER4} -} - configservers() { @@ -133,19 +114,10 @@ doping() unset RUMP_SERVER } -docleanup() -{ - - RUMP_SERVER=${RUMP_SERVER1} rump.halt - RUMP_SERVER=${RUMP_SERVER2} rump.halt - RUMP_SERVER=${RUMP_SERVER3} rump.halt - RUMP_SERVER=${RUMP_SERVER4} rump.halt -} - mplsfw4_body() { - startservers + dostart configservers 3 doping } @@ -168,7 +140,7 @@ mplsfw4_expl_head() mplsfw4_expl_body() { - startservers + dostart configservers 0 doping } Index: src/tests/net/mpls/t_ldp_regen.sh diff -u src/tests/net/mpls/t_ldp_regen.sh:1.8 src/tests/net/mpls/t_ldp_regen.sh:1.9 --- src/tests/net/mpls/t_ldp_regen.sh:1.8 Mon May 13 13:55:09 2019 +++ src/tests/net/mpls/t_ldp_regen.sh Tue Mar 31 21:49:26 2020 @@ -1,4 +1,4 @@ -# $NetBSD: t_ldp_regen.sh,v 1.8 2019/05/13 17:55:09 bad Exp $ +# $NetBSD: t_ldp_regen.sh,v 1.9 2020/04/01 01:49:26 christos Exp $ # # Copyright (c) 2013 The NetBSD Foundation, Inc. # All rights reserved. @@ -35,6 +35,7 @@ # Now: * R4 should install label IMPLNULL for that prefix # * R3 should realloc the target label from IMPLNULL to something else +export PATH=/sbin:/usr/sbin:/bin:/usr/bin RUMP_SERVER1=unix://./r1 RUMP_SERVER2=unix://./r2 @@ -68,15 +69,7 @@ newaddr_and_ping() { rump.ping -n -o -w 5 10.0.5.1 } -create_servers() { - - # allows us to run as normal user - ulimit -r 400 - - atf_check -s exit:0 rump_server ${RUMP_LIBS} ${RUMP_SERVER1} - atf_check -s exit:0 rump_server ${RUMP_LIBS} ${RUMP_SERVER2} - atf_check -s exit:0 rump_server ${RUMP_LIBS} ${RUMP_SERVER3} - atf_check -s exit:0 rump_server ${RUMP_LIBS} ${RUMP_SERVER4} +configservers() { # LDP HIJACK export RUMPHIJACK=path=/rump,socket=all,sysctl=yes @@ -153,21 +146,14 @@ wait_ldp_ok() { rump.ping -o -w 60 10.0.4.1 } -docleanup() { - - RUMP_SERVER=${RUMP_SERVER1} rump.halt - RUMP_SERVER=${RUMP_SERVER2} rump.halt - RUMP_SERVER=${RUMP_SERVER3} rump.halt - RUMP_SERVER=${RUMP_SERVER4} rump.halt -} - ldp_regen_body() { if sysctl machdep.cpu_brand 2>/dev/null | grep QEMU >/dev/null 2>&1 then atf_skip "unreliable under qemu, skip until PR kern/43997 fixed" fi - create_servers + dostart + configservers wait_ldp_ok newaddr_and_ping } Index: src/tests/net/mpls/t_mpls_fw6.sh
CVS commit: src/tests/net
Module Name:src Committed By: christos Date: Wed Apr 1 00:49:04 UTC 2020 Modified Files: src/tests/net: net_common.sh Log Message: Enforce a standard path To generate a diff of this commit: cvs rdiff -u -r1.40 -r1.41 src/tests/net/net_common.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/net_common.sh diff -u src/tests/net/net_common.sh:1.40 src/tests/net/net_common.sh:1.41 --- src/tests/net/net_common.sh:1.40 Mon Mar 30 09:01:39 2020 +++ src/tests/net/net_common.sh Tue Mar 31 20:49:04 2020 @@ -1,4 +1,4 @@ -# $NetBSD: net_common.sh,v 1.40 2020/03/30 13:01:39 christos Exp $ +# $NetBSD: net_common.sh,v 1.41 2020/04/01 00:49:04 christos Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -29,6 +29,8 @@ # Common utility functions for tests/net # +export PATH="/sbin:/usr/sbin:/bin:/usr/bin" + HIJACKING="env LD_PRELOAD=/usr/lib/librumphijack.so \ RUMPHIJACK=path=/rump,socket=all:nolocal,sysctl=yes" ONEDAYISH="(23h5[0-9]m|1d0h0m)[0-9]+s ?"
CVS commit: src/tests/net
Module Name:src Committed By: christos Date: Mon Mar 30 13:01:39 UTC 2020 Modified Files: src/tests/net: net_common.sh Log Message: Some interfaces (gif) don't have a mac address... To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 src/tests/net/net_common.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/net_common.sh diff -u src/tests/net/net_common.sh:1.39 src/tests/net/net_common.sh:1.40 --- src/tests/net/net_common.sh:1.39 Thu Feb 20 03:02:26 2020 +++ src/tests/net/net_common.sh Mon Mar 30 09:01:39 2020 @@ -1,4 +1,4 @@ -# $NetBSD: net_common.sh,v 1.39 2020/02/20 08:02:26 ozaki-r Exp $ +# $NetBSD: net_common.sh,v 1.40 2020/03/30 13:01:39 christos Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -326,13 +326,17 @@ rump_server_add_iface() if [ -n "$bus" ]; then atf_check -s exit:0 rump.ifconfig $ifname linkstr $bus fi - macaddr=$(get_macaddr $sock $ifname) - export RUMP_SERVER=$backup - if [ -f $_rump_server_macaddrs ]; then - atf_check -s not-exit:0 grep -q $macaddr $_rump_server_macaddrs + macaddr=$(get_macaddr $sock $ifname) + if [ -n "$macaddr" ]; then + if [ -f $_rump_server_macaddrs ]; then + atf_check -s not-exit:0 \ + grep -q $macaddr $_rump_server_macaddrs + fi + echo $macaddr >> $_rump_server_macaddrs fi - echo $macaddr >> $_rump_server_macaddrs + + export RUMP_SERVER=$backup echo $sock $ifname >> $_rump_server_ifaces $DEBUG && cat $_rump_server_ifaces
CVS commit: src/tests/net/ndp
Module Name:src Committed By: roy Date: Sun Mar 15 21:15:25 UTC 2020 Modified Files: src/tests/net/ndp: t_ndp.sh Log Message: tests: ndp_rtm: Check correct source address in RTA_AUTHOR Fixes PR kern/55074. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/tests/net/ndp/t_ndp.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/ndp/t_ndp.sh diff -u src/tests/net/ndp/t_ndp.sh:1.37 src/tests/net/ndp/t_ndp.sh:1.38 --- src/tests/net/ndp/t_ndp.sh:1.37 Wed Mar 11 08:52:13 2020 +++ src/tests/net/ndp/t_ndp.sh Sun Mar 15 21:15:25 2020 @@ -1,4 +1,4 @@ -# $NetBSD: t_ndp.sh,v 1.37 2020/03/11 08:52:13 roy Exp $ +# $NetBSD: t_ndp.sh,v 1.38 2020/03/15 21:15:25 roy Exp $ # # Copyright (c) 2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -472,7 +472,7 @@ ndp_rtm_body() hdr="RTM_MISS.+" what="" - addr="$IP6DST_FAIL1 link#2 $IP6DST" + addr="$IP6DST_FAIL1 link#2 $IP6SRC" atf_check -s exit:0 -o match:"$hdr" -o match:"$what" -o match:"$addr" \ cat $file
CVS commit: src/tests/net
Module Name:src Committed By: roy Date: Wed Mar 11 08:52:13 UTC 2020 Modified Files: src/tests/net/arp: t_arp.sh src/tests/net/ndp: t_ndp.sh Log Message: tests: check RTA_AUTHOR in messages To generate a diff of this commit: cvs rdiff -u -r1.40 -r1.41 src/tests/net/arp/t_arp.sh cvs rdiff -u -r1.36 -r1.37 src/tests/net/ndp/t_ndp.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/arp/t_arp.sh diff -u src/tests/net/arp/t_arp.sh:1.40 src/tests/net/arp/t_arp.sh:1.41 --- src/tests/net/arp/t_arp.sh:1.40 Mon Sep 9 10:29:04 2019 +++ src/tests/net/arp/t_arp.sh Wed Mar 11 08:52:13 2020 @@ -1,4 +1,4 @@ -# $NetBSD: t_arp.sh,v 1.40 2019/09/09 10:29:04 roy Exp $ +# $NetBSD: t_arp.sh,v 1.41 2020/03/11 08:52:13 roy Exp $ # # Copyright (c) 2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -735,8 +735,8 @@ arp_rtm_body() $DEBUG && cat $file hdr="RTM_MISS.+" - what="" - addr="$IP4DST_FAIL1 link#2" + what="" + addr="$IP4DST_FAIL1 link#2 $IP4SRC" atf_check -s exit:0 -o match:"$hdr" -o match:"$what" -o match:"$addr" \ cat $file Index: src/tests/net/ndp/t_ndp.sh diff -u src/tests/net/ndp/t_ndp.sh:1.36 src/tests/net/ndp/t_ndp.sh:1.37 --- src/tests/net/ndp/t_ndp.sh:1.36 Tue Sep 3 19:07:50 2019 +++ src/tests/net/ndp/t_ndp.sh Wed Mar 11 08:52:13 2020 @@ -1,4 +1,4 @@ -# $NetBSD: t_ndp.sh,v 1.36 2019/09/03 19:07:50 roy Exp $ +# $NetBSD: t_ndp.sh,v 1.37 2020/03/11 08:52:13 roy Exp $ # # Copyright (c) 2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -455,8 +455,8 @@ ndp_rtm_body() $DEBUG && cat $file hdr="RTM_ADD.+" - what="" - addr="$IP6DST $macaddr_dst" + what="" + addr="$IP6DST $macaddr_dst $IP6DST" atf_check -s exit:0 -o match:"$hdr" -o match:"$what" -o match:"$addr" \ cat $file @@ -471,8 +471,8 @@ ndp_rtm_body() $DEBUG && cat $file hdr="RTM_MISS.+" - what="" - addr="$IP6DST_FAIL1 link#2" + what="" + addr="$IP6DST_FAIL1 link#2 $IP6DST" atf_check -s exit:0 -o match:"$hdr" -o match:"$what" -o match:"$addr" \ cat $file
CVS commit: src/tests/net/if_vlan
Module Name:src Committed By: nisimura Date: Sun Mar 8 09:05:34 UTC 2020 Modified Files: src/tests/net/if_vlan: t_vlan.sh Log Message: address to ATF t_vlan failure. adapt ifmcstat(8) output format change. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/tests/net/if_vlan/t_vlan.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_vlan/t_vlan.sh diff -u src/tests/net/if_vlan/t_vlan.sh:1.16 src/tests/net/if_vlan/t_vlan.sh:1.17 --- src/tests/net/if_vlan/t_vlan.sh:1.16 Mon Nov 11 02:40:48 2019 +++ src/tests/net/if_vlan/t_vlan.sh Sun Mar 8 09:05:33 2020 @@ -1,4 +1,4 @@ -# $NetBSD: t_vlan.sh,v 1.16 2019/11/11 02:40:48 yamaguchi Exp $ +# $NetBSD: t_vlan.sh,v 1.17 2020/03/08 09:05:33 nisimura Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -792,7 +792,7 @@ vlan_multicast_body_common() # add an address to different interfaces $atf_siocXmulti add vlan0 $mcaddr $atf_siocXmulti add vlan1 $mcaddr - atf_check -s exit:0 -o match:"${eth_mcaddr}: 2" $HIJACKING ifmcstat + atf_check -s exit:0 -o match:"${eth_mcaddr} refcount 2" $HIJACKING ifmcstat $atf_siocXmulti del vlan0 $mcaddr # delete the address with invalid interface @@ -805,7 +805,7 @@ vlan_multicast_body_common() $atf_siocXmulti add vlan0 $mcaddr $atf_siocXmulti add vlan0 $mcaddr $atf_siocXmulti add vlan0 $mcaddr - atf_check -s exit:0 -o match:"${eth_mcaddr}: 3" $HIJACKING ifmcstat + atf_check -s exit:0 -o match:"${eth_mcaddr} refcount 3" $HIJACKING ifmcstat $atf_siocXmulti del vlan0 $mcaddr $atf_siocXmulti del vlan0 $mcaddr $atf_siocXmulti del vlan0 $mcaddr
CVS commit: src/tests/net
Module Name:src Committed By: ozaki-r Date: Thu Feb 20 08:02:26 UTC 2020 Modified Files: src/tests/net: net_common.sh Log Message: tests: abort if MAC address duplication found To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 src/tests/net/net_common.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/net_common.sh diff -u src/tests/net/net_common.sh:1.38 src/tests/net/net_common.sh:1.39 --- src/tests/net/net_common.sh:1.38 Thu Feb 20 07:58:19 2020 +++ src/tests/net/net_common.sh Thu Feb 20 08:02:26 2020 @@ -1,4 +1,4 @@ -# $NetBSD: net_common.sh,v 1.38 2020/02/20 07:58:19 ozaki-r Exp $ +# $NetBSD: net_common.sh,v 1.39 2020/02/20 08:02:26 ozaki-r Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -183,6 +183,7 @@ CRYPTO_NPF_LIBS="$CRYPTO_LIBS -lrumpvfs _rump_server_socks=./.__socks _rump_server_ifaces=./.__ifaces _rump_server_buses=./.__buses +_rump_server_macaddrs=./.__macaddrs DEBUG_SYSCTL_ENTRIES="net.inet.arp.debug net.inet6.icmp6.nd6_debug \ net.inet.ipsec.debug" @@ -318,14 +319,21 @@ rump_server_add_iface() local ifname=$2 local bus=$3 local backup=$RUMP_SERVER + local macaddr= export RUMP_SERVER=$sock atf_check -s exit:0 rump.ifconfig $ifname create if [ -n "$bus" ]; then atf_check -s exit:0 rump.ifconfig $ifname linkstr $bus fi + macaddr=$(get_macaddr $sock $ifname) export RUMP_SERVER=$backup + if [ -f $_rump_server_macaddrs ]; then + atf_check -s not-exit:0 grep -q $macaddr $_rump_server_macaddrs + fi + echo $macaddr >> $_rump_server_macaddrs + echo $sock $ifname >> $_rump_server_ifaces $DEBUG && cat $_rump_server_ifaces
CVS commit: src/tests/net
Module Name:src Committed By: ozaki-r Date: Thu Feb 20 07:58:19 UTC 2020 Modified Files: src/tests/net: net_common.sh Log Message: tests: dump stats of an interface before destroying it To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/tests/net/net_common.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/net_common.sh diff -u src/tests/net/net_common.sh:1.37 src/tests/net/net_common.sh:1.38 --- src/tests/net/net_common.sh:1.37 Mon Aug 26 04:50:32 2019 +++ src/tests/net/net_common.sh Thu Feb 20 07:58:19 2020 @@ -1,4 +1,4 @@ -# $NetBSD: net_common.sh,v 1.37 2019/08/26 04:50:32 ozaki-r Exp $ +# $NetBSD: net_common.sh,v 1.38 2020/02/20 07:58:19 ozaki-r Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -398,6 +398,9 @@ rump_server_destroy_ifaces() while read sock ifname; do export RUMP_SERVER=$sock if rump.ifconfig -l |grep -q $ifname; then + if $DEBUG; then +rump.ifconfig -v $ifname + fi atf_check -s exit:0 rump.ifconfig $ifname destroy fi atf_check -s exit:0 -o ignore rump.ifconfig
CVS commit: src/tests/net/ipsec
Module Name:src Committed By: ozaki-r Date: Mon Feb 17 08:46:10 UTC 2020 Modified Files: src/tests/net/ipsec: t_ipsec_gif.sh t_ipsec_l2tp.sh Log Message: tests: add missing ifconfig -w This change mitigates PR kern/54897. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/tests/net/ipsec/t_ipsec_gif.sh \ src/tests/net/ipsec/t_ipsec_l2tp.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/ipsec/t_ipsec_gif.sh diff -u src/tests/net/ipsec/t_ipsec_gif.sh:1.8 src/tests/net/ipsec/t_ipsec_gif.sh:1.9 --- src/tests/net/ipsec/t_ipsec_gif.sh:1.8 Mon Aug 19 03:22:05 2019 +++ src/tests/net/ipsec/t_ipsec_gif.sh Mon Feb 17 08:46:10 2020 @@ -1,4 +1,4 @@ -# $NetBSD: t_ipsec_gif.sh,v 1.8 2019/08/19 03:22:05 ozaki-r Exp $ +# $NetBSD: t_ipsec_gif.sh,v 1.9 2020/02/17 08:46:10 ozaki-r Exp $ # # Copyright (c) 2017 Internet Initiative Japan Inc. # All rights reserved. @@ -59,6 +59,15 @@ make_gif_pktstr() echo "$src > $dst: $proto_cap.+$inner_str" } +wait_for_all_dad_completions() +{ + + for sock in $SOCK_LOCAL $SOCK_TUN_LOCAL $SOCK_TUN_REMOTE $SOCK_REMOTE; do + export RUMP_SERVER=$sock + atf_check -s exit:0 rump.ifconfig -w 10 + done +} + test_ipsec4_gif() { local mode=$1 @@ -121,8 +130,9 @@ test_ipsec4_gif() export RUMP_SERVER=$SOCK_REMOTE atf_check -s exit:0 rump.ifconfig shmif0 $ip_remote/24 - # Run ifconfig -w 10 just once for optimization - atf_check -s exit:0 rump.ifconfig -w 10 + + wait_for_all_dad_completions + atf_check -s exit:0 -o ignore \ rump.route -n add -net $subnet_local $ip_gw_remote @@ -273,8 +283,9 @@ test_ipsec6_gif() export RUMP_SERVER=$SOCK_REMOTE atf_check -s exit:0 rump.ifconfig shmif0 inet6 $ip_remote - # Run ifconfig -w 10 just once for optimization - atf_check -s exit:0 rump.ifconfig -w 10 + + wait_for_all_dad_completions + atf_check -s exit:0 -o ignore \ rump.route -n add -inet6 -net $subnet_local/64 $ip_gw_remote Index: src/tests/net/ipsec/t_ipsec_l2tp.sh diff -u src/tests/net/ipsec/t_ipsec_l2tp.sh:1.8 src/tests/net/ipsec/t_ipsec_l2tp.sh:1.9 --- src/tests/net/ipsec/t_ipsec_l2tp.sh:1.8 Mon Aug 19 03:22:05 2019 +++ src/tests/net/ipsec/t_ipsec_l2tp.sh Mon Feb 17 08:46:10 2020 @@ -1,4 +1,4 @@ -# $NetBSD: t_ipsec_l2tp.sh,v 1.8 2019/08/19 03:22:05 ozaki-r Exp $ +# $NetBSD: t_ipsec_l2tp.sh,v 1.9 2020/02/17 08:46:10 ozaki-r Exp $ # # Copyright (c) 2017 Internet Initiative Japan Inc. # All rights reserved. @@ -62,6 +62,15 @@ make_l2tp_pktstr() echo "$src > $dst: $proto_cap.+$proto_str" } +wait_for_all_dad_completions() +{ + + for sock in $SOCK_LOCAL $SOCK_TUN_LOCAL $SOCK_TUN_REMOTE $SOCK_REMOTE; do + export RUMP_SERVER=$sock + atf_check -s exit:0 rump.ifconfig -w 10 + done +} + test_ipsec4_l2tp() { local mode=$1 @@ -121,8 +130,8 @@ test_ipsec4_l2tp() export RUMP_SERVER=$SOCK_REMOTE atf_check -s exit:0 rump.ifconfig shmif0 $ip_remote/24 - # Run ifconfig -w 10 just once for optimization - atf_check -s exit:0 rump.ifconfig -w 10 + + wait_for_all_dad_completions extract_new_packets $BUS_TUNNEL > $outfile @@ -263,8 +272,8 @@ test_ipsec6_l2tp() export RUMP_SERVER=$SOCK_REMOTE atf_check -s exit:0 rump.ifconfig shmif0 inet6 $ip_remote - # Run ifconfig -w 10 just once for optimization - atf_check -s exit:0 rump.ifconfig -w 10 + + wait_for_all_dad_completions extract_new_packets $BUS_TUNNEL > $outfile
CVS commit: src/tests/net/route
Module Name:src Committed By: ozaki-r Date: Thu Apr 18 07:56:54 UTC 2019 Modified Files: src/tests/net/route: t_change.sh Log Message: tests: dump kernel stats on cleanup To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/tests/net/route/t_change.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/route/t_change.sh diff -u src/tests/net/route/t_change.sh:1.12 src/tests/net/route/t_change.sh:1.13 --- src/tests/net/route/t_change.sh:1.12 Mon Dec 18 04:11:46 2017 +++ src/tests/net/route/t_change.sh Thu Apr 18 07:56:54 2019 @@ -1,4 +1,4 @@ -# $NetBSD: t_change.sh,v 1.12 2017/12/18 04:11:46 ozaki-r Exp $ +# $NetBSD: t_change.sh,v 1.13 2019/04/18 07:56:54 ozaki-r Exp $ # # Copyright (c) 2011 The NetBSD Foundation, Inc. # All rights reserved. @@ -32,6 +32,14 @@ export RUMP_SERVER=unix://commsock DEBUG=${DEBUG:-false} +route_cleanup_common() +{ + + $DEBUG && dump_kernel_stats unix://commsock + $DEBUG && extract_rump_server_core + env RUMP_SERVER=unix://commsock rump.halt +} + atf_test_case route_change_reject2blackhole cleanup route_change_reject2blackhole_head() { @@ -58,7 +66,7 @@ route_change_reject2blackhole_body() route_change_reject2blackhole_cleanup() { - env RUMP_SERVER=unix://commsock rump.halt + route_cleanup_common } atf_test_case route_change_gateway cleanup @@ -91,7 +99,7 @@ route_change_gateway_body() route_change_gateway_cleanup() { - env RUMP_SERVER=unix://commsock rump.halt + route_cleanup_common } atf_test_case route_change_ifa cleanup @@ -156,7 +164,7 @@ destination: 192.168.0.0 route_change_ifa_cleanup() { - env RUMP_SERVER=unix://commsock rump.halt + route_cleanup_common } atf_test_case route_change_ifp cleanup @@ -223,7 +231,7 @@ destination: 192.168.0.0 route_change_ifp_cleanup() { - env RUMP_SERVER=unix://commsock rump.halt + route_cleanup_common } atf_test_case route_change_ifp_ifa cleanup @@ -290,7 +298,7 @@ destination: 192.168.0.0 route_change_ifp_ifa_cleanup() { - env RUMP_SERVER=unix://commsock rump.halt + route_cleanup_common } atf_test_case route_change_flags cleanup @@ -326,7 +334,7 @@ route_change_flags_body() route_change_flags_cleanup() { - env RUMP_SERVER=unix://commsock rump.halt + route_cleanup_common } atf_test_case route_change_default_flags cleanup @@ -361,7 +369,7 @@ route_change_default_flags_body() route_change_default_flags_cleanup() { - env RUMP_SERVER=unix://commsock rump.halt + route_cleanup_common } atf_init_test_cases()
CVS commit: src/tests/net
Module Name:src Committed By: ozaki-r Date: Thu Apr 18 07:56:05 UTC 2019 Modified Files: src/tests/net: net_common.sh Log Message: tests: make utility funtions easy to use for tests that don't use the framework To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/tests/net/net_common.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/net_common.sh diff -u src/tests/net/net_common.sh:1.29 src/tests/net/net_common.sh:1.30 --- src/tests/net/net_common.sh:1.29 Thu Jan 17 02:49:11 2019 +++ src/tests/net/net_common.sh Thu Apr 18 07:56:04 2019 @@ -1,4 +1,4 @@ -# $NetBSD: net_common.sh,v 1.29 2019/01/17 02:49:11 knakahara Exp $ +# $NetBSD: net_common.sh,v 1.30 2019/04/18 07:56:04 ozaki-r Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -384,29 +384,42 @@ rump_server_halt_servers() return 0 } +extract_rump_server_core() +{ + + if [ -f rump_server.core ]; then + gdb -ex bt /usr/bin/rump_server rump_server.core + strings rump_server.core |grep panic + fi +} + +dump_kernel_stats() +{ + local sock=$1 + + echo "### Dumping $sock" + export RUMP_SERVER=$sock + rump.ifconfig -av + rump.netstat -nr + # XXX still need hijacking + $HIJACKING rump.netstat -nai + rump.arp -na + rump.ndp -na + $HIJACKING ifmcstat + $HIJACKING dmesg +} + rump_server_dump_servers() { local backup=$RUMP_SERVER $DEBUG && cat $_rump_server_socks for sock in $(cat $_rump_server_socks); do - echo "### Dumping $sock" - export RUMP_SERVER=$sock - rump.ifconfig -av - rump.netstat -nr - # XXX still need hijacking - $HIJACKING rump.netstat -nai - rump.arp -na - rump.ndp -na - $HIJACKING ifmcstat - $HIJACKING dmesg + dump_kernel_stats $sock done export RUMP_SERVER=$backup - if [ -f rump_server.core ]; then - gdb -ex bt /usr/bin/rump_server rump_server.core - strings rump_server.core |grep panic - fi + extract_rump_server_core return 0 }
CVS commit: src/tests/net/net
Module Name:src Committed By: christos Date: Sun Apr 14 01:45:30 UTC 2019 Modified Files: src/tests/net/net: t_unix.c Log Message: ifix uninialized pid To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/tests/net/net/t_unix.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/net/t_unix.c diff -u src/tests/net/net/t_unix.c:1.17 src/tests/net/net/t_unix.c:1.18 --- src/tests/net/net/t_unix.c:1.17 Sat Feb 17 15:16:18 2018 +++ src/tests/net/net/t_unix.c Sat Apr 13 21:45:30 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: t_unix.c,v 1.17 2018/02/17 20:16:18 christos Exp $ */ +/* $NetBSD: t_unix.c,v 1.18 2019/04/14 01:45:30 christos Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ #include #ifdef __RCSID -__RCSID("$Id: t_unix.c,v 1.17 2018/02/17 20:16:18 christos Exp $"); +__RCSID("$Id: t_unix.c,v 1.18 2019/04/14 01:45:30 christos Exp $"); #else #define getprogname() argv[0] #endif @@ -140,6 +140,7 @@ peercred(int s, uid_t *euid, gid_t *egid *pid = cred.unp_pid; return 0; #else + *pid = -1; return getpeereid(s, euid, egid); #endif }
CVS commit: src/tests/net/if_ipsec
Module Name:src Committed By: knakahara Date: Tue Jan 15 05:34:38 UTC 2019 Modified Files: src/tests/net/if_ipsec: t_ipsec.sh Log Message: Fix PR kern/53848. Add missing "ifconfig -w". To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/tests/net/if_ipsec/t_ipsec.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_ipsec/t_ipsec.sh diff -u src/tests/net/if_ipsec/t_ipsec.sh:1.8 src/tests/net/if_ipsec/t_ipsec.sh:1.9 --- src/tests/net/if_ipsec/t_ipsec.sh:1.8 Tue Jan 15 05:33:42 2019 +++ src/tests/net/if_ipsec/t_ipsec.sh Tue Jan 15 05:34:37 2019 @@ -1,4 +1,4 @@ -# $NetBSD: t_ipsec.sh,v 1.8 2019/01/15 05:33:42 knakahara Exp $ +# $NetBSD: t_ipsec.sh,v 1.9 2019/01/15 05:34:37 knakahara Exp $ # # Copyright (c) 2017 Internet Initiative Japan Inc. # All rights reserved. @@ -99,6 +99,10 @@ setup_router() rump_server_add_iface $sock shmif1 bus1 export RUMP_SERVER=${sock} + + atf_check -s exit:0 rump.sysctl -q -w net.inet.ip.dad_count=0 + atf_check -s exit:0 rump.sysctl -q -w net.inet6.ip6.dad_count=0 + if [ ${lan_mode} = "ipv6" ]; then atf_check -s exit:0 rump.ifconfig shmif0 inet6 ${lan} else @@ -113,10 +117,9 @@ setup_router() atf_check -s exit:0 rump.ifconfig shmif1 inet ${wan} netmask 0xff00 fi atf_check -s exit:0 rump.ifconfig shmif1 up + atf_check -s exit:0 rump.ifconfig -w 10 $DEBUG && rump.ifconfig shmif1 - atf_check -s exit:0 rump.sysctl -q -w net.inet.ip.dad_count=0 - atf_check -s exit:0 rump.sysctl -q -w net.inet6.ip6.dad_count=0 unset RUMP_SERVER } @@ -250,6 +253,8 @@ setup_if_ipsec() atf_check -s exit:0 -o ignore rump.route add -inet ${peernet} ${addr} fi + atf_check -s exit:0 rump.ifconfig -w 10 + $DEBUG && rump.ifconfig ipsec0 $DEBUG && rump.route -nL show } @@ -428,6 +433,7 @@ setup_dummy_if_ipsec() else atf_check -s exit:0 rump.ifconfig ipsec1 inet ${addr}/32 ${remote} fi + atf_check -s exit:0 rump.ifconfig -w 10 $DEBUG && rump.ifconfig ipsec1 unset RUMP_SERVER @@ -569,6 +575,7 @@ setup_recursive_if_ipsec() else atf_check -s exit:0 rump.ifconfig ${ipsec} inet ${addr}/32 ${remote} fi + atf_check -s exit:0 rump.ifconfig -w 10 setup_if_ipsec_sa $sock ${src} ${dst} ${inner} ${proto} ${algo} ${dir} export RUMP_SERVER=${sock}
CVS commit: src/tests/net/if_ipsec
Module Name:src Committed By: knakahara Date: Tue Jan 15 05:33:42 UTC 2019 Modified Files: src/tests/net/if_ipsec: t_ipsec.sh Log Message: revert t_ipsec.sh:r1.7 To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/tests/net/if_ipsec/t_ipsec.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_ipsec/t_ipsec.sh diff -u src/tests/net/if_ipsec/t_ipsec.sh:1.7 src/tests/net/if_ipsec/t_ipsec.sh:1.8 --- src/tests/net/if_ipsec/t_ipsec.sh:1.7 Fri Jan 11 08:05:52 2019 +++ src/tests/net/if_ipsec/t_ipsec.sh Tue Jan 15 05:33:42 2019 @@ -1,4 +1,4 @@ -# $NetBSD: t_ipsec.sh,v 1.7 2019/01/11 08:05:52 knakahara Exp $ +# $NetBSD: t_ipsec.sh,v 1.8 2019/01/15 05:33:42 knakahara Exp $ # # Copyright (c) 2017 Internet Initiative Japan Inc. # All rights reserved. @@ -62,7 +62,7 @@ ROUTER2_IPSECIP6_RECURSIVE1=fc00:104::1 ROUTER2_IPSECIP6_RECURSIVE2=fc00:204::1 DEBUG=${DEBUG:-false} -TIMEOUT=15 +TIMEOUT=7 atf_test_case ipsecif_create_destroy cleanup ipsecif_create_destroy_head()
CVS commit: src/tests/net/if_ipsec
Module Name:src Committed By: knakahara Date: Fri Jan 11 08:05:53 UTC 2019 Modified Files: src/tests/net/if_ipsec: t_ipsec.sh Log Message: workaround for PR kern/53848 To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/tests/net/if_ipsec/t_ipsec.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_ipsec/t_ipsec.sh diff -u src/tests/net/if_ipsec/t_ipsec.sh:1.6 src/tests/net/if_ipsec/t_ipsec.sh:1.7 --- src/tests/net/if_ipsec/t_ipsec.sh:1.6 Thu Jan 10 00:45:08 2019 +++ src/tests/net/if_ipsec/t_ipsec.sh Fri Jan 11 08:05:52 2019 @@ -1,4 +1,4 @@ -# $NetBSD: t_ipsec.sh,v 1.6 2019/01/10 00:45:08 knakahara Exp $ +# $NetBSD: t_ipsec.sh,v 1.7 2019/01/11 08:05:52 knakahara Exp $ # # Copyright (c) 2017 Internet Initiative Japan Inc. # All rights reserved. @@ -62,7 +62,7 @@ ROUTER2_IPSECIP6_RECURSIVE1=fc00:104::1 ROUTER2_IPSECIP6_RECURSIVE2=fc00:204::1 DEBUG=${DEBUG:-false} -TIMEOUT=7 +TIMEOUT=15 atf_test_case ipsecif_create_destroy cleanup ipsecif_create_destroy_head()
CVS commit: src/tests/net/if_ipsec
Module Name:src Committed By: knakahara Date: Thu Jan 10 00:45:08 UTC 2019 Modified Files: src/tests/net/if_ipsec: t_ipsec.sh Log Message: tests/net/if_ipsec/t_ipsec disable dad. This may fix PR kern/53848 To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/tests/net/if_ipsec/t_ipsec.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_ipsec/t_ipsec.sh diff -u src/tests/net/if_ipsec/t_ipsec.sh:1.5 src/tests/net/if_ipsec/t_ipsec.sh:1.6 --- src/tests/net/if_ipsec/t_ipsec.sh:1.5 Tue Dec 25 03:28:29 2018 +++ src/tests/net/if_ipsec/t_ipsec.sh Thu Jan 10 00:45:08 2019 @@ -1,4 +1,4 @@ -# $NetBSD: t_ipsec.sh,v 1.5 2018/12/25 03:28:29 knakahara Exp $ +# $NetBSD: t_ipsec.sh,v 1.6 2019/01/10 00:45:08 knakahara Exp $ # # Copyright (c) 2017 Internet Initiative Japan Inc. # All rights reserved. @@ -114,6 +114,9 @@ setup_router() fi atf_check -s exit:0 rump.ifconfig shmif1 up $DEBUG && rump.ifconfig shmif1 + + atf_check -s exit:0 rump.sysctl -q -w net.inet.ip.dad_count=0 + atf_check -s exit:0 rump.sysctl -q -w net.inet6.ip6.dad_count=0 unset RUMP_SERVER }
CVS commit: src/tests/net/if_ipsec
Module Name:src Committed By: knakahara Date: Wed Dec 26 08:59:41 UTC 2018 Modified Files: src/tests/net/if_ipsec: t_ipsec_natt.sh Log Message: Add ATF for ipsecif(4) which connect to two peers in the same NAPT. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/net/if_ipsec/t_ipsec_natt.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_ipsec/t_ipsec_natt.sh diff -u src/tests/net/if_ipsec/t_ipsec_natt.sh:1.1 src/tests/net/if_ipsec/t_ipsec_natt.sh:1.2 --- src/tests/net/if_ipsec/t_ipsec_natt.sh:1.1 Tue Dec 25 03:54:44 2018 +++ src/tests/net/if_ipsec/t_ipsec_natt.sh Wed Dec 26 08:59:41 2018 @@ -1,4 +1,4 @@ -# $NetBSD: t_ipsec_natt.sh,v 1.1 2018/12/25 03:54:44 knakahara Exp $ +# $NetBSD: t_ipsec_natt.sh,v 1.2 2018/12/26 08:59:41 knakahara Exp $ # # Copyright (c) 2018 Internet Initiative Japan Inc. # All rights reserved. @@ -25,7 +25,8 @@ # POSSIBILITY OF SUCH DAMAGE. # -SOCK_LOCAL=unix://ipsec_natt_local +SOCK_LOCAL_A=unix://ipsec_natt_local_a +SOCK_LOCAL_B=unix://ipsec_natt_local_b SOCK_NAT=unix://ipsec_natt_nat SOCK_REMOTE=unix://ipsec_natt_remote BUS_LOCAL=./bus_ipsec_natt_local @@ -37,10 +38,12 @@ HIJACKING_NPF="${HIJACKING},blanket=/dev setup_servers() { - rump_server_crypto_start $SOCK_LOCAL netipsec ipsec + rump_server_crypto_start $SOCK_LOCAL_A netipsec ipsec + rump_server_crypto_start $SOCK_LOCAL_B netipsec ipsec rump_server_npf_start $SOCK_NAT rump_server_crypto_start $SOCK_REMOTE netipsec ipsec - rump_server_add_iface $SOCK_LOCAL shmif0 $BUS_LOCAL + rump_server_add_iface $SOCK_LOCAL_A shmif0 $BUS_LOCAL + rump_server_add_iface $SOCK_LOCAL_B shmif0 $BUS_LOCAL rump_server_add_iface $SOCK_NAT shmif0 $BUS_LOCAL rump_server_add_iface $SOCK_NAT shmif1 $BUS_NAT rump_server_add_iface $SOCK_REMOTE shmif0 $BUS_NAT @@ -293,24 +296,33 @@ check_tcp_com_over_ipsecif() test_ipsecif_natt_transport() { local algo=$1 - local ip_local=192.168.0.2 + local ip_local_a=192.168.0.2 + local ip_local_b=192.168.0.3 local ip_nat_local=192.168.0.1 local ip_nat_remote=10.0.0.1 local ip_remote=10.0.0.2 local subnet_local=192.168.0.0 - local ip_local_ipsecif=172.16.100.1 - local ip_remote_ipsecif=172.16.10.1 + local ip_local_ipsecif_a=172.16.100.1 + local ip_local_ipsecif_b=172.16.110.1 + local ip_remote_ipsecif_a=172.16.10.1 + local ip_remote_ipsecif_b=172.16.11.1 local npffile=./npf.conf local file_send=./file.send local algo_args="$(generate_algo_args esp-udp $algo)" - local pid= port= + local pid= port_a= port_b= setup_servers - export RUMP_SERVER=$SOCK_LOCAL + export RUMP_SERVER=$SOCK_LOCAL_A atf_check -s exit:0 rump.sysctl -q -w net.inet.ip.dad_count=0 - atf_check -s exit:0 rump.ifconfig shmif0 $ip_local/24 + atf_check -s exit:0 rump.ifconfig shmif0 $ip_local_a/24 + atf_check -s exit:0 -o ignore \ + rump.route -n add default $ip_nat_local + + export RUMP_SERVER=$SOCK_LOCAL_B + atf_check -s exit:0 rump.sysctl -q -w net.inet.ip.dad_count=0 + atf_check -s exit:0 rump.ifconfig shmif0 $ip_local_b/24 atf_check -s exit:0 -o ignore \ rump.route -n add default $ip_nat_local @@ -327,7 +339,8 @@ test_ipsecif_natt_transport() rump.route -n add -net $subnet_local $ip_nat_remote # There is no NAT/NAPT. ping should just work. - check_ping_packets $SOCK_LOCAL $BUS_NAT $ip_local $ip_remote + check_ping_packets $SOCK_LOCAL_A $BUS_NAT $ip_local_a $ip_remote + check_ping_packets $SOCK_LOCAL_B $BUS_NAT $ip_local_b $ip_remote # Setup an NAPT with npf build_npf_conf $npffile "$subnet_local/24" @@ -338,29 +351,88 @@ test_ipsecif_natt_transport() $DEBUG && ${HIJACKING},"blanket=/dev/npf" npfctl show # There is an NAPT. ping works but source IP/port are translated - check_ping_packets $SOCK_LOCAL $BUS_NAT $ip_nat_remote $ip_remote + check_ping_packets $SOCK_LOCAL_A $BUS_NAT $ip_nat_remote $ip_remote + check_ping_packets $SOCK_LOCAL_B $BUS_NAT $ip_nat_remote $ip_remote # Try TCP communications just in case - check_tcp_com_prepare $SOCK_REMOTE $SOCK_LOCAL $BUS_NAT \ + check_tcp_com_prepare $SOCK_REMOTE $SOCK_LOCAL_A $BUS_NAT \ + $ip_remote $ip_nat_remote $ip_remote + check_tcp_com_prepare $SOCK_REMOTE $SOCK_LOCAL_B $BUS_NAT \ $ip_remote $ip_nat_remote $ip_remote # Launch a nc server as a terminator of NAT-T on outside the NAPT start_natt_terminator $SOCK_REMOTE $ip_remote 4500 echo zzz > $file_send + Test for primary ipsecif(4) NAT-T. + + export RUMP_SERVER=$SOCK_LOCAL_A + # Send a UDP packet to the remote server at port 4500 from the local + # host of port 4500. This makes a mapping on the NAPT between them + atf_check -s exit:0 $HIJACKING \ + nc -u -w 3 -p 4500 $ip_remote 4500 < $file_send + # Launch a nc server as a terminator of NAT-T on inside the NAPT, + # taking over port 4500 of the local host. + start_natt_terminator $SOCK_LOCAL_A $ip_local_a 4500 +
CVS commit: src/tests/net/if_ipsec
Module Name:src Committed By: knakahara Date: Tue Dec 25 03:28:29 UTC 2018 Modified Files: src/tests/net/if_ipsec: t_ipsec.sh Log Message: reduce debug messages when $DEBUG is not true. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/tests/net/if_ipsec/t_ipsec.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_ipsec/t_ipsec.sh diff -u src/tests/net/if_ipsec/t_ipsec.sh:1.4 src/tests/net/if_ipsec/t_ipsec.sh:1.5 --- src/tests/net/if_ipsec/t_ipsec.sh:1.4 Tue Mar 13 03:50:26 2018 +++ src/tests/net/if_ipsec/t_ipsec.sh Tue Dec 25 03:28:29 2018 @@ -1,4 +1,4 @@ -# $NetBSD: t_ipsec.sh,v 1.4 2018/03/13 03:50:26 knakahara Exp $ +# $NetBSD: t_ipsec.sh,v 1.5 2018/12/25 03:28:29 knakahara Exp $ # # Copyright (c) 2017 Internet Initiative Japan Inc. # All rights reserved. @@ -105,7 +105,7 @@ setup_router() atf_check -s exit:0 rump.ifconfig shmif0 inet ${lan} netmask 0xff00 fi atf_check -s exit:0 rump.ifconfig shmif0 up - rump.ifconfig shmif0 + $DEBUG && rump.ifconfig shmif0 if [ ${wan_mode} = "ipv6" ]; then atf_check -s exit:0 rump.ifconfig shmif1 inet6 ${wan} @@ -113,7 +113,7 @@ setup_router() atf_check -s exit:0 rump.ifconfig shmif1 inet ${wan} netmask 0xff00 fi atf_check -s exit:0 rump.ifconfig shmif1 up - rump.ifconfig shmif1 + $DEBUG && rump.ifconfig shmif1 unset RUMP_SERVER } @@ -247,8 +247,8 @@ setup_if_ipsec() atf_check -s exit:0 -o ignore rump.route add -inet ${peernet} ${addr} fi - rump.ifconfig ipsec0 - rump.route -nL show + $DEBUG && rump.ifconfig ipsec0 + $DEBUG && rump.route -nL show } setup_if_ipsec_sa() @@ -426,7 +426,7 @@ setup_dummy_if_ipsec() atf_check -s exit:0 rump.ifconfig ipsec1 inet ${addr}/32 ${remote} fi - rump.ifconfig ipsec1 + $DEBUG && rump.ifconfig ipsec1 unset RUMP_SERVER } @@ -569,7 +569,7 @@ setup_recursive_if_ipsec() setup_if_ipsec_sa $sock ${src} ${dst} ${inner} ${proto} ${algo} ${dir} export RUMP_SERVER=${sock} - rump.ifconfig ${ipsec} + $DEBUG && rump.ifconfig ${ipsec} unset RUMP_SERVER } @@ -680,7 +680,7 @@ test_ping_success() mode=$1 export RUMP_SERVER=$SOCK1 - rump.ifconfig -v ipsec0 + $DEBUG && rump.ifconfig -v ipsec0 if [ ${mode} = "ipv6" ]; then # XXX # rump.ping6 rarely fails with the message that @@ -694,10 +694,10 @@ test_ping_success() rump.ping -n -w $TIMEOUT -c 1 -I $ROUTER1_LANIP \ $ROUTER2_LANIP fi - rump.ifconfig -v ipsec0 + $DEBUG && rump.ifconfig -v ipsec0 export RUMP_SERVER=$SOCK2 - rump.ifconfig -v ipsec0 + $DEBUG && rump.ifconfig -v ipsec0 if [ ${mode} = "ipv6" ]; then atf_check -s exit:0 -o ignore \ rump.ping6 -n -X $TIMEOUT -c 1 -S $ROUTER2_LANIP6 \ @@ -707,7 +707,7 @@ test_ping_success() rump.ping -n -w $TIMEOUT -c 1 -I $ROUTER2_LANIP \ $ROUTER1_LANIP fi - rump.ifconfig -v ipsec0 + $DEBUG && rump.ifconfig -v ipsec0 unset RUMP_SERVER } @@ -726,12 +726,12 @@ test_change_tunnel_duplicate() newdst=$ROUTER2_WANIP_DUMMY fi export RUMP_SERVER=$SOCK1 - rump.ifconfig -v ipsec0 - rump.ifconfig -v ipsec1 + $DEBUG && rump.ifconfig -v ipsec0 + $DEBUG && rump.ifconfig -v ipsec1 atf_check -s exit:0 -e match:SIOCSLIFPHYADDR \ rump.ifconfig ipsec0 tunnel ${newsrc} ${newdst} - rump.ifconfig -v ipsec0 - rump.ifconfig -v ipsec1 + $DEBUG && rump.ifconfig -v ipsec0 + $DEBUG && rump.ifconfig -v ipsec1 if [ ${mode} = "ipv6" ]; then newsrc=$ROUTER2_WANIP6_DUMMY @@ -741,12 +741,12 @@ test_change_tunnel_duplicate() newdst=$ROUTER1_WANIP_DUMMY fi export RUMP_SERVER=$SOCK2 - rump.ifconfig -v ipsec0 - rump.ifconfig -v ipsec1 + $DEBUG && rump.ifconfig -v ipsec0 + $DEBUG && rump.ifconfig -v ipsec1 atf_check -s exit:0 -e match:SIOCSLIFPHYADDR \ rump.ifconfig ipsec0 tunnel ${newsrc} ${newdst} - rump.ifconfig -v ipsec0 - rump.ifconfig -v ipsec1 + $DEBUG && rump.ifconfig -v ipsec0 + $DEBUG && rump.ifconfig -v ipsec1 unset RUMP_SERVER } @@ -765,10 +765,10 @@ test_change_tunnel_success() newdst=$ROUTER2_WANIP_DUMMY fi export RUMP_SERVER=$SOCK1 - rump.ifconfig -v ipsec0 + $DEBUG && rump.ifconfig -v ipsec0 atf_check -s exit:0 \ rump.ifconfig ipsec0 tunnel ${newsrc} ${newdst} - rump.ifconfig -v ipsec0 + $DEBUG && rump.ifconfig -v ipsec0 if [ ${mode} = "ipv6" ]; then newsrc=$ROUTER2_WANIP6_DUMMY @@ -778,10 +778,10 @@ test_change_tunnel_success() newdst=$ROUTER1_WANIP_DUMMY fi export RUMP_SERVER=$SOCK2 - rump.ifconfig -v ipsec0 + $DEBUG && rump.ifconfig -v ipsec0 atf_check -s exit:0 \ rump.ifconfig ipsec0 tunnel ${newsrc} ${newdst} - rump.ifconfig -v ipsec0 + $DEBUG && rump.ifconfig -v ipsec0 unset RUMP_SERVER }
CVS commit: src/tests/net/if_vlan
Module Name:src Committed By: ozaki-r Date: Tue Dec 11 03:47:51 UTC 2018 Modified Files: src/tests/net/if_vlan: t_vlan.sh Log Message: tests: add missing $af To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/tests/net/if_vlan/t_vlan.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_vlan/t_vlan.sh diff -u src/tests/net/if_vlan/t_vlan.sh:1.14 src/tests/net/if_vlan/t_vlan.sh:1.15 --- src/tests/net/if_vlan/t_vlan.sh:1.14 Fri Dec 7 09:29:01 2018 +++ src/tests/net/if_vlan/t_vlan.sh Tue Dec 11 03:47:51 2018 @@ -1,4 +1,4 @@ -# $NetBSD: t_vlan.sh,v 1.14 2018/12/07 09:29:01 ozaki-r Exp $ +# $NetBSD: t_vlan.sh,v 1.15 2018/12/11 03:47:51 ozaki-r Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -376,7 +376,7 @@ vlan_vlanid_body_common() $atf_ifconfig vlan0 -vlanif atf_check -s not-exit:0 -e match:"Invalid argument" \ - rump.ifconfig vlan0 $local0/$prefix + rump.ifconfig vlan0 $af $local0/$prefix export RUMP_SERVER=$SOCK_LOCAL $atf_ifconfig vlan0 vlan 10 vlanif shmif0
CVS commit: src/tests/net/if_vlan
Module Name:src Committed By: ozaki-r Date: Fri Dec 7 09:29:01 UTC 2018 Modified Files: src/tests/net/if_vlan: t_vlan.sh Log Message: tests: check error messages strictly To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/tests/net/if_vlan/t_vlan.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_vlan/t_vlan.sh diff -u src/tests/net/if_vlan/t_vlan.sh:1.13 src/tests/net/if_vlan/t_vlan.sh:1.14 --- src/tests/net/if_vlan/t_vlan.sh:1.13 Fri Dec 7 09:28:31 2018 +++ src/tests/net/if_vlan/t_vlan.sh Fri Dec 7 09:29:01 2018 @@ -1,4 +1,4 @@ -# $NetBSD: t_vlan.sh,v 1.13 2018/12/07 09:28:31 ozaki-r Exp $ +# $NetBSD: t_vlan.sh,v 1.14 2018/12/07 09:29:01 ozaki-r Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -342,7 +342,7 @@ vlan_vlanid_body_common() $atf_ifconfig vlan0 create export RUMP_SERVER=$SOCK_LOCAL - atf_check -s not-exit:0 -e ignore\ + atf_check -s not-exit:0 -e match:"^usage: rump.ifconfig" \ rump.ifconfig vlan0 vlan -1 vlanif shmif0 # $config_and_ping 0 # reserved vlan id @@ -368,14 +368,14 @@ vlan_vlanid_body_common() done $atf_ifconfig vlan0 vlan 1 vlanif shmif0 - atf_check -s not-exit:0 -e ignore \ + atf_check -s not-exit:0 -e match:"SIOCSETVLAN: Device busy" \ rump.ifconfig vlan0 vlan 2 vlanif shmif0 - atf_check -s not-exit:0 -e ignore \ + atf_check -s not-exit:0 -e match:"SIOCSETVLAN: Device busy" \ rump.ifconfig vlan0 vlan 1 vlanif shmif1 $atf_ifconfig vlan0 -vlanif - atf_check -s not-exit:0 -e ignore \ + atf_check -s not-exit:0 -e match:"Invalid argument" \ rump.ifconfig vlan0 $local0/$prefix export RUMP_SERVER=$SOCK_LOCAL @@ -469,8 +469,8 @@ vlan_configs_body_common() $atf_ifconfig vlan0 -vlanif shmif0 $atf_ifconfig vlan0 vlan 10 vlanif shmif0 - atf_check -s exit:0 -e ignore rump.ifconfig vlan0 -vlanif shmif1 - atf_check -s exit:0 -e ignore rump.ifconfig vlan0 -vlanif shmif2 + atf_check -s exit:0 rump.ifconfig vlan0 -vlanif shmif1 + atf_check -s exit:0 rump.ifconfig vlan0 -vlanif shmif2 $atf_ifconfig vlan0 -vlanif @@ -659,7 +659,8 @@ vlan_multicast_body_common() atf_check -s exit:0 -o not-match:"$eth_mcaddr" $HIJACKING ifmcstat # delete a non-existing address - atf_check -s not-exit:0 -e ignore $HIJACKING $siocXmulti del vlan0 $mcaddr + atf_check -s not-exit:0 -e match:"Invalid argument" \ + $HIJACKING $siocXmulti del vlan0 $mcaddr # add an address to different interfaces $atf_siocXmulti add vlan0 $mcaddr
CVS commit: src/tests/net/if_vlan
Module Name:src Committed By: ozaki-r Date: Fri Dec 7 09:28:31 UTC 2018 Modified Files: src/tests/net/if_vlan: t_vlan.sh Log Message: tests: reduce repeated phrases... (NFC) To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/tests/net/if_vlan/t_vlan.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_vlan/t_vlan.sh diff -u src/tests/net/if_vlan/t_vlan.sh:1.12 src/tests/net/if_vlan/t_vlan.sh:1.13 --- src/tests/net/if_vlan/t_vlan.sh:1.12 Wed Nov 14 05:07:48 2018 +++ src/tests/net/if_vlan/t_vlan.sh Fri Dec 7 09:28:31 2018 @@ -1,4 +1,4 @@ -# $NetBSD: t_vlan.sh,v 1.12 2018/11/14 05:07:48 knakahara Exp $ +# $NetBSD: t_vlan.sh,v 1.13 2018/12/07 09:28:31 ozaki-r Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -45,43 +45,45 @@ DEBUG=${DEBUG:-false} vlan_create_destroy_body_common() { + local atf_ifconfig="atf_check -s exit:0 rump.ifconfig" + export RUMP_SERVER=${SOCK_LOCAL} - atf_check -s exit:0 rump.ifconfig vlan0 create - atf_check -s exit:0 rump.ifconfig vlan0 destroy + $atf_ifconfig vlan0 create + $atf_ifconfig vlan0 destroy - atf_check -s exit:0 rump.ifconfig vlan0 create - atf_check -s exit:0 rump.ifconfig vlan0 up - atf_check -s exit:0 rump.ifconfig vlan0 down - atf_check -s exit:0 rump.ifconfig vlan0 destroy - - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig vlan0 create - atf_check -s exit:0 rump.ifconfig vlan0 vlan 1 vlanif shmif0 - atf_check -s exit:0 rump.ifconfig vlan0 up - atf_check -s exit:0 rump.ifconfig vlan0 destroy + $atf_ifconfig vlan0 create + $atf_ifconfig vlan0 up + $atf_ifconfig vlan0 down + $atf_ifconfig vlan0 destroy + + $atf_ifconfig shmif0 create + $atf_ifconfig vlan0 create + $atf_ifconfig vlan0 vlan 1 vlanif shmif0 + $atf_ifconfig vlan0 up + $atf_ifconfig vlan0 destroy # more than one vlan interface with a same parent interface - atf_check -s exit:0 rump.ifconfig shmif1 create - atf_check -s exit:0 rump.ifconfig vlan0 create - atf_check -s exit:0 rump.ifconfig vlan0 vlan 10 vlanif shmif0 - atf_check -s exit:0 rump.ifconfig vlan1 create - atf_check -s exit:0 rump.ifconfig vlan1 vlan 11 vlanif shmif0 + $atf_ifconfig shmif1 create + $atf_ifconfig vlan0 create + $atf_ifconfig vlan0 vlan 10 vlanif shmif0 + $atf_ifconfig vlan1 create + $atf_ifconfig vlan1 vlan 11 vlanif shmif0 # more than one interface with another parent interface - atf_check -s exit:0 rump.ifconfig vlan2 create - atf_check -s exit:0 rump.ifconfig vlan2 vlan 12 vlanif shmif1 - atf_check -s exit:0 rump.ifconfig vlan3 create - atf_check -s exit:0 rump.ifconfig vlan3 vlan 13 vlanif shmif1 - atf_check -s exit:0 rump.ifconfig shmif0 destroy + $atf_ifconfig vlan2 create + $atf_ifconfig vlan2 vlan 12 vlanif shmif1 + $atf_ifconfig vlan3 create + $atf_ifconfig vlan3 vlan 13 vlanif shmif1 + $atf_ifconfig shmif0 destroy atf_check -s exit:0 -o not-match:'shmif0' rump.ifconfig vlan0 atf_check -s exit:0 -o not-match:'shmif0' rump.ifconfig vlan1 atf_check -s exit:0 -o match:'shmif1' rump.ifconfig vlan2 atf_check -s exit:0 -o match:'shmif1' rump.ifconfig vlan3 - atf_check -s exit:0 rump.ifconfig vlan0 destroy - atf_check -s exit:0 rump.ifconfig vlan1 destroy - atf_check -s exit:0 rump.ifconfig vlan2 destroy - atf_check -s exit:0 rump.ifconfig vlan3 destroy + $atf_ifconfig vlan0 destroy + $atf_ifconfig vlan1 destroy + $atf_ifconfig vlan2 destroy + $atf_ifconfig vlan3 destroy } @@ -133,6 +135,7 @@ vlan_create_destroy6_cleanup() vlan_basic_body_common() { + local atf_ifconfig="atf_check -s exit:0 rump.ifconfig" local outfile=./out local af=inet local prefix=24 @@ -152,23 +155,23 @@ vlan_basic_body_common() rump_server_add_iface $SOCK_REMOTE shmif0 $BUS export RUMP_SERVER=$SOCK_LOCAL - atf_check -s exit:0 rump.ifconfig shmif0 up + $atf_ifconfig shmif0 up export RUMP_SERVER=$SOCK_REMOTE - atf_check -s exit:0 rump.ifconfig shmif0 up + $atf_ifconfig shmif0 up export RUMP_SERVER=$SOCK_LOCAL - atf_check -s exit:0 rump.ifconfig vlan0 create - atf_check -s exit:0 rump.ifconfig vlan0 vlan 10 vlanif shmif0 - atf_check -s exit:0 rump.ifconfig vlan0 $af $local0/$prefix - atf_check -s exit:0 rump.ifconfig vlan0 up - atf_check -s exit:0 rump.ifconfig -w 10 + $atf_ifconfig vlan0 create + $atf_ifconfig vlan0 vlan 10 vlanif shmif0 + $atf_ifconfig vlan0 $af $local0/$prefix + $atf_ifconfig vlan0 up + $atf_ifconfig -w 10 export RUMP_SERVER=$SOCK_REMOTE - atf_check -s exit:0 rump.ifconfig vlan0 create - atf_check -s exit:0 rump.ifconfig vlan0 vlan 10 vlanif shmif0 - atf_check -s exit:0 rump.ifconfig vlan0 $af $remote0/$prefix - atf_check -s exit:0 rump.ifconfig vlan0 up - atf_check -s exit:0 rump.ifconfig -w 10 + $atf_ifconfig vlan0 create + $atf_ifconfig vlan0 vlan 10 vlanif shmif0 + $atf_ifconfig vlan0 $af $remote0/$prefix + $atf_ifconfig vlan0 up + $atf_ifconfig -w 10
CVS commit: src/tests/net/ipsec
Module Name:src Committed By: knakahara Date: Thu Nov 22 04:51:41 UTC 2018 Modified Files: src/tests/net/ipsec: natt_terminator.c t_ipsec_natt.sh Log Message: Add ATF for IPv6 NAT-T. We use IPv6 NAT-T to avoid IPsec slowing down caused by dropping ESP packets by some Customer Premises Equipments (CPE). I implement ATF to test such situation. I think it can also work with nat66, but I have not tested to the fine details. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/net/ipsec/natt_terminator.c \ src/tests/net/ipsec/t_ipsec_natt.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/ipsec/natt_terminator.c diff -u src/tests/net/ipsec/natt_terminator.c:1.1 src/tests/net/ipsec/natt_terminator.c:1.2 --- src/tests/net/ipsec/natt_terminator.c:1.1 Mon Oct 30 15:59:23 2017 +++ src/tests/net/ipsec/natt_terminator.c Thu Nov 22 04:51:41 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: natt_terminator.c,v 1.1 2017/10/30 15:59:23 ozaki-r Exp $ */ +/* $NetBSD: natt_terminator.c,v 1.2 2018/11/22 04:51:41 knakahara Exp $ */ /*- * Copyright (c) 2017 Internet Initiative Japan Inc. @@ -41,6 +41,14 @@ #include #include +static void +usage(void) +{ + const char *prog = "natt_terminator"; + + fprintf(stderr, "Usage: %s [-46] \n", prog); +} + int main(int argc, char **argv) { @@ -49,17 +57,34 @@ main(int argc, char **argv) int s, e; const char *addr, *port; int option; + int c, family = AF_INET; + + while ((c = getopt(argc, argv, "46")) != -1) { + switch (c) { + case '4': + family = AF_INET; + break; + case '6': + family = AF_INET6; + break; + default: + usage(); + return 1; + } + } + argc -= optind; + argv += optind; - if (argc != 3) { - fprintf(stderr, "Usage: %s \n", argv[0]); + if (argc != 2) { + usage(); return 1; } - addr = argv[1]; - port = argv[2]; + addr = argv[0]; + port = argv[1]; memset(, 0, sizeof(hints)); - hints.ai_family = AF_INET; + hints.ai_family = family; hints.ai_socktype = SOCK_DGRAM; hints.ai_protocol = IPPROTO_UDP; hints.ai_flags = 0; Index: src/tests/net/ipsec/t_ipsec_natt.sh diff -u src/tests/net/ipsec/t_ipsec_natt.sh:1.1 src/tests/net/ipsec/t_ipsec_natt.sh:1.2 --- src/tests/net/ipsec/t_ipsec_natt.sh:1.1 Mon Oct 30 15:59:23 2017 +++ src/tests/net/ipsec/t_ipsec_natt.sh Thu Nov 22 04:51:41 2018 @@ -1,4 +1,4 @@ -# $NetBSD: t_ipsec_natt.sh,v 1.1 2017/10/30 15:59:23 ozaki-r Exp $ +# $NetBSD: t_ipsec_natt.sh,v 1.2 2018/11/22 04:51:41 knakahara Exp $ # # Copyright (c) 2017 Internet Initiative Japan Inc. # All rights reserved. @@ -31,11 +31,12 @@ SOCK_REMOTE=unix://ipsec_natt_remote BUS_LOCAL=./bus_ipsec_natt_local BUS_NAT=./bus_ipsec_natt_nat BUS_REMOTE=./bus_ipsec_natt_remote +BUS_GLOBAL=./bus_ipsec_natt_global DEBUG=${DEBUG:-false} HIJACKING_NPF="${HIJACKING},blanket=/dev/npf" -setup_servers() +setup_servers_ipv4() { rump_server_crypto_start $SOCK_LOCAL netipsec @@ -47,6 +48,22 @@ setup_servers() rump_server_add_iface $SOCK_REMOTE shmif0 $BUS_NAT } +setup_servers_ipv6() +{ + + rump_server_crypto_start $SOCK_LOCAL netipsec netinet6 ipsec + rump_server_crypto_start $SOCK_REMOTE netipsec netinet6 ipsec + rump_server_add_iface $SOCK_LOCAL shmif0 $BUS_GLOBAL + rump_server_add_iface $SOCK_REMOTE shmif0 $BUS_GLOBAL +} + +setup_servers() +{ + local proto=$1 + + setup_servers_$proto +} + setup_sp() { local proto=$1 @@ -151,17 +168,24 @@ PIDSFILE=./terminator.pids start_natt_terminator() { local sock=$1 - local ip=$2 - local port=$3 - local pidsfile=$4 + local proto=$2 + local ip=$3 + local port=$4 + local pidsfile=$5 local backup=$RUMP_SERVER - local pid= + local pid= opt= local terminator="$(atf_get_srcdir)/natt_terminator" + if [ "$proto" = "ipv6" ]; then + opt="-6" + else + opt="-4" + fi + export RUMP_SERVER=$sock env LD_PRELOAD=/usr/lib/librumphijack.so \ - $terminator $ip $port & + $terminator $opt $ip $port & pid=$! if [ ! -f $PIDSFILE ]; then touch $PIDSFILE @@ -189,7 +213,7 @@ stop_natt_terminators() rm -f $PIDSFILE } -test_ipsec_natt_transport() +test_ipsec_natt_transport_ipv4() { local algo=$1 local ip_local=10.0.1.2 @@ -204,7 +228,7 @@ test_ipsec_natt_transport() local algo_args="$(generate_algo_args esp-udp $algo)" local pid= port= - setup_servers + setup_servers ipv4 export RUMP_SERVER=$SOCK_LOCAL atf_check -s exit:0 rump.sysctl -q -w net.inet.ip.dad_count=0 @@ -278,7 +302,7 @@ test_ipsec_natt_transport() cat $outfile # Launch a nc server as a terminator of NAT-T on outside the NAPT - start_natt_terminator $SOCK_REMOTE $ip_remote 4500 + start_natt_terminator $SOCK_REMOTE ipv4 $ip_remote 4500 echo zzz > $file_send export RUMP_SERVER=$SOCK_LOCAL @@ -288,7 +312,7 @@ test_ipsec_natt_transport() nc -u -w 3 -p 4500 $ip_remote 4500 < $file_send # Launch a nc server as a terminator of NAT-T on inside the
CVS commit: src/tests/net/if_vlan
Module Name:src Committed By: knakahara Date: Wed Nov 14 05:07:48 UTC 2018 Modified Files: src/tests/net/if_vlan: t_vlan.sh Log Message: let ATF detect a bug fixed by if_vla.c:r1.132. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/tests/net/if_vlan/t_vlan.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_vlan/t_vlan.sh diff -u src/tests/net/if_vlan/t_vlan.sh:1.11 src/tests/net/if_vlan/t_vlan.sh:1.12 --- src/tests/net/if_vlan/t_vlan.sh:1.11 Thu Jun 14 08:38:24 2018 +++ src/tests/net/if_vlan/t_vlan.sh Wed Nov 14 05:07:48 2018 @@ -1,4 +1,4 @@ -# $NetBSD: t_vlan.sh,v 1.11 2018/06/14 08:38:24 yamaguchi Exp $ +# $NetBSD: t_vlan.sh,v 1.12 2018/11/14 05:07:48 knakahara Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -449,6 +449,9 @@ vlan_configs_body_common() atf_check -s exit:0 rump.ifconfig shmif0 create atf_check -s exit:0 rump.ifconfig shmif1 create + # unset U/L bit to detect a bug fixed by if_vlan.c:r1.132 + atf_check -s exit:0 rump.ifconfig shmif0 link b0:a0:75:00:01:00 active + atf_check -s exit:0 rump.ifconfig shmif1 link b0:a0:75:00:01:01 active atf_check -s exit:0 rump.ifconfig vlan0 create atf_check -s exit:0 rump.ifconfig vlan0 vlan 10 vlanif shmif0
CVS commit: src/tests/net/if_bridge
Module Name:src Committed By: ozaki-r Date: Fri Nov 9 06:45:03 UTC 2018 Modified Files: src/tests/net/if_bridge: t_rtable.sh Log Message: Add a test to show a large number of MAC addresses cached in a bridge To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/net/if_bridge/t_rtable.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_bridge/t_rtable.sh diff -u src/tests/net/if_bridge/t_rtable.sh:1.3 src/tests/net/if_bridge/t_rtable.sh:1.4 --- src/tests/net/if_bridge/t_rtable.sh:1.3 Wed Apr 18 04:03:12 2018 +++ src/tests/net/if_bridge/t_rtable.sh Fri Nov 9 06:45:03 2018 @@ -1,4 +1,4 @@ -# $NetBSD: t_rtable.sh,v 1.3 2018/04/18 04:03:12 ozaki-r Exp $ +# $NetBSD: t_rtable.sh,v 1.4 2018/11/09 06:45:03 ozaki-r Exp $ # # Copyright (c) 2017 Internet Initiative Japan Inc. # All rights reserved. @@ -96,7 +96,7 @@ get_number_of_caches() export RUMP_SERVER=$SOCK2 export LD_PRELOAD=/usr/lib/librumphijack.so - echo $(($(/sbin/brconfig bridge0 |grep -A 100 "Address cache" |wc -l) - 1)) + echo $(/sbin/brconfig bridge0 addr |wc -l) unset LD_PRELOAD } @@ -441,6 +441,49 @@ bridge_rtable_delete_member_cleanup() } +atf_test_case bridge_rtable_manyaddrs cleanup +bridge_rtable_manyaddrs_head() +{ + + atf_set "descr" "Tests brconfig addr under many MAC addresses" + atf_set "require.progs" "rump_server" +} + +bridge_rtable_manyaddrs_body() +{ + local addr= + + setup + setup_bridge + + export RUMP_SERVER=$SOCK2 + export LD_PRELOAD=/usr/lib/librumphijack.so + atf_check -s exit:0 -o ignore /sbin/brconfig bridge0 maxaddr 1024 + + # Fill the MAC addresses + for i in 1 2 3 4; do + for j in $(seq 0 255); do + addr="00:11:22:33:4$i:$(printf "%02x" $j)" + atf_check -s exit:0 -o empty \ + /sbin/brconfig bridge0 static shmif0 $addr + done + + n=$(get_number_of_caches) + atf_check_equal $n $((i * 256)) + done + + + rump_server_destroy_ifaces +} + +bridge_rtable_manyaddrs_cleanup() +{ + + $DEBUG && dump + cleanup +} + + atf_init_test_cases() { @@ -449,5 +492,6 @@ atf_init_test_cases() atf_add_test_case bridge_rtable_timeout atf_add_test_case bridge_rtable_maxaddr atf_add_test_case bridge_rtable_delete_member + atf_add_test_case bridge_rtable_manyaddrs # TODO: brconfig static/flushall/discover/learn }
CVS commit: src/tests/net/if_vlan
Module Name:src Committed By: yamaguchi Date: Thu Jun 14 08:38:24 UTC 2018 Modified Files: src/tests/net/if_vlan: t_vlan.sh Log Message: Update the error message in t_vlan (ENXIO => EINVAL) ok ozaki-r@ To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/tests/net/if_vlan/t_vlan.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_vlan/t_vlan.sh diff -u src/tests/net/if_vlan/t_vlan.sh:1.10 src/tests/net/if_vlan/t_vlan.sh:1.11 --- src/tests/net/if_vlan/t_vlan.sh:1.10 Thu Jun 14 08:22:52 2018 +++ src/tests/net/if_vlan/t_vlan.sh Thu Jun 14 08:38:24 2018 @@ -1,4 +1,4 @@ -# $NetBSD: t_vlan.sh,v 1.10 2018/06/14 08:22:52 yamaguchi Exp $ +# $NetBSD: t_vlan.sh,v 1.11 2018/06/14 08:38:24 yamaguchi Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -655,7 +655,7 @@ vlan_multicast_body_common() atf_check -s exit:0 $HIJACKING $siocXmulti del vlan0 $mcaddr # delete the address with invalid interface - atf_check -s not-exit:0 -e match:"Device not configured" \ + atf_check -s not-exit:0 -e match:"Invalid argument" \ $HIJACKING $siocXmulti del vlan0 $mcaddr atf_check -s exit:0 $HIJACKING $siocXmulti del vlan1 $mcaddr
CVS commit: src/tests/net/if_vlan
Module Name:src Committed By: ozaki-r Date: Tue Jun 12 04:21:22 UTC 2018 Modified Files: src/tests/net/if_vlan: t_vlan.sh Log Message: Add tests of vlan with bridge The tests trigger a panic reported in PR kern/53357. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/tests/net/if_vlan/t_vlan.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_vlan/t_vlan.sh diff -u src/tests/net/if_vlan/t_vlan.sh:1.8 src/tests/net/if_vlan/t_vlan.sh:1.9 --- src/tests/net/if_vlan/t_vlan.sh:1.8 Thu Feb 1 05:22:02 2018 +++ src/tests/net/if_vlan/t_vlan.sh Tue Jun 12 04:21:22 2018 @@ -1,4 +1,4 @@ -# $NetBSD: t_vlan.sh,v 1.8 2018/02/01 05:22:02 ozaki-r Exp $ +# $NetBSD: t_vlan.sh,v 1.9 2018/06/12 04:21:22 ozaki-r Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -524,6 +524,80 @@ vlan_configs6_cleanup() cleanup } +vlan_bridge_body_common() +{ + + rump_server_add_iface $SOCK_LOCAL shmif0 $BUS + + export RUMP_SERVER=$SOCK_LOCAL + atf_check -s exit:0 rump.ifconfig shmif0 up + + atf_check -s exit:0 rump.ifconfig vlan0 create + atf_check -s exit:0 rump.ifconfig vlan0 vlan 10 vlanif shmif0 + atf_check -s exit:0 rump.ifconfig vlan0 up + $DEBUG && rump.ifconfig vlan0 + + atf_check -s exit:0 rump.ifconfig bridge0 create + # Adjust to the MTU of a vlan on a shmif + atf_check -s exit:0 rump.ifconfig bridge0 mtu 1496 + atf_check -s exit:0 rump.ifconfig bridge0 up + # Test brconfig add + atf_check -s exit:0 $HIJACKING brconfig bridge0 add vlan0 + $DEBUG && brconfig bridge0 + # Test brconfig delete + atf_check -s exit:0 $HIJACKING brconfig bridge0 delete vlan0 + + atf_check -s exit:0 $HIJACKING brconfig bridge0 add vlan0 + # Test vlan destruction with bridge + atf_check -s exit:0 rump.ifconfig vlan0 destroy + + rump_server_destroy_ifaces +} + +atf_test_case vlan_bridge cleanup +vlan_bridge_head() +{ + + atf_set "descr" "tests of vlan interfaces with bridges (IPv4)" + atf_set "require.progs" "rump_server" +} + +vlan_bridge_body() +{ + + rump_server_start $SOCK_LOCAL vlan bridge + vlan_bridge_body_common +} + +vlan_bridge_cleanup() +{ + + $DEBUG && dump + cleanup +} + +atf_test_case vlan_bridge6 cleanup +vlan_bridge6_head() +{ + + atf_set "descr" "tests of vlan interfaces with bridges (IPv6)" + atf_set "require.progs" "rump_server" +} + +vlan_bridge6_body() +{ + + rump_server_start $SOCK_LOCAL vlan netinet6 bridge + vlan_bridge_body_common +} + +vlan_bridge6_cleanup() +{ + + $DEBUG && dump + cleanup +} + atf_init_test_cases() { @@ -531,9 +605,11 @@ atf_init_test_cases() atf_add_test_case vlan_basic atf_add_test_case vlan_vlanid atf_add_test_case vlan_configs + atf_add_test_case vlan_bridge atf_add_test_case vlan_create_destroy6 atf_add_test_case vlan_basic6 atf_add_test_case vlan_vlanid6 atf_add_test_case vlan_configs6 + atf_add_test_case vlan_bridge6 }
CVS commit: src/tests/net/net
Module Name:src Committed By: maxv Date: Thu Apr 26 06:23:33 UTC 2018 Modified Files: src/tests/net/net: t_ping6_opts.sh Log Message: Remove ping6_opts_hops, "-g" does not exist anymore (RH0 removed). To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/tests/net/net/t_ping6_opts.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/net/t_ping6_opts.sh diff -u src/tests/net/net/t_ping6_opts.sh:1.8 src/tests/net/net/t_ping6_opts.sh:1.9 --- src/tests/net/net/t_ping6_opts.sh:1.8 Fri Nov 25 08:51:17 2016 +++ src/tests/net/net/t_ping6_opts.sh Thu Apr 26 06:23:33 2018 @@ -1,4 +1,4 @@ -# $NetBSD: t_ping6_opts.sh,v 1.8 2016/11/25 08:51:17 ozaki-r Exp $ +# $NetBSD: t_ping6_opts.sh,v 1.9 2018/04/26 06:23:33 maxv Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -292,89 +292,10 @@ ping6_opts_gateway_cleanup() cleanup } -atf_test_case ping6_opts_hops cleanup -ping6_opts_hops_head() -{ - - atf_set "descr" "tests of ping6 hops (Type 0 Routing Header)" - atf_set "require.progs" "rump_server" -} - -ping6_opts_hops_body() -{ - local my_macaddr= - local gw_shmif0_macaddr= - local gw_shmif2_macaddr= - - setup6 - setup_forwarding6 - - my_macaddr=$(get_macaddr ${SOCKSRC} shmif0) - gw_shmif0_macaddr=$(get_macaddr ${SOCKFWD} shmif0) - - export RUMP_SERVER=$SOCKSRC - atf_check -s exit:0 -o ignore rump.ping6 -n -c 1 -X $TIMEOUT $IP6DST - check_echo_request_pkt_with_macaddr \ - $my_macaddr $gw_shmif0_macaddr $IP6SRC $IP6DST - - rump_server_add_iface $SOCKFWD shmif2 $BUS_SRCGW - export RUMP_SERVER=$SOCKFWD - atf_check -s exit:0 rump.ifconfig shmif2 inet6 $IP6SRCGW2 - atf_check -s exit:0 rump.ifconfig -w 10 - gw_shmif2_macaddr=$(get_macaddr ${SOCKFWD} shmif2) - - export RUMP_SERVER=$SOCKSRC - atf_check -s exit:0 -o ignore rump.ping6 -n -c 1 -X $TIMEOUT $IP6DST - check_echo_request_pkt_with_macaddr \ - $my_macaddr $gw_shmif0_macaddr $IP6SRC $IP6DST - - # ping6 hops - - # ping6 fails expectedly because the kernel doesn't support - # to receive packets with type 0 routing headers, but we can - # check whether a sent packet is correct. - atf_check -s not-exit:0 -o ignore rump.ping6 -n -c 1 -X $TIMEOUT \ - $IP6SRCGW $IP6DST - check_echo_request_pkt_with_macaddr_and_rthdr0 \ - $my_macaddr $gw_shmif0_macaddr $IP6SRC $IP6SRCGW $IP6DST - - atf_check -s not-exit:0 -o ignore rump.ping6 -n -c 1 -X $TIMEOUT \ - $IP6SRCGW2 $IP6DST - check_echo_request_pkt_with_macaddr_and_rthdr0 \ - $my_macaddr $gw_shmif2_macaddr $IP6SRC $IP6SRCGW2 $IP6DST - - # ping6 -g hops - atf_check -s not-exit:0 -o ignore rump.ping6 -n -c 1 -X $TIMEOUT \ - -g $IP6SRCGW $IP6SRCGW $IP6DST - check_echo_request_pkt_with_macaddr_and_rthdr0 \ - $my_macaddr $gw_shmif0_macaddr $IP6SRC $IP6SRCGW $IP6DST - - atf_check -s not-exit:0 -o ignore rump.ping6 -n -c 1 -X $TIMEOUT \ - -g $IP6SRCGW2 $IP6SRCGW2 $IP6DST - check_echo_request_pkt_with_macaddr_and_rthdr0 \ - $my_macaddr $gw_shmif2_macaddr $IP6SRC $IP6SRCGW2 $IP6DST - - # ping6 -g hops, but different nexthops (is it valid?) - atf_check -s not-exit:0 -o ignore rump.ping6 -n -c 1 -X $TIMEOUT \ - -g $IP6SRCGW $IP6SRCGW2 $IP6DST - check_echo_request_pkt_with_macaddr_and_rthdr0 \ - $my_macaddr $gw_shmif0_macaddr $IP6SRC $IP6SRCGW2 $IP6DST - - rump_server_destroy_ifaces -} - -ping6_opts_hops_cleanup() -{ - - $DEBUG && dump - cleanup -} - atf_init_test_cases() { atf_add_test_case ping6_opts_sourceaddr atf_add_test_case ping6_opts_interface atf_add_test_case ping6_opts_gateway - atf_add_test_case ping6_opts_hops }
CVS commit: src/tests/net/if_bridge
Module Name:src Committed By: ozaki-r Date: Wed Apr 18 04:03:12 UTC 2018 Modified Files: src/tests/net/if_bridge: t_rtable.sh Log Message: Add a test that checks if brconfig flush surely removes all entries To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/net/if_bridge/t_rtable.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_bridge/t_rtable.sh diff -u src/tests/net/if_bridge/t_rtable.sh:1.2 src/tests/net/if_bridge/t_rtable.sh:1.3 --- src/tests/net/if_bridge/t_rtable.sh:1.2 Tue Apr 10 07:09:00 2018 +++ src/tests/net/if_bridge/t_rtable.sh Wed Apr 18 04:03:12 2018 @@ -1,4 +1,4 @@ -# $NetBSD: t_rtable.sh,v 1.2 2018/04/10 07:09:00 ozaki-r Exp $ +# $NetBSD: t_rtable.sh,v 1.3 2018/04/18 04:03:12 ozaki-r Exp $ # # Copyright (c) 2017 Internet Initiative Japan Inc. # All rights reserved. @@ -169,6 +169,7 @@ bridge_rtable_flush_head() bridge_rtable_flush_body() { local addr1= addr3= + local n= setup setup_bridge @@ -195,6 +196,34 @@ bridge_rtable_flush_body() atf_check -s exit:0 -o not-match:"$addr3 shmif1" /sbin/brconfig bridge0 unset LD_PRELOAD + # Add extra interfaces and addresses + export RUMP_SERVER=$SOCK1 + rump_server_add_iface $SOCK1 shmif1 bus1 + atf_check -s exit:0 rump.ifconfig shmif1 10.0.0.11/24 + atf_check -s exit:0 rump.ifconfig -w 10 + + export RUMP_SERVER=$SOCK3 + rump_server_add_iface $SOCK3 shmif1 bus2 + atf_check -s exit:0 rump.ifconfig shmif1 10.0.0.12/24 + atf_check -s exit:0 rump.ifconfig -w 10 + + # Let cache entries + export RUMP_SERVER=$SOCK1 + atf_check -s exit:0 -o ignore rump.ping -n -w $TIMEOUT -c 1 10.0.0.12 + export RUMP_SERVER=$SOCK3 + atf_check -s exit:0 -o ignore rump.ping -n -w $TIMEOUT -c 1 10.0.0.11 + + export RUMP_SERVER=$SOCK2 + export LD_PRELOAD=/usr/lib/librumphijack.so + $DEBUG && /sbin/brconfig bridge0 + n=$(get_number_of_caches) + atf_check_equal $n 4 + + atf_check -s exit:0 -o ignore /sbin/brconfig bridge0 flush + n=$(get_number_of_caches) + atf_check_equal $n 0 + unset LD_PRELOAD + rump_server_destroy_ifaces }
CVS commit: src/tests/net/if_bridge
Module Name:src Committed By: ozaki-r Date: Tue Apr 10 07:09:00 UTC 2018 Modified Files: src/tests/net/if_bridge: t_rtable.sh Log Message: Add a test case for bridge_rtdelete To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/net/if_bridge/t_rtable.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_bridge/t_rtable.sh diff -u src/tests/net/if_bridge/t_rtable.sh:1.1 src/tests/net/if_bridge/t_rtable.sh:1.2 --- src/tests/net/if_bridge/t_rtable.sh:1.1 Sat Mar 11 04:24:52 2017 +++ src/tests/net/if_bridge/t_rtable.sh Tue Apr 10 07:09:00 2018 @@ -1,4 +1,4 @@ -# $NetBSD: t_rtable.sh,v 1.1 2017/03/11 04:24:52 ozaki-r Exp $ +# $NetBSD: t_rtable.sh,v 1.2 2018/04/10 07:09:00 ozaki-r Exp $ # # Copyright (c) 2017 Internet Initiative Japan Inc. # All rights reserved. @@ -342,6 +342,76 @@ bridge_rtable_maxaddr_cleanup() } +atf_test_case bridge_rtable_delete_member cleanup +bridge_rtable_delete_member_head() +{ + + atf_set "descr" "Tests belonging rtable entries are removed on deleting an interface" + atf_set "require.progs" "rump_server" +} + +bridge_rtable_delete_member_body() +{ + local addr10= addr30= addr11= addr31= + local n= + + setup + setup_bridge + + # Add extra interfaces and addresses + export RUMP_SERVER=$SOCK1 + rump_server_add_iface $SOCK1 shmif1 bus1 + atf_check -s exit:0 rump.ifconfig shmif1 10.0.0.11/24 + atf_check -s exit:0 rump.ifconfig -w 10 + + export RUMP_SERVER=$SOCK3 + rump_server_add_iface $SOCK3 shmif1 bus2 + atf_check -s exit:0 rump.ifconfig shmif1 10.0.0.12/24 + atf_check -s exit:0 rump.ifconfig -w 10 + + # Get MAC addresses of the endpoints. + addr10=$(get_macaddr $SOCK1 shmif0) + addr30=$(get_macaddr $SOCK3 shmif0) + addr11=$(get_macaddr $SOCK1 shmif1) + addr31=$(get_macaddr $SOCK3 shmif1) + + # Make the bridge learn the MAC addresses of the endpoints. + export RUMP_SERVER=$SOCK1 + atf_check -s exit:0 -o ignore rump.ping -n -w $TIMEOUT -c 1 10.0.0.12 + export RUMP_SERVER=$SOCK3 + atf_check -s exit:0 -o ignore rump.ping -n -w $TIMEOUT -c 1 10.0.0.11 + + export RUMP_SERVER=$SOCK2 + export LD_PRELOAD=/usr/lib/librumphijack.so + $DEBUG && /sbin/brconfig bridge0 + atf_check -s exit:0 -o match:"$addr10 shmif0" /sbin/brconfig bridge0 + atf_check -s exit:0 -o match:"$addr11 shmif0" /sbin/brconfig bridge0 + atf_check -s exit:0 -o match:"$addr30 shmif1" /sbin/brconfig bridge0 + atf_check -s exit:0 -o match:"$addr31 shmif1" /sbin/brconfig bridge0 + + atf_check -s exit:0 -o ignore /sbin/brconfig bridge0 delete shmif0 + atf_check -s exit:0 -o not-match:"$addr10 shmif0" /sbin/brconfig bridge0 + atf_check -s exit:0 -o not-match:"$addr11 shmif0" /sbin/brconfig bridge0 + atf_check -s exit:0 -o match:"$addr30 shmif1" /sbin/brconfig bridge0 + atf_check -s exit:0 -o match:"$addr31 shmif1" /sbin/brconfig bridge0 + + atf_check -s exit:0 -o ignore /sbin/brconfig bridge0 delete shmif1 + atf_check -s exit:0 -o not-match:"$addr10 shmif0" /sbin/brconfig bridge0 + atf_check -s exit:0 -o not-match:"$addr11 shmif0" /sbin/brconfig bridge0 + atf_check -s exit:0 -o not-match:"$addr30 shmif1" /sbin/brconfig bridge0 + atf_check -s exit:0 -o not-match:"$addr31 shmif1" /sbin/brconfig bridge0 + + rump_server_destroy_ifaces +} + +bridge_rtable_delete_member_cleanup() +{ + + $DEBUG && dump + cleanup +} + + atf_init_test_cases() { @@ -349,5 +419,6 @@ atf_init_test_cases() atf_add_test_case bridge_rtable_flush atf_add_test_case bridge_rtable_timeout atf_add_test_case bridge_rtable_maxaddr + atf_add_test_case bridge_rtable_delete_member # TODO: brconfig static/flushall/discover/learn }
CVS commit: src/tests/net
Module Name:src Committed By: ozaki-r Date: Sat Apr 7 12:36:58 UTC 2018 Modified Files: src/tests/net: net_common.sh Log Message: Fix typo To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/tests/net/net_common.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/net_common.sh diff -u src/tests/net/net_common.sh:1.27 src/tests/net/net_common.sh:1.28 --- src/tests/net/net_common.sh:1.27 Fri Apr 6 09:22:38 2018 +++ src/tests/net/net_common.sh Sat Apr 7 12:36:58 2018 @@ -1,4 +1,4 @@ -# $NetBSD: net_common.sh,v 1.27 2018/04/06 09:22:38 ozaki-r Exp $ +# $NetBSD: net_common.sh,v 1.28 2018/04/07 12:36:58 ozaki-r Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -319,7 +319,7 @@ rump_server_add_iface() rump_server_destroy_ifaces() { local backup=$RUMP_SERVER - local outout=ignore + local output=ignore $DEBUG && cat $_rump_server_ifaces
CVS commit: src/tests/net/arp
Module Name:src Committed By: ozaki-r Date: Fri Apr 6 09:23:36 UTC 2018 Modified Files: src/tests/net/arp: t_arp.sh Log Message: Add tests for GARP without DAD Additionally make the existing tests for GARP more explicit. To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/tests/net/arp/t_arp.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/arp/t_arp.sh diff -u src/tests/net/arp/t_arp.sh:1.35 src/tests/net/arp/t_arp.sh:1.36 --- src/tests/net/arp/t_arp.sh:1.35 Fri Apr 6 09:21:57 2018 +++ src/tests/net/arp/t_arp.sh Fri Apr 6 09:23:36 2018 @@ -1,4 +1,4 @@ -# $NetBSD: t_arp.sh,v 1.35 2018/04/06 09:21:57 ozaki-r Exp $ +# $NetBSD: t_arp.sh,v 1.36 2018/04/06 09:23:36 ozaki-r Exp $ # # Copyright (c) 2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -41,6 +41,7 @@ atf_test_case arp_cache_expiration_5s cl atf_test_case arp_cache_expiration_10s cleanup atf_test_case arp_command cleanup atf_test_case arp_garp cleanup +atf_test_case arp_garp_without_dad cleanup atf_test_case arp_cache_overwriting cleanup atf_test_case arp_proxy_arp_pub cleanup atf_test_case arp_proxy_arp_pubproxy cleanup @@ -71,6 +72,13 @@ arp_garp_head() atf_set "require.progs" "rump_server" } +arp_garp_without_dad_head() +{ + + atf_set "descr" "Tests for GARP with DAD disabled" + atf_set "require.progs" "rump_server" +} + arp_cache_overwriting_head() { atf_set "descr" "Tests for behavior of overwriting ARP caches" @@ -297,45 +305,100 @@ make_pkt_str_arpreq() echo $pkt } -arp_garp_body() +test_garp_common() { + local no_dad=$1 local pkt= rump_server_start $SOCKSRC export RUMP_SERVER=$SOCKSRC + if $no_dad; then + atf_check -s exit:0 -o match:'3 -> 0' \ + rump.sysctl -w net.inet.ip.dad_count=0 + fi + # Setup an interface rump_server_add_iface $SOCKSRC shmif0 bus1 atf_check -s exit:0 rump.ifconfig shmif0 inet 10.0.0.1/24 - atf_check -s exit:0 rump.ifconfig shmif0 inet 10.0.0.2/24 alias atf_check -s exit:0 rump.ifconfig shmif0 up $DEBUG && rump.ifconfig shmif0 atf_check -s exit:0 sleep 1 extract_new_packets bus1 > ./out + # + # Assign an address to an interface without IFF_UP + # # A GARP packet is sent for the primary address pkt=$(make_pkt_str_arpreq 10.0.0.1 10.0.0.1) atf_check -s exit:0 -o match:"$pkt" cat ./out - # No GARP packet is sent for the alias address + + atf_check -s exit:0 rump.ifconfig shmif0 down + atf_check -s exit:0 rump.ifconfig shmif0 inet 10.0.0.2/24 alias + + atf_check -s exit:0 sleep 1 + extract_new_packets bus1 > ./out + + # A GARP packet is sent for the alias address pkt=$(make_pkt_str_arpreq 10.0.0.2 10.0.0.2) - atf_check -s exit:0 -o not-match:"$pkt" cat ./out + atf_check -s exit:0 -o match:"$pkt" cat ./out - atf_check -s exit:0 rump.ifconfig -w 10 + # Clean up + atf_check -s exit:0 rump.ifconfig shmif0 inet 10.0.0.1/24 delete + atf_check -s exit:0 rump.ifconfig shmif0 inet 10.0.0.2/24 delete + + # + # Assign an address to an interface with IFF_UP + # + atf_check -s exit:0 rump.ifconfig shmif0 up + + # Primary address atf_check -s exit:0 rump.ifconfig shmif0 inet 10.0.0.3/24 - atf_check -s exit:0 rump.ifconfig shmif0 inet 10.0.0.4/24 alias - # No GARP packets are sent during IFF_UP + atf_check -s exit:0 sleep 1 extract_new_packets bus1 > ./out + pkt=$(make_pkt_str_arpreq 10.0.0.3 10.0.0.3) - atf_check -s exit:0 -o not-match:"$pkt" cat ./out + if $no_dad; then + # A GARP packet is sent + atf_check -s exit:0 -o match:"$pkt" cat ./out + else + # No GARP packet is sent + atf_check -s exit:0 -o not-match:"$pkt" cat ./out + fi + + # Alias address + atf_check -s exit:0 rump.ifconfig shmif0 inet 10.0.0.4/24 alias + + atf_check -s exit:0 sleep 1 + extract_new_packets bus1 > ./out + pkt=$(make_pkt_str_arpreq 10.0.0.4 10.0.0.4) - atf_check -s exit:0 -o not-match:"$pkt" cat ./out + if $no_dad; then + # A GARP packet is sent + atf_check -s exit:0 -o match:"$pkt" cat ./out + else + # No GARP packet is sent + atf_check -s exit:0 -o not-match:"$pkt" cat ./out + fi rump_server_destroy_ifaces } +arp_garp_body() +{ + + test_garp_common false +} + +arp_garp_without_dad_body() +{ + + test_garp_common true +} + arp_cache_overwriting_body() { local bonus=2 @@ -583,6 +646,13 @@ arp_garp_cleanup() cleanup } +arp_garp_without_dad_cleanup() +{ + + $DEBUG && dump + cleanup +} + arp_cache_overwriting_cleanup() { $DEBUG && dump @@ -879,6 +949,7 @@ atf_init_test_cases() atf_add_test_case arp_cache_expiration_10s atf_add_test_case arp_command atf_add_test_case arp_garp + atf_add_test_case arp_garp_without_dad atf_add_test_case arp_cache_overwriting atf_add_test_case arp_proxy_arp_pub atf_add_test_case arp_proxy_arp_pubproxy
CVS commit: src/tests/net
Module Name:src Committed By: ozaki-r Date: Fri Apr 6 09:22:38 UTC 2018 Modified Files: src/tests/net: net_common.sh Log Message: Show outputs of commands if $DEBUG To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/tests/net/net_common.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/net_common.sh diff -u src/tests/net/net_common.sh:1.26 src/tests/net/net_common.sh:1.27 --- src/tests/net/net_common.sh:1.26 Thu Feb 1 05:22:01 2018 +++ src/tests/net/net_common.sh Fri Apr 6 09:22:38 2018 @@ -1,4 +1,4 @@ -# $NetBSD: net_common.sh,v 1.26 2018/02/01 05:22:01 ozaki-r Exp $ +# $NetBSD: net_common.sh,v 1.27 2018/04/06 09:22:38 ozaki-r Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -319,19 +319,23 @@ rump_server_add_iface() rump_server_destroy_ifaces() { local backup=$RUMP_SERVER + local outout=ignore $DEBUG && cat $_rump_server_ifaces # Try to dump states before destroying interfaces for sock in $(cat $_rump_server_socks); do export RUMP_SERVER=$sock - atf_check -s exit:0 -o ignore rump.ifconfig - atf_check -s exit:0 -o ignore rump.netstat -nr + if $DEBUG; then + output=save:/dev/stdout + fi + atf_check -s exit:0 -o $output rump.ifconfig + atf_check -s exit:0 -o $output rump.netstat -nr # XXX still need hijacking - atf_check -s exit:0 -o ignore $HIJACKING rump.netstat -nai - atf_check -s exit:0 -o ignore rump.arp -na - atf_check -s exit:0 -o ignore rump.ndp -na - atf_check -s exit:0 -o ignore $HIJACKING ifmcstat + atf_check -s exit:0 -o $output $HIJACKING rump.netstat -nai + atf_check -s exit:0 -o $output rump.arp -na + atf_check -s exit:0 -o $output rump.ndp -na + atf_check -s exit:0 -o $output $HIJACKING ifmcstat done # XXX using pipe doesn't work. See PR bin/51667
CVS commit: src/tests/net/arp
Module Name:src Committed By: ozaki-r Date: Fri Apr 6 09:21:57 UTC 2018 Modified Files: src/tests/net/arp: t_arp.sh Log Message: Improve packet checks and error reporting To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/tests/net/arp/t_arp.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/arp/t_arp.sh diff -u src/tests/net/arp/t_arp.sh:1.34 src/tests/net/arp/t_arp.sh:1.35 --- src/tests/net/arp/t_arp.sh:1.34 Thu Nov 23 06:22:12 2017 +++ src/tests/net/arp/t_arp.sh Fri Apr 6 09:21:57 2018 @@ -1,4 +1,4 @@ -# $NetBSD: t_arp.sh,v 1.34 2017/11/23 06:22:12 kre Exp $ +# $NetBSD: t_arp.sh,v 1.35 2018/04/06 09:21:57 ozaki-r Exp $ # # Copyright (c) 2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -292,7 +292,7 @@ make_pkt_str_arpreq() { local target=$1 local sender=$2 - pkt="> ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 42:" + pkt="> ff:ff:ff:ff:ff:ff, ethertype ARP \(0x0806\), length 42:" pkt="$pkt Request who-has $target tell $sender, length 28" echo $pkt } @@ -313,25 +313,25 @@ arp_garp_body() $DEBUG && rump.ifconfig shmif0 atf_check -s exit:0 sleep 1 - shmif_dumpbus -p - bus1 2>/dev/null| tcpdump -n -e -r - > ./out + extract_new_packets bus1 > ./out # A GARP packet is sent for the primary address pkt=$(make_pkt_str_arpreq 10.0.0.1 10.0.0.1) - atf_check -s exit:0 -x "cat ./out |grep -q '$pkt'" + atf_check -s exit:0 -o match:"$pkt" cat ./out # No GARP packet is sent for the alias address pkt=$(make_pkt_str_arpreq 10.0.0.2 10.0.0.2) - atf_check -s not-exit:0 -x "cat ./out |grep -q '$pkt'" + atf_check -s exit:0 -o not-match:"$pkt" cat ./out atf_check -s exit:0 rump.ifconfig -w 10 atf_check -s exit:0 rump.ifconfig shmif0 inet 10.0.0.3/24 atf_check -s exit:0 rump.ifconfig shmif0 inet 10.0.0.4/24 alias # No GARP packets are sent during IFF_UP - shmif_dumpbus -p - bus1 2>/dev/null| tcpdump -n -e -r - > ./out + extract_new_packets bus1 > ./out pkt=$(make_pkt_str_arpreq 10.0.0.3 10.0.0.3) - atf_check -s not-exit:0 -x "cat ./out |grep -q '$pkt'" + atf_check -s exit:0 -o not-match:"$pkt" cat ./out pkt=$(make_pkt_str_arpreq 10.0.0.4 10.0.0.4) - atf_check -s not-exit:0 -x "cat ./out |grep -q '$pkt'" + atf_check -s exit:0 -o not-match:"$pkt" cat ./out rump_server_destroy_ifaces } @@ -519,7 +519,7 @@ arp_link_activation_body() $DEBUG && cat ./out pkt=$(make_pkt_str_arpreq $IP4SRC $IP4SRC) - atf_check -s not-exit:0 -x "cat ./out |grep -q '$pkt'" + atf_check -s exit:0 -o not-match:"$pkt" cat ./out atf_check -s exit:0 -o ignore rump.ifconfig shmif0 link \ b2:a1:00:00:00:02 active @@ -529,8 +529,7 @@ arp_link_activation_body() $DEBUG && cat ./out pkt=$(make_pkt_str_arpreq $IP4SRC $IP4SRC) - atf_check -s exit:0 -x \ - "cat ./out |grep '$pkt' |grep -q 'b2:a1:00:00:00:02'" + atf_check -s exit:0 -o match:"b2:a1:00:00:00:02 $pkt" cat ./out rump_server_destroy_ifaces }
CVS commit: src/tests/net/icmp
Module Name:src Committed By: roy Date: Mon Mar 26 09:11:15 UTC 2018 Modified Files: src/tests/net/icmp: t_ping.c Log Message: Handle errors better. Fix test for checking we sent all the data we asked to. To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/tests/net/icmp/t_ping.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/icmp/t_ping.c diff -u src/tests/net/icmp/t_ping.c:1.22 src/tests/net/icmp/t_ping.c:1.23 --- src/tests/net/icmp/t_ping.c:1.22 Sat Mar 24 15:51:57 2018 +++ src/tests/net/icmp/t_ping.c Mon Mar 26 09:11:15 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: t_ping.c,v 1.22 2018/03/24 15:51:57 roy Exp $ */ +/* $NetBSD: t_ping.c,v 1.23 2018/03/26 09:11:15 roy Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ #include #ifndef lint -__RCSID("$NetBSD: t_ping.c,v 1.22 2018/03/24 15:51:57 roy Exp $"); +__RCSID("$NetBSD: t_ping.c,v 1.23 2018/03/26 09:11:15 roy Exp $"); #endif /* not lint */ #include @@ -334,7 +334,8 @@ ATF_TC_BODY(ping_of_death, tc) char ifname[IFNAMSIZ]; pid_t cpid; size_t tot, frag; - int s, x, loop, error; + int s, x, loop; + ssize_t error; cpid = fork(); rump_init(); @@ -420,11 +421,13 @@ ATF_TC_BODY(ping_of_death, tc) error = rump_sys_sendto(s, data, frag, 0, (struct sockaddr *), sizeof(dst)); - if (error == sizeof(dst)) -continue; - if (error == -1 && errno == ENOBUFS) -continue; - atf_tc_fail_errno("sendto failed"); + if (error == -1) { +if (errno == ENOBUFS) + continue; +atf_tc_fail_errno("sendto failed"); + } + if ((size_t)error != frag) +atf_tc_fail("sendto did not write all data"); } if (waitpid(-1, , WNOHANG) > 0) { if (WIFEXITED(status) && WEXITSTATUS(status) == 0)
CVS commit: src/tests/net/icmp
Module Name:src Committed By: roy Date: Sat Mar 24 15:51:57 UTC 2018 Modified Files: src/tests/net/icmp: t_ping.c Log Message: Allow a valid sendto duh To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/tests/net/icmp/t_ping.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/icmp/t_ping.c diff -u src/tests/net/icmp/t_ping.c:1.21 src/tests/net/icmp/t_ping.c:1.22 --- src/tests/net/icmp/t_ping.c:1.21 Sat Mar 24 00:06:32 2018 +++ src/tests/net/icmp/t_ping.c Sat Mar 24 15:51:57 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: t_ping.c,v 1.21 2018/03/24 00:06:32 kamil Exp $ */ +/* $NetBSD: t_ping.c,v 1.22 2018/03/24 15:51:57 roy Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ #include #ifndef lint -__RCSID("$NetBSD: t_ping.c,v 1.21 2018/03/24 00:06:32 kamil Exp $"); +__RCSID("$NetBSD: t_ping.c,v 1.22 2018/03/24 15:51:57 roy Exp $"); #endif /* not lint */ #include @@ -420,6 +420,8 @@ ATF_TC_BODY(ping_of_death, tc) error = rump_sys_sendto(s, data, frag, 0, (struct sockaddr *), sizeof(dst)); + if (error == sizeof(dst)) +continue; if (error == -1 && errno == ENOBUFS) continue; atf_tc_fail_errno("sendto failed");
CVS commit: src/tests/net/icmp
Module Name:src Committed By: kamil Date: Sat Mar 24 00:06:32 UTC 2018 Modified Files: src/tests/net/icmp: t_ping.c Log Message: Fix a printf(3)-like format in ATF ICMP t_ping.c Use %zd for ssize_t, instead of %d. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/tests/net/icmp/t_ping.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/icmp/t_ping.c diff -u src/tests/net/icmp/t_ping.c:1.20 src/tests/net/icmp/t_ping.c:1.21 --- src/tests/net/icmp/t_ping.c:1.20 Fri Mar 23 10:05:45 2018 +++ src/tests/net/icmp/t_ping.c Sat Mar 24 00:06:32 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: t_ping.c,v 1.20 2018/03/23 10:05:45 roy Exp $ */ +/* $NetBSD: t_ping.c,v 1.21 2018/03/24 00:06:32 kamil Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ #include #ifndef lint -__RCSID("$NetBSD: t_ping.c,v 1.20 2018/03/23 10:05:45 roy Exp $"); +__RCSID("$NetBSD: t_ping.c,v 1.21 2018/03/24 00:06:32 kamil Exp $"); #endif /* not lint */ #include @@ -198,7 +198,7 @@ doping(const char *target, int loops, u_ } if (n == -1 && (errno == EAGAIN || errno == ENOBUFS)) continue; - atf_tc_fail_errno("recv failed (n == %d)", n); + atf_tc_fail_errno("recv failed (n == %zd)", n); } rump_sys_close(s);
CVS commit: src/tests/net/icmp
Module Name:src Committed By: roy Date: Fri Mar 23 10:05:45 UTC 2018 Modified Files: src/tests/net/icmp: t_ping.c Log Message: Note value received. Harden another sendto for ENOBUFS. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/tests/net/icmp/t_ping.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/icmp/t_ping.c diff -u src/tests/net/icmp/t_ping.c:1.19 src/tests/net/icmp/t_ping.c:1.20 --- src/tests/net/icmp/t_ping.c:1.19 Thu Mar 22 17:27:34 2018 +++ src/tests/net/icmp/t_ping.c Fri Mar 23 10:05:45 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: t_ping.c,v 1.19 2018/03/22 17:27:34 roy Exp $ */ +/* $NetBSD: t_ping.c,v 1.20 2018/03/23 10:05:45 roy Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ #include #ifndef lint -__RCSID("$NetBSD: t_ping.c,v 1.19 2018/03/22 17:27:34 roy Exp $"); +__RCSID("$NetBSD: t_ping.c,v 1.20 2018/03/23 10:05:45 roy Exp $"); #endif /* not lint */ #include @@ -198,7 +198,7 @@ doping(const char *target, int loops, u_ } if (n == -1 && (errno == EAGAIN || errno == ENOBUFS)) continue; - atf_tc_fail_errno("recv failed"); + atf_tc_fail_errno("recv failed (n == %d)", n); } rump_sys_close(s); @@ -334,7 +334,7 @@ ATF_TC_BODY(ping_of_death, tc) char ifname[IFNAMSIZ]; pid_t cpid; size_t tot, frag; - int s, x, loop; + int s, x, loop, error; cpid = fork(); rump_init(); @@ -418,15 +418,18 @@ ATF_TC_BODY(ping_of_death, tc) ip->ip_off |= IP_MF; } - RL(rump_sys_sendto(s, data, frag, 0, - (struct sockaddr *), sizeof(dst))); + error = rump_sys_sendto(s, data, frag, 0, + (struct sockaddr *), sizeof(dst)); + if (error == -1 && errno == ENOBUFS) +continue; + atf_tc_fail_errno("sendto failed"); } if (waitpid(-1, , WNOHANG) > 0) { if (WIFEXITED(status) && WEXITSTATUS(status) == 0) break; atf_tc_fail("child did not exit clean"); } - + usleep(1); } }
CVS commit: src/tests/net/icmp
Module Name:src Committed By: roy Date: Thu Mar 22 17:27:34 UTC 2018 Modified Files: src/tests/net/icmp: t_ping.c Log Message: Handle ENOBUFS in sendto To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/tests/net/icmp/t_ping.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/icmp/t_ping.c diff -u src/tests/net/icmp/t_ping.c:1.18 src/tests/net/icmp/t_ping.c:1.19 --- src/tests/net/icmp/t_ping.c:1.18 Thu Mar 22 17:16:05 2018 +++ src/tests/net/icmp/t_ping.c Thu Mar 22 17:27:34 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: t_ping.c,v 1.18 2018/03/22 17:16:05 roy Exp $ */ +/* $NetBSD: t_ping.c,v 1.19 2018/03/22 17:27:34 roy Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ #include #ifndef lint -__RCSID("$NetBSD: t_ping.c,v 1.18 2018/03/22 17:16:05 roy Exp $"); +__RCSID("$NetBSD: t_ping.c,v 1.19 2018/03/22 17:27:34 roy Exp $"); #endif /* not lint */ #include @@ -182,8 +182,14 @@ doping(const char *target, int loops, u_ icmp->icmp_seq = htons(loop); icmp->icmp_cksum = 0; icmp->icmp_cksum = in_cksum(icmp, pktsize); - RL(rump_sys_sendto(s, icmp, pktsize, 0, - (struct sockaddr *), sizeof(dst))); + + n = rump_sys_sendto(s, icmp, pktsize, 0, + (struct sockaddr *), sizeof(dst)); + if (n == -1) { + if (errno == ENOBUFS) +continue; + atf_tc_fail_errno("sendto failed"); + } RL(rump_sys_fcntl(s, F_SETFL, xnon)); while ((n = rump_sys_recvfrom(s, recvbuf, sizeof(recvbuf), 0,
CVS commit: src/tests/net/icmp
Module Name:src Committed By: roy Date: Thu Mar 22 17:16:05 UTC 2018 Modified Files: src/tests/net/icmp: t_ping.c Log Message: Handle ENOBUFS in recv To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/tests/net/icmp/t_ping.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/icmp/t_ping.c diff -u src/tests/net/icmp/t_ping.c:1.17 src/tests/net/icmp/t_ping.c:1.18 --- src/tests/net/icmp/t_ping.c:1.17 Fri Jan 13 21:30:42 2017 +++ src/tests/net/icmp/t_ping.c Thu Mar 22 17:16:05 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: t_ping.c,v 1.17 2017/01/13 21:30:42 christos Exp $ */ +/* $NetBSD: t_ping.c,v 1.18 2018/03/22 17:16:05 roy Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ #include #ifndef lint -__RCSID("$NetBSD: t_ping.c,v 1.17 2017/01/13 21:30:42 christos Exp $"); +__RCSID("$NetBSD: t_ping.c,v 1.18 2018/03/22 17:16:05 roy Exp $"); #endif /* not lint */ #include @@ -190,7 +190,7 @@ doping(const char *target, int loops, u_ (struct sockaddr *), )) > 0) { succ++; } - if (n == -1 && errno == EAGAIN) + if (n == -1 && (errno == EAGAIN || errno == ENOBUFS)) continue; atf_tc_fail_errno("recv failed"); }
CVS commit: src/tests/net
Module Name:src Committed By: ozaki-r Date: Thu Mar 22 09:21:24 UTC 2018 Modified Files: src/tests/net/if_tap: t_tap.sh src/tests/net/ndp: t_ndp.sh Log Message: Avoid setting IP addresses of the same subnet on different interface If we do so, there will remain one route that is of a preceding address, but that behavior is not documented and may be changed in the future. Tests shouldn't rely on such a unstable behavior. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/tests/net/if_tap/t_tap.sh cvs rdiff -u -r1.30 -r1.31 src/tests/net/ndp/t_ndp.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_tap/t_tap.sh diff -u src/tests/net/if_tap/t_tap.sh:1.7 src/tests/net/if_tap/t_tap.sh:1.8 --- src/tests/net/if_tap/t_tap.sh:1.7 Thu Feb 1 05:22:02 2018 +++ src/tests/net/if_tap/t_tap.sh Thu Mar 22 09:21:24 2018 @@ -1,4 +1,4 @@ -# $NetBSD: t_tap.sh,v 1.7 2018/02/01 05:22:02 ozaki-r Exp $ +# $NetBSD: t_tap.sh,v 1.8 2018/03/22 09:21:24 ozaki-r Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -82,10 +82,6 @@ tap_stand_alone_body() atf_check -s exit:0 rump.ifconfig shmif0 $IP4_LOCAL atf_check -s exit:0 rump.ifconfig shmif0 inet6 $IP6_LOCAL atf_check -s exit:0 rump.ifconfig shmif0 up - atf_check -s exit:0 rump.ifconfig tap0 create - atf_check -s exit:0 rump.ifconfig tap0 $IP4_TAP - atf_check -s exit:0 rump.ifconfig tap0 inet6 $IP6_TAP - atf_check -s exit:0 rump.ifconfig tap0 up atf_check -s exit:0 rump.ifconfig -w 10 export RUMP_SERVER=${SOCK_REMOTE} @@ -96,14 +92,23 @@ tap_stand_alone_body() atf_check -s exit:0 rump.ifconfig -w 10 atf_check -s exit:0 -o ignore rump.ping -n -w $TIMEOUT -c 1 $IP4_LOCAL - # Cannot reach to an alone tap - atf_check -s not-exit:0 -o ignore -e ignore \ - rump.ping -n -w $TIMEOUT -c 1 $IP4_TAP - atf_check -s exit:0 -o ignore rump.ping6 -n -X $TIMEOUT -c 1 $IP6_LOCAL + + export RUMP_SERVER=${SOCK_LOCAL} + atf_check -s exit:0 rump.ifconfig shmif0 $IP4_LOCAL delete + atf_check -s exit:0 rump.ifconfig shmif0 inet6 $IP6_LOCAL delete + atf_check -s exit:0 rump.ifconfig tap0 create + atf_check -s exit:0 rump.ifconfig tap0 $IP4_TAP + atf_check -s exit:0 rump.ifconfig tap0 inet6 $IP6_TAP + atf_check -s exit:0 rump.ifconfig tap0 up + atf_check -s exit:0 rump.ifconfig -w 10 + + export RUMP_SERVER=${SOCK_REMOTE} # Cannot reach to an alone tap atf_check -s not-exit:0 -o ignore -e ignore \ rump.ping6 -n -X $TIMEOUT -c 1 $IP6_TAP + atf_check -s not-exit:0 -o ignore -e ignore \ + rump.ping -n -w $TIMEOUT -c 1 $IP4_TAP rump_server_destroy_ifaces } Index: src/tests/net/ndp/t_ndp.sh diff -u src/tests/net/ndp/t_ndp.sh:1.30 src/tests/net/ndp/t_ndp.sh:1.31 --- src/tests/net/ndp/t_ndp.sh:1.30 Fri Nov 24 03:38:32 2017 +++ src/tests/net/ndp/t_ndp.sh Thu Mar 22 09:21:24 2018 @@ -1,4 +1,4 @@ -# $NetBSD: t_ndp.sh,v 1.30 2017/11/24 03:38:32 kre Exp $ +# $NetBSD: t_ndp.sh,v 1.31 2018/03/22 09:21:24 ozaki-r Exp $ # # Copyright (c) 2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -488,7 +488,7 @@ ndp_purge_on_route_change_body() rump_server_add_iface $SOCKSRC shmif1 bus1 export RUMP_SERVER=$SOCKSRC - atf_check -s exit:0 rump.ifconfig shmif1 inet6 $IP6SRC2 + atf_check -s exit:0 rump.ifconfig shmif1 inet6 fc00:1::1 atf_check -s exit:0 rump.ifconfig -w 10 $DEBUG && rump.netstat -nr -f inet6
CVS commit: src/tests/net/if_ipsec
Module Name:src Committed By: knakahara Date: Tue Mar 13 03:50:26 UTC 2018 Modified Files: src/tests/net/if_ipsec: t_ipsec.sh Log Message: Enhance assertion ipsecif(4) ATF to avoid confusing setkey(8) error message. When setkey(8) says "syntax error at [-E]", it must mean get_if_ipsec_unique() failed. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/net/if_ipsec/t_ipsec.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_ipsec/t_ipsec.sh diff -u src/tests/net/if_ipsec/t_ipsec.sh:1.3 src/tests/net/if_ipsec/t_ipsec.sh:1.4 --- src/tests/net/if_ipsec/t_ipsec.sh:1.3 Thu Feb 1 05:22:01 2018 +++ src/tests/net/if_ipsec/t_ipsec.sh Tue Mar 13 03:50:26 2018 @@ -1,4 +1,4 @@ -# $NetBSD: t_ipsec.sh,v 1.3 2018/02/01 05:22:01 ozaki-r Exp $ +# $NetBSD: t_ipsec.sh,v 1.4 2018/03/13 03:50:26 knakahara Exp $ # # Copyright (c) 2017 Internet Initiative Japan Inc. # All rights reserved. @@ -269,7 +269,9 @@ setup_if_ipsec_sa() local algo_args="$(generate_algo_args $proto $algo)" inunique=`get_if_ipsec_unique ${sock} ${dst} ${mode}` + atf_check -s exit:0 test "X$inunique" != "X" outunique=`get_if_ipsec_unique ${sock} ${src} ${mode}` + atf_check -s exit:0 test "X$outunique" != "X" if [ ${dir} = "1to2" ] ; then if [ ${mode} = "ipv6" ] ; then @@ -446,7 +448,9 @@ setup_dummy_if_ipsec_sa() local algo_args="$(generate_algo_args $proto $algo)" inunique=`get_if_ipsec_unique ${sock} ${dst} ${mode}` + atf_check -s exit:0 test "X$inunique" != "X" outunique=`get_if_ipsec_unique ${sock} ${src} ${mode}` + atf_check -s exit:0 test "X$outunique" != "X" if [ ${dir} = "1to2" ] ; then inid="2"
CVS commit: src/tests/net/ndp
Module Name:src Committed By: ozaki-r Date: Wed Mar 7 02:30:37 UTC 2018 Modified Files: src/tests/net/ndp: t_dad.sh Log Message: Tweak tests; increase the size of NS packets for the addition of a nonce To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/tests/net/ndp/t_dad.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/ndp/t_dad.sh diff -u src/tests/net/ndp/t_dad.sh:1.13 src/tests/net/ndp/t_dad.sh:1.14 --- src/tests/net/ndp/t_dad.sh:1.13 Wed Mar 7 02:30:00 2018 +++ src/tests/net/ndp/t_dad.sh Wed Mar 7 02:30:37 2018 @@ -1,4 +1,4 @@ -# $NetBSD: t_dad.sh,v 1.13 2018/03/07 02:30:00 ozaki-r Exp $ +# $NetBSD: t_dad.sh,v 1.14 2018/03/07 02:30:37 ozaki-r Exp $ # # Copyright (c) 2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -74,9 +74,9 @@ make_ns_pkt_str() { local id=$1 local target=$2 - pkt="33:33:ff:00:00:0${id}, ethertype IPv6 (0x86dd), length 78: ::" + pkt="33:33:ff:00:00:0${id}, ethertype IPv6 (0x86dd), length 86: ::" pkt="$pkt > ff02::1:ff00:${id}: ICMP6, neighbor solicitation," - pkt="$pkt who has $target, length 24" + pkt="$pkt who has $target, length 32" echo $pkt }
CVS commit: src/tests/net/ndp
Module Name:src Committed By: ozaki-r Date: Wed Mar 7 02:30:00 UTC 2018 Modified Files: src/tests/net/ndp: t_dad.sh Log Message: Provide more informative reports on failures To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/tests/net/ndp/t_dad.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/ndp/t_dad.sh diff -u src/tests/net/ndp/t_dad.sh:1.12 src/tests/net/ndp/t_dad.sh:1.13 --- src/tests/net/ndp/t_dad.sh:1.12 Fri Nov 25 08:51:17 2016 +++ src/tests/net/ndp/t_dad.sh Wed Mar 7 02:30:00 2018 @@ -1,4 +1,4 @@ -# $NetBSD: t_dad.sh,v 1.12 2016/11/25 08:51:17 ozaki-r Exp $ +# $NetBSD: t_dad.sh,v 1.13 2018/03/07 02:30:00 ozaki-r Exp $ # # Copyright (c) 2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -31,6 +31,7 @@ SOCKPEER=unix://commsock2 DEBUG=${DEBUG:-false} duplicated="[Dd][Uu][Pp][Ll][Ii][Cc][Aa][Tt][Ee][Dd]" +tentative="[Tt][Ee][Nn][Tt][Aa][Tt][Ii][Vv][Ee]" atf_test_case dad_basic cleanup atf_test_case dad_duplicated cleanup @@ -95,11 +96,12 @@ dad_basic_body() $DEBUG && rump.ifconfig shmif0 atf_check -s exit:0 rump.ifconfig shmif0 up - rump.ifconfig shmif0 > ./out - $DEBUG && cat ./out + $DEBUG && rump.ifconfig shmif0 # The primary address doesn't start with tentative state - atf_check -s not-exit:0 -x "cat ./out |grep $localip1 |grep -q tentative" + atf_check -s exit:0 -o match:"$localip1" \ + -o not-match:"$localip1.+$tentative" \ + rump.ifconfig shmif0 # The alias address starts with tentative state # XXX we have no stable way to check this, so skip for now #atf_check -s exit:0 -x "cat ./out |grep $localip2 |grep -q tentative" @@ -110,10 +112,12 @@ dad_basic_body() # Check DAD probe packets (Neighbor Solicitation Message) pkt=$(make_ns_pkt_str 2 $localip2) - atf_check -s exit:0 -x "cat ./out |grep -q '$pkt'" + pkt=$(echo $pkt | sed 's/\([\(\)]\)/\\\1/g') + atf_check -s exit:0 -o match:"$pkt" cat ./out # No DAD for the primary address pkt=$(make_ns_pkt_str 1 $localip1) - atf_check -s not-exit:0 -x "cat ./out |grep -q '$pkt'" + pkt=$(echo $pkt | sed 's/\([\(\)]\)/\\\1/g') + atf_check -s exit:0 -o not-match:"$pkt" cat ./out # Waiting for DAD complete atf_check -s exit:0 rump.ifconfig -w 10 @@ -123,7 +127,9 @@ dad_basic_body() # IPv6 DAD doesn't announce (Neighbor Advertisement Message) # The alias address left tentative - atf_check -s not-exit:0 -x "rump.ifconfig shmif0 |grep $localip2 |grep -q tentative" + atf_check -s exit:0 -o match:"$localip2" \ + -o not-match:"$localip2.+$tentative" \ + rump.ifconfig shmif0 # # Add a new address on the fly @@ -139,7 +145,8 @@ dad_basic_body() extract_new_packets bus1 > ./out $DEBUG && cat ./out pkt=$(make_ns_pkt_str 3 $localip3) - atf_check -s exit:0 -x "cat ./out |grep -q '$pkt'" + pkt=$(echo $pkt | sed 's/\([\(\)]\)/\\\1/g') + atf_check -s exit:0 -o match:"$pkt" cat ./out # Waiting for DAD complete atf_check -s exit:0 rump.ifconfig -w 10 @@ -149,7 +156,9 @@ dad_basic_body() # IPv6 DAD doesn't announce (Neighbor Advertisement Message) # The new address left tentative - atf_check -s not-exit:0 -x "rump.ifconfig shmif0 |grep $localip3 |grep -q tentative" + atf_check -s exit:0 -o match:"$localip3" \ + -o not-match:"$localip3.+$tentative" \ + rump.ifconfig shmif0 rump_server_destroy_ifaces } @@ -169,7 +178,8 @@ dad_duplicated_body() export RUMP_SERVER=$SOCKLOCAL # The primary address isn't marked as duplicated - atf_check -s exit:0 -o not-match:"$localip1.+$duplicated" \ + atf_check -s exit:0 -o match:"$localip1" \ + -o not-match:"$localip1.+$duplicated" \ rump.ifconfig shmif0 # @@ -185,7 +195,8 @@ dad_duplicated_body() # A unique address isn't marked as duplicated atf_check -s exit:0 rump.ifconfig shmif0 inet6 $localip2 atf_check -s exit:0 sleep 1 - atf_check -s exit:0 -o not-match:"$localip2.+$duplicated" \ + atf_check -s exit:0 -o match:"$localip2" \ + -o not-match:"$localip2.+$duplicated" \ rump.ifconfig shmif0 rump_server_destroy_ifaces
CVS commit: src/tests/net/net
Module Name:src Committed By: christos Date: Sat Feb 17 20:16:19 UTC 2018 Modified Files: src/tests/net/net: t_unix.c Log Message: make it compile again for those who don't have LOCAL_PEERCRED To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/tests/net/net/t_unix.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/net/t_unix.c diff -u src/tests/net/net/t_unix.c:1.16 src/tests/net/net/t_unix.c:1.17 --- src/tests/net/net/t_unix.c:1.16 Sat Feb 17 11:34:18 2018 +++ src/tests/net/net/t_unix.c Sat Feb 17 15:16:18 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: t_unix.c,v 1.16 2018/02/17 16:34:18 christos Exp $ */ +/* $NetBSD: t_unix.c,v 1.17 2018/02/17 20:16:18 christos Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ #include #ifdef __RCSID -__RCSID("$Id: t_unix.c,v 1.16 2018/02/17 16:34:18 christos Exp $"); +__RCSID("$Id: t_unix.c,v 1.17 2018/02/17 20:16:18 christos Exp $"); #else #define getprogname() argv[0] #endif @@ -127,17 +127,36 @@ fail: } static int +peercred(int s, uid_t *euid, gid_t *egid, pid_t *pid) +{ +#ifdef LOCAL_PEEREID + struct unpcbid cred; + socklen_t crl; + crl = sizeof(cred); + if (getsockopt(s, 0, LOCAL_PEEREID, , ) == -1) + return -1; + *euid = cred.unp_euid; + *egid = cred.unp_egid; + *pid = cred.unp_pid; + return 0; +#else + return getpeereid(s, euid, egid); +#endif +} + +static int test(bool forkit, bool closeit, size_t len) { size_t slen; - socklen_t sl, crl; + socklen_t sl; int srvr = -1, clnt = -1, acpt = -1; + uid_t euid; + gid_t egid; pid_t srvrpid, clntpid; struct sockaddr_un *sock_addr = NULL, *sun = NULL; socklen_t sock_addrlen; socklen_t peer_addrlen; struct sockaddr_un peer_addr; - struct unpcbid cred; srvrpid = clntpid = getpid(); srvr = socket(AF_UNIX, SOCK_STREAM, 0); @@ -188,6 +207,7 @@ test(bool forkit, bool closeit, size_t l } if (clntpid == getpid()) { + pid_t pid = srvrpid; clnt = socket(AF_UNIX, SOCK_STREAM, 0); if (clnt == -1) FAIL("socket(client)"); @@ -195,12 +215,13 @@ test(bool forkit, bool closeit, size_t l if (connect(clnt, (const struct sockaddr *)sun, sl) == -1) FAIL("connect"); - crl = sizeof(cred); - if (getsockopt(clnt, 0, LOCAL_PEEREID, , ) == -1) - FAIL("getsockopt()"); - CHECK_EQUAL(cred.unp_euid, geteuid(), "client"); - CHECK_EQUAL(cred.unp_egid, getegid(), "client"); - CHECK_EQUAL(cred.unp_pid, srvrpid, "client"); + if (peercred(clnt, , , ) == -1) + FAIL("peercred (client)"); + printf("peercred(client) euid=%jd egid=%jd pid=%jd\n", + (intmax_t)euid, (intmax_t)egid, (intmax_t)pid); + CHECK_EQUAL(euid, geteuid(), "client"); + CHECK_EQUAL(egid, getegid(), "client"); + CHECK_EQUAL(pid, srvrpid, "client"); } if (srvrpid == getpid()) { @@ -223,12 +244,14 @@ test(bool forkit, bool closeit, size_t l } if (srvrpid == getpid()) { - crl = sizeof(cred); - if (getsockopt(acpt, 0, LOCAL_PEEREID, , ) == -1) - FAIL("getsockopt()"); - CHECK_EQUAL(cred.unp_euid, geteuid(), "server"); - CHECK_EQUAL(cred.unp_egid, getegid(), "server"); - CHECK_EQUAL(cred.unp_pid, clntpid, "client"); + pid_t pid = clntpid; + if (peercred(acpt, , , ) == -1) + FAIL("peercred (server)"); + printf("peercred(server) euid=%jd egid=%jd pid=%jd\n", + (intmax_t)euid, (intmax_t)egid, (intmax_t)pid); + CHECK_EQUAL(euid, geteuid(), "server"); + CHECK_EQUAL(egid, getegid(), "server"); + CHECK_EQUAL(pid, clntpid, "server"); if ((sock_addr = calloc(1, slen)) == NULL) FAIL("calloc");
CVS commit: src/tests/net/net
Module Name:src Committed By: christos Date: Sat Feb 17 16:34:18 UTC 2018 Modified Files: src/tests/net/net: t_unix.c Log Message: Add a test demonstrating thst LOCAL_PEEREID is busted. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/tests/net/net/t_unix.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/net/t_unix.c diff -u src/tests/net/net/t_unix.c:1.15 src/tests/net/net/t_unix.c:1.16 --- src/tests/net/net/t_unix.c:1.15 Fri Feb 16 17:17:17 2018 +++ src/tests/net/net/t_unix.c Sat Feb 17 11:34:18 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: t_unix.c,v 1.15 2018/02/16 22:17:17 christos Exp $ */ +/* $NetBSD: t_unix.c,v 1.16 2018/02/17 16:34:18 christos Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ #include #ifdef __RCSID -__RCSID("$Id: t_unix.c,v 1.15 2018/02/16 22:17:17 christos Exp $"); +__RCSID("$Id: t_unix.c,v 1.16 2018/02/17 16:34:18 christos Exp $"); #else #define getprogname() argv[0] #endif @@ -51,6 +51,7 @@ __RCSID("$Id: t_unix.c,v 1.15 2018/02/16 #include #include #include +#include #include #include #include @@ -126,18 +127,19 @@ fail: } static int -test(bool closeit, size_t len) +test(bool forkit, bool closeit, size_t len) { size_t slen; - socklen_t sl; + socklen_t sl, crl; int srvr = -1, clnt = -1, acpt = -1; - uid_t euid; - gid_t egid; + pid_t srvrpid, clntpid; struct sockaddr_un *sock_addr = NULL, *sun = NULL; socklen_t sock_addrlen; socklen_t peer_addrlen; struct sockaddr_un peer_addr; + struct unpcbid cred; + srvrpid = clntpid = getpid(); srvr = socket(AF_UNIX, SOCK_STREAM, 0); if (srvr == -1) FAIL("socket(srvrer)"); @@ -172,70 +174,99 @@ test(bool closeit, size_t len) if (listen(srvr, SOMAXCONN) == -1) FAIL("listen"); - clnt = socket(AF_UNIX, SOCK_STREAM, 0); - if (clnt == -1) - FAIL("socket(client)"); - - if (connect(clnt, (const struct sockaddr *)sun, sl) == -1) - FAIL("connect"); - - if (getpeereid(clnt, , ) == -1) - FAIL("getpeereid(clnt)"); - CHECK_EQUAL(euid, geteuid(), "client"); - CHECK_EQUAL(egid, getegid(), "client"); - - - acpt = acc(srvr); - - peer_addrlen = sizeof(peer_addr); - memset(_addr, 0, sizeof(peer_addr)); - if (getpeername(acpt, (struct sockaddr *)_addr, - _addrlen) == -1) - FAIL("getpeername"); - print("peer", _addr, peer_addrlen); - - if (closeit) { - if (close(clnt) == -1) - FAIL("close"); - clnt = -1; + if (forkit) { + switch (clntpid = fork()) { + case 0: /* child */ + srvrpid = getppid(); + clntpid = getpid(); + break; + case -1: + FAIL("fork"); + default: + break; + } } - /* This is not symmetric? It is supposed to work! */ - if (getpeereid(acpt, , ) == -1) - FAIL("getpeereid(srvr)"); - CHECK_EQUAL(euid, geteuid(), "server"); - CHECK_EQUAL(egid, getegid(), "server"); + if (clntpid == getpid()) { + clnt = socket(AF_UNIX, SOCK_STREAM, 0); + if (clnt == -1) + FAIL("socket(client)"); + + if (connect(clnt, (const struct sockaddr *)sun, sl) == -1) + FAIL("connect"); + + crl = sizeof(cred); + if (getsockopt(clnt, 0, LOCAL_PEEREID, , ) == -1) + FAIL("getsockopt()"); + CHECK_EQUAL(cred.unp_euid, geteuid(), "client"); + CHECK_EQUAL(cred.unp_egid, getegid(), "client"); + CHECK_EQUAL(cred.unp_pid, srvrpid, "client"); + } - if ((sock_addr = calloc(1, slen)) == NULL) - FAIL("calloc"); - sock_addrlen = slen; - if (getsockname(srvr, (struct sockaddr *)sock_addr, _addrlen) - == -1) - FAIL("getsockname"); - print("sock", sock_addr, sock_addrlen); - - if (sock_addr->sun_family != AF_UNIX) - FAIL("sock_addr->sun_family %d != AF_UNIX", - sock_addr->sun_family); - - len += OF; - if (sock_addrlen LX != len) - FAIL("sock_addr_len %zu != %zu", (size_t)sock_addrlen, len); + if (srvrpid == getpid()) { + acpt = acc(srvr); + + peer_addrlen = sizeof(peer_addr); + memset(_addr, 0, sizeof(peer_addr)); + if (getpeername(acpt, (struct sockaddr *)_addr, + _addrlen) == -1) + FAIL("getpeername"); + print("peer", _addr, peer_addrlen); + } + + if (clntpid == getpid()) { + if (closeit) { + if (close(clnt) == -1) +FAIL("close"); + clnt = -1; + } + } + + if (srvrpid == getpid()) { + crl = sizeof(cred); + if (getsockopt(acpt, 0, LOCAL_PEEREID, , ) == -1) + FAIL("getsockopt()"); + CHECK_EQUAL(cred.unp_euid, geteuid(), "server"); + CHECK_EQUAL(cred.unp_egid, getegid(), "server"); + CHECK_EQUAL(cred.unp_pid, clntpid, "client"); + + if ((sock_addr = calloc(1, slen)) == NULL) + FAIL("calloc"); + sock_addrlen = slen; + if (getsockname(srvr, (struct sockaddr *)sock_addr, + _addrlen) == -1) + FAIL("getsockname"); + print("sock", sock_addr, sock_addrlen); + + if (sock_addr->sun_family != AF_UNIX) + FAIL("sock_addr->sun_family %d != AF_UNIX", + sock_addr->sun_family); + + len += OF; + if (sock_addrlen LX != len) + FAIL("sock_addr_len %zu != %zu", (size_t)sock_addrlen, +