CVS commit: src/tests/net/if_lagg
Module Name:src Committed By: yamaguchi Date: Fri Apr 5 07:04:17 UTC 2024 Modified Files: src/tests/net/if_lagg: t_lagg.sh Log Message: lagg(4) test: Fix typo and old comment To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 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.10 src/tests/net/if_lagg/t_lagg.sh:1.11 --- src/tests/net/if_lagg/t_lagg.sh:1.10 Wed Oct 18 06:41:00 2023 +++ src/tests/net/if_lagg/t_lagg.sh Fri Apr 5 07:04:17 2024 @@ -1,4 +1,4 @@ -# $NetBSD: t_lagg.sh,v 1.10 2023/10/18 06:41:00 yamaguchi Exp $ +# $NetBSD: t_lagg.sh,v 1.11 2024/04/05 07:04:17 yamaguchi Exp $ # # Copyright (c) 2021 Internet Initiative Japan Inc. # All rights reserved. @@ -214,7 +214,7 @@ lagg_ifconfig_body() lagg_ifconfig_cleanup() { - $DEBG && dump + $DEBUG && dump cleanup } @@ -392,7 +392,7 @@ lagg_mtu_body() atf_check -s exit:0 -o match:"mtu *$mtu_big" rump.ifconfig shmif1 atf_check -s exit:0 -o match:"mtu *$mtu_small" rump.ifconfig shmif2 - # copy MTU from 1st port + # copy MTU to 1st added port $atf_ifconfig lagg0 laggport shmif0 atf_check -s exit:0 -o match:"mtu *$mtu_lagg" rump.ifconfig lagg0 atf_check -s exit:0 -o match:"mtu *$mtu_lagg" rump.ifconfig shmif0
CVS commit: src/tests/net/if_lagg
Module Name:src Committed By: yamaguchi Date: Fri Apr 5 07:04:17 UTC 2024 Modified Files: src/tests/net/if_lagg: t_lagg.sh Log Message: lagg(4) test: Fix typo and old comment To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 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.
CVS commit: src/tests/net/if_vlan
Module Name:src Committed By: yamaguchi Date: Thu Nov 2 09:50:50 UTC 2023 Modified Files: src/tests/net/if_vlan: t_vlan.sh Log Message: Added the test for vlan over l2tp To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 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.24 src/tests/net/if_vlan/t_vlan.sh:1.25 --- src/tests/net/if_vlan/t_vlan.sh:1.24 Thu Aug 19 03:27:05 2021 +++ src/tests/net/if_vlan/t_vlan.sh Thu Nov 2 09:50:50 2023 @@ -1,4 +1,4 @@ -# $NetBSD: t_vlan.sh,v 1.24 2021/08/19 03:27:05 yamaguchi Exp $ +# $NetBSD: t_vlan.sh,v 1.25 2023/11/02 09:50:50 yamaguchi Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -1035,6 +1035,139 @@ vlan_promisc_cleanup() cleanup } +vlan_l2tp_body_common() +{ + local atf_ifconfig="atf_check -s exit:0 rump.ifconfig" + + local af=$1 + local ping_cmd="rump.ping -c 1" + local pfx=24 + local local0=$IP_LOCAL0 + local local1=$IP_LOCAL1 + local remote0=$IP_REMOTE0 + local remote1=$IP_REMOTE1 + local sysctl_param="net.inet.ip.dad_count=0" + local vid0=10 + local vid1=11 + + local l2tp_laddr=10.222.222.1 + local l2tp_lsession=1001 + local l2tp_raddr=10.222.222.2 + local l2tp_rsession=1002 + + if [ x"$af" = x"inet6" ]; then + ping_cmd="rump.ping6 -c 1" + rumplib="netinet6" + pfx=64 + local0=$IP6_LOCAL0 + local1=$IP6_LOCAL1 + remote0=$IP6_REMOTE0 + remote1=$IP6_REMOTE1 + sysctl_param="net.inet6.ip6.dad_count=0" + fi + + rump_server_add_iface $SOCK_LOCAL shmif0 $BUS + rump_server_add_iface $SOCK_LOCAL l2tp0 + rump_server_add_iface $SOCK_LOCAL vlan0 + rump_server_add_iface $SOCK_LOCAL vlan1 + + rump_server_add_iface $SOCK_REMOTE shmif0 $BUS + rump_server_add_iface $SOCK_REMOTE l2tp0 + rump_server_add_iface $SOCK_REMOTE vlan0 + rump_server_add_iface $SOCK_REMOTE vlan1 + + export RUMP_SERVER=$SOCK_LOCAL + atf_check -s exit:0 -o ignore rump.sysctl -w $sysctl_param + $atf_ifconfig shmif0 $l2tp_laddr/24 + $atf_ifconfig l2tp0 tunnel $l2tp_laddr $l2tp_raddr + $atf_ifconfig l2tp0 session $l2tp_lsession $l2tp_rsession + $atf_ifconfig l2tp0 up + + export RUMP_SERVER=$SOCK_REMOTE + atf_check -s exit:0 -o ignore rump.sysctl -w $sysctl_param + $atf_ifconfig shmif0 $l2tp_raddr/24 + $atf_ifconfig l2tp0 tunnel $l2tp_raddr $l2tp_laddr + $atf_ifconfig l2tp0 session $l2tp_rsession $l2tp_lsession + $atf_ifconfig l2tp0 up + + # configure vlans on l2tp(4) + export RUMP_SERVER=$SOCK_LOCAL + $atf_ifconfig vlan0 vlan $vid0 vlanif l2tp0 + $atf_ifconfig vlan0 $af $local0/$pfx + $atf_ifconfig vlan1 vlan $vid1 vlanif l2tp0 + $atf_ifconfig vlan1 $af $local1/$pfx + export RUMP_SERVER=$SOCK_REMOTE + $atf_ifconfig vlan0 vlan $vid0 vlanif l2tp0 + $atf_ifconfig vlan0 $af $remote0/$pfx + $atf_ifconfig vlan1 vlan $vid1 vlanif l2tp0 + $atf_ifconfig vlan1 $af $remote1/$pfx + + # test for VLAN frame transfer + export RUMP_SERVER=$SOCK_LOCAL + atf_check -s exit:0 -o ignore $ping_cmd $remote0 + atf_check -s exit:0 -o ignore $ping_cmd $remote1 + + # unconfig vlans + export RUMP_SERVER=$SOCK_LOCAL + $atf_ifconfig vlan0 -vlanif + export RUMP_SERVER=$SOCK_REMOTE + $atf_ifconfig vlan0 -vlanif + + # remove l2tp0 that has vlan1 + export RUMP_SERVER=$SOCK_LOCAL + $atf_ifconfig l2tp0 destroy + export RUMP_SERVER=$SOCK_REMOTE + $atf_ifconfig l2tp0 destroy +} + +atf_test_case vlan_l2tp cleanup +vlan_l2tp_head() +{ + + atf_set "descr" "tests of vlan(IPv4) over l2tp(IPv4)" + atf_set "require.progs" "rump_server" +} + +vlan_l2tp_body() +{ + + rump_server_start $SOCK_LOCAL vlan l2tp + rump_server_start $SOCK_REMOTE vlan l2tp + + vlan_l2tp_body_common "inet" +} + +vlan_l2tp_cleanup() +{ + + $DEBUG && dump + cleanup +} + +atf_test_case vlan_l2tp6 cleanup +vlan_l2tp6_head() +{ + + atf_set "descr" "tests of vlan(IPv6) over l2tp(IPv4)" + atf_set "require.progs" "rump_server" +} + +vlan_l2tp6_body() +{ + + rump_server_start $SOCK_LOCAL vlan l2tp netinet6 + rump_server_start $SOCK_REMOTE vlan l2tp netinet6 + + vlan_l2tp_body_common "inet6" +} + +vlan_l2tp6_cleanup() +{ + + $DEBUG && dump + cleanup +} + atf_init_test_cases() { @@ -1046,6 +1179,7 @@ atf_init_test_cases() atf_add_test_case vlan_bridge atf_add_test_case vlan_multicast atf_add_test_case vlan_promisc + atf_add_test_case vlan_l2tp atf_add_test_case vlan_create_destroy6 atf_add_test_case vlan_basic6 @@ -1054,4 +1188,5 @@ atf_init_test_cases() atf_add_test_case vlan_configs6 atf_add_test_case vlan_bridge6 atf_add_test_case vlan_multicast6 + atf_add_test_case vlan_l2tp6 }
CVS commit: src/tests/net/if_vlan
Module Name:src Committed By: yamaguchi Date: Thu Nov 2 09:50:50 UTC 2023 Modified Files: src/tests/net/if_vlan: t_vlan.sh Log Message: Added the test for vlan over l2tp To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 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.
CVS commit: src/tests/net/if_lagg
Module Name:src Committed By: yamaguchi Date: Wed Oct 18 06:41:00 UTC 2023 Modified Files: src/tests/net/if_lagg: t_lagg.sh Log Message: Update the test case for MTU of lag to adapt new behavior To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 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.9 src/tests/net/if_lagg/t_lagg.sh:1.10 --- src/tests/net/if_lagg/t_lagg.sh:1.9 Mon Oct 16 07:57:40 2023 +++ src/tests/net/if_lagg/t_lagg.sh Wed Oct 18 06:41:00 2023 @@ -1,4 +1,4 @@ -# $NetBSD: t_lagg.sh,v 1.9 2023/10/16 07:57:40 yamaguchi Exp $ +# $NetBSD: t_lagg.sh,v 1.10 2023/10/18 06:41:00 yamaguchi Exp $ # # Copyright (c) 2021 Internet Initiative Japan Inc. # All rights reserved. @@ -367,6 +367,7 @@ lagg_mtu_head() lagg_mtu_body() { local atf_ifconfig="atf_check -s exit:0 rump.ifconfig" + local mtu_lagg=1500 local mtu_1st=1450 local mtu_big=1460 local mtu_small=1440 @@ -379,60 +380,47 @@ lagg_mtu_body() rump_server_add_iface $SOCK_HOST0 shmif2 $BUS2 $atf_ifconfig lagg0 create $atf_ifconfig lagg0 laggproto lacp + $atf_ifconfig lagg0 up $atf_ifconfig shmif0 mtu $mtu_1st $atf_ifconfig shmif1 mtu $mtu_big $atf_ifconfig shmif2 mtu $mtu_small - atf_check -s exit:0 -o match:"mtu *1500" rump.ifconfig lagg0 + # check initial MTU settings + atf_check -s exit:0 -o match:"mtu *$mtu_lagg" rump.ifconfig lagg0 atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig shmif0 atf_check -s exit:0 -o match:"mtu *$mtu_big" rump.ifconfig shmif1 atf_check -s exit:0 -o match:"mtu *$mtu_small" rump.ifconfig shmif2 # copy MTU from 1st port $atf_ifconfig lagg0 laggport shmif0 - atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig lagg0 - atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig shmif0 + atf_check -s exit:0 -o match:"mtu *$mtu_lagg" rump.ifconfig lagg0 + atf_check -s exit:0 -o match:"mtu *$mtu_lagg" rump.ifconfig shmif0 # copy MTU to added port $atf_ifconfig lagg0 laggport shmif1 $atf_ifconfig lagg0 laggport shmif2 - atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig lagg0 - atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig shmif0 - atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig shmif1 - atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig shmif2 + atf_check -s exit:0 -o match:"mtu *$mtu_lagg" rump.ifconfig lagg0 + atf_check -s exit:0 -o match:"mtu *$mtu_lagg" rump.ifconfig shmif0 + atf_check -s exit:0 -o match:"mtu *$mtu_lagg" rump.ifconfig shmif1 + atf_check -s exit:0 -o match:"mtu *$mtu_lagg" rump.ifconfig shmif2 # reset MTU after detaching from lagg0 $atf_ifconfig lagg0 -laggport shmif2 atf_check -s exit:0 -o match:"mtu *$mtu_small" rump.ifconfig shmif2 # change MTU of lagg0 - $atf_ifconfig lagg0 up - $atf_ifconfig lagg0 mtu 1500 - atf_check -s exit:0 -o match:"mtu *1500" rump.ifconfig lagg0 - atf_check -s exit:0 -o match:"mtu *1500" rump.ifconfig shmif0 - atf_check -s exit:0 -o match:"mtu *1500" rump.ifconfig shmif1 + mtu_lagg=1400 + $atf_ifconfig lagg0 mtu $mtu_lagg + atf_check -s exit:0 -o match:"mtu *$mtu_lagg" rump.ifconfig lagg0 + atf_check -s exit:0 -o match:"mtu *$mtu_lagg" rump.ifconfig shmif0 + atf_check -s exit:0 -o match:"mtu *$mtu_lagg" rump.ifconfig shmif1 # reset MTU after detching from lagg0 $atf_ifconfig lagg0 -laggport shmif0 $atf_ifconfig lagg0 -laggport shmif1 atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig shmif0 atf_check -s exit:0 -o match:"mtu *$mtu_big" rump.ifconfig shmif1 - - # MTU should not be changed - atf_check -s exit:0 -o match:"mtu *1500" rump.ifconfig lagg0 - - # copy MTU from 1st port even when MTU of lagg0 is changhed - $atf_ifconfig lagg0 mtu 1400 - atf_check -s exit:0 -o match:"mtu *1400" rump.ifconfig lagg0 - $atf_ifconfig lagg0 laggport shmif0 - atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig lagg0 - atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig shmif0 - - # MTU of lagg0 need not reset - $atf_ifconfig lagg0 -laggport shmif0 - atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig lagg0 - atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig shmif0 } lagg_mtu_cleanup()
CVS commit: src/tests/net/if_lagg
Module Name:src Committed By: yamaguchi Date: Wed Oct 18 06:41:00 UTC 2023 Modified Files: src/tests/net/if_lagg: t_lagg.sh Log Message: Update the test case for MTU of lag to adapt new behavior To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 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.
CVS commit: src/tests/net/if_lagg
Module Name:src Committed By: yamaguchi Date: Mon Oct 16 07:57:40 UTC 2023 Modified Files: src/tests/net/if_lagg: t_lagg.sh Log Message: Make the lagg interface up before change its MTU This change is related to PR kern/57650 To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 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.8 src/tests/net/if_lagg/t_lagg.sh:1.9 --- src/tests/net/if_lagg/t_lagg.sh:1.8 Thu Mar 31 03:26:33 2022 +++ src/tests/net/if_lagg/t_lagg.sh Mon Oct 16 07:57:40 2023 @@ -1,4 +1,4 @@ -# $NetBSD: t_lagg.sh,v 1.8 2022/03/31 03:26:33 yamaguchi Exp $ +# $NetBSD: t_lagg.sh,v 1.9 2023/10/16 07:57:40 yamaguchi Exp $ # # Copyright (c) 2021 Internet Initiative Japan Inc. # All rights reserved. @@ -407,6 +407,7 @@ lagg_mtu_body() atf_check -s exit:0 -o match:"mtu *$mtu_small" rump.ifconfig shmif2 # change MTU of lagg0 + $atf_ifconfig lagg0 up $atf_ifconfig lagg0 mtu 1500 atf_check -s exit:0 -o match:"mtu *1500" rump.ifconfig lagg0 atf_check -s exit:0 -o match:"mtu *1500" rump.ifconfig shmif0
CVS commit: src/tests/net/if_lagg
Module Name:src Committed By: yamaguchi Date: Mon Oct 16 07:57:40 UTC 2023 Modified Files: src/tests/net/if_lagg: t_lagg.sh Log Message: Make the lagg interface up before change its MTU This change is related to PR kern/57650 To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 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.
CVS commit: src/tests/net/if_ipsec
Module Name:src Committed By: knakahara Date: Wed Sep 27 08:48:01 UTC 2023 Modified Files: src/tests/net/if_ipsec: t_ipsec_unnumbered.sh Log Message: Update for sys/net/if_ipsec.c:r1.35 To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/net/if_ipsec/t_ipsec_unnumbered.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_unnumbered.sh diff -u src/tests/net/if_ipsec/t_ipsec_unnumbered.sh:1.1 src/tests/net/if_ipsec/t_ipsec_unnumbered.sh:1.2 --- src/tests/net/if_ipsec/t_ipsec_unnumbered.sh:1.1 Fri Nov 25 08:43:16 2022 +++ src/tests/net/if_ipsec/t_ipsec_unnumbered.sh Wed Sep 27 08:48:01 2023 @@ -1,4 +1,4 @@ -# $NetBSD: t_ipsec_unnumbered.sh,v 1.1 2022/11/25 08:43:16 knakahara Exp $ +# $NetBSD: t_ipsec_unnumbered.sh,v 1.2 2023/09/27 08:48:01 knakahara Exp $ # # Copyright (c) 2022 Internet Initiative Japan Inc. # All rights reserved. @@ -73,7 +73,7 @@ add_sa() local tmpfile=./tmp local spi=1 local algo_args="$(generate_algo_args esp $algo)" - local uniq=8200 # 8192(reqid_base) + 2 * 4(lo0, shmif0, shmif1 and ipsec0) + local uniq=8192 # 8192(reqid_base) + 2 * 0(unit id of "ipsec0") export RUMP_SERVER=$SOCK_LOCAL cat > $tmpfile <<-EOF
CVS commit: src/tests/net/if_ipsec
Module Name:src Committed By: knakahara Date: Wed Sep 27 08:48:01 UTC 2023 Modified Files: src/tests/net/if_ipsec: t_ipsec_unnumbered.sh Log Message: Update for sys/net/if_ipsec.c:r1.35 To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/net/if_ipsec/t_ipsec_unnumbered.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/net/carp
Module Name:src Committed By: gson Date: Tue Sep 19 11:55:14 UTC 2023 Modified Files: src/tests/net/carp: t_basic.sh Log Message: Don't expect the net/carp/t_basic/carp_handover_ipv6_halt_nocarpdevip and carp_handover_ipv6_ifdown_nocarpdevip test cases to fail. At least on the TNF i386 and amd64 testbeds, they pass more often than not since the commit of src/sys/netinet/ip_carp.c 1.119 by mlelstv on 2023.04.07.06.44.08. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/tests/net/carp/t_basic.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/net/carp
Module Name:src Committed By: gson Date: Tue Sep 19 11:55:14 UTC 2023 Modified Files: src/tests/net/carp: t_basic.sh Log Message: Don't expect the net/carp/t_basic/carp_handover_ipv6_halt_nocarpdevip and carp_handover_ipv6_ifdown_nocarpdevip test cases to fail. At least on the TNF i386 and amd64 testbeds, they pass more often than not since the commit of src/sys/netinet/ip_carp.c 1.119 by mlelstv on 2023.04.07.06.44.08. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/tests/net/carp/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/carp/t_basic.sh diff -u src/tests/net/carp/t_basic.sh:1.8 src/tests/net/carp/t_basic.sh:1.9 --- src/tests/net/carp/t_basic.sh:1.8 Mon Aug 19 03:22:05 2019 +++ src/tests/net/carp/t_basic.sh Tue Sep 19 11:55:14 2023 @@ -1,4 +1,4 @@ -# $NetBSD: t_basic.sh,v 1.8 2019/08/19 03:22:05 ozaki-r Exp $ +# $NetBSD: t_basic.sh,v 1.9 2023/09/19 11:55:14 gson Exp $ # # Copyright (c) 2017 Internet Initiative Japan Inc. # All rights reserved. @@ -328,9 +328,6 @@ add_test_case() name="${name}_nocarpdevip" desc="$desc without carpdev IP" fi - if [ $ipproto = ipv6 -a $carpdevip = no ]; then - expected_failure_code="atf_expect_fail 'nd6 needs to be fixed';" - fi atf_test_case ${name} cleanup eval "
CVS commit: src/tests/net/ipsec
Module Name:src Committed By: rin Date: Tue Aug 22 05:40:50 UTC 2023 Modified Files: src/tests/net/ipsec: t_ipsec_gif.sh t_ipsec_l2tp.sh Log Message: t_ipsec_{gif,l2tp}: Adjust for tcpdump 4.99.4 It does not longer output redundant `` (ipip-proto-4)'': https://github.com/the-tcpdump-group/tcpdump/commit/cba9b77a98e9dde764abde71a899ee8937ca56e8 Now, these tests become passing again. Thanks mlelstv@ for finding out upstream commit. OK ozaki-r@ To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 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.9 src/tests/net/ipsec/t_ipsec_gif.sh:1.10 --- src/tests/net/ipsec/t_ipsec_gif.sh:1.9 Mon Feb 17 08:46:10 2020 +++ src/tests/net/ipsec/t_ipsec_gif.sh Tue Aug 22 05:40:50 2023 @@ -1,4 +1,4 @@ -# $NetBSD: t_ipsec_gif.sh,v 1.9 2020/02/17 08:46:10 ozaki-r Exp $ +# $NetBSD: t_ipsec_gif.sh,v 1.10 2023/08/22 05:40:50 rin Exp $ # # Copyright (c) 2017 Internet Initiative Japan Inc. # All rights reserved. @@ -49,11 +49,7 @@ make_gif_pktstr() proto_cap=ESP else proto_cap=AH - if [ $ipproto = ipv4 ]; then - inner_str="$src_inner > $dst_inner:.+\(ipip-proto-4\)" - else - inner_str="$src_inner > $dst_inner" - fi + inner_str="$src_inner > $dst_inner" fi echo "$src > $dst: $proto_cap.+$inner_str" @@ -144,11 +140,9 @@ test_ipsec4_gif() extract_new_packets $BUS_TUNNEL > $outfile str="$ip_gwlo_tun > $ip_gwre_tun:" str="$str $ip_local > $ip_remote: ICMP echo request," - str="$str .+ \(ipip-proto-4\)" atf_check -s exit:0 -o match:"$str" cat $outfile str="$ip_gwre_tun > $ip_gwlo_tun:" str="$str $ip_remote > $ip_local: ICMP echo reply," - str="$str .+ \(ipip-proto-4\)" atf_check -s exit:0 -o match:"$str" cat $outfile if [ $mode = tunnel ]; then Index: src/tests/net/ipsec/t_ipsec_l2tp.sh diff -u src/tests/net/ipsec/t_ipsec_l2tp.sh:1.9 src/tests/net/ipsec/t_ipsec_l2tp.sh:1.10 --- src/tests/net/ipsec/t_ipsec_l2tp.sh:1.9 Mon Feb 17 08:46:10 2020 +++ src/tests/net/ipsec/t_ipsec_l2tp.sh Tue Aug 22 05:40:50 2023 @@ -1,4 +1,4 @@ -# $NetBSD: t_ipsec_l2tp.sh,v 1.9 2020/02/17 08:46:10 ozaki-r Exp $ +# $NetBSD: t_ipsec_l2tp.sh,v 1.10 2023/08/22 05:40:50 rin Exp $ # # Copyright (c) 2017 Internet Initiative Japan Inc. # All rights reserved. @@ -49,11 +49,7 @@ make_l2tp_pktstr() else proto_cap=AH if [ $ipproto = ipv4 ]; then - if [ $mode = tunnel ]; then -proto_str="ip-proto-115 102 \(ipip-proto-4\)" - else -proto_str="ip-proto-115 102" - fi + proto_str="ip-proto-115 102" else proto_str="ip-proto-115" fi
CVS commit: src/tests/net/ipsec
Module Name:src Committed By: rin Date: Tue Aug 22 05:40:50 UTC 2023 Modified Files: src/tests/net/ipsec: t_ipsec_gif.sh t_ipsec_l2tp.sh Log Message: t_ipsec_{gif,l2tp}: Adjust for tcpdump 4.99.4 It does not longer output redundant `` (ipip-proto-4)'': https://github.com/the-tcpdump-group/tcpdump/commit/cba9b77a98e9dde764abde71a899ee8937ca56e8 Now, these tests become passing again. Thanks mlelstv@ for finding out upstream commit. OK ozaki-r@ To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 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.
CVS commit: src/tests/net/inpcb
Module Name:src Committed By: riastradh Date: Sat Aug 5 13:25:26 UTC 2023 Modified Files: src/tests/net/inpcb: t_inpcb_bind.sh Log Message: tests/net/inpcb: Tests require root. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/net/inpcb/t_inpcb_bind.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/inpcb/t_inpcb_bind.sh diff -u src/tests/net/inpcb/t_inpcb_bind.sh:1.1 src/tests/net/inpcb/t_inpcb_bind.sh:1.2 --- src/tests/net/inpcb/t_inpcb_bind.sh:1.1 Thu Nov 17 08:40:23 2022 +++ src/tests/net/inpcb/t_inpcb_bind.sh Sat Aug 5 13:25:26 2023 @@ -1,4 +1,4 @@ -# $NetBSD: t_inpcb_bind.sh,v 1.1 2022/11/17 08:40:23 ozaki-r Exp $ +# $NetBSD: t_inpcb_bind.sh,v 1.2 2023/08/05 13:25:26 riastradh Exp $ # # Copyright (c) 2022 Internet Initiative Japan Inc. # All rights reserved. @@ -70,6 +70,7 @@ add_test() eval "${name}_head() { atf_set descr \"${desc}\" atf_set require.progs rump_server + atf_set require.user root } ${name}_body() { test_${name}
CVS commit: src/tests/net/inpcb
Module Name:src Committed By: riastradh Date: Sat Aug 5 13:25:26 UTC 2023 Modified Files: src/tests/net/inpcb: t_inpcb_bind.sh Log Message: tests/net/inpcb: Tests require root. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/net/inpcb/t_inpcb_bind.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/net/net
Module Name:src Committed By: riastradh Date: Sat Aug 5 13:22:49 UTC 2023 Modified Files: src/tests/net/net: t_bind.c Log Message: tests/net/net/t_bind: IP_BINDANY and IPV6_BINDANY require root. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 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.
CVS commit: src/tests/net/net
Module Name:src Committed By: riastradh Date: Sat Aug 5 13:22:49 UTC 2023 Modified Files: src/tests/net/net: t_bind.c Log Message: tests/net/net/t_bind: IP_BINDANY and IPV6_BINDANY require root. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 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/t_bind.c diff -u src/tests/net/net/t_bind.c:1.1 src/tests/net/net/t_bind.c:1.2 --- src/tests/net/net/t_bind.c:1.1 Tue Sep 8 14:13:50 2020 +++ src/tests/net/net/t_bind.c Sat Aug 5 13:22:49 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: t_bind.c,v 1.1 2020/09/08 14:13:50 christos Exp $ */ +/* $NetBSD: t_bind.c,v 1.2 2023/08/05 13:22:49 riastradh Exp $ */ /*- * Copyright (c) 2020 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ #include #ifdef __RCSID -__RCSID("$Id: t_bind.c,v 1.1 2020/09/08 14:13:50 christos Exp $"); +__RCSID("$Id: t_bind.c,v 1.2 2023/08/05 13:22:49 riastradh Exp $"); #endif #include @@ -144,6 +144,7 @@ ATF_TC_HEAD(bindany_4, tc) { atf_tc_set_md_var(tc, "descr", "Check AF_INET bindany"); + atf_tc_set_md_var(tc, "require.user", "root"); } ATF_TC_BODY(bindany_4, tc) @@ -156,6 +157,7 @@ ATF_TC_HEAD(bindany_6, tc) { atf_tc_set_md_var(tc, "descr", "Check AF_INET6 bindany"); + atf_tc_set_md_var(tc, "require.user", "root"); } ATF_TC_BODY(bindany_6, tc)
CVS commit: src/tests/net/ipsec
Module Name:src Committed By: knakahara Date: Mon Jun 19 08:28:09 UTC 2023 Modified Files: src/tests/net/ipsec: t_ipsec_ah_keys.sh t_ipsec_esp_keys.sh t_ipsec_transport.sh t_ipsec_tunnel.sh t_ipsec_tunnel_ipcomp.sh t_ipsec_tunnel_odd.sh Log Message: Repair test coverage. I revert by proxy as the committer seems too busy to even reply mail. TODO: Provide some way for small machines to run subset test so that they get shorter run time at the expense of test coverage. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/net/ipsec/t_ipsec_ah_keys.sh \ src/tests/net/ipsec/t_ipsec_esp_keys.sh \ src/tests/net/ipsec/t_ipsec_tunnel_ipcomp.sh cvs rdiff -u -r1.7 -r1.8 src/tests/net/ipsec/t_ipsec_transport.sh cvs rdiff -u -r1.10 -r1.11 src/tests/net/ipsec/t_ipsec_tunnel.sh cvs rdiff -u -r1.4 -r1.5 src/tests/net/ipsec/t_ipsec_tunnel_odd.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_ah_keys.sh diff -u src/tests/net/ipsec/t_ipsec_ah_keys.sh:1.3 src/tests/net/ipsec/t_ipsec_ah_keys.sh:1.4 --- src/tests/net/ipsec/t_ipsec_ah_keys.sh:1.3 Sun Jun 4 22:18:47 2023 +++ src/tests/net/ipsec/t_ipsec_ah_keys.sh Mon Jun 19 08:28:09 2023 @@ -1,4 +1,4 @@ -# $NetBSD: t_ipsec_ah_keys.sh,v 1.3 2023/06/04 22:18:47 chs Exp $ +# $NetBSD: t_ipsec_ah_keys.sh,v 1.4 2023/06/19 08:28:09 knakahara Exp $ # # Copyright (c) 2017 Internet Initiative Japan Inc. # All rights reserved. @@ -152,7 +152,7 @@ add_test_invalid_keys() atf_init_test_cases() { - for aalgo in $AH_AUTHENTICATION_ALGORITHMS_MINIMUM; do + for aalgo in $AH_AUTHENTICATION_ALGORITHMS; do add_test_valid_keys $aalgo add_test_invalid_keys $aalgo done Index: src/tests/net/ipsec/t_ipsec_esp_keys.sh diff -u src/tests/net/ipsec/t_ipsec_esp_keys.sh:1.3 src/tests/net/ipsec/t_ipsec_esp_keys.sh:1.4 --- src/tests/net/ipsec/t_ipsec_esp_keys.sh:1.3 Sun Jun 4 22:18:47 2023 +++ src/tests/net/ipsec/t_ipsec_esp_keys.sh Mon Jun 19 08:28:09 2023 @@ -1,4 +1,4 @@ -# $NetBSD: t_ipsec_esp_keys.sh,v 1.3 2023/06/04 22:18:47 chs Exp $ +# $NetBSD: t_ipsec_esp_keys.sh,v 1.4 2023/06/19 08:28:09 knakahara Exp $ # # Copyright (c) 2017 Internet Initiative Japan Inc. # All rights reserved. @@ -152,7 +152,7 @@ add_test_invalid_keys() atf_init_test_cases() { - for ealgo in $ESP_ENCRYPTION_ALGORITHMS_MINIMUM; do + for ealgo in $ESP_ENCRYPTION_ALGORITHMS; do add_test_valid_keys $ealgo add_test_invalid_keys $ealgo done Index: src/tests/net/ipsec/t_ipsec_tunnel_ipcomp.sh diff -u src/tests/net/ipsec/t_ipsec_tunnel_ipcomp.sh:1.3 src/tests/net/ipsec/t_ipsec_tunnel_ipcomp.sh:1.4 --- src/tests/net/ipsec/t_ipsec_tunnel_ipcomp.sh:1.3 Sun Jun 4 22:18:47 2023 +++ src/tests/net/ipsec/t_ipsec_tunnel_ipcomp.sh Mon Jun 19 08:28:09 2023 @@ -1,4 +1,4 @@ -# $NetBSD: t_ipsec_tunnel_ipcomp.sh,v 1.3 2023/06/04 22:18:47 chs Exp $ +# $NetBSD: t_ipsec_tunnel_ipcomp.sh,v 1.4 2023/06/19 08:28:09 knakahara Exp $ # # Copyright (c) 2017 Internet Initiative Japan Inc. # All rights reserved. @@ -395,7 +395,7 @@ atf_init_test_cases() { local calgo= algo= - for calgo in $IPCOMP_COMPRESSION_ALGORITHMS_MINIMUM; do + for calgo in $IPCOMP_COMPRESSION_ALGORITHMS; do for algo in $ESP_ENCRYPTION_ALGORITHMS_MINIMUM; do add_test_tunnel_mode ipv4 esp $algo $calgo add_test_tunnel_mode ipv6 esp $algo $calgo Index: src/tests/net/ipsec/t_ipsec_transport.sh diff -u src/tests/net/ipsec/t_ipsec_transport.sh:1.7 src/tests/net/ipsec/t_ipsec_transport.sh:1.8 --- src/tests/net/ipsec/t_ipsec_transport.sh:1.7 Sun Jun 4 22:18:47 2023 +++ src/tests/net/ipsec/t_ipsec_transport.sh Mon Jun 19 08:28:09 2023 @@ -1,4 +1,4 @@ -# $NetBSD: t_ipsec_transport.sh,v 1.7 2023/06/04 22:18:47 chs Exp $ +# $NetBSD: t_ipsec_transport.sh,v 1.8 2023/06/19 08:28:09 knakahara Exp $ # # Copyright (c) 2017 Internet Initiative Japan Inc. # All rights reserved. @@ -261,15 +261,15 @@ atf_init_test_cases() { local algo= - for algo in $ESP_ENCRYPTION_ALGORITHMS_MINIMUM; do + for algo in $ESP_ENCRYPTION_ALGORITHMS; do add_test_transport_mode ipv4 esp $algo add_test_transport_mode ipv6 esp $algo done - for algo in $AH_AUTHENTICATION_ALGORITHMS_MINIMUM; do + for algo in $AH_AUTHENTICATION_ALGORITHMS; do add_test_transport_mode ipv4 ah $algo add_test_transport_mode ipv6 ah $algo done - for algo in $IPCOMP_COMPRESSION_ALGORITHMS_MINIMUM; do + for algo in $IPCOMP_COMPRESSION_ALGORITHMS; do add_test_transport_mode ipv4 ipcomp $algo add_test_transport_mode ipv6 ipcomp $algo done Index: src/tests/net/ipsec/t_ipsec_tunnel.sh diff -u src/tests/net/ipsec/t_ipsec_tunnel.sh:1.10 src/tests/net/ipsec/t_ipsec_tunnel.sh:1.11 --- src/tests/net/ipsec/t_ipsec_tunnel.sh:1.10 Sun Jun 4 22:18:47 2023 +++ src/tests/net/ipsec/t_ipsec_tunnel.sh Mon Jun 19 08:28:09 2023 @@ -1,4 +1,4 @@ -# $NetBSD: t_ipsec_tunnel.sh,v 1.10 2023/06/04 22:18:47 chs Exp $
CVS commit: src/tests/net/ipsec
Module Name:src Committed By: knakahara Date: Mon Jun 19 08:28:09 UTC 2023 Modified Files: src/tests/net/ipsec: t_ipsec_ah_keys.sh t_ipsec_esp_keys.sh t_ipsec_transport.sh t_ipsec_tunnel.sh t_ipsec_tunnel_ipcomp.sh t_ipsec_tunnel_odd.sh Log Message: Repair test coverage. I revert by proxy as the committer seems too busy to even reply mail. TODO: Provide some way for small machines to run subset test so that they get shorter run time at the expense of test coverage. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/net/ipsec/t_ipsec_ah_keys.sh \ src/tests/net/ipsec/t_ipsec_esp_keys.sh \ src/tests/net/ipsec/t_ipsec_tunnel_ipcomp.sh cvs rdiff -u -r1.7 -r1.8 src/tests/net/ipsec/t_ipsec_transport.sh cvs rdiff -u -r1.10 -r1.11 src/tests/net/ipsec/t_ipsec_tunnel.sh cvs rdiff -u -r1.4 -r1.5 src/tests/net/ipsec/t_ipsec_tunnel_odd.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/net/ipsec
Module Name:src Committed By: chs Date: Sun Jun 4 22:18:47 UTC 2023 Modified Files: src/tests/net/ipsec: t_ipsec_ah_keys.sh t_ipsec_esp_keys.sh t_ipsec_transport.sh t_ipsec_tunnel.sh t_ipsec_tunnel_ipcomp.sh t_ipsec_tunnel_odd.sh Log Message: The ATF design is O(N^2) in the number of TCs in one TP, which on some slower platforms causes the net/ipsec tests to take as much as 30% of the total time to run all of the ATF tests. Reduce the number of TCs in various net/ipsec TPs by iterating over *_ALGORITHMS_MINIMUM rather than *_ALGORITHMS. Various of the net/ipsec tests already use the smaller lists, so change the rest of them to do so as well. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/net/ipsec/t_ipsec_ah_keys.sh \ src/tests/net/ipsec/t_ipsec_esp_keys.sh \ src/tests/net/ipsec/t_ipsec_tunnel_ipcomp.sh cvs rdiff -u -r1.6 -r1.7 src/tests/net/ipsec/t_ipsec_transport.sh cvs rdiff -u -r1.9 -r1.10 src/tests/net/ipsec/t_ipsec_tunnel.sh cvs rdiff -u -r1.3 -r1.4 src/tests/net/ipsec/t_ipsec_tunnel_odd.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_ah_keys.sh diff -u src/tests/net/ipsec/t_ipsec_ah_keys.sh:1.2 src/tests/net/ipsec/t_ipsec_ah_keys.sh:1.3 --- src/tests/net/ipsec/t_ipsec_ah_keys.sh:1.2 Thu Aug 3 03:16:27 2017 +++ src/tests/net/ipsec/t_ipsec_ah_keys.sh Sun Jun 4 22:18:47 2023 @@ -1,4 +1,4 @@ -# $NetBSD: t_ipsec_ah_keys.sh,v 1.2 2017/08/03 03:16:27 ozaki-r Exp $ +# $NetBSD: t_ipsec_ah_keys.sh,v 1.3 2023/06/04 22:18:47 chs Exp $ # # Copyright (c) 2017 Internet Initiative Japan Inc. # All rights reserved. @@ -152,7 +152,7 @@ add_test_invalid_keys() atf_init_test_cases() { - for aalgo in $AH_AUTHENTICATION_ALGORITHMS; do + for aalgo in $AH_AUTHENTICATION_ALGORITHMS_MINIMUM; do add_test_valid_keys $aalgo add_test_invalid_keys $aalgo done Index: src/tests/net/ipsec/t_ipsec_esp_keys.sh diff -u src/tests/net/ipsec/t_ipsec_esp_keys.sh:1.2 src/tests/net/ipsec/t_ipsec_esp_keys.sh:1.3 --- src/tests/net/ipsec/t_ipsec_esp_keys.sh:1.2 Thu Aug 3 03:16:27 2017 +++ src/tests/net/ipsec/t_ipsec_esp_keys.sh Sun Jun 4 22:18:47 2023 @@ -1,4 +1,4 @@ -# $NetBSD: t_ipsec_esp_keys.sh,v 1.2 2017/08/03 03:16:27 ozaki-r Exp $ +# $NetBSD: t_ipsec_esp_keys.sh,v 1.3 2023/06/04 22:18:47 chs Exp $ # # Copyright (c) 2017 Internet Initiative Japan Inc. # All rights reserved. @@ -152,7 +152,7 @@ add_test_invalid_keys() atf_init_test_cases() { - for ealgo in $ESP_ENCRYPTION_ALGORITHMS; do + for ealgo in $ESP_ENCRYPTION_ALGORITHMS_MINIMUM; do add_test_valid_keys $ealgo add_test_invalid_keys $ealgo done Index: src/tests/net/ipsec/t_ipsec_tunnel_ipcomp.sh diff -u src/tests/net/ipsec/t_ipsec_tunnel_ipcomp.sh:1.2 src/tests/net/ipsec/t_ipsec_tunnel_ipcomp.sh:1.3 --- src/tests/net/ipsec/t_ipsec_tunnel_ipcomp.sh:1.2 Thu Aug 3 03:16:27 2017 +++ src/tests/net/ipsec/t_ipsec_tunnel_ipcomp.sh Sun Jun 4 22:18:47 2023 @@ -1,4 +1,4 @@ -# $NetBSD: t_ipsec_tunnel_ipcomp.sh,v 1.2 2017/08/03 03:16:27 ozaki-r Exp $ +# $NetBSD: t_ipsec_tunnel_ipcomp.sh,v 1.3 2023/06/04 22:18:47 chs Exp $ # # Copyright (c) 2017 Internet Initiative Japan Inc. # All rights reserved. @@ -395,7 +395,7 @@ atf_init_test_cases() { local calgo= algo= - for calgo in $IPCOMP_COMPRESSION_ALGORITHMS; do + for calgo in $IPCOMP_COMPRESSION_ALGORITHMS_MINIMUM; do for algo in $ESP_ENCRYPTION_ALGORITHMS_MINIMUM; do add_test_tunnel_mode ipv4 esp $algo $calgo add_test_tunnel_mode ipv6 esp $algo $calgo Index: src/tests/net/ipsec/t_ipsec_transport.sh diff -u src/tests/net/ipsec/t_ipsec_transport.sh:1.6 src/tests/net/ipsec/t_ipsec_transport.sh:1.7 --- src/tests/net/ipsec/t_ipsec_transport.sh:1.6 Thu Aug 3 03:16:27 2017 +++ src/tests/net/ipsec/t_ipsec_transport.sh Sun Jun 4 22:18:47 2023 @@ -1,4 +1,4 @@ -# $NetBSD: t_ipsec_transport.sh,v 1.6 2017/08/03 03:16:27 ozaki-r Exp $ +# $NetBSD: t_ipsec_transport.sh,v 1.7 2023/06/04 22:18:47 chs Exp $ # # Copyright (c) 2017 Internet Initiative Japan Inc. # All rights reserved. @@ -261,15 +261,15 @@ atf_init_test_cases() { local algo= - for algo in $ESP_ENCRYPTION_ALGORITHMS; do + for algo in $ESP_ENCRYPTION_ALGORITHMS_MINIMUM; do add_test_transport_mode ipv4 esp $algo add_test_transport_mode ipv6 esp $algo done - for algo in $AH_AUTHENTICATION_ALGORITHMS; do + for algo in $AH_AUTHENTICATION_ALGORITHMS_MINIMUM; do add_test_transport_mode ipv4 ah $algo add_test_transport_mode ipv6 ah $algo done - for algo in $IPCOMP_COMPRESSION_ALGORITHMS; do + for algo in $IPCOMP_COMPRESSION_ALGORITHMS_MINIMUM; do add_test_transport_mode ipv4 ipcomp $algo add_test_transport_mode ipv6 ipcomp $algo done Index: src/tests/net/ipsec/t_ipsec_tunnel.sh diff -u src/tests/net/ipsec/t_ipsec_tunnel.sh:1.9 src/tests/net/ipsec/t_ipsec_tunnel.sh:1.10 --- src/tests/net/ipsec/t_ipsec_tunnel.sh:1.9 Thu
CVS commit: src/tests/net/ipsec
Module Name:src Committed By: chs Date: Sun Jun 4 22:18:47 UTC 2023 Modified Files: src/tests/net/ipsec: t_ipsec_ah_keys.sh t_ipsec_esp_keys.sh t_ipsec_transport.sh t_ipsec_tunnel.sh t_ipsec_tunnel_ipcomp.sh t_ipsec_tunnel_odd.sh Log Message: The ATF design is O(N^2) in the number of TCs in one TP, which on some slower platforms causes the net/ipsec tests to take as much as 30% of the total time to run all of the ATF tests. Reduce the number of TCs in various net/ipsec TPs by iterating over *_ALGORITHMS_MINIMUM rather than *_ALGORITHMS. Various of the net/ipsec tests already use the smaller lists, so change the rest of them to do so as well. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/net/ipsec/t_ipsec_ah_keys.sh \ src/tests/net/ipsec/t_ipsec_esp_keys.sh \ src/tests/net/ipsec/t_ipsec_tunnel_ipcomp.sh cvs rdiff -u -r1.6 -r1.7 src/tests/net/ipsec/t_ipsec_transport.sh cvs rdiff -u -r1.9 -r1.10 src/tests/net/ipsec/t_ipsec_tunnel.sh cvs rdiff -u -r1.3 -r1.4 src/tests/net/ipsec/t_ipsec_tunnel_odd.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/net/net
Module Name:src Committed By: ozaki-r Date: Wed Nov 30 07:48:43 UTC 2022 Modified Files: src/tests/net/net: Makefile Log Message: tests: restore a line removed accidentally To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/tests/net/net/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/net/Makefile diff -u src/tests/net/net/Makefile:1.27 src/tests/net/net/Makefile:1.28 --- src/tests/net/net/Makefile:1.27 Wed Nov 30 06:07:51 2022 +++ src/tests/net/net/Makefile Wed Nov 30 07:48:43 2022 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.27 2022/11/30 06:07:51 ozaki-r Exp $ +# $NetBSD: Makefile,v 1.28 2022/11/30 07:48:43 ozaki-r Exp $ # .include @@ -11,6 +11,7 @@ TESTS_C+= t_mapped TESTS_C+= t_tcp TESTS_C+= t_udp TESTS_C+= t_pktinfo +TESTS_C+= t_socket_afinet TESTS_C+= t_ip_reass .if (${MKRUMP} != "no") && !defined(BSD_MK_COMPAT_FILE) TESTS_C+= t_pktinfo_send
CVS commit: src/tests/net/net
Module Name:src Committed By: ozaki-r Date: Wed Nov 30 07:48:43 UTC 2022 Modified Files: src/tests/net/net: Makefile Log Message: tests: restore a line removed accidentally To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/tests/net/net/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/net/net
Module Name:src Committed By: ozaki-r Date: Wed Nov 30 06:06:36 UTC 2022 Modified Files: src/tests/net/net: t_ip_reass.c Log Message: tests: tweak t_ip_reass.c for NetBSD The test is modified to run on rump kernels. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/net/net/t_ip_reass.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_ip_reass.c diff -u src/tests/net/net/t_ip_reass.c:1.1 src/tests/net/net/t_ip_reass.c:1.2 --- src/tests/net/net/t_ip_reass.c:1.1 Wed Nov 30 06:05:58 2022 +++ src/tests/net/net/t_ip_reass.c Wed Nov 30 06:06:36 2022 @@ -1,3 +1,5 @@ +/* $NetBSD: t_ip_reass.c,v 1.2 2022/11/30 06:06:36 ozaki-r Exp $ */ + /*- * Copyright (c) 2018 The FreeBSD Foundation * @@ -28,7 +30,13 @@ */ #include + +#ifdef __NetBSD__ +__RCSID("$NetBSD: t_ip_reass.c,v 1.2 2022/11/30 06:06:36 ozaki-r Exp $"); +#define USE_RUMPKERNEL 1 +#else __FBSDID("$FreeBSD$"); +#endif #include #include @@ -50,8 +58,25 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef USE_RUMPKERNEL +#include +#include +#include +#include "h_macros.h" + +#define ioctl rump_sys_ioctl +#define close rump_sys_close +#define write rump_sys_write +#endif + #include +#ifdef __NetBSD__ +struct ipstat { + uint64_t ips_ipstat[IP_NSTATS]; +}; +#endif + struct lopacket { u_int family; struct ip hdr; @@ -141,10 +166,15 @@ open_lobpf(in_addr_t *addrp) struct ifaddrs *ifa, *ifap; int error, fd; +#ifdef USE_RUMPKERNEL + rump_init(); + RL(fd = rump_sys_open("/dev/bpf", O_RDWR)); +#else fd = open("/dev/bpf0", O_RDWR); if (fd < 0 && errno == ENOENT) atf_tc_skip("no BPF device available"); ATF_REQUIRE_MSG(fd >= 0, "open(/dev/bpf0): %s", strerror(errno)); +#endif error = getifaddrs(); ATF_REQUIRE(error == 0); @@ -181,10 +211,21 @@ get_ipstat(struct ipstat *stat) ATF_REQUIRE(len == sizeof(*stat)); } +#ifdef __NetBSD__ #define CHECK_IP_COUNTER(oldp, newp, counter)\ - ATF_REQUIRE_MSG((oldp)->ips_ ## counter < (newp)->ips_ ## counter, \ + ATF_REQUIRE_MSG((oldp)->ips_ipstat[counter] < (newp)->ips_ipstat[counter], \ "ips_" #counter " wasn't incremented (%ju vs. %ju)", \ + (uintmax_t)old.ips_ipstat[counter], (uintmax_t)new.ips_ipstat[counter]); +#define fragdropped IP_STAT_FRAGDROPPED +#define toosmall IP_STAT_TOOSMALL +#define toolong IP_STAT_TOOLONG +#define badfrags IP_STAT_BADFRAGS +#else +#define CHECK_IP_COUNTER(oldp, newp, counter)\ + ATF_REQUIRE_MSG((oldp)->ips_ ## counter < (newp)->ips_ ## counter, \ + #counter " wasn't incremented (%ju vs. %ju)", \ (uintmax_t)old.ips_ ## counter, (uintmax_t)new.ips_## counter); +#endif /* * Make sure a fragment with MF set doesn't come after the last fragment of a @@ -306,14 +347,21 @@ ATF_TC_BODY(ip_reass__zero_length_fragme get_ipstat(); write_lopacket(fd, packet1); get_ipstat(); +#ifdef __NetBSD__ + CHECK_IP_COUNTER(, , badfrags); +#else CHECK_IP_COUNTER(, , toosmall); CHECK_IP_COUNTER(, , fragdropped); +#endif get_ipstat(); write_lopacket(fd, packet2); get_ipstat(); + /* NetBSD doesn't reject a packet of zero length w/o MF */ +#ifndef __NetBSD__ CHECK_IP_COUNTER(, , toosmall); CHECK_IP_COUNTER(, , fragdropped); +#endif error = close(fd); ATF_REQUIRE(error == 0); @@ -359,13 +407,17 @@ ATF_TC_BODY(ip_reass__large_fragment, tc write_lopacket(fd, packet1); get_ipstat(); CHECK_IP_COUNTER(, , toolong); +#ifndef __NetBSD__ CHECK_IP_COUNTER(, , fragdropped); +#endif get_ipstat(); write_lopacket(fd, packet2); get_ipstat(); CHECK_IP_COUNTER(, , toolong); +#ifndef __NetBSD__ CHECK_IP_COUNTER(, , fragdropped); +#endif error = close(fd); ATF_REQUIRE(error == 0);
CVS commit: src/tests/net/net
Module Name:src Committed By: ozaki-r Date: Wed Nov 30 06:06:36 UTC 2022 Modified Files: src/tests/net/net: t_ip_reass.c Log Message: tests: tweak t_ip_reass.c for NetBSD The test is modified to run on rump kernels. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/net/net/t_ip_reass.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/net/net
Module Name:src Committed By: ozaki-r Date: Wed Nov 30 06:05:58 UTC 2022 Added Files: src/tests/net/net: t_ip_reass.c Log Message: tests: import ip_reass_test.c from FreeBSD as t_ip_reass.c As of: commit 9ed1e4ecd4e9eb3bde16f52a937a6fa86a971638 Author: Mark Johnston Date: Tue Nov 20 18:13:18 2018 + Plug a trivial memory leak. CID:1396911 MFC with: r340485 To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/tests/net/net/t_ip_reass.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/tests/net/net/t_ip_reass.c diff -u /dev/null src/tests/net/net/t_ip_reass.c:1.1 --- /dev/null Wed Nov 30 06:05:58 2022 +++ src/tests/net/net/t_ip_reass.c Wed Nov 30 06:05:58 2022 @@ -0,0 +1,383 @@ +/*- + * Copyright (c) 2018 The FreeBSD Foundation + * + * This software was developed by Mark Johnston under sponsorship from + * the FreeBSD Foundation. + * + * 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 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 AUTHOR 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +struct lopacket { + u_int family; + struct ip hdr; + char payload[]; +}; + +static void +update_cksum(struct ip *ip) +{ + size_t i; + uint32_t cksum; + uint16_t *cksump; + + ip->ip_sum = 0; + cksump = (uint16_t *)ip; + for (cksum = 0, i = 0; i < sizeof(*ip) / sizeof(*cksump); cksump++, i++) + cksum += ntohs(*cksump); + cksum = (cksum >> 16) + (cksum & 0x); + cksum = ~(cksum + (cksum >> 16)); + ip->ip_sum = htons((uint16_t)cksum); +} + +static struct lopacket * +alloc_lopacket(in_addr_t dstaddr, size_t payloadlen) +{ + struct ip *ip; + struct lopacket *packet; + size_t pktlen; + + pktlen = sizeof(*packet) + payloadlen; + packet = malloc(pktlen); + ATF_REQUIRE(packet != NULL); + + memset(packet, 0, pktlen); + packet->family = AF_INET; + + ip = >hdr; + ip->ip_hl = sizeof(struct ip) >> 2; + ip->ip_v = 4; + ip->ip_tos = 0; + ip->ip_len = htons(sizeof(*ip) + payloadlen); + ip->ip_id = 0; + ip->ip_off = 0; + ip->ip_ttl = 1; + ip->ip_p = IPPROTO_IP; + ip->ip_sum = 0; + ip->ip_src.s_addr = dstaddr; + ip->ip_dst.s_addr = dstaddr; + update_cksum(ip); + + return (packet); +} + +static void +free_lopacket(struct lopacket *packet) +{ + + free(packet); +} + +static void +write_lopacket(int bpffd, struct lopacket *packet) +{ + struct timespec ts; + ssize_t n; + size_t len; + + len = sizeof(packet->family) + ntohs(packet->hdr.ip_len); + n = write(bpffd, packet, len); + ATF_REQUIRE_MSG(n >= 0, "packet write failed: %s", strerror(errno)); + ATF_REQUIRE_MSG((size_t)n == len, "wrote %zd bytes instead of %zu", + n, len); + + /* + * Loopback packets are dispatched asynchronously, give netisr some + * time. + */ + ts.tv_sec = 0; + ts.tv_nsec = 500; /* 5ms */ + (void)nanosleep(, NULL); +} + +static int +open_lobpf(in_addr_t *addrp) +{ + struct ifreq ifr; + struct ifaddrs *ifa, *ifap; + int error, fd; + + fd = open("/dev/bpf0", O_RDWR); + if (fd < 0 && errno == ENOENT) + atf_tc_skip("no BPF device available"); + ATF_REQUIRE_MSG(fd >= 0, "open(/dev/bpf0): %s", strerror(errno)); + + error = getifaddrs(); + ATF_REQUIRE(error == 0); + for (ifa = ifap; ifa != NULL; ifa = ifa->ifa_next) + if ((ifa->ifa_flags & IFF_LOOPBACK) != 0 && + ifa->ifa_addr->sa_family == AF_INET) + break; + if (ifa == NULL) + atf_tc_skip("no loopback address found"); + + memset(, 0, sizeof(ifr)); + strlcpy(ifr.ifr_name, ifa->ifa_name, IFNAMSIZ); + error = ioctl(fd,
CVS commit: src/tests/net/net
Module Name:src Committed By: ozaki-r Date: Wed Nov 30 06:05:58 UTC 2022 Added Files: src/tests/net/net: t_ip_reass.c Log Message: tests: import ip_reass_test.c from FreeBSD as t_ip_reass.c As of: commit 9ed1e4ecd4e9eb3bde16f52a937a6fa86a971638 Author: Mark Johnston Date: Tue Nov 20 18:13:18 2018 + Plug a trivial memory leak. CID:1396911 MFC with: r340485 To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/tests/net/net/t_ip_reass.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/net/ipsec
Module Name:src Committed By: knakahara Date: Thu Nov 24 02:58:28 UTC 2022 Modified Files: src/tests/net/ipsec: t_ipsec_forwarding.sh Log Message: clean up To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/net/ipsec/t_ipsec_forwarding.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/net/ipsec
Module Name:src Committed By: knakahara Date: Thu Nov 24 02:58:28 UTC 2022 Modified Files: src/tests/net/ipsec: t_ipsec_forwarding.sh Log Message: clean up To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/net/ipsec/t_ipsec_forwarding.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_forwarding.sh diff -u src/tests/net/ipsec/t_ipsec_forwarding.sh:1.1 src/tests/net/ipsec/t_ipsec_forwarding.sh:1.2 --- src/tests/net/ipsec/t_ipsec_forwarding.sh:1.1 Wed Nov 9 08:21:20 2022 +++ src/tests/net/ipsec/t_ipsec_forwarding.sh Thu Nov 24 02:58:28 2022 @@ -1,4 +1,4 @@ -# $NetBSD: t_ipsec_forwarding.sh,v 1.1 2022/11/09 08:21:20 knakahara Exp $ +# $NetBSD: t_ipsec_forwarding.sh,v 1.2 2022/11/24 02:58:28 knakahara Exp $ # # Copyright (c) 2022 Internet Initiative Japan Inc. # All rights reserved. @@ -456,33 +456,6 @@ test_ipsec_sp_port_ipv6() atf_check -s exit:0 \ -o match:"${ip_remote_i}\.$port > ${ip_local_i}\.[0-9]+" \ cat $routfile - -# # Check TCP communications from remote to local -# start_nc_server $SOCK_LOCAL $port $file_recv ipv6 -# prepare_file $file_send -# export RUMP_SERVER=$SOCK_REMOTE -# atf_check -s exit:0 $HIJACKING nc -w 3 $ip_local_i $port < $file_send -# atf_check -s exit:0 diff -q $file_send $file_recv -# stop_nc_server -# -# extract_new_packets $BUS_LOCAL_F > $loutfile -# extract_new_packets $BUS_REMOTE_F > $routfile -# $DEBUG && cat $loutfile -# atf_check -s exit:0 \ -# -o match:"${ip_local_f}\.[0-9]+ > ${ip_remote_i}\.$port" \ -# cat $loutfile -# atf_check -s exit:0 \ -# -o match:"${ip_remote_i}\.$port > ${ip_local_f}\.[0-9]+" \ -# cat $loutfile -# $DEBUG && cat $routfile -# atf_check -s exit:0 \ -# -o match:"${ip_forward_l} > ${ip_remote_i}: ESP" \ -# cat $routfile -# atf_check -s exit:0 \ -# -o match:"${ip_remote_i} > ${ip_forward_l}: ESP" \ -# cat $routfile - - } add_test_ipsec_sp_port()
CVS commit: src/tests/net/inpcb
Module Name:src Committed By: ozaki-r Date: Thu Nov 17 08:42:56 UTC 2022 Added Files: src/tests/net/inpcb: t_broadcast_bind.sh Log Message: tests: add t_broadcast_bind.sh To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/tests/net/inpcb/t_broadcast_bind.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/tests/net/inpcb/t_broadcast_bind.sh diff -u /dev/null src/tests/net/inpcb/t_broadcast_bind.sh:1.1 --- /dev/null Thu Nov 17 08:42:56 2022 +++ src/tests/net/inpcb/t_broadcast_bind.sh Thu Nov 17 08:42:56 2022 @@ -0,0 +1,75 @@ +# $NetBSD: t_broadcast_bind.sh,v 1.1 2022/11/17 08:42:56 ozaki-r Exp $ +# +# Copyright (c) 2022 Internet Initiative Japan Inc. +# All rights reserved. +# +# 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. +# + +SOCK=unix://broadcast_bind +BUS=./bus + +DEBUG=${DEBUG:-false} +NAME="broadcast_bind" + +test_broadcast_bind_basic() +{ + #local insfx=$(jot -s '.' -r 2 0 255) + local insfx="0.0" + local inaddr="10.$insfx.10" + local badaddr="10.$insfx.22" + local bcaddr="10.$insfx.255" + local prog="$(atf_get_srcdir)/broadcast_bind" + + rump_server_start $SOCK + rump_server_add_iface $SOCK shmif0 $BUS + + export RUMP_SERVER=$SOCK + atf_check -s exit:0 rump.ifconfig shmif0 $inaddr/24 + atf_check -s exit:0 $HIJACKING $prog $inaddr $badaddr $bcaddr +} + +add_test() +{ + local name="${NAME}_$1" + local desc="$2" + + atf_test_case "${name}" cleanup + eval "${name}_head() { + atf_set descr \"${desc}\" + atf_set require.progs rump_server + } + ${name}_body() { + test_${name} + } + ${name}_cleanup() { + \$DEBUG && dump + cleanup + }" + atf_add_test_case "${name}" +} + +atf_init_test_cases() +{ + + add_test basic "bind(2)ing with broadcast and inexistant addresses" +}
CVS commit: src/tests/net/inpcb
Module Name:src Committed By: ozaki-r Date: Thu Nov 17 08:42:56 UTC 2022 Added Files: src/tests/net/inpcb: t_broadcast_bind.sh Log Message: tests: add t_broadcast_bind.sh To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/tests/net/inpcb/t_broadcast_bind.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/net/inpcb
Module Name:src Committed By: ozaki-r Date: Thu Nov 17 08:42:06 UTC 2022 Modified Files: src/tests/net/inpcb: broadcast_bind.c Log Message: tests: tweak broadcast_bind.c for NetBSD To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/net/inpcb/broadcast_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/inpcb/broadcast_bind.c diff -u src/tests/net/inpcb/broadcast_bind.c:1.1 src/tests/net/inpcb/broadcast_bind.c:1.2 --- src/tests/net/inpcb/broadcast_bind.c:1.1 Thu Nov 17 08:41:16 2022 +++ src/tests/net/inpcb/broadcast_bind.c Thu Nov 17 08:42:06 2022 @@ -1,3 +1,4 @@ +/* $NetBSD: broadcast_bind.c,v 1.2 2022/11/17 08:42:06 ozaki-r Exp $ */ /* $OpenBSD: broadcast_bind.c,v 1.2 2015/12/02 20:45:00 mpi Exp $ */ /* @@ -30,7 +31,7 @@ #include -int +static int test_bind(char *paddr, struct in_addr *addr, u_int16_t port, int type, int expected_errno) { @@ -100,7 +101,11 @@ main(int argc, char *argv[]) rc = 0; rc |= test_bind(argv[1], _addr, port, SOCK_STREAM, 0); rc |= test_bind(argv[2], _addr, port, SOCK_STREAM, EADDRNOTAVAIL); +#ifdef __NetBSD__ + rc |= test_bind(argv[3], _addr, port, SOCK_STREAM, 0); +#else rc |= test_bind(argv[3], _addr, port, SOCK_STREAM, EADDRNOTAVAIL); +#endif rc |= test_bind(argv[2], _addr, port, SOCK_STREAM, EADDRNOTAVAIL); rc |= test_bind(argv[3], _addr, port, SOCK_DGRAM, 0);
CVS commit: src/tests/net/inpcb
Module Name:src Committed By: ozaki-r Date: Thu Nov 17 08:42:06 UTC 2022 Modified Files: src/tests/net/inpcb: broadcast_bind.c Log Message: tests: tweak broadcast_bind.c for NetBSD To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/net/inpcb/broadcast_bind.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/net/inpcb
Module Name:src Committed By: ozaki-r Date: Thu Nov 17 08:41:16 UTC 2022 Added Files: src/tests/net/inpcb: broadcast_bind.c Log Message: tests: import broadcast_bind.c from OpenBSD As of $OpenBSD: broadcast_bind.c,v 1.2 2015/12/02 20:45:00 mpi Exp $ To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/tests/net/inpcb/broadcast_bind.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/tests/net/inpcb/broadcast_bind.c diff -u /dev/null src/tests/net/inpcb/broadcast_bind.c:1.1 --- /dev/null Thu Nov 17 08:41:16 2022 +++ src/tests/net/inpcb/broadcast_bind.c Thu Nov 17 08:41:16 2022 @@ -0,0 +1,109 @@ +/* $OpenBSD: broadcast_bind.c,v 1.2 2015/12/02 20:45:00 mpi Exp $ */ + +/* + * Copyright (c) 2015 Vincent Gross + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include + + +int +test_bind(char *paddr, struct in_addr *addr, u_int16_t port, int type, +int expected_errno) +{ + int s, rc; + struct sockaddr_in sin; + + memset(, 0, sizeof(sin)); + sin.sin_family = AF_INET; + sin.sin_len = sizeof(sin); + sin.sin_port = htons(port); + memcpy(_addr, addr, sizeof(*addr)); + + s = socket(PF_INET, type, 0); + if (s < 0) { + warn("socket(PF_INET, %d, 0)", type); + return (1); + } + + rc = bind(s, (struct sockaddr *), sin.sin_len); + if ((rc == 0 && expected_errno == 0) || + (rc != 0 && expected_errno == errno)) { + close(s); + return (0); + } + + warn("bind(%s,%d) (type %d) expected %d, got %d", paddr, port, type, + expected_errno, errno); + close(s); + + return (1); +} + +int +main(int argc, char *argv[]) +{ + int rc; + struct in_addr uc_addr, err_addr, bc_addr; + int port = 3; + + if (argc != 4) + errx(1, "needs 2 arguments: "); + + rc = inet_pton(AF_INET, argv[1], _addr); + if (rc != 1) { + if (rc) + err(1, "inet_pton(unicast)"); + else + errx(1, "inet_pton(unicast): error parsing %s", + argv[1]); + } + rc = inet_pton(AF_INET, argv[2], _addr); + if (rc != 1) { + if (rc) + err(1, "inet_pton(error)"); + else + errx(1, "inet_pton(error): error parsing %s", argv[2]); + } + rc = inet_pton(AF_INET, argv[3], _addr); + if (rc != 1) { + if (rc) + err(1, "inet_pton(broadcast)"); + else + errx(1, "inet_pton(broadcast): error parsing %s", + argv[3]); + } + + rc = 0; + rc |= test_bind(argv[1], _addr, port, SOCK_STREAM, 0); + rc |= test_bind(argv[2], _addr, port, SOCK_STREAM, EADDRNOTAVAIL); + rc |= test_bind(argv[3], _addr, port, SOCK_STREAM, EADDRNOTAVAIL); + + rc |= test_bind(argv[2], _addr, port, SOCK_STREAM, EADDRNOTAVAIL); + rc |= test_bind(argv[3], _addr, port, SOCK_DGRAM, 0); + + return (rc); +}
CVS commit: src/tests/net/inpcb
Module Name:src Committed By: ozaki-r Date: Thu Nov 17 08:41:16 UTC 2022 Added Files: src/tests/net/inpcb: broadcast_bind.c Log Message: tests: import broadcast_bind.c from OpenBSD As of $OpenBSD: broadcast_bind.c,v 1.2 2015/12/02 20:45:00 mpi Exp $ To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/tests/net/inpcb/broadcast_bind.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/net/inpcb
Module Name:src Committed By: ozaki-r Date: Thu Nov 17 08:40:24 UTC 2022 Added Files: src/tests/net/inpcb: t_inpcb_bind.sh Log Message: tests: add t_inpcb_bind.sh To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/tests/net/inpcb/t_inpcb_bind.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/tests/net/inpcb/t_inpcb_bind.sh diff -u /dev/null src/tests/net/inpcb/t_inpcb_bind.sh:1.1 --- /dev/null Thu Nov 17 08:40:24 2022 +++ src/tests/net/inpcb/t_inpcb_bind.sh Thu Nov 17 08:40:23 2022 @@ -0,0 +1,89 @@ +# $NetBSD: t_inpcb_bind.sh,v 1.1 2022/11/17 08:40:23 ozaki-r Exp $ +# +# Copyright (c) 2022 Internet Initiative Japan Inc. +# All rights reserved. +# +# 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. +# + +SOCK=unix://inpcb_bind +BUS=./bus + +DEBUG=${DEBUG:-false} +NAME="inpcb_bind" + +test_inpcb_bind_ipv4() +{ + local addr="10.0.0.10" + local port=23000 + local prog="$(atf_get_srcdir)/inpcb_bind" + + rump_server_start $SOCK + rump_server_add_iface $SOCK shmif0 $BUS + + export RUMP_SERVER=$SOCK + atf_check -s exit:0 rump.ifconfig shmif0 $addr/24 + atf_check -s exit:0 -o ignore $HIJACKING $prog $addr $port + atf_check -s exit:0 -o ignore $HIJACKING $prog 224.0.2.1 $port $addr +} + +test_inpcb_bind_ipv6() +{ + local addr="fc00::10" + local port=23000 + local prog="$(atf_get_srcdir)/inpcb_bind" + + rump_server_start $SOCK netinet6 + rump_server_add_iface $SOCK shmif0 $BUS + + export RUMP_SERVER=$SOCK + atf_check -s exit:0 rump.ifconfig shmif0 inet6 $addr/64 + atf_check -s exit:0 -o ignore $HIJACKING $prog $addr $port + atf_check -s exit:0 -o ignore $HIJACKING $prog ff1e::123 $port $addr +} + +add_test() +{ + local name="${NAME}_$1" + local desc="$2" + + atf_test_case "${name}" cleanup + eval "${name}_head() { + atf_set descr \"${desc}\" + atf_set require.progs rump_server + } + ${name}_body() { + test_${name} + } + ${name}_cleanup() { + \$DEBUG && dump + cleanup + }" + atf_add_test_case "${name}" +} + +atf_init_test_cases() +{ + + add_test ipv4 "tests for inpcb_bind (ipv4)" + add_test ipv6 "tests for inpcb_bind (ipv6)" +}
CVS commit: src/tests/net/inpcb
Module Name:src Committed By: ozaki-r Date: Thu Nov 17 08:40:24 UTC 2022 Added Files: src/tests/net/inpcb: t_inpcb_bind.sh Log Message: tests: add t_inpcb_bind.sh To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/tests/net/inpcb/t_inpcb_bind.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/net/inpcb
Module Name:src Committed By: ozaki-r Date: Thu Nov 17 08:38:58 UTC 2022 Modified Files: src/tests/net/inpcb: inpcb_bind.c Log Message: tests: make inpcb_bind.c buildable To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/net/inpcb/inpcb_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/inpcb/inpcb_bind.c diff -u src/tests/net/inpcb/inpcb_bind.c:1.1 src/tests/net/inpcb/inpcb_bind.c:1.2 --- src/tests/net/inpcb/inpcb_bind.c:1.1 Thu Nov 17 08:38:08 2022 +++ src/tests/net/inpcb/inpcb_bind.c Thu Nov 17 08:38:58 2022 @@ -1,3 +1,4 @@ +/* $NetBSD: inpcb_bind.c,v 1.2 2022/11/17 08:38:58 ozaki-r Exp $ */ /* $OpenBSD: runtest.c,v 1.7 2022/04/10 14:08:35 claudio Exp $ */ /* * Copyright (c) 2015 Vincent Gross @@ -29,12 +30,11 @@ #include #include -int +static int runtest(int *sockp, struct addrinfo *ai, int reuseaddr, int reuseport, void *mreq, int expected) { int error, optval; - struct ip_mreq imr; *sockp = socket(ai->ai_family, ai->ai_socktype, 0); if (*sockp == -1) { @@ -106,7 +106,7 @@ runtest(int *sockp, struct addrinfo *ai, return (0); } -void +static void cleanup(int *fds, int num_fds) { while (num_fds-- > 0) @@ -114,7 +114,7 @@ cleanup(int *fds, int num_fds) err(2, "unable to clean up sockets, aborting"); } -int +static int unicast_testsuite(struct addrinfo *local, struct addrinfo *any) { int test_rc, rc, *s; @@ -180,12 +180,11 @@ unicast_testsuite(struct addrinfo *local return (test_rc); } -int +static int mcast_reuse_testsuite(struct addrinfo *local, void *mr) { int test_rc, rc, *s; int sockets[6]; - int testnum = 1; test_rc = 0; rc = 0; s = sockets; @@ -266,13 +265,12 @@ mcast_reuse_testsuite(struct addrinfo *l return (test_rc); } -int +static int mcast6_testsuite(struct addrinfo *local, struct ipv6_mreq *local_mreq, struct addrinfo *any, struct ipv6_mreq *any_mreq) { int test_rc, rc, *s; int sockets[4]; - int testnum = 1; test_rc = 0; rc = 0; s = sockets; @@ -350,11 +348,10 @@ main(int argc, char *argv[]) char *baddr_s, *bport_s, *bmifa_s; struct addrinfo hints, *baddr, *any, *mifa; struct ifaddrs *ifap, *curifa; - struct ip_mreq local_imr, any_imr; + struct ip_mreq local_imr; struct ipv6_mreq local_i6mr, any_i6mr; struct sockaddr_in *sin; struct sockaddr_in6 *sin6; - int *s; memset(, 0, sizeof(hints)); hints.ai_flags = AI_ADDRCONFIG | AI_NUMERICHOST | AI_NUMERICSERV | \ @@ -373,7 +370,7 @@ main(int argc, char *argv[]) if ((error = getaddrinfo(NULL, bport_s, , ))) errx(2, "getaddrinfo(NULL,%s): %s", bport_s, gai_strerror(error)); - any->ai_canonname = "*"; + any->ai_canonname = strdup("*"); switch (baddr->ai_family) { case AF_INET:
CVS commit: src/tests/net/inpcb
Module Name:src Committed By: ozaki-r Date: Thu Nov 17 08:38:58 UTC 2022 Modified Files: src/tests/net/inpcb: inpcb_bind.c Log Message: tests: make inpcb_bind.c buildable To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/net/inpcb/inpcb_bind.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/net/inpcb
Module Name:src Committed By: ozaki-r Date: Thu Nov 17 08:38:08 UTC 2022 Added Files: src/tests/net/inpcb: inpcb_bind.c Log Message: tests: import in_pcbbind/runtest.c from OpenBSD as inpcb_bind.c As of $OpenBSD: runtest.c,v 1.7 2022/04/10 14:08:35 claudio Exp $ To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/tests/net/inpcb/inpcb_bind.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/tests/net/inpcb/inpcb_bind.c diff -u /dev/null src/tests/net/inpcb/inpcb_bind.c:1.1 --- /dev/null Thu Nov 17 08:38:08 2022 +++ src/tests/net/inpcb/inpcb_bind.c Thu Nov 17 08:38:08 2022 @@ -0,0 +1,455 @@ +/* $OpenBSD: runtest.c,v 1.7 2022/04/10 14:08:35 claudio Exp $ */ +/* + * Copyright (c) 2015 Vincent Gross + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +int +runtest(int *sockp, struct addrinfo *ai, int reuseaddr, int reuseport, +void *mreq, int expected) +{ + int error, optval; + struct ip_mreq imr; + + *sockp = socket(ai->ai_family, ai->ai_socktype, 0); + if (*sockp == -1) { + warn("%s : socket()", ai->ai_canonname); + return (3); + } + + if (reuseaddr) { + optval = 1; + error = setsockopt(*sockp, SOL_SOCKET, SO_REUSEADDR, + , sizeof(int)); + if (error) { + warn("%s : setsockopt(SO_REUSEADDR)", ai->ai_canonname); + return (2); + } + } + + if (reuseport) { + optval = 1; + error = setsockopt(*sockp, SOL_SOCKET, SO_REUSEPORT, + , sizeof(int)); + if (error) { + warn("%s : setsockopt(SO_REUSEPORT)", ai->ai_canonname); + return (2); + } + } + + if (mreq) { + switch (ai->ai_family) { + case AF_INET6: + error = setsockopt(*sockp, IPPROTO_IPV6, IPV6_JOIN_GROUP, + mreq, sizeof(struct ipv6_mreq)); + if (error) { +warn("%s : setsockopt(IPV6_JOIN_GROUP)", +ai->ai_canonname); +return (2); + } + break; + case AF_INET: + error = setsockopt(*sockp, IPPROTO_IP, IP_ADD_MEMBERSHIP, + mreq, sizeof(struct ip_mreq)); + if (error) { +warn("%s : setsockopt(IP_ADD_MEMBERSHIP)", +ai->ai_canonname); +return (2); + } + break; + default: + warnx("%s : trying to join multicast group in unknown AF", + ai->ai_canonname); + return (2); + } + } + + + error = bind(*sockp, ai->ai_addr, ai->ai_addrlen); + if (error && (expected == 0 || expected != errno)) { + warn("bind(%s,%s,%s)", ai->ai_canonname, + reuseaddr ? "REUSEADDR" : "", reuseport ? "REUSEPORT" : ""); + return (1); + } + if (error == 0 && expected != 0) { + warnx("bind(%s,%s,%s) succeeded, expected : %s", ai->ai_canonname, + reuseaddr ? "REUSEADDR" : "", reuseport ? "REUSEPORT" : "", + strerror(expected)); + return (1); + } + + return (0); +} + +void +cleanup(int *fds, int num_fds) +{ + while (num_fds-- > 0) + if (close(*fds++) && errno != EBADF) + err(2, "unable to clean up sockets, aborting"); +} + +int +unicast_testsuite(struct addrinfo *local, struct addrinfo *any) +{ + int test_rc, rc, *s; + int sockets[4]; + + test_rc = 0; + rc = 0; s = sockets; + rc |= runtest(s++, local, 0, 0, NULL, 0); + rc |= runtest(s++, any, 0, 0, NULL, EADDRINUSE); + rc |= runtest(s++, any, 1, 0, NULL, 0); + cleanup(sockets, 3); + test_rc |= rc; + if (rc) + warnx("%s : test #%d failed", __func__, 1); + + rc = 0; s = sockets; + rc |= runtest(s++, any, 0, 0, NULL, 0); + rc |= runtest(s++, local, 0, 0, NULL, EADDRINUSE); + rc |= runtest(s++, local, 1, 0, NULL, 0); + cleanup(sockets, 3); + test_rc |= rc; + if (rc) + warnx("%s : test #%d failed", __func__, 2); + + rc = 0; s = sockets; + rc |= runtest(s++, local, 0, 1, NULL, 0); + rc |= runtest(s++, local, 0, 1, NULL, 0); + rc |= runtest(s++, local, 1, 0, NULL, EADDRINUSE); + rc |= runtest(s++, local, 0, 0, NULL, EADDRINUSE); + cleanup(sockets, 4); + test_rc |= rc; + if (rc) + warnx("%s : test #%d failed", __func__, 3); + + rc = 0; s = sockets; + rc |= runtest(s++, any, 0, 1, NULL, 0); + rc |= runtest(s++, any, 0, 1, NULL, 0); + rc |= runtest(s++, any, 1, 0, NULL, EADDRINUSE); + rc |= runtest(s++, any, 0, 0, NULL, EADDRINUSE); + cleanup(sockets, 4); + test_rc |= rc; + if (rc) +
CVS commit: src/tests/net/inpcb
Module Name:src Committed By: ozaki-r Date: Thu Nov 17 08:38:08 UTC 2022 Added Files: src/tests/net/inpcb: inpcb_bind.c Log Message: tests: import in_pcbbind/runtest.c from OpenBSD as inpcb_bind.c As of $OpenBSD: runtest.c,v 1.7 2022/04/10 14:08:35 claudio Exp $ To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/tests/net/inpcb/inpcb_bind.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/net/tcp
Module Name:src Committed By: ozaki-r Date: Thu Nov 17 08:36:54 UTC 2022 Modified Files: src/tests/net/tcp: t_tcp_connect_port.c Log Message: tests: make t_tcp_connect_port.c run on rump kernel To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/net/tcp/t_tcp_connect_port.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/tcp/t_tcp_connect_port.c diff -u src/tests/net/tcp/t_tcp_connect_port.c:1.1 src/tests/net/tcp/t_tcp_connect_port.c:1.2 --- src/tests/net/tcp/t_tcp_connect_port.c:1.1 Thu Nov 17 08:36:00 2022 +++ src/tests/net/tcp/t_tcp_connect_port.c Thu Nov 17 08:36:54 2022 @@ -1,3 +1,5 @@ +/* $NetBSD: t_tcp_connect_port.c,v 1.2 2022/11/17 08:36:54 ozaki-r Exp $ */ + /*- * SPDX-License-Identifier: BSD-2-Clause * @@ -27,7 +29,12 @@ */ #include +#ifdef __NetBSD__ +__RCSID("$NetBSD: t_tcp_connect_port.c,v 1.2 2022/11/17 08:36:54 ozaki-r Exp $"); +#define USE_RUMPKERNEL 1 +#else __FBSDID("$FreeBSD$"); +#endif #include #include @@ -45,6 +52,21 @@ __FBSDID("$FreeBSD$"); #include +#ifdef USE_RUMPKERNEL +#include +#include + +#define socket rump_sys_socket +#define bind rump_sys_bind +#define listen rump_sys_listen +#define accept rump_sys_accept +#define connect rump_sys_connect +#define write rump_sys_write +#define close rump_sys_close +#define setsockopt rump_sys_setsockopt +#define getsockname rump_sys_getsockname +#endif /* USE_RUMPKERNEL */ + #define SYSCTLBAKFILE "tmp.net.inet.ip.portrange.randomized" /* @@ -54,6 +76,9 @@ __FBSDID("$FreeBSD$"); static void disable_random_ports(void) { +#ifdef USE_RUMPKERNEL + rump_init(); /* XXX */ +#else int error, fd, random_new, random_save; size_t sysctlsz; @@ -112,6 +137,7 @@ restore_sysctl: NULL, _save, sysctlsz); atf_tc_skip("Error setting sysctl"); } +#endif /* USE_RUMPKERNEL */ } /* @@ -120,6 +146,7 @@ restore_sysctl: static void restore_random_ports(void) { +#ifndef USE_RUMPKERNEL int error, fd, random_save; /* Open the backup file, read the contents, close it, and delete it. */ @@ -152,6 +179,7 @@ restore_random_ports(void) if (error) warn("sysctlbyname(\"net.inet.ip.portrange.randomized\") " "failed while restoring value"); +#endif /* USE_RUMPKERNEL */ } /* @@ -271,7 +299,9 @@ ATF_TC_HEAD(basic_ipv4, tc) { atf_tc_set_md_var(tc, "require.user", "root"); +#ifndef USE_RUMPKERNEL atf_tc_set_md_var(tc, "require.config", "allow_sysctl_side_effects"); +#endif atf_tc_set_md_var(tc, "descr", "Check automatic local port assignment during TCP connect calls"); } @@ -300,7 +330,9 @@ ATF_TC_HEAD(basic_ipv6, tc) { atf_tc_set_md_var(tc, "require.user", "root"); +#ifndef USE_RUMPKERNEL atf_tc_set_md_var(tc, "require.config", "allow_sysctl_side_effects"); +#endif atf_tc_set_md_var(tc, "descr", "Check automatic local port assignment during TCP connect calls"); }
CVS commit: src/tests/net/tcp
Module Name:src Committed By: ozaki-r Date: Thu Nov 17 08:36:54 UTC 2022 Modified Files: src/tests/net/tcp: t_tcp_connect_port.c Log Message: tests: make t_tcp_connect_port.c run on rump kernel To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/net/tcp/t_tcp_connect_port.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/net/tcp
Module Name:src Committed By: ozaki-r Date: Thu Nov 17 08:36:00 UTC 2022 Added Files: src/tests/net/tcp: t_tcp_connect_port.c Log Message: tests: import tcp_connect_port_test.c from FreeBSD as t_tcp_connect_port.c As of: commit 36c52a52eecf1ed0232f9e138564009a85de76c2 Author: Jonathan T. Looney Date: Sat Nov 14 15:44:28 2020 + Add a regression test for the port-selection behavior fixed in r367680. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/tests/net/tcp/t_tcp_connect_port.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/tests/net/tcp/t_tcp_connect_port.c diff -u /dev/null src/tests/net/tcp/t_tcp_connect_port.c:1.1 --- /dev/null Thu Nov 17 08:36:00 2022 +++ src/tests/net/tcp/t_tcp_connect_port.c Thu Nov 17 08:36:00 2022 @@ -0,0 +1,334 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2020 Netflix, Inc. + * + * 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 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 AUTHOR 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include + +#define SYSCTLBAKFILE "tmp.net.inet.ip.portrange.randomized" + +/* + * Check if port allocation is randomized. If so, update it. Save the old + * value of the sysctl so it can be updated later. + */ +static void +disable_random_ports(void) +{ + int error, fd, random_new, random_save; + size_t sysctlsz; + + /* + * Pre-emptively unlink our restoration file, so we will do no + * restoration on error. + */ + unlink(SYSCTLBAKFILE); + + /* + * Disable the net.inet.ip.portrange.randomized sysctl. Save the + * old value so we can restore it, if necessary. + */ + random_new = 0; + sysctlsz = sizeof(random_save); + error = sysctlbyname("net.inet.ip.portrange.randomized", _save, + , _new, sizeof(random_new)); + if (error) { + warn("sysctlbyname(\"net.inet.ip.portrange.randomized\") " + "failed"); + atf_tc_skip("Unable to set sysctl"); + } + if (sysctlsz != sizeof(random_save)) { + fprintf(stderr, "Error: unexpected sysctl value size " + "(expected %zu, actual %zu)\n", sizeof(random_save), + sysctlsz); + goto restore_sysctl; + } + + /* Open the backup file, write the contents, and close it. */ + fd = open(SYSCTLBAKFILE, O_WRONLY|O_CREAT|O_TRUNC|O_EXCL, + S_IRUSR|S_IWUSR); + if (fd < 0) { + warn("error opening sysctl backup file"); + goto restore_sysctl; + } + error = write(fd, _save, sizeof(random_save)); + if (error < 0) { + warn("error writing saved value to sysctl backup file"); + goto cleanup_and_restore; + } + if (error != (int)sizeof(random_save)) { + fprintf(stderr, + "Error writing saved value to sysctl backup file: " + "(expected %zu, actual %d)\n", sizeof(random_save), error); + goto cleanup_and_restore; + } + error = close(fd); + if (error) { + warn("error closing sysctl backup file"); +cleanup_and_restore: + (void)close(fd); + (void)unlink(SYSCTLBAKFILE); +restore_sysctl: + (void)sysctlbyname("net.inet.ip.portrange.randomized", NULL, + NULL, _save, sysctlsz); + atf_tc_skip("Error setting sysctl"); + } +} + +/* + * Restore the sysctl value from the backup file and delete the backup file. + */ +static void +restore_random_ports(void) +{ + int error, fd, random_save; + + /* Open the backup file, read the contents, close it, and delete it. */ + fd = open(SYSCTLBAKFILE, O_RDONLY); + if (fd < 0) { + warn("error opening sysctl backup file"); + return; + } + error = read(fd, _save, sizeof(random_save)); + if (error < 0) { + warn("error reading saved value from sysctl backup file");
CVS commit: src/tests/net/tcp
Module Name:src Committed By: ozaki-r Date: Thu Nov 17 08:36:00 UTC 2022 Added Files: src/tests/net/tcp: t_tcp_connect_port.c Log Message: tests: import tcp_connect_port_test.c from FreeBSD as t_tcp_connect_port.c As of: commit 36c52a52eecf1ed0232f9e138564009a85de76c2 Author: Jonathan T. Looney Date: Sat Nov 14 15:44:28 2020 + Add a regression test for the port-selection behavior fixed in r367680. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/tests/net/tcp/t_tcp_connect_port.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/net/net
Module Name:src Committed By: ozaki-r Date: Thu Nov 17 08:34:39 UTC 2022 Modified Files: src/tests/net/net: t_socket_afinet.c Log Message: tests: make t_socket_afinet.c run on rump kernel To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/net/net/t_socket_afinet.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_socket_afinet.c diff -u src/tests/net/net/t_socket_afinet.c:1.1 src/tests/net/net/t_socket_afinet.c:1.2 --- src/tests/net/net/t_socket_afinet.c:1.1 Thu Nov 17 08:33:27 2022 +++ src/tests/net/net/t_socket_afinet.c Thu Nov 17 08:34:39 2022 @@ -1,3 +1,5 @@ +/* $NetBSD: t_socket_afinet.c,v 1.2 2022/11/17 08:34:39 ozaki-r Exp $ */ + /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * @@ -26,7 +28,12 @@ */ #include +#ifdef __NetBSD__ +__RCSID("$NetBSD: t_socket_afinet.c,v 1.2 2022/11/17 08:34:39 ozaki-r Exp $"); +#define USE_RUMPKERNEL 1 +#else __FBSDID("$FreeBSD$"); +#endif #include #include @@ -35,11 +42,30 @@ __FBSDID("$FreeBSD$"); #include +#ifdef USE_RUMPKERNEL +#include +#include + +#define socket rump_sys_socket +#define bind rump_sys_bind +#define listen rump_sys_listen +#define connect rump_sys_connect +#define write rump_sys_write +#define poll rump_sys_poll +#define close rump_sys_close + +#define RUMP_INIT() rump_init() +#else +#define RUMP_INIT() do { } while (0) +#endif + ATF_TC_WITHOUT_HEAD(socket_afinet); ATF_TC_BODY(socket_afinet, tc) { int sd; + RUMP_INIT(); + sd = socket(PF_INET, SOCK_DGRAM, 0); ATF_CHECK(sd >= 0); @@ -52,6 +78,12 @@ ATF_TC_BODY(socket_afinet_bind_zero, tc) int sd, rc; struct sockaddr_in sin; + RUMP_INIT(); + +#ifdef __NetBSD__ + atf_tc_expect_fail("NetBSD doesn't allow sin_family == 0 (sin_len == 0 too)"); +#endif + if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) atf_tc_skip("doesn't work when mac_portacl(4) loaded (https://bugs.freebsd.org/238781)"); @@ -76,6 +108,8 @@ ATF_TC_BODY(socket_afinet_bind_ok, tc) int sd, rc; struct sockaddr_in sin; + RUMP_INIT(); + sd = socket(PF_INET, SOCK_DGRAM, 0); ATF_CHECK(sd >= 0); @@ -90,6 +124,7 @@ ATF_TC_BODY(socket_afinet_bind_ok, tc) close(sd); } +#ifdef POLLRDHUP ATF_TC_WITHOUT_HEAD(socket_afinet_poll_no_rdhup); ATF_TC_BODY(socket_afinet_poll_no_rdhup, tc) { @@ -98,6 +133,8 @@ ATF_TC_BODY(socket_afinet_poll_no_rdhup, struct pollfd pfd; int one = 1; + RUMP_INIT(); + /* Verify that we don't expose POLLRDHUP if not requested. */ /* Server setup. */ @@ -158,6 +195,8 @@ ATF_TC_BODY(socket_afinet_poll_rdhup, tc char buffer; int one = 1; + RUMP_INIT(); + /* Verify that server sees POLLRDHUP if it asks for it. */ /* Server setup. */ @@ -227,6 +266,7 @@ ATF_TC_BODY(socket_afinet_poll_rdhup, tc close(ss2); close(ss); } +#endif /* POLLRDHUP */ ATF_TP_ADD_TCS(tp) { @@ -234,8 +274,10 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, socket_afinet); ATF_TP_ADD_TC(tp, socket_afinet_bind_zero); ATF_TP_ADD_TC(tp, socket_afinet_bind_ok); +#ifdef POLLRDHUP ATF_TP_ADD_TC(tp, socket_afinet_poll_no_rdhup); ATF_TP_ADD_TC(tp, socket_afinet_poll_rdhup); +#endif return atf_no_error(); }
CVS commit: src/tests/net/net
Module Name:src Committed By: ozaki-r Date: Thu Nov 17 08:34:39 UTC 2022 Modified Files: src/tests/net/net: t_socket_afinet.c Log Message: tests: make t_socket_afinet.c run on rump kernel To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/net/net/t_socket_afinet.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/net/net
Module Name:src Committed By: ozaki-r Date: Thu Nov 17 08:33:27 UTC 2022 Added Files: src/tests/net/net: t_socket_afinet.c Log Message: tests: import socket_afinet.c from FreeBSD as t_socket_afinet.c As of: commit 32efde896e19d229ee2cf09fe7e6ab0fbf6e Author: Thomas Munro Date: Wed Apr 28 21:31:38 2021 +1200 poll(2): Add POLLRDHUP. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/tests/net/net/t_socket_afinet.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/tests/net/net/t_socket_afinet.c diff -u /dev/null src/tests/net/net/t_socket_afinet.c:1.1 --- /dev/null Thu Nov 17 08:33:27 2022 +++ src/tests/net/net/t_socket_afinet.c Thu Nov 17 08:33:27 2022 @@ -0,0 +1,241 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Bjoern A. Zeeb + * + * 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 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 AUTHOR 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#include + +ATF_TC_WITHOUT_HEAD(socket_afinet); +ATF_TC_BODY(socket_afinet, tc) +{ + int sd; + + sd = socket(PF_INET, SOCK_DGRAM, 0); + ATF_CHECK(sd >= 0); + + close(sd); +} + +ATF_TC_WITHOUT_HEAD(socket_afinet_bind_zero); +ATF_TC_BODY(socket_afinet_bind_zero, tc) +{ + int sd, rc; + struct sockaddr_in sin; + + if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) + atf_tc_skip("doesn't work when mac_portacl(4) loaded (https://bugs.freebsd.org/238781)"); + + sd = socket(PF_INET, SOCK_DGRAM, 0); + ATF_CHECK(sd >= 0); + + bzero(, sizeof(sin)); + /* + * For AF_INET we do not check the family in in_pcbbind_setup(9), + * sa_len gets set from the syscall argument in getsockaddr(9), + * so we bind to 0:0. + */ + rc = bind(sd, (struct sockaddr *), sizeof(sin)); + ATF_CHECK_EQ(0, rc); + + close(sd); +} + +ATF_TC_WITHOUT_HEAD(socket_afinet_bind_ok); +ATF_TC_BODY(socket_afinet_bind_ok, tc) +{ + int sd, rc; + struct sockaddr_in sin; + + sd = socket(PF_INET, SOCK_DGRAM, 0); + ATF_CHECK(sd >= 0); + + bzero(, sizeof(sin)); + sin.sin_family = AF_INET; + sin.sin_len = sizeof(sin); + sin.sin_port = htons(); + sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + rc = bind(sd, (struct sockaddr *), sizeof(sin)); + ATF_CHECK_EQ(0, rc); + + close(sd); +} + +ATF_TC_WITHOUT_HEAD(socket_afinet_poll_no_rdhup); +ATF_TC_BODY(socket_afinet_poll_no_rdhup, tc) +{ + int ss, ss2, cs, rc; + struct sockaddr_in sin; + struct pollfd pfd; + int one = 1; + + /* Verify that we don't expose POLLRDHUP if not requested. */ + + /* Server setup. */ + ss = socket(PF_INET, SOCK_STREAM, 0); + ATF_CHECK(ss >= 0); + rc = setsockopt(ss, SOL_SOCKET, SO_REUSEPORT, , sizeof(one)); + ATF_CHECK_EQ(0, rc); + bzero(, sizeof(sin)); + sin.sin_family = AF_INET; + sin.sin_len = sizeof(sin); + sin.sin_port = htons(); + sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + rc = bind(ss, (struct sockaddr *), sizeof(sin)); + ATF_CHECK_EQ(0, rc); + rc = listen(ss, 1); + ATF_CHECK_EQ(0, rc); + + /* Client connects, server accepts. */ + cs = socket(PF_INET, SOCK_STREAM, 0); + ATF_CHECK(cs >= 0); + rc = connect(cs, (struct sockaddr *), sizeof(sin)); + ATF_CHECK_EQ(0, rc); + ss2 = accept(ss, NULL, NULL); + ATF_CHECK(ss2 >= 0); + + /* Server can write, sees only POLLOUT. */ + pfd.fd = ss2; + pfd.events = POLLIN | POLLOUT; + rc = poll(, 1, 0); + ATF_CHECK_EQ(1, rc); + ATF_CHECK_EQ(POLLOUT, pfd.revents); + + /* Client closes socket! */ + rc = close(cs); + ATF_CHECK_EQ(0, rc); + + /* + * Server now sees POLLIN, but not POLLRDHUP because we didn't ask. + * Need non-zero timeout to wait for the FIN to arrive and trigger the + * socket to become readable. + */ + pfd.fd = ss2;
CVS commit: src/tests/net/net
Module Name:src Committed By: ozaki-r Date: Thu Nov 17 08:33:27 UTC 2022 Added Files: src/tests/net/net: t_socket_afinet.c Log Message: tests: import socket_afinet.c from FreeBSD as t_socket_afinet.c As of: commit 32efde896e19d229ee2cf09fe7e6ab0fbf6e Author: Thomas Munro Date: Wed Apr 28 21:31:38 2021 +1200 poll(2): Add POLLRDHUP. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/tests/net/net/t_socket_afinet.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/net
Module Name:src Committed By: ozaki-r Date: Wed Nov 2 09:35:12 UTC 2022 Modified Files: src/tests/net: net_common.sh Log Message: tests: enable start_nc_server to have extra options for nc To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 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.
CVS commit: src/tests/net
Module Name:src Committed By: ozaki-r Date: Wed Nov 2 09:35:12 UTC 2022 Modified Files: src/tests/net: net_common.sh Log Message: tests: enable start_nc_server to have extra options for nc To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 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.43 src/tests/net/net_common.sh:1.44 --- src/tests/net/net_common.sh:1.43 Thu Nov 25 14:17:22 2021 +++ src/tests/net/net_common.sh Wed Nov 2 09:35:12 2022 @@ -1,4 +1,4 @@ -# $NetBSD: net_common.sh,v 1.43 2021/11/25 14:17:22 hannken Exp $ +# $NetBSD: net_common.sh,v 1.44 2022/11/02 09:35:12 ozaki-r Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -139,6 +139,7 @@ start_nc_server() local port=$2 local outfile=$3 local proto=${4:-ipv4} + local extra_opts="$5" local backup=$RUMP_SERVER local opts= @@ -149,6 +150,7 @@ start_nc_server() else opts="-l -6" fi + opts="$opts $extra_opts" env LD_PRELOAD=/usr/lib/librumphijack.so nc $opts $port > $outfile & echo $! > $NC_PID
CVS commit: src/tests/net/route
Module Name:src Committed By: knakahara Date: Tue Sep 20 02:25:07 UTC 2022 Modified Files: src/tests/net/route: t_route.sh Log Message: tests: add tests for automatic route deletions on an address removal To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/tests/net/route/t_route.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_route.sh diff -u src/tests/net/route/t_route.sh:1.14 src/tests/net/route/t_route.sh:1.15 --- src/tests/net/route/t_route.sh:1.14 Mon Dec 18 04:11:46 2017 +++ src/tests/net/route/t_route.sh Tue Sep 20 02:25:07 2022 @@ -1,4 +1,4 @@ -# $NetBSD: t_route.sh,v 1.14 2017/12/18 04:11:46 ozaki-r Exp $ +# $NetBSD: t_route.sh,v 1.15 2022/09/20 02:25:07 knakahara Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -539,6 +539,156 @@ route_command_add6_cleanup() cleanup } +test_route_address_removal() +{ + + rump_server_start $SOCKHOST netinet6 + + export RUMP_SERVER=${SOCKHOST} + rump_server_add_iface $SOCKHOST shmif0 $BUS + + # + # 1. test auto removal of a route that depends a removing address + # + atf_check -s exit:0 rump.ifconfig shmif0 $af $addr1/$prefix + atf_check -s exit:0 -o match:"add net $alt_net(/$prefix)?: gateway $addrgw" \ + rump.route -n add -$af -net $alt_net/$prefix $addrgw + $DEBUG && rump.netstat -nr -f $af + atf_check -s exit:0 rump.ifconfig shmif0 $af $addr1 delete + $DEBUG && rump.netstat -nr -f $af + + # The route should be deleted on the address removal + atf_check -s not-exit:0 -e match:"writing to routing socket: not in table" \ + rump.route -n get -$af $alt_addr + + # + # 2. test auto update of a route that depends a removing address where + #there is another address with the same prefix sharing a connected + #route + # + atf_check -s exit:0 rump.ifconfig shmif0 $af $addr1/$prefix + atf_check -s exit:0 rump.ifconfig shmif0 $af $addr2/$prefix alias + atf_check -s exit:0 -o match:"add net $alt_net(/$prefix)?: gateway $addrgw" \ + rump.route -n add -$af -net $alt_net/$prefix $addrgw + $DEBUG && rump.netstat -nr -f $af + + atf_check -s exit:0 -o match:"local addr: $addr1" \ + rump.route -n get -$af $addrgw + atf_check -s exit:0 -o match:"local addr: $addr1" \ + rump.route -n get -$af $alt_addr + + atf_check -s exit:0 rump.ifconfig shmif0 $af $addr1 delete + $DEBUG && rump.netstat -nr -f $af + + # local addr (rt_ifa) of the connected route should be changed + # on the address removal + atf_check -s exit:0 -o match:"local addr: $addr2" \ + rump.route -n get -$af $addrgw + # local addr (rt_ifa) of the related route should be changed + # on the address removal too + atf_check -s exit:0 -o match:"local addr: $addr2" \ + rump.route -n get -$af $alt_addr + + # cleanup + atf_check -s exit:0 rump.ifconfig shmif0 $af $addr2 delete + + # + # 3. test auto update of a route that depends a removing address where + #there is another address with a different (short) prefix + # + atf_check -s exit:0 rump.ifconfig shmif0 $af $addr1/$prefix + atf_check -s exit:0 rump.ifconfig shmif0 $af $addr2/$prefix_short alias + atf_check -s exit:0 -o match:"add net $alt_net(/$prefix)?: gateway $addrgw" \ + rump.route -n add -$af -net $alt_net/$prefix $addrgw + $DEBUG && rump.netstat -nr -f $af + + atf_check -s exit:0 -o match:"local addr: $addr1" \ + rump.route -n get -$af $addrgw + atf_check -s exit:0 -o match:"local addr: $addr1" \ + rump.route -n get -$af $alt_addr + + atf_check -s exit:0 rump.ifconfig shmif0 $af $addr1 delete + $DEBUG && rump.netstat -nr -f $af + + # local addr (rt_ifa) of the connected route should be changed + # on the address removal + atf_check -s exit:0 -o match:"local addr: $addr2" \ + rump.route -n get -$af $addrgw + if [ $af = inet ]; then + # local addr (rt_ifa) of the related route should be changed + # on the address removal too + atf_check -s exit:0 -o match:"local addr: $addr2" \ + rump.route -n get -$af $alt_addr + else + # For IPv6, each address has its own connected route so the + # address removal just results in a removal of the related route + atf_check -s not-exit:0 \ + -e match:"writing to routing socket: not in table" \ + rump.route -n get -$af $alt_addr + fi + + rump_server_destroy_ifaces +} + +atf_test_case route_address_removal cleanup +route_address_removal_head() +{ + + atf_set "descr" "tests of auto removal/update of routes on address removal (IPv4)" + atf_set "require.progs" "rump_server" +} + +route_address_removal_body() +{ + local addr1=10.0.0.1 + local addr2=10.0.0.2 + local addrgw=10.0.0.3 + local prefix=24 + local prefix_short=16 + local alt_net=10.0.1.0 + local alt_addr=10.0.1.1 + local af=inet + + test_route_address_removal +} + +route_address_removal_cleanup() +{ + + $DEBUG && dump + cleanup +} + +atf_test_case route_address_removal6 cleanup +route_address_removal6_head()
CVS commit: src/tests/net/route
Module Name:src Committed By: knakahara Date: Tue Sep 20 02:25:07 UTC 2022 Modified Files: src/tests/net/route: t_route.sh Log Message: tests: add tests for automatic route deletions on an address removal To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/tests/net/route/t_route.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/net/if_wg
Module Name:src Committed By: martin Date: Mon Jun 13 07:59:15 UTC 2022 Modified Files: src/tests/net/if_wg: t_misc.sh Log Message: PR 56879: bump timeout for the wg_malformed test to 100 seconds, as suggested by Tom Lane - the test takes ~32 seconds on my unloaded sh4 machine. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 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.11 src/tests/net/if_wg/t_misc.sh:1.12 --- src/tests/net/if_wg/t_misc.sh:1.11 Fri Nov 26 20:02:35 2021 +++ src/tests/net/if_wg/t_misc.sh Mon Jun 13 07:59:15 2022 @@ -1,4 +1,4 @@ -# $NetBSD: t_misc.sh,v 1.11 2021/11/26 20:02:35 gson Exp $ +# $NetBSD: t_misc.sh,v 1.12 2022/06/13 07:59:15 martin Exp $ # # Copyright (c) 2018 Ryota Ozaki # All rights reserved. @@ -603,7 +603,7 @@ wg_malformed_head() atf_set "descr" "tests malformed packet headers" atf_set "require.progs" "nc" "rump_server" "wgconfig" "wg-keygen" - atf_set "timeout" "10" + atf_set "timeout" "100" } wg_malformed_body()
CVS commit: src/tests/net/if_wg
Module Name:src Committed By: martin Date: Mon Jun 13 07:59:15 UTC 2022 Modified Files: src/tests/net/if_wg: t_misc.sh Log Message: PR 56879: bump timeout for the wg_malformed test to 100 seconds, as suggested by Tom Lane - the test takes ~32 seconds on my unloaded sh4 machine. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 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.
CVS commit: src/tests/net/if_lagg
Module Name:src Committed By: yamaguchi Date: Thu Mar 31 03:26:33 UTC 2022 Modified Files: src/tests/net/if_lagg: t_lagg.sh Log Message: Add tests for MTU of lagg(4) To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 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.
CVS commit: src/tests/net/if_lagg
Module Name:src Committed By: yamaguchi Date: Thu Mar 31 03:26:33 UTC 2022 Modified Files: src/tests/net/if_lagg: t_lagg.sh Log Message: Add tests for MTU of lagg(4) To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 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.7 src/tests/net/if_lagg/t_lagg.sh:1.8 --- src/tests/net/if_lagg/t_lagg.sh:1.7 Thu Mar 31 03:09:03 2022 +++ src/tests/net/if_lagg/t_lagg.sh Thu Mar 31 03:26:33 2022 @@ -1,4 +1,4 @@ -# $NetBSD: t_lagg.sh,v 1.7 2022/03/31 03:09:03 yamaguchi Exp $ +# $NetBSD: t_lagg.sh,v 1.8 2022/03/31 03:26:33 yamaguchi Exp $ # # Copyright (c) 2021 Internet Initiative Japan Inc. # All rights reserved. @@ -357,6 +357,90 @@ lagg_ipv6lla_cleanup() cleanup } +atf_test_case lagg_mtu cleanup +lagg_mtu_head() +{ + atf_set "descr" "tests for MTU" + atf_set "require.progs" "rump_server" +} + +lagg_mtu_body() +{ + local atf_ifconfig="atf_check -s exit:0 rump.ifconfig" + local mtu_1st=1450 + local mtu_big=1460 + local mtu_small=1440 + + rump_server_start $SOCK_HOST0 lagg + + export RUMP_SERVER=$SOCK_HOST0 + rump_server_add_iface $SOCK_HOST0 shmif0 $BUS0 + rump_server_add_iface $SOCK_HOST0 shmif1 $BUS1 + rump_server_add_iface $SOCK_HOST0 shmif2 $BUS2 + $atf_ifconfig lagg0 create + $atf_ifconfig lagg0 laggproto lacp + + $atf_ifconfig shmif0 mtu $mtu_1st + $atf_ifconfig shmif1 mtu $mtu_big + $atf_ifconfig shmif2 mtu $mtu_small + + atf_check -s exit:0 -o match:"mtu *1500" rump.ifconfig lagg0 + atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig shmif0 + atf_check -s exit:0 -o match:"mtu *$mtu_big" rump.ifconfig shmif1 + atf_check -s exit:0 -o match:"mtu *$mtu_small" rump.ifconfig shmif2 + + # copy MTU from 1st port + $atf_ifconfig lagg0 laggport shmif0 + atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig lagg0 + atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig shmif0 + + # copy MTU to added port + $atf_ifconfig lagg0 laggport shmif1 + $atf_ifconfig lagg0 laggport shmif2 + atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig lagg0 + atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig shmif0 + atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig shmif1 + atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig shmif2 + + # reset MTU after detaching from lagg0 + $atf_ifconfig lagg0 -laggport shmif2 + atf_check -s exit:0 -o match:"mtu *$mtu_small" rump.ifconfig shmif2 + + # change MTU of lagg0 + $atf_ifconfig lagg0 mtu 1500 + atf_check -s exit:0 -o match:"mtu *1500" rump.ifconfig lagg0 + atf_check -s exit:0 -o match:"mtu *1500" rump.ifconfig shmif0 + atf_check -s exit:0 -o match:"mtu *1500" rump.ifconfig shmif1 + + # reset MTU after detching from lagg0 + $atf_ifconfig lagg0 -laggport shmif0 + $atf_ifconfig lagg0 -laggport shmif1 + atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig shmif0 + atf_check -s exit:0 -o match:"mtu *$mtu_big" rump.ifconfig shmif1 + + # MTU should not be changed + atf_check -s exit:0 -o match:"mtu *1500" rump.ifconfig lagg0 + + # copy MTU from 1st port even when MTU of lagg0 is changhed + $atf_ifconfig lagg0 mtu 1400 + atf_check -s exit:0 -o match:"mtu *1400" rump.ifconfig lagg0 + $atf_ifconfig lagg0 laggport shmif0 + atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig lagg0 + atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig shmif0 + + # MTU of lagg0 need not reset + $atf_ifconfig lagg0 -laggport shmif0 + atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig lagg0 + atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig shmif0 +} + +lagg_mtu_cleanup() +{ + + $DEBUG && dump + cleanup +} + atf_test_case lagg_lacp_basic cleanup lagg_lacp_basic_head() { @@ -1376,6 +1460,7 @@ atf_init_test_cases() atf_add_test_case lagg_ifconfig atf_add_test_case lagg_macaddr atf_add_test_case lagg_ipv6lla + atf_add_test_case lagg_mtu atf_add_test_case lagg_lacp_basic atf_add_test_case lagg_lacp_ipv4 atf_add_test_case lagg_lacp_ipv6
CVS commit: src/tests/net/if_lagg
Module Name:src Committed By: yamaguchi Date: Thu Mar 31 03:09:03 UTC 2022 Modified Files: src/tests/net/if_lagg: t_lagg.sh Log Message: Added waiting for distributing state after attaching vlan A lagg interface is reset on attaching vlan to enable ETHERCAP_VLAN_MTU if the lagg I/F has it. Therefore, it is necessary to wait for distributing. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 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.6 src/tests/net/if_lagg/t_lagg.sh:1.7 --- src/tests/net/if_lagg/t_lagg.sh:1.6 Mon Nov 8 06:24:11 2021 +++ src/tests/net/if_lagg/t_lagg.sh Thu Mar 31 03:09:03 2022 @@ -1,4 +1,4 @@ -# $NetBSD: t_lagg.sh,v 1.6 2021/11/08 06:24:11 yamaguchi Exp $ +# $NetBSD: t_lagg.sh,v 1.7 2022/03/31 03:09:03 yamaguchi Exp $ # # Copyright (c) 2021 Internet Initiative Japan Inc. # All rights reserved. @@ -736,39 +736,31 @@ lagg_lacp_vlan() setup_l2tp_ipv4tunnel fi - export RUMP_SERVER=$SOCK_HOST0 - $atf_ifconfig lagg0 create - $atf_ifconfig lagg0 laggproto lacp laggport $iface0 - $atf_ifconfig $iface0 up - $atf_ifconfig lagg0 up + for sock in $SOCK_HOST0 $SOCK_HOST1; do + export RUMP_SERVER=$sock + $atf_ifconfig lagg0 create + $atf_ifconfig lagg0 laggproto lacp laggport $iface0 + + $atf_ifconfig vlan0 create + $atf_ifconfig vlan0 vlan 10 vlanif lagg0 + $atf_ifconfig vlan1 create + $atf_ifconfig vlan1 vlan 11 vlanif lagg0 - export RUMP_SERVER=$SOCK_HOST1 - $atf_ifconfig lagg0 create - $atf_ifconfig lagg0 laggproto lacp laggport $iface0 - $atf_ifconfig $iface0 up - $atf_ifconfig lagg0 up + $atf_ifconfig $iface0 up + $atf_ifconfig lagg0 up + done export RUMP_SERVER=$SOCK_HOST0 wait_for_distributing lagg0 - - $atf_ifconfig vlan0 create - $atf_ifconfig vlan0 vlan 10 vlanif lagg0 $atf_ifconfig vlan0 $af $host0addr0/$pfx $atf_ifconfig vlan0 up - - $atf_ifconfig vlan1 create - $atf_ifconfig vlan1 vlan 11 vlanif lagg0 $atf_ifconfig vlan1 $af $host0addr1/$pfx $atf_ifconfig vlan1 up export RUMP_SERVER=$SOCK_HOST1 - $atf_ifconfig vlan0 create - $atf_ifconfig vlan0 vlan 10 vlanif lagg0 + wait_for_distributing lagg0 $atf_ifconfig vlan0 $af $host1addr0/$pfx $atf_ifconfig vlan0 up - - $atf_ifconfig vlan1 create - $atf_ifconfig vlan1 vlan 11 vlanif lagg0 $atf_ifconfig vlan1 $af $host1addr1/$pfx $atf_ifconfig vlan1 up
CVS commit: src/tests/net/if_lagg
Module Name:src Committed By: yamaguchi Date: Thu Mar 31 03:09:03 UTC 2022 Modified Files: src/tests/net/if_lagg: t_lagg.sh Log Message: Added waiting for distributing state after attaching vlan A lagg interface is reset on attaching vlan to enable ETHERCAP_VLAN_MTU if the lagg I/F has it. Therefore, it is necessary to wait for distributing. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 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.
CVS commit: src/tests/net/ndp
Module Name:src Committed By: ozaki-r Date: Fri Jan 7 03:07:41 UTC 2022 Modified Files: src/tests/net/ndp: t_ndp.sh Log Message: tests: skip ndp_cache_state on qemu To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 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.39 src/tests/net/ndp/t_ndp.sh:1.40 --- src/tests/net/ndp/t_ndp.sh:1.39 Thu Sep 17 11:56:35 2020 +++ src/tests/net/ndp/t_ndp.sh Fri Jan 7 03:07:41 2022 @@ -1,4 +1,4 @@ -# $NetBSD: t_ndp.sh,v 1.39 2020/09/17 11:56:35 roy Exp $ +# $NetBSD: t_ndp.sh,v 1.40 2022/01/07 03:07:41 ozaki-r Exp $ # # Copyright (c) 2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -752,6 +752,8 @@ ndp_cache_state_body() { local macaddr= + skip_if_qemu + rump_server_start $SOCKSRC netinet6 rump_server_start $SOCKDST netinet6
CVS commit: src/tests/net/ndp
Module Name:src Committed By: ozaki-r Date: Fri Jan 7 03:07:41 UTC 2022 Modified Files: src/tests/net/ndp: t_ndp.sh Log Message: tests: skip ndp_cache_state on qemu To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 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.
CVS commit: src/tests/net/ipsec
Module Name:src Committed By: msaitoh Date: Sun Dec 5 02:49:21 UTC 2021 Modified Files: src/tests/net/ipsec: algorithms.sh Log Message: s/encript/encrypt/ in comment. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/tests/net/ipsec/algorithms.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/algorithms.sh diff -u src/tests/net/ipsec/algorithms.sh:1.6 src/tests/net/ipsec/algorithms.sh:1.7 --- src/tests/net/ipsec/algorithms.sh:1.6 Fri Oct 27 04:31:50 2017 +++ src/tests/net/ipsec/algorithms.sh Sun Dec 5 02:49:21 2021 @@ -1,4 +1,4 @@ -# $NetBSD: algorithms.sh,v 1.6 2017/10/27 04:31:50 ozaki-r Exp $ +# $NetBSD: algorithms.sh,v 1.7 2021/12/05 02:49:21 msaitoh Exp $ # # Copyright (c) 2017 Internet Initiative Japan Inc. # All rights reserved. @@ -29,7 +29,7 @@ ESP_ENCRYPTION_ALGORITHMS="des-cbc 3des- des-deriv rijndael-cbc aes-ctr camellia-cbc aes-gcm-16 aes-gmac" ESP_ENCRYPTION_ALGORITHMS_MINIMUM="null rijndael-cbc" -# Valid key lengths of ESP encription algorithms +# Valid key lengths of ESP encryption algorithms #des-cbc 64 #3des-cbc192 #null0 to 2048 XXX only accept 0 length
CVS commit: src/tests/net/ipsec
Module Name:src Committed By: msaitoh Date: Sun Dec 5 02:49:21 UTC 2021 Modified Files: src/tests/net/ipsec: algorithms.sh Log Message: s/encript/encrypt/ in comment. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/tests/net/ipsec/algorithms.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/net/if_wg
Module Name:src Committed By: gson Date: Fri Nov 26 20:02:35 UTC 2021 Modified Files: src/tests/net/if_wg: t_misc.sh Log Message: The wg_handshake_timeout test case was failing because it contained atf_fail "failed to trigger PR kern/56252" without a corresponding atf_expect_fail "PR kern/56252", which makes no sense. Since the test case does occasionally fail on real hardware, fix this by adding the atf_expect_fail rather than by removing the atf_fail. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 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.10 src/tests/net/if_wg/t_misc.sh:1.11 --- src/tests/net/if_wg/t_misc.sh:1.10 Thu Jun 17 12:45:58 2021 +++ src/tests/net/if_wg/t_misc.sh Fri Nov 26 20:02:35 2021 @@ -1,4 +1,4 @@ -# $NetBSD: t_misc.sh,v 1.10 2021/06/17 12:45:58 riastradh Exp $ +# $NetBSD: t_misc.sh,v 1.11 2021/11/26 20:02:35 gson Exp $ # # Copyright (c) 2018 Ryota Ozaki # All rights reserved. @@ -198,6 +198,8 @@ wg_handshake_timeout_body() n=$(grep "$ip_local.$port > $ip_peer.$port" $outfile |wc -l) + atf_expect_fail "PR kern/56252" + # Give up handshaking after three attempts atf_check_equal $n 3
CVS commit: src/tests/net/if_wg
Module Name:src Committed By: gson Date: Fri Nov 26 20:02:35 UTC 2021 Modified Files: src/tests/net/if_wg: t_misc.sh Log Message: The wg_handshake_timeout test case was failing because it contained atf_fail "failed to trigger PR kern/56252" without a corresponding atf_expect_fail "PR kern/56252", which makes no sense. Since the test case does occasionally fail on real hardware, fix this by adding the atf_expect_fail rather than by removing the atf_fail. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 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.
CVS commit: src/tests/net/if
Module Name:src Committed By: gson Date: Fri Nov 26 15:45:52 UTC 2021 Modified Files: src/tests/net/if: t_compat.c Log Message: Delete trailing whitespace To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/tests/net/if/t_compat.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/if/t_compat.c diff -u src/tests/net/if/t_compat.c:1.4 src/tests/net/if/t_compat.c:1.5 --- src/tests/net/if/t_compat.c:1.4 Sat Nov 12 15:12:59 2016 +++ src/tests/net/if/t_compat.c Fri Nov 26 15:45:52 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: t_compat.c,v 1.4 2016/11/12 15:12:59 kre Exp $ */ +/* $NetBSD: t_compat.c,v 1.5 2021/11/26 15:45:52 gson Exp $ */ #include #include @@ -25,9 +25,9 @@ struct oifreq { struct sockaddr ifru_addr; struct sockaddr ifru_dstaddr; struct sockaddr ifru_broadaddr; -short ifru_flags; +short ifru_flags; int ifru_metric; -int ifru_mtu; +int ifru_mtu; int ifru_dlt; u_int ifru_value; void * ifru_data; @@ -36,7 +36,7 @@ struct oifreq { void*b_buf; } ifru_b; } ifr_ifru; -}; +}; #define OOSIOCGIFBRDADDR _IOWR('i', 18, struct oifreq) ATF_TC(OOSIOCGIFBRDADDR);
CVS commit: src/tests/net/if
Module Name:src Committed By: gson Date: Fri Nov 26 15:45:52 UTC 2021 Modified Files: src/tests/net/if: t_compat.c Log Message: Delete trailing whitespace To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/tests/net/if/t_compat.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/net
Module Name:src Committed By: hannken Date: Thu Nov 25 14:17:22 UTC 2021 Modified Files: src/tests/net: net_common.sh src/tests/net/mpls: t_ldp_regen.sh src/tests/net/net: t_ipv6_lifetime.sh Log Message: Consistently use "drvctl -l qemufwcfg0" to check if running under qemu in general. To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 src/tests/net/net_common.sh cvs rdiff -u -r1.10 -r1.11 src/tests/net/mpls/t_ldp_regen.sh cvs rdiff -u -r1.6 -r1.7 src/tests/net/net/t_ipv6_lifetime.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.42 src/tests/net/net_common.sh:1.43 --- src/tests/net/net_common.sh:1.42 Fri Jul 9 05:54:11 2021 +++ src/tests/net/net_common.sh Thu Nov 25 14:17:22 2021 @@ -1,4 +1,4 @@ -# $NetBSD: net_common.sh,v 1.42 2021/07/09 05:54:11 yamaguchi Exp $ +# $NetBSD: net_common.sh,v 1.43 2021/11/25 14:17:22 hannken Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -537,7 +537,7 @@ dump() skip_if_qemu() { - if sysctl machdep.cpu_brand 2>/dev/null | grep QEMU >/dev/null 2>&1 + if drvctl -l qemufwcfg0 >/dev/null 2>&1 then atf_skip "unreliable under qemu, skip until PR kern/43997 fixed" fi Index: src/tests/net/mpls/t_ldp_regen.sh diff -u src/tests/net/mpls/t_ldp_regen.sh:1.10 src/tests/net/mpls/t_ldp_regen.sh:1.11 --- src/tests/net/mpls/t_ldp_regen.sh:1.10 Wed Apr 1 01:51:02 2020 +++ src/tests/net/mpls/t_ldp_regen.sh Thu Nov 25 14:17:22 2021 @@ -1,4 +1,4 @@ -# $NetBSD: t_ldp_regen.sh,v 1.10 2020/04/01 01:51:02 christos Exp $ +# $NetBSD: t_ldp_regen.sh,v 1.11 2021/11/25 14:17:22 hannken Exp $ # # Copyright (c) 2013 The NetBSD Foundation, Inc. # All rights reserved. @@ -139,7 +139,7 @@ wait_ldp_ok() { ldp_regen_body() { -if sysctl machdep.cpu_brand 2>/dev/null | grep QEMU >/dev/null 2>&1 + if drvctl -l qemufwcfg0 >/dev/null 2>&1 then atf_skip "unreliable under qemu, skip until PR kern/43997 fixed" fi Index: src/tests/net/net/t_ipv6_lifetime.sh diff -u src/tests/net/net/t_ipv6_lifetime.sh:1.6 src/tests/net/net/t_ipv6_lifetime.sh:1.7 --- src/tests/net/net/t_ipv6_lifetime.sh:1.6 Fri Nov 25 08:51:17 2016 +++ src/tests/net/net/t_ipv6_lifetime.sh Thu Nov 25 14:17:22 2021 @@ -1,4 +1,4 @@ -# $NetBSD: t_ipv6_lifetime.sh,v 1.6 2016/11/25 08:51:17 ozaki-r Exp $ +# $NetBSD: t_ipv6_lifetime.sh,v 1.7 2021/11/25 14:17:22 hannken Exp $ # # Copyright (c) 2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -97,7 +97,7 @@ basic_body() atf_check -s exit:0 -o match:'pltime' rump.ifconfig -L shmif0 atf_check -s exit:0 -o match:'vltime' rump.ifconfig -L shmif0 - if sysctl machdep.cpu_brand 2>/dev/null | grep QEMU >/dev/null 2>&1 + if drvctl -l qemufwcfg0 >/dev/null 2>&1 then atf_check -s exit:0 rump.ifconfig shmif0 inet6 $ip delete atf_skip "unreliable under qemu, skip until PR kern/43997 fixed"
CVS commit: src/tests/net
Module Name:src Committed By: hannken Date: Thu Nov 25 14:17:22 UTC 2021 Modified Files: src/tests/net: net_common.sh src/tests/net/mpls: t_ldp_regen.sh src/tests/net/net: t_ipv6_lifetime.sh Log Message: Consistently use "drvctl -l qemufwcfg0" to check if running under qemu in general. To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 src/tests/net/net_common.sh cvs rdiff -u -r1.10 -r1.11 src/tests/net/mpls/t_ldp_regen.sh cvs rdiff -u -r1.6 -r1.7 src/tests/net/net/t_ipv6_lifetime.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/net/net
Module Name:src Committed By: rin Date: Mon Nov 8 10:57:09 UTC 2021 Modified Files: src/tests/net/net: t_tcp.c Log Message: Fix (a kind of) violation of strict aliasing rule. Due to the rule, "sin" and "sin6" can be treated as restrict pointers. Compilers seem to be confused by structure copy for those pointed by them before assignments. For aarch64eb, GCC 9 and 10 compile t_tcp.c rev 1.11 into a code, where fetch for "sin6->sin6_port" is preceding the structure copy "ss = bs". This results in failure of connect(2) with EADDRNOOTAVAIL. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/tests/net/net/t_tcp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/net/net
Module Name:src Committed By: rin Date: Mon Nov 8 10:57:09 UTC 2021 Modified Files: src/tests/net/net: t_tcp.c Log Message: Fix (a kind of) violation of strict aliasing rule. Due to the rule, "sin" and "sin6" can be treated as restrict pointers. Compilers seem to be confused by structure copy for those pointed by them before assignments. For aarch64eb, GCC 9 and 10 compile t_tcp.c rev 1.11 into a code, where fetch for "sin6->sin6_port" is preceding the structure copy "ss = bs". This results in failure of connect(2) with EADDRNOOTAVAIL. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/tests/net/net/t_tcp.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_tcp.c diff -u src/tests/net/net/t_tcp.c:1.11 src/tests/net/net/t_tcp.c:1.12 --- src/tests/net/net/t_tcp.c:1.11 Sat Oct 26 23:08:27 2019 +++ src/tests/net/net/t_tcp.c Mon Nov 8 10:57:09 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: t_tcp.c,v 1.11 2019/10/26 23:08:27 christos Exp $ */ +/* $NetBSD: t_tcp.c,v 1.12 2021/11/08 10:57:09 rin Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ #include #ifdef __RCSID -__RCSID("$Id: t_tcp.c,v 1.11 2019/10/26 23:08:27 christos Exp $"); +__RCSID("$Id: t_tcp.c,v 1.12 2021/11/08 10:57:09 rin Exp $"); #endif /* Example code. Should block; does with accept not accept4_. */ @@ -139,15 +139,14 @@ accept_test(sa_family_t sfamily, sa_fami FAIL("socket"); if (sfamily == AF_INET6 && cfamily == AF_INET) { - ss = bs; - sin6 = (void *) + in_port_t port = ((struct sockaddr_in6 *))->sin6_port; sin = (void *) addrlen = sizeof(*sin); #ifdef BSD4_4 sin->sin_len = sizeof(*sin); #endif sin->sin_family = AF_INET; - sin->sin_port = sin6->sin6_port; + sin->sin_port = port; sin->sin_addr.s_addr = htonl(INADDR_LOOPBACK); }
CVS commit: src/tests/net/if_lagg
Module Name:src Committed By: yamaguchi Date: Mon Nov 8 06:24:11 UTC 2021 Modified Files: src/tests/net/if_lagg: t_lagg.sh Log Message: Added tests for lagg(4) about MAC addresses To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 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.5 src/tests/net/if_lagg/t_lagg.sh:1.6 --- src/tests/net/if_lagg/t_lagg.sh:1.5 Tue Nov 2 01:57:16 2021 +++ src/tests/net/if_lagg/t_lagg.sh Mon Nov 8 06:24:11 2021 @@ -1,4 +1,4 @@ -# $NetBSD: t_lagg.sh,v 1.5 2021/11/02 01:57:16 yamaguchi Exp $ +# $NetBSD: t_lagg.sh,v 1.6 2021/11/08 06:24:11 yamaguchi Exp $ # # Copyright (c) 2021 Internet Initiative Japan Inc. # All rights reserved. @@ -228,6 +228,7 @@ lagg_macaddr_head() lagg_macaddr_body() { local atf_ifconfig="atf_check -s exit:0 rump.ifconfig" + local lnkaddr0="02:00:00:00:00:01" # 02: I/G = 0, G/L = 1 rump_server_start $SOCK_HOST0 lagg @@ -242,26 +243,68 @@ lagg_macaddr_body() $atf_ifconfig lagg0 laggproto lacp + # + # Copy MAC address from shmif0 that is + # the first port to lagg. + # (laggport: (none) => shmif0) + # $atf_ifconfig lagg0 laggport shmif0 atf_check -s exit:0 -o match:$maddr0 rump.ifconfig lagg0 + atf_check -s exit:0 -o match:$maddr0 rump.ifconfig shmif0 + # + # Copy MAC address assigned to lagg0 to shmif1 + # (laggport: shmif0 => shmif0, shmif1) + # $atf_ifconfig lagg0 laggport shmif1 atf_check -s exit:0 -o match:$maddr0 rump.ifconfig lagg0 atf_check -s exit:0 -o match:$maddr0 rump.ifconfig shmif1 + # + # Change MAC address on the detaching + # the first port (shmif0) from lagg0 + # (laggport: shmif0, shmif1 => shmif1) + # $atf_ifconfig lagg0 -laggport shmif0 atf_check -s exit:0 -o match:$maddr1 rump.ifconfig lagg0 atf_check -s exit:0 -o match:$maddr0 rump.ifconfig shmif0 + atf_check -s exit:0 -o match:$maddr1 rump.ifconfig shmif1 + # + # Copy lagg0's MAC address to shmif0 even if + # lagg0 had used shmif0's MAC address + # (laggport: shmif1 => shmif1, shmif0) + # $atf_ifconfig lagg0 laggport shmif0 atf_check -s exit:0 -o match:$maddr1 rump.ifconfig lagg0 atf_check -s exit:0 -o match:$maddr1 rump.ifconfig shmif0 + # + # should not change MAC address of lagg0 on detaching + # shmif0 that copied mac address from lagg0 + # (laggport: shmif1, shmif0 => shmif1) + # $atf_ifconfig lagg0 -laggport shmif0 + atf_check -s exit:0 -o match:$maddr1 rump.ifconfig lagg0 atf_check -s exit:0 -o match:$maddr0 rump.ifconfig shmif0 + # + # Use the generated MAC address + # when all port detached from lagg0 + # (laggport: shmif1 => (none)) $atf_ifconfig lagg0 -laggport shmif1 atf_check -s exit:0 -o match:$maddr rump.ifconfig lagg0 + + # + # Copy the active MAC address from shmif0 to lagg0 + # when shmif0 has two MAC addresses + # + $atf_ifconfig shmif0 link $lnkaddr0 + $atf_ifconfig lagg0 laggport shmif0 + atf_check -s exit:0 -o match:$maddr0 rump.ifconfig lagg0 + atf_check -s exit:0 -o not-match:$lnkaddr0 rump.ifconfig lagg0 + atf_check -s exit:0 -o match:$maddr0 rump.ifconfig shmif0 + atf_check -s exit:0 -o match:$lnkaddr0 rump.ifconfig shmif0 } lagg_macaddr_cleanup()
CVS commit: src/tests/net/if_lagg
Module Name:src Committed By: yamaguchi Date: Mon Nov 8 06:24:11 UTC 2021 Modified Files: src/tests/net/if_lagg: t_lagg.sh Log Message: Added tests for lagg(4) about MAC addresses To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 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.
CVS commit: src/tests/net/if_lagg
Module Name:src Committed By: yamaguchi Date: Tue Nov 2 01:57:16 UTC 2021 Modified Files: src/tests/net/if_lagg: t_lagg.sh Log Message: Added tests of combination of lagg(4), vlan(4), and l2tp(4) To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 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.4 src/tests/net/if_lagg/t_lagg.sh:1.5 --- src/tests/net/if_lagg/t_lagg.sh:1.4 Tue Nov 2 01:42:26 2021 +++ src/tests/net/if_lagg/t_lagg.sh Tue Nov 2 01:57:16 2021 @@ -1,4 +1,4 @@ -# $NetBSD: t_lagg.sh,v 1.4 2021/11/02 01:42:26 yamaguchi Exp $ +# $NetBSD: t_lagg.sh,v 1.5 2021/11/02 01:57:16 yamaguchi Exp $ # # Copyright (c) 2021 Internet Initiative Japan Inc. # All rights reserved. @@ -640,6 +640,7 @@ lagg_lacp_vlan() local atf_ifconfig="atf_check -s exit:0 rump.ifconfig" local af=$1 + local l2proto=$2 local atf_ping="atf_check -s exit:0 -o ignore rump.ping -c 1" local rumplib="vlan" local pfx=24 @@ -664,6 +665,19 @@ lagg_lacp_vlan() ;; esac + case $l2proto in + "ether") + iface0=shmif0 + iface1=shmif1 + iface2=shmif2 + ;; + "l2tp") + rumplib="$rumplib l2tp" + iface0=l2tp0 + iface1=l2tp1 + iface2=l2tp2 + esac + rump_server_start $SOCK_HOST0 lagg $rumplib rump_server_start $SOCK_HOST1 lagg $rumplib @@ -675,16 +689,20 @@ lagg_lacp_vlan() rump_server_add_iface $SOCK_HOST1 shmif1 $BUS1 rump_server_add_iface $SOCK_HOST1 shmif2 $BUS2 + if [ x"$l2proto" = x"l2tp" ]; then + setup_l2tp_ipv4tunnel + fi + export RUMP_SERVER=$SOCK_HOST0 $atf_ifconfig lagg0 create - $atf_ifconfig lagg0 laggproto lacp laggport shmif0 - $atf_ifconfig shmif0 up + $atf_ifconfig lagg0 laggproto lacp laggport $iface0 + $atf_ifconfig $iface0 up $atf_ifconfig lagg0 up export RUMP_SERVER=$SOCK_HOST1 $atf_ifconfig lagg0 create - $atf_ifconfig lagg0 laggproto lacp laggport shmif0 - $atf_ifconfig shmif0 up + $atf_ifconfig lagg0 laggproto lacp laggport $iface0 + $atf_ifconfig $iface0 up $atf_ifconfig lagg0 up export RUMP_SERVER=$SOCK_HOST0 @@ -720,18 +738,18 @@ lagg_lacp_vlan() $atf_ping $host1addr0 $atf_ping $host1addr1 - $atf_ifconfig lagg0 laggport shmif1 - $atf_ifconfig shmif1 up + $atf_ifconfig lagg0 laggport $iface1 + $atf_ifconfig $iface1 up export RUMP_SERVER=$SOCK_HOST1 - $atf_ifconfig lagg0 laggport shmif1 - $atf_ifconfig shmif1 up + $atf_ifconfig lagg0 laggport $iface1 + $atf_ifconfig $iface1 up export RUMP_SERVER=$SOCK_HOST0 - wait_for_distributing lagg0 shmif1 + wait_for_distributing lagg0 $iface1 export RUMP_SERVER=$SOCK_HOST1 - wait_for_distributing lagg0 shmif1 + wait_for_distributing lagg0 $iface1 $atf_ping $host0addr0 $atf_ping $host0addr1 @@ -748,7 +766,7 @@ lagg_lacp_vlan_ipv4_head() lagg_lacp_vlan_ipv4_body() { - lagg_lacp_vlan "inet" + lagg_lacp_vlan "inet" "ether" } lagg_lacp_vlan_ipv4_cleanup() @@ -768,7 +786,7 @@ lagg_lacp_vlan_ipv6_head() lagg_lacp_vlan_ipv6_body() { - lagg_lacp_vlan "inet6" + lagg_lacp_vlan "inet6" "ether" } lagg_lacp_vlan_ipv6_cleanup() @@ -777,6 +795,48 @@ lagg_lacp_vlan_ipv6_cleanup() cleanup } +atf_test_case lagg_lacp_vlanl2tp_ipv4 cleanup +lagg_lacp_vlanl2tp_ipv4_head() +{ + + atf_set "descr" "tests for IPv4 VLAN frames over LACP L2TP LAG" + atf_set "require.progs" "rump_server" +} + +lagg_lacp_vlanl2tp_ipv4_body() +{ + + lagg_lacp_vlan "inet" "l2tp" +} + +lagg_lacp_vlanl2tp_ipv4_cleanup() +{ + + $DEBUG && dump + cleanup +} + +atf_test_case lagg_lacp_vlanl2tp_ipv6 cleanup +lagg_lacp_vlanl2tp_ipv6_head() +{ + + atf_set "descr" "tests for IPv6 VLAN frames over LACP L2TP LAG" + atf_set "require.progs" "rump_server" +} + +lagg_lacp_vlanl2tp_ipv6_body() +{ + + lagg_lacp_vlan "inet6" "l2tp" +} + +lagg_lacp_vlanl2tp_ipv6_cleanup() +{ + + $DEBUG && dump + cleanup +} + atf_test_case lagg_lacp_portpri cleanup lagg_lacp_portpri_head() { @@ -1288,6 +1348,8 @@ atf_init_test_cases() atf_add_test_case lagg_lacp_l2tp_ipv6 atf_add_test_case lagg_lacp_vlan_ipv4 atf_add_test_case lagg_lacp_vlan_ipv6 + atf_add_test_case lagg_lacp_vlanl2tp_ipv4 + atf_add_test_case lagg_lacp_vlanl2tp_ipv6 atf_add_test_case lagg_lacp_portpri atf_add_test_case lagg_failover_ipv4 atf_add_test_case lagg_failover_ipv6
CVS commit: src/tests/net/if_lagg
Module Name:src Committed By: yamaguchi Date: Tue Nov 2 01:57:16 UTC 2021 Modified Files: src/tests/net/if_lagg: t_lagg.sh Log Message: Added tests of combination of lagg(4), vlan(4), and l2tp(4) To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 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.
CVS commit: src/tests/net/if_lagg
Module Name:src Committed By: yamaguchi Date: Tue Nov 2 01:42:26 UTC 2021 Modified Files: src/tests/net/if_lagg: t_lagg.sh Log Message: Use IPv6 addresses, not IPv4, in combination test of IPv6, lagg and vlan To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 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.3 src/tests/net/if_lagg/t_lagg.sh:1.4 --- src/tests/net/if_lagg/t_lagg.sh:1.3 Tue Oct 19 07:57:15 2021 +++ src/tests/net/if_lagg/t_lagg.sh Tue Nov 2 01:42:26 2021 @@ -1,4 +1,4 @@ -# $NetBSD: t_lagg.sh,v 1.3 2021/10/19 07:57:15 yamaguchi Exp $ +# $NetBSD: t_lagg.sh,v 1.4 2021/11/02 01:42:26 yamaguchi Exp $ # # Copyright (c) 2021 Internet Initiative Japan Inc. # All rights reserved. @@ -655,7 +655,7 @@ lagg_lacp_vlan() ;; "inet6") atf_ping="atf_check -s exit:0 -o ignore rump.ping6 -c 1" - rumplib="netinet6" + rumplib="$rumplib netinet6" pfx=64 host0addr0=$IP6ADDR0 host1addr0=$IP6ADDR1 @@ -768,7 +768,7 @@ lagg_lacp_vlan_ipv6_head() lagg_lacp_vlan_ipv6_body() { - lagg_lacp_vlan "inet" + lagg_lacp_vlan "inet6" } lagg_lacp_vlan_ipv6_cleanup()
CVS commit: src/tests/net/if_lagg
Module Name:src Committed By: yamaguchi Date: Tue Nov 2 01:42:26 UTC 2021 Modified Files: src/tests/net/if_lagg: t_lagg.sh Log Message: Use IPv6 addresses, not IPv4, in combination test of IPv6, lagg and vlan To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 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.
CVS commit: src/tests/net/if_lagg
Module Name:src Committed By: yamaguchi Date: Tue Oct 19 07:57:15 UTC 2021 Modified Files: src/tests/net/if_lagg: t_lagg.sh Log Message: added test cases for lagg(4) on l2tp(4) To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 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.
CVS commit: src/tests/net/if_lagg
Module Name:src Committed By: yamaguchi Date: Tue Oct 19 07:57:15 UTC 2021 Modified Files: src/tests/net/if_lagg: t_lagg.sh Log Message: added test cases for lagg(4) on l2tp(4) To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 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.2 src/tests/net/if_lagg/t_lagg.sh:1.3 --- src/tests/net/if_lagg/t_lagg.sh:1.2 Tue May 25 00:38:30 2021 +++ src/tests/net/if_lagg/t_lagg.sh Tue Oct 19 07:57:15 2021 @@ -1,4 +1,4 @@ -# $NetBSD: t_lagg.sh,v 1.2 2021/05/25 00:38:30 yamaguchi Exp $ +# $NetBSD: t_lagg.sh,v 1.3 2021/10/19 07:57:15 yamaguchi Exp $ # # Copyright (c) 2021 Internet Initiative Japan Inc. # All rights reserved. @@ -85,6 +85,59 @@ expected_inactive() rump.ifconfig ${if_lagg} } +setup_l2tp_ipv4tunnel() +{ + local atf_ifconfig="atf_check -s exit:0 rump.ifconfig" + + local a_addr0=10.0.0.1 + local a_addr1=10.0.0.2 + local b_addr0=10.0.1.1 + local b_addr1=10.0.1.2 + local c_addr0=10.0.2.1 + local c_addr1=10.0.2.2 + + local a_session0=1001 + local a_session1=1002 + local b_session0=1011 + local b_session1=1012 + local c_session0=1021 + local c_session1=1022 + + rump_server_add_iface $SOCK_HOST0 l2tp0 + rump_server_add_iface $SOCK_HOST0 l2tp1 + rump_server_add_iface $SOCK_HOST0 l2tp2 + rump_server_add_iface $SOCK_HOST1 l2tp0 + rump_server_add_iface $SOCK_HOST1 l2tp1 + rump_server_add_iface $SOCK_HOST1 l2tp2 + + + export RUMP_SERVER=$SOCK_HOST0 + $atf_ifconfig shmif0 $a_addr0/24 + $atf_ifconfig l2tp0 tunnel $a_addr0$a_addr1 + $atf_ifconfig l2tp0 session $a_session0 $a_session1 + + $atf_ifconfig shmif1 $b_addr0/24 + $atf_ifconfig l2tp1 tunnel $b_addr0$b_addr1 + $atf_ifconfig l2tp1 session $b_session0 $b_session1 + + $atf_ifconfig shmif2 $c_addr0/24 + $atf_ifconfig l2tp2 tunnel $c_addr0$c_addr1 + $atf_ifconfig l2tp2 session $c_session0 $c_session1 + + export RUMP_SERVER=$SOCK_HOST1 + $atf_ifconfig shmif0 $a_addr1/24 + $atf_ifconfig l2tp0 tunnel $a_addr1$a_addr0 + $atf_ifconfig l2tp0 session $a_session1 $a_session0 + + $atf_ifconfig shmif1 $b_addr1/24 + $atf_ifconfig l2tp1 tunnel $b_addr1$b_addr0 + $atf_ifconfig l2tp1 session $b_session1 $b_session0 + + $atf_ifconfig shmif2 $c_addr1/24 + $atf_ifconfig l2tp2 tunnel $c_addr1$c_addr0 + $atf_ifconfig l2tp2 session $c_session1 $c_session0 +} + atf_test_case lagg_ifconfig cleanup lagg_ifconfig_head() { @@ -403,6 +456,7 @@ lagg_lacp_ping() local atf_ifconfig="atf_check -s exit:0 rump.ifconfig" local af=$1 + local l2proto=$2 local atf_ping="atf_check -s exit:0 -o ignore rump.ping -c 1" local ping=rump.ping local rumplib="" @@ -423,6 +477,20 @@ lagg_lacp_ping() ;; esac + case $l2proto in + "ether") + iface0=shmif0 + iface1=shmif1 + iface2=shmif2 + ;; + "l2tp") + rumplib="$rumplib l2tp" + iface0=l2tp0 + iface1=l2tp1 + iface2=l2tp2 + ;; + esac + rump_server_start $SOCK_HOST0 lagg $rumplib rump_server_start $SOCK_HOST1 lagg $rumplib @@ -434,18 +502,22 @@ lagg_lacp_ping() rump_server_add_iface $SOCK_HOST1 shmif1 $BUS1 rump_server_add_iface $SOCK_HOST1 shmif2 $BUS2 + if [ x"$l2proto" = x"l2tp" ];then + setup_l2tp_ipv4tunnel + fi + export RUMP_SERVER=$SOCK_HOST0 $atf_ifconfig lagg0 create - $atf_ifconfig lagg0 laggproto lacp laggport shmif0 + $atf_ifconfig lagg0 laggproto lacp laggport $iface0 $atf_ifconfig lagg0 $af $addr_host0/$pfx - $atf_ifconfig shmif0 up + $atf_ifconfig $iface0 up $atf_ifconfig lagg0 up export RUMP_SERVER=$SOCK_HOST1 $atf_ifconfig lagg0 create - $atf_ifconfig lagg0 laggproto lacp laggport shmif0 + $atf_ifconfig lagg0 laggproto lacp laggport $iface0 $atf_ifconfig lagg0 $af $addr_host1/$pfx - $atf_ifconfig shmif0 up + $atf_ifconfig $iface0 up $atf_ifconfig lagg0 up export RUMP_SERVER=$SOCK_HOST0 @@ -459,22 +531,22 @@ lagg_lacp_ping() $atf_ping $addr_host0 export RUMP_SERVER=$SOCK_HOST0 - $atf_ifconfig shmif1 up - $atf_ifconfig lagg0 laggport shmif1 laggport shmif2 - $atf_ifconfig shmif2 up + $atf_ifconfig $iface1 up + $atf_ifconfig lagg0 laggport $iface1 laggport $iface2 + $atf_ifconfig $iface2 up export RUMP_SERVER=$SOCK_HOST1 - $atf_ifconfig shmif1 up - $atf_ifconfig lagg0 laggport shmif1 laggport shmif2 - $atf_ifconfig shmif2 up + $atf_ifconfig $iface1 up + $atf_ifconfig lagg0 laggport $iface1 laggport $iface2 + $atf_ifconfig $iface2 up export RUMP_SERVER=$SOCK_HOST0 - wait_for_distributing lagg0 shmif1 - wait_for_distributing lagg0 shmif2 + wait_for_distributing lagg0 $iface1 + wait_for_distributing lagg0 $iface2 export RUMP_SERVER=$SOCK_HOST1 - wait_for_distributing lagg0 shmif1 - wait_for_distributing lagg0 shmif2 + wait_for_distributing lagg0 $iface1 + wait_for_distributing lagg0 $iface2 $atf_ping $addr_host0 } @@ -490,7 +562,7 @@
CVS commit: src/tests/net/if_vlan
Module Name:src Committed By: yamaguchi Date: Thu Aug 19 03:36:42 UTC 2021 Modified Files: src/tests/net/if_vlan: siocXmulti.c Log Message: Added description of license To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/net/if_vlan/siocXmulti.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/if_vlan/siocXmulti.c diff -u src/tests/net/if_vlan/siocXmulti.c:1.2 src/tests/net/if_vlan/siocXmulti.c:1.3 --- src/tests/net/if_vlan/siocXmulti.c:1.2 Sun Oct 13 07:46:16 2019 +++ src/tests/net/if_vlan/siocXmulti.c Thu Aug 19 03:36:42 2021 @@ -1,3 +1,33 @@ +/* $NetBSD: siocXmulti.c,v 1.3 2021/08/19 03:36:42 yamaguchi Exp $ */ + +/* + * Copyright (c) 2021 Internet Initiative Japan Inc. + * All rights reserved. + * + * 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. + */ + +#include +__RCSID("$NetBSD: siocXmulti.c,v 1.3 2021/08/19 03:36:42 yamaguchi Exp $"); #include #include
CVS commit: src/tests/net/if_vlan
Module Name:src Committed By: yamaguchi Date: Thu Aug 19 03:36:42 UTC 2021 Modified Files: src/tests/net/if_vlan: siocXmulti.c Log Message: Added description of license To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/net/if_vlan/siocXmulti.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/net/if_vlan
Module Name:src Committed By: yamaguchi Date: Thu Aug 19 03:27:05 UTC 2021 Modified Files: src/tests/net/if_vlan: Makefile bpfopen.c t_vlan.sh Log Message: Make the test program run in background after doing BIOCPROMISC t_vlan has rarely failed by checking IFF_PROMISC before the test program do BIOCPROMISC. To solve this, BIOCPROMISC is done in the foreground. fixes PR/56357 To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/net/if_vlan/Makefile cvs rdiff -u -r1.1 -r1.2 src/tests/net/if_vlan/bpfopen.c cvs rdiff -u -r1.23 -r1.24 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/Makefile diff -u src/tests/net/if_vlan/Makefile:1.3 src/tests/net/if_vlan/Makefile:1.4 --- src/tests/net/if_vlan/Makefile:1.3 Fri Jul 9 05:54:11 2021 +++ src/tests/net/if_vlan/Makefile Thu Aug 19 03:27:05 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.3 2021/07/09 05:54:11 yamaguchi Exp $ +# $NetBSD: Makefile,v 1.4 2021/08/19 03:27:05 yamaguchi Exp $ # .include @@ -17,5 +17,7 @@ BINDIR.siocXmulti= ${TESTSDIR} PROGS+= bpfopen MAN.bpfopen= #empty BINDIR.bpfopen= ${TESTSDIR} +DPADD.bpfopen+= ${LIBUTIL} +LDADD.bpfopen+= -lutil .include Index: src/tests/net/if_vlan/bpfopen.c diff -u src/tests/net/if_vlan/bpfopen.c:1.1 src/tests/net/if_vlan/bpfopen.c:1.2 --- src/tests/net/if_vlan/bpfopen.c:1.1 Fri Jul 9 05:54:11 2021 +++ src/tests/net/if_vlan/bpfopen.c Thu Aug 19 03:27:05 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: bpfopen.c,v 1.1 2021/07/09 05:54:11 yamaguchi Exp $ */ +/* $NetBSD: bpfopen.c,v 1.2 2021/08/19 03:27:05 yamaguchi Exp $ */ /* * Copyright (c) 2021 Internet Initiative Japan Inc. @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: bpfopen.c,v 1.1 2021/07/09 05:54:11 yamaguchi Exp $"); +__RCSID("$NetBSD: bpfopen.c,v 1.2 2021/08/19 03:27:05 yamaguchi Exp $"); #include #include @@ -45,6 +45,8 @@ __RCSID("$NetBSD: bpfopen.c,v 1.1 2021/0 #include #include +#include + enum { ARG_PROG = 0, ARG_HOST, @@ -58,16 +60,25 @@ enum { }; static void sighandler(int); - -static sig_atomic_t quit; +static void log_debug(const char *, ...) __printflike(1, 2); +static int bpf_open(void); +static void bpf_close(int); +static void bpf_read(int); + +static sig_atomic_t quit; +static bool daemonize = false; +static int verbose = 0; +static const char *path_pid = "/var/run/bpfopen.pid"; +static const char *path_bpf = "/dev/bpf"; +static const char *ifname = NULL; static void usage(void) { - fprintf(stderr, "%s {-r|-h} \n" - "\t-r: rump_server\n" - "\t-h: host\n", + fprintf(stderr, "%s [-vd] [-p pidfile] [-b devbpf ] \n" + "\t-v: verbose\n" + "\t-d: daemon mode\n", getprogname()); exit(1); } @@ -75,42 +86,146 @@ usage(void) int main(int argc, char *argv[]) { - struct ifreq ifr; - struct pollfd pfd[PFD_NUM]; - const char *bpf_path; - int n, bpfd, nfds; - size_t bufsiz; - char *buf; + int bpfd; + int ch; - if (argc != ARG_NUM) + while ((ch = getopt(argc, argv, "b:dp:v")) != -1) { + switch (ch) { + case 'b': + path_bpf = optarg; + break; + case 'd': + daemonize = true; + break; + case 'p': + path_pid = optarg; + break; + case 'v': + verbose++; + break; + default: + usage(); + } + } + + argc -= optind; + argv += optind; + + if (argc != 1) usage(); - if (strcmp(argv[ARG_HOST], "-h") == 0) { - bpf_path = "/dev/bpf"; - } else if (strcmp(argv[ARG_HOST], "-r") == 0){ - bpf_path = "/rump/dev/bpf"; - } else { - errx(1, "-r or -h"); - } + ifname = argv[0]; - bpfd = open(bpf_path, O_RDONLY); + bpfd = bpf_open(); if (bpfd < 0) - err(1, "open %s", bpf_path); + err(1, "bpf_open"); + log_debug("bpf opened"); + + if (daemonize) { + if (daemon(1, 1) != 0) { + bpf_close(bpfd); + err(1, "daemon"); + } + log_debug("daemonized"); + + if (pidfile(path_pid) != 0) { + bpf_close(bpfd); + err(1, "pidfile"); + } + } + + bpf_read(bpfd); + bpf_close(bpfd); + if (daemonize) + pidfile_clean(); + + return 0; +} + +static void +sighandler(int signo) +{ + + quit = 1; +} + +static void +log_debug(const char *fmt, ...) +{ + va_list ap; + + if (verbose <= 0) + return; + + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + + fprintf(stderr, "\n"); +} + +static int +bpf_open(void) +{ + struct ifreq ifr; + int bpfd; + + bpfd = open(path_bpf, O_RDONLY); + if (bpfd < 0) { + log_debug("open: %s", strerror(errno)); + return -1; + } memset(, 0, sizeof(ifr)); - strlcpy(ifr.ifr_name, argv[ARG_IFNAME], - sizeof(ifr.ifr_name)); - if (ioctl(bpfd, BIOCSETIF, ) != 0) - err(1, "BIOCSETIF"); - if (ioctl(bpfd, BIOCPROMISC, NULL) != 0) - err(1, "BIOCPROMISC"); - if (ioctl(bpfd, BIOCGBLEN, ) != 0) - err(1, "BIOCGBLEN"); + strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); + + if (ioctl(bpfd, BIOCSETIF, ) != 0) { + log_debug("BIOCSETIF: %s", strerror(errno)); + goto
CVS commit: src/tests/net/if_vlan
Module Name:src Committed By: yamaguchi Date: Thu Aug 19 03:27:05 UTC 2021 Modified Files: src/tests/net/if_vlan: Makefile bpfopen.c t_vlan.sh Log Message: Make the test program run in background after doing BIOCPROMISC t_vlan has rarely failed by checking IFF_PROMISC before the test program do BIOCPROMISC. To solve this, BIOCPROMISC is done in the foreground. fixes PR/56357 To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/net/if_vlan/Makefile cvs rdiff -u -r1.1 -r1.2 src/tests/net/if_vlan/bpfopen.c cvs rdiff -u -r1.23 -r1.24 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.
CVS commit: src/tests/net/if_vlan
Module Name:src Committed By: yamaguchi Date: Mon Nov 11 02:40:48 UTC 2019 Modified Files: src/tests/net/if_vlan: t_vlan.sh Log Message: atf: add test cases for MTU that is increased on SIOCSETVLAN >From t-kusaba@IIJ, thanks To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 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.
CVS commit: src/tests/net/if_vlan
Module Name:src Committed By: yamaguchi Date: Mon Nov 11 02:40:48 UTC 2019 Modified Files: src/tests/net/if_vlan: t_vlan.sh Log Message: atf: add test cases for MTU that is increased on SIOCSETVLAN >From t-kusaba@IIJ, thanks To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 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.15 src/tests/net/if_vlan/t_vlan.sh:1.16 --- src/tests/net/if_vlan/t_vlan.sh:1.15 Tue Dec 11 03:47:51 2018 +++ src/tests/net/if_vlan/t_vlan.sh Mon Nov 11 02:40:48 2019 @@ -1,4 +1,4 @@ -# $NetBSD: t_vlan.sh,v 1.15 2018/12/11 03:47:51 ozaki-r Exp $ +# $NetBSD: t_vlan.sh,v 1.16 2019/11/11 02:40:48 yamaguchi Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -33,9 +33,9 @@ IP_LOCAL1=10.0.1.1 IP_REMOTE0=10.0.0.2 IP_REMOTE1=10.0.1.2 IP_MCADDR0=224.0.0.10 -IP6_LOCAL0=fc00:0::1 +IP6_LOCAL0=fc00::1 IP6_LOCAL1=fc00:1::1 -IP6_REMOTE0=fc00:0::2 +IP6_REMOTE0=fc00::2 IP6_REMOTE1=fc00:1::2 IP6_MCADDR0=ff11::10 ETH_IP_MCADDR0=01:00:5e:00:00:0a @@ -255,6 +255,133 @@ vlan_basic6_cleanup() cleanup } +vlan_auto_follow_mtu_body_common() +{ + local atf_ifconfig="atf_check -s exit:0 rump.ifconfig" + local outfile=./out + local af=inet + local prefix=24 + local local0=$IP_LOCAL0 + local remote0=$IP_REMOTE0 + local ping_cmd="rump.ping -D -n -w 1 -c 1" + local mtu=1500 + local vlan_mtu=`expr $mtu - 4` + # ipv4 header=20bytes, icmp header=8bytes + local padding=`expr $vlan_mtu - 20 - 8` + local over_padding=`expr $vlan_mtu - 20 - 8 + 1` + local nonfrag_msg="$local0 > $remote0: ICMP echo request" + # unused for ipv4 + local frag_msg="" + + if [ x"$1" = x"inet6" ]; then + af="inet6" + prefix=64 + local0=$IP6_LOCAL0 + remote0=$IP6_REMOTE0 + # ipv6 header=40bytes, icmpv6 header=8bytes + padding=`expr $vlan_mtu - 40 - 8` + over_padding=`expr $vlan_mtu - 40 - 8 + 1` + ping_cmd="rump.ping6 -mm -n -c 1 -i 1" + nonfrag_msg="$local0 > $remote0: ICMP6, echo request" + frag_msg="$local0 > $remote0: frag .* ICMP6, echo request" + fi + + rump_server_add_iface $SOCK_LOCAL shmif0 $BUS + rump_server_add_iface $SOCK_REMOTE shmif0 $BUS + + export RUMP_SERVER=$SOCK_LOCAL + $atf_ifconfig shmif0 up + export RUMP_SERVER=$SOCK_REMOTE + $atf_ifconfig shmif0 up + + export RUMP_SERVER=$SOCK_LOCAL + $atf_ifconfig vlan0 create + + # since upper bound of shmif's mtu is 1500, + # so we lower vlan's mtu instead of raising shmif's. + # to do this, we change the interface's parameter + # such as ND_IFINFO(ifp)->maxmtu that is changed by SIOCSIFMTU. + + # $atf_config shmif0 mtu 1600 + $atf_ifconfig vlan0 vlan 10 vlanif shmif0 + $atf_ifconfig vlan0 mtu 1400 + $atf_ifconfig vlan0 -vlanif shmif0 + + $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_ifconfig vlan0 create + $atf_ifconfig vlan0 vlan 10 vlanif shmif0 + $atf_ifconfig vlan0 $af $remote0/$prefix + $atf_ifconfig vlan0 up + $atf_ifconfig -w 10 + + extract_new_packets $BUS > $outfile + export RUMP_SERVER=$SOCK_LOCAL + + atf_check -s exit:0 -o ignore $ping_cmd -s $padding $remote0 + extract_new_packets $BUS > $outfile + atf_check -s exit:0 -o match:"$nonfrag_msg" cat $outfile + + if [ x"$1" = x"inet6" ]; then + atf_check -s exit:0 -o ignore $ping_cmd -s $over_padding $remote0 + extract_new_packets $BUS > $outfile + atf_check -s exit:0 -o match:"$frag_msg" cat $outfile + else + atf_check -s not-exit:0 -o ignore -e match:"Message too long" \ +$ping_cmd -s $over_padding $remote0 + fi +} + +atf_test_case vlan_auto_follow_mtu cleanup +vlan_auto_follow_mtu_head() +{ + + atf_set "descr" "tests of setting vlan mtu using IPv4" + atf_set "require.progs" "rump_server" +} + +vlan_auto_follow_mtu_body() +{ + rump_server_start $SOCK_LOCAL vlan + rump_server_start $SOCK_REMOTE vlan + + vlan_auto_follow_mtu_body_common inet +} + +vlan_auto_follow_mtu_cleanup() +{ + + $DEBUG && dump + cleanup +} + +atf_test_case vlan_auto_follow_mtu6 cleanup +vlan_auto_follow_mtu6_head() +{ + + atf_set "descr" "tests of setting vlan mtu using IPv6" + atf_set "require.progs" "rump_server" +} + +vlan_auto_follow_mtu6_body() +{ + rump_server_start $SOCK_LOCAL vlan netinet6 + rump_server_start $SOCK_REMOTE vlan netinet6 + + vlan_auto_follow_mtu_body_common inet6 +} + +vlan_auto_follow_mtu6_cleanup() +{ + + $DEBUG && dump + cleanup +} + vlanid_config_and_ping() { local atf_ifconfig="atf_check -s exit:0 rump.ifconfig" @@ -738,6 +865,7 @@ atf_init_test_cases() atf_add_test_case vlan_create_destroy atf_add_test_case vlan_basic + atf_add_test_case vlan_auto_follow_mtu atf_add_test_case vlan_vlanid atf_add_test_case vlan_configs atf_add_test_case vlan_bridge @@ -745,6 +873,7 @@ atf_init_test_cases()
CVS commit: src/tests/net/ndp
Module Name:src Committed By: ozaki-r Date: Wed Oct 16 07:42:23 UTC 2019 Modified Files: src/tests/net/ndp: t_ra.sh Log Message: tests: add tests for the validateion of net.inet6.ip6.temppltime To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/tests/net/ndp/t_ra.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/net/ndp
Module Name:src Committed By: ozaki-r Date: Wed Oct 16 07:42:23 UTC 2019 Modified Files: src/tests/net/ndp: t_ra.sh Log Message: tests: add tests for the validateion of net.inet6.ip6.temppltime To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/tests/net/ndp/t_ra.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_ra.sh diff -u src/tests/net/ndp/t_ra.sh:1.32 src/tests/net/ndp/t_ra.sh:1.33 --- src/tests/net/ndp/t_ra.sh:1.32 Sat Nov 25 07:58:47 2017 +++ src/tests/net/ndp/t_ra.sh Wed Oct 16 07:42:22 2019 @@ -1,4 +1,4 @@ -# $NetBSD: t_ra.sh,v 1.32 2017/11/25 07:58:47 kre Exp $ +# $NetBSD: t_ra.sh,v 1.33 2019/10/16 07:42:22 ozaki-r Exp $ # # Copyright (c) 2015 Internet Initiative Japan Inc. # All rights reserved. @@ -695,6 +695,15 @@ ra_temporary_address_body() # autoconf, temporal address should be used as the source address check_echo_request_pkt bus1 $ip_temp $IP6SRV + # + # Testing the validation of net.inet6.ip6.temppltime + # + # XXX should move to a better place + atf_check -s not-exit:0 -e match:'Invalid argument' \ + rump.sysctl -w net.inet6.ip6.temppltime=$((600 + 5)) + atf_check -s exit:0 -o match:'86400 -> 606' \ + rump.sysctl -w net.inet6.ip6.temppltime=$((600 + 5 + 1)) + unset RUMP_SERVER terminate_rtadvd $PIDFILE
CVS commit: src/tests/net
Module Name:src Committed By: mrg Date: Sun Oct 13 07:46:16 UTC 2019 Modified Files: src/tests/net/can: h_canutils.c src/tests/net/if_vlan: siocXmulti.c Log Message: ifr_name is nul terminated. make it so. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/net/can/h_canutils.c cvs rdiff -u -r1.1 -r1.2 src/tests/net/if_vlan/siocXmulti.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/can/h_canutils.c diff -u src/tests/net/can/h_canutils.c:1.3 src/tests/net/can/h_canutils.c:1.4 --- src/tests/net/can/h_canutils.c:1.3 Sun May 28 13:55:07 2017 +++ src/tests/net/can/h_canutils.c Sun Oct 13 07:46:16 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: h_canutils.c,v 1.3 2017/05/28 13:55:07 kre Exp $ */ +/* $NetBSD: h_canutils.c,v 1.4 2019/10/13 07:46:16 mrg Exp $ */ /*- * Copyright (c) 2017 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include #ifndef lint -__RCSID("$NetBSD: h_canutils.c,v 1.3 2017/05/28 13:55:07 kre Exp $"); +__RCSID("$NetBSD: h_canutils.c,v 1.4 2019/10/13 07:46:16 mrg Exp $"); #endif /* not lint */ #include @@ -70,14 +70,16 @@ cancfg_rump_createif(const char *ifname) } memset(, 0, sizeof(ifr)); - strncpy(ifr.ifr_name, ifname, IFNAMSIZ); + strncpy(ifr.ifr_name, ifname, IFNAMSIZ-1); + ifr.ifr_name[IFNAMSIZ - 1] = '\0'; if ((rv = rump_sys_ioctl(s, SIOCIFCREATE, )) < 0) { atf_tc_fail_errno("if config create"); } memset(, 0, sizeof(ifr)); - strncpy(ifr.ifr_name, ifname, IFNAMSIZ); + strncpy(ifr.ifr_name, ifname, IFNAMSIZ-1); + ifr.ifr_name[IFNAMSIZ - 1] = '\0'; if ((rv = rump_sys_ioctl(s, SIOCGIFFLAGS, )) < 0) { atf_tc_fail_errno("if config get flags"); Index: src/tests/net/if_vlan/siocXmulti.c diff -u src/tests/net/if_vlan/siocXmulti.c:1.1 src/tests/net/if_vlan/siocXmulti.c:1.2 --- src/tests/net/if_vlan/siocXmulti.c:1.1 Thu Jun 14 08:22:52 2018 +++ src/tests/net/if_vlan/siocXmulti.c Sun Oct 13 07:46:16 2019 @@ -56,7 +56,8 @@ main(int argc, char *argv[]) if (ifidx == 0) err(1, "if_nametoindex(%s)", argv[ARG_IFNAME]); - strncpy(ifr.ifr_name, argv[ARG_IFNAME], sizeof(ifr.ifr_name)); + strncpy(ifr.ifr_name, argv[ARG_IFNAME], sizeof(ifr.ifr_name) - 1); + ifr.ifr_name[sizeof(ifr.ifr_name) - 1] = '\0'; sin = (struct sockaddr_in *)_addr; sin->sin_family = AF_INET;
CVS commit: src/tests/net
Module Name:src Committed By: mrg Date: Sun Oct 13 07:46:16 UTC 2019 Modified Files: src/tests/net/can: h_canutils.c src/tests/net/if_vlan: siocXmulti.c Log Message: ifr_name is nul terminated. make it so. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/net/can/h_canutils.c cvs rdiff -u -r1.1 -r1.2 src/tests/net/if_vlan/siocXmulti.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/net/arp
Module Name:src Committed By: roy Date: Mon Sep 9 10:29:04 UTC 2019 Modified Files: src/tests/net/arp: t_arp.sh Log Message: t_arp: Wait for 10 seconds for RTM_MISS Let's try increasing the ping timeout to try and fix PR misc/54525. To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 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.
CVS commit: src/tests/net/arp
Module Name:src Committed By: roy Date: Mon Sep 9 10:29:04 UTC 2019 Modified Files: src/tests/net/arp: t_arp.sh Log Message: t_arp: Wait for 10 seconds for RTM_MISS Let's try increasing the ping timeout to try and fix PR misc/54525. To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 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.39 src/tests/net/arp/t_arp.sh:1.40 --- src/tests/net/arp/t_arp.sh:1.39 Tue Sep 3 19:07:50 2019 +++ src/tests/net/arp/t_arp.sh Mon Sep 9 10:29:04 2019 @@ -1,4 +1,4 @@ -# $NetBSD: t_arp.sh,v 1.39 2019/09/03 19:07:50 roy Exp $ +# $NetBSD: t_arp.sh,v 1.40 2019/09/09 10:29:04 roy Exp $ # # Copyright (c) 2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -730,7 +730,7 @@ arp_rtm_body() sleep 1 # arp_maxtries = 5, second between each try atf_check -s exit:2 -o ignore -e ignore \ - rump.ping -n -w 6 -c 6 $IP4DST_FAIL1 + rump.ping -n -w 10 -c 10 $IP4DST_FAIL1 wait $pid $DEBUG && cat $file
CVS commit: src/tests/net
Module Name:src Committed By: roy Date: Tue Sep 3 19:07:50 UTC 2019 Modified Files: src/tests/net/arp: t_arp.sh src/tests/net/ndp: t_ndp.sh Log Message: tests: fix ARP and NDP tests for RTM_* messages While here add tests for RTM_MISS. To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 src/tests/net/arp/t_arp.sh cvs rdiff -u -r1.35 -r1.36 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.38 src/tests/net/arp/t_arp.sh:1.39 --- src/tests/net/arp/t_arp.sh:1.38 Mon Aug 19 03:22:05 2019 +++ src/tests/net/arp/t_arp.sh Tue Sep 3 19:07:50 2019 @@ -1,4 +1,4 @@ -# $NetBSD: t_arp.sh,v 1.38 2019/08/19 03:22:05 ozaki-r Exp $ +# $NetBSD: t_arp.sh,v 1.39 2019/09/03 19:07:50 roy Exp $ # # Copyright (c) 2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -33,6 +33,8 @@ IP4NET=10.0.1.0 IP4DST=10.0.1.2 IP4DST_PROXYARP1=10.0.1.3 IP4DST_PROXYARP2=10.0.1.4 +IP4DST_FAIL1=10.0.1.99 +IP4DST_FAIL2=10.0.99.99 DEBUG=${DEBUG:-false} TIMEOUT=1 @@ -718,7 +720,38 @@ arp_rtm_body() hdr="RTM_ADD.+" what="" - addr="$IP4DST link#2" + addr="$IP4DST $macaddr_dst" + atf_check -s exit:0 -o match:"$hdr" -o match:"$what" -o match:"$addr" \ + cat $file + + # Test ping and a resulting routing message (RTM_MISS) on subnet + 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 6 -c 6 $IP4DST_FAIL1 + wait $pid + $DEBUG && cat $file + + hdr="RTM_MISS.+" + what="" + addr="$IP4DST_FAIL1 link#2" + atf_check -s exit:0 -o match:"$hdr" -o match:"$what" -o match:"$addr" \ + cat $file + + # Test ping and a resulting routing message (RTM_MISS) off subnet + rump.route -n monitor -c 1 > $file & + pid=$! + sleep 1 + atf_check -s exit:2 -o ignore -e ignore \ + rump.ping -n -w 1 -c 1 $IP4DST_FAIL2 + wait $pid + $DEBUG && cat $file + + hdr="RTM_MISS.+" + what="" + addr="$IP4DST_FAIL2" 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.35 src/tests/net/ndp/t_ndp.sh:1.36 --- src/tests/net/ndp/t_ndp.sh:1.35 Mon Aug 19 03:20:27 2019 +++ src/tests/net/ndp/t_ndp.sh Tue Sep 3 19:07:50 2019 @@ -1,4 +1,4 @@ -# $NetBSD: t_ndp.sh,v 1.35 2019/08/19 03:20:27 ozaki-r Exp $ +# $NetBSD: t_ndp.sh,v 1.36 2019/09/03 19:07:50 roy Exp $ # # Copyright (c) 2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -31,6 +31,8 @@ IP6SRC=fc00::1 IP6SRC2=fc00::3 IP6DST=fc00::2 IP6NET=fc00::0 +IP6DST_FAIL1=fc00::99 +IP6DST_FAIL2=fc01::99 DEBUG=${DEBUG:-false} TIMEOUT=1 @@ -454,7 +456,38 @@ ndp_rtm_body() hdr="RTM_ADD.+" what="" - addr="$IP6DST link#2" + addr="$IP6DST $macaddr_dst" + atf_check -s exit:0 -o match:"$hdr" -o match:"$what" -o match:"$addr" \ + cat $file + + # Test ping and a resulting routing message (RTM_MISS) on subnet + 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 + wait $pid + $DEBUG && cat $file + + hdr="RTM_MISS.+" + what="" + addr="$IP6DST_FAIL1 link#2" + atf_check -s exit:0 -o match:"$hdr" -o match:"$what" -o match:"$addr" \ + cat $file + + # Test ping and a resulting routing message (RTM_MISS) off subnet + rump.route -n monitor -c 1 > $file & + pid=$! + sleep 1 + atf_check -s exit:1 -o ignore -e ignore \ + rump.ping6 -n -X 1 -c 1 $IP6DST_FAIL2 + wait $pid + $DEBUG && cat $file + + hdr="RTM_MISS.+" + what="" + addr="$IP6DST_FAIL2" 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: Tue Sep 3 19:07:50 UTC 2019 Modified Files: src/tests/net/arp: t_arp.sh src/tests/net/ndp: t_ndp.sh Log Message: tests: fix ARP and NDP tests for RTM_* messages While here add tests for RTM_MISS. To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 src/tests/net/arp/t_arp.sh cvs rdiff -u -r1.35 -r1.36 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.
CVS commit: src/tests/net/net
Module Name:src Committed By: ozaki-r Date: Mon Aug 26 07:41:51 UTC 2019 Modified Files: src/tests/net/net: t_ipv6address.sh Log Message: tests: add tests for IPv6 link-local addresses with a scope ID Setting an address with a scope ID doesn't work for rump.ifconfig for some reasons and needs $HIJACKING for now. The bug should be fixed someday. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/tests/net/net/t_ipv6address.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/net/net
Module Name:src Committed By: ozaki-r Date: Mon Aug 26 07:41:51 UTC 2019 Modified Files: src/tests/net/net: t_ipv6address.sh Log Message: tests: add tests for IPv6 link-local addresses with a scope ID Setting an address with a scope ID doesn't work for rump.ifconfig for some reasons and needs $HIJACKING for now. The bug should be fixed someday. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/tests/net/net/t_ipv6address.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_ipv6address.sh diff -u src/tests/net/net/t_ipv6address.sh:1.15 src/tests/net/net/t_ipv6address.sh:1.16 --- src/tests/net/net/t_ipv6address.sh:1.15 Mon May 13 17:55:09 2019 +++ src/tests/net/net/t_ipv6address.sh Mon Aug 26 07:41:50 2019 @@ -1,4 +1,4 @@ -# $NetBSD: t_ipv6address.sh,v 1.15 2019/05/13 17:55:09 bad Exp $ +# $NetBSD: t_ipv6address.sh,v 1.16 2019/08/26 07:41:50 ozaki-r Exp $ # # Copyright (c) 2015 Internet Initiative Japan Inc. # All rights reserved. @@ -247,6 +247,7 @@ linklocal_body() local dst_if0_lladdr=`get_linklocal_addr ${SOCKDST} shmif0` local fwd_if0_lladdr=`get_linklocal_addr ${SOCKFWD} shmif0` local fwd_if1_lladdr=`get_linklocal_addr ${SOCKFWD} shmif1` + local lladdr=fe80::2 export RUMP_SERVER=${SOCKSRC} $DEBUG && rump.ifconfig @@ -325,6 +326,19 @@ linklocal_body() atf_check -s ignore -o not-empty -e ignore \ -x "shmif_dumpbus -p - ${BUS2} | tcpdump -r - -n -p icmp6" + # Setting a link-local address with a scope ID + # XXX need $HIJACKING for some reasons + cleanup_bus + export RUMP_SERVER=${SOCKFWD} + $DEBUG && rump.ifconfig shmif0 + atf_check -s exit:0 $HIJACKING rump.ifconfig shmif0 inet6 $lladdr%shmif0/64 + export RUMP_SERVER=${SOCKSRC} + atf_check -s exit:0 -o match:"0.0% packet loss" rump.ping6 -c 1 \ + -X $TIMEOUT -n $lladdr + export RUMP_SERVER=${SOCKDST} + atf_check -s not-exit:0 -o match:"100.0% packet loss" rump.ping6 -c 1 \ + -X $TIMEOUT -n $lladdr + unset RUMP_SERVER }
CVS commit: src/tests/net
Module Name:src Committed By: ozaki-r Date: Mon Aug 26 04:50:32 UTC 2019 Modified Files: src/tests/net: net_common.sh Log Message: tests: explain how rump_server_check_memleaks works To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 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.
CVS commit: src/tests/net
Module Name:src Committed By: ozaki-r Date: Mon Aug 26 04:50:32 UTC 2019 Modified Files: src/tests/net: net_common.sh Log Message: tests: explain how rump_server_check_memleaks works To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 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.36 src/tests/net/net_common.sh:1.37 --- src/tests/net/net_common.sh:1.36 Mon Aug 26 04:50:03 2019 +++ src/tests/net/net_common.sh Mon Aug 26 04:50:32 2019 @@ -1,4 +1,4 @@ -# $NetBSD: net_common.sh,v 1.36 2019/08/26 04:50:03 ozaki-r Exp $ +# $NetBSD: net_common.sh,v 1.37 2019/08/26 04:50:32 ozaki-r Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -351,7 +351,13 @@ rump_server_check_poolleaks() atf_check_equal '$target$reqs' '$target$rels' } - +# +# rump_server_check_memleaks detects memory leaks. It can detect leaks of pool +# objects that are guaranteed to be all deallocated at this point, i.e., all +# created interfaces are destroyed. Currently only llentpl satisfies this +# constraint. This mechanism can't be applied to objects allocated through +# pool_cache(9) because it doesn't track released objects explicitly. +# rump_server_check_memleaks() {
CVS commit: src/tests/net
Module Name:src Committed By: ozaki-r Date: Mon Aug 26 04:50:03 UTC 2019 Modified Files: src/tests/net: net_common.sh Log Message: tests: restore rump_server_check_poolleaks for llentpl It didn't work correctly because rumphijack for vmstat didn't work expectedly; vmstat has the sgid bit for kvm(3) and that prevents rumphijack from working. Address the issue by cloning a vmstat binary without the sgid bit temporarily and using it for rumphijack. Note that it's a workaround. vmstat should stop using kvm(3) for /dev/kmem and drop the sgid bit eventually. To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 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.
CVS commit: src/tests/net
Module Name:src Committed By: ozaki-r Date: Mon Aug 26 04:50:03 UTC 2019 Modified Files: src/tests/net: net_common.sh Log Message: tests: restore rump_server_check_poolleaks for llentpl It didn't work correctly because rumphijack for vmstat didn't work expectedly; vmstat has the sgid bit for kvm(3) and that prevents rumphijack from working. Address the issue by cloning a vmstat binary without the sgid bit temporarily and using it for rumphijack. Note that it's a workaround. vmstat should stop using kvm(3) for /dev/kmem and drop the sgid bit eventually. To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 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.35 src/tests/net/net_common.sh:1.36 --- src/tests/net/net_common.sh:1.35 Tue Aug 20 09:53:45 2019 +++ src/tests/net/net_common.sh Mon Aug 26 04:50:03 2019 @@ -1,4 +1,4 @@ -# $NetBSD: net_common.sh,v 1.35 2019/08/20 09:53:45 ozaki-r Exp $ +# $NetBSD: net_common.sh,v 1.36 2019/08/26 04:50:03 ozaki-r Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -341,8 +341,13 @@ rump_server_check_poolleaks() { local target=$1 - reqs=$($HIJACKING vmstat -mv | awk "/$target/ {print \$3;}") - rels=$($HIJACKING vmstat -mv | awk "/$target/ {print \$5;}") + # XXX rumphijack doesn't work with a binary with suid/sgid bits like + # vmstat. Use a copied one to drop sgid bit as a workaround until + # vmstat stops using kvm(3) for /dev/kmem and the sgid bit. + cp /usr/bin/vmstat ./vmstat + reqs=$($HIJACKING ./vmstat -mv | awk "/$target/ {print \$3;}") + rels=$($HIJACKING ./vmstat -mv | awk "/$target/ {print \$5;}") + rm -f ./vmstat atf_check_equal '$target$reqs' '$target$rels' } @@ -350,8 +355,7 @@ rump_server_check_poolleaks() rump_server_check_memleaks() { - # XXX this doesn't work in some cases for unknown reasons - #rump_server_check_poolleaks llentrypl + rump_server_check_poolleaks llentrypl # This doesn't work for objects allocated through pool_cache #rump_server_check_poolleaks mbpl #rump_server_check_poolleaks mclpl @@ -437,7 +441,10 @@ dump_kernel_stats() rump.netstat -nr # XXX still need hijacking $HIJACKING rump.netstat -nai - $HIJACKING vmstat -m + # XXX workaround for vmstat with the sgid bit + cp /usr/bin/vmstat ./vmstat + $HIJACKING ./vmstat -m + rm -f ./vmstat rump.arp -na rump.ndp -na $HIJACKING ifmcstat