Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/net/net Fix ping_opts_gateway and ping_opts_recordroute



details:   https://anonhg.NetBSD.org/src/rev/c64f2617fa7b
branches:  trunk
changeset: 359415:c64f2617fa7b
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Fri Feb 09 03:53:07 2018 +0000

description:
Fix ping_opts_gateway and ping_opts_recordroute

We need to enable the options of source routing on all rump kernels.

diffstat:

 tests/net/net/t_ping_opts.sh |  34 +++++++++++++++++++++++++++-------
 1 files changed, 27 insertions(+), 7 deletions(-)

diffs (69 lines):

diff -r f9a29cbf765d -r c64f2617fa7b tests/net/net/t_ping_opts.sh
--- a/tests/net/net/t_ping_opts.sh      Fri Feb 09 03:20:21 2018 +0000
+++ b/tests/net/net/t_ping_opts.sh      Fri Feb 09 03:53:07 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: t_ping_opts.sh,v 1.2 2018/02/08 09:56:19 maxv Exp $
+#      $NetBSD: t_ping_opts.sh,v 1.3 2018/02/09 03:53:07 ozaki-r Exp $
 #
 # Copyright (c) 2017 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -206,9 +206,6 @@
        my_macaddr=$(get_macaddr ${SOCKSRC} shmif0)
        gw_shmif0_macaddr=$(get_macaddr ${SOCKFWD} shmif0)
 
-       atf_check -s exit:0 rump.sysctl -q -w net.inet.ip.allowsrcrt=1
-       atf_check -s exit:0 rump.sysctl -q -w net.inet.ip.forwsrcrt=1
-
        export RUMP_SERVER=$SOCKSRC
        atf_check -s exit:0 -o ignore rump.ping $PING_OPTS $IPDST
        check_echo_request_pkt_with_macaddr \
@@ -225,6 +222,22 @@
        check_echo_request_pkt_with_macaddr \
            $my_macaddr $gw_shmif0_macaddr $IPSRC $IPDST
 
+       export RUMP_SERVER=$SOCKSRC
+       # ping -g <gateway>
+       # By default source-routed packets are prohibited
+       atf_check -s not-exit:0 -o match:'Net prohibited access' \
+           rump.ping $PING_OPTS -g $IPSRCGW $IPDST
+
+       # Enable the options of source routing
+       export RUMP_SERVER=$SOCKSRC
+       atf_check -s exit:0 rump.sysctl -q -w net.inet.ip.allowsrcrt=1
+       export RUMP_SERVER=$SOCKDST
+       atf_check -s exit:0 rump.sysctl -q -w net.inet.ip.allowsrcrt=1
+       export RUMP_SERVER=$SOCKFWD
+       atf_check -s exit:0 rump.sysctl -q -w net.inet.ip.allowsrcrt=1
+       atf_check -s exit:0 rump.sysctl -q -w net.inet.ip.forwsrcrt=1
+
+       export RUMP_SERVER=$SOCKSRC
        # ping -g <gateway>
        atf_check -s exit:0 -o ignore rump.ping $PING_OPTS \
            -g $IPSRCGW $IPDST
@@ -238,9 +251,6 @@
        check_echo_request_pkt_with_macaddr \
            $my_macaddr $gw_shmif2_macaddr $IPSRC $IPSRCGW2
 
-       atf_check -s exit:0 rump.sysctl -q -w net.inet.ip.allowsrcrt=0
-       atf_check -s exit:0 rump.sysctl -q -w net.inet.ip.forwsrcrt=0
-
        rump_server_destroy_ifaces
 }
 
@@ -308,6 +318,16 @@
            $my_macaddr $gw_shmif0_macaddr $IPSRC $IPDST
        check_recorded_routes $out
 
+       # Enable the options of source routing
+       export RUMP_SERVER=$SOCKSRC
+       atf_check -s exit:0 rump.sysctl -q -w net.inet.ip.allowsrcrt=1
+       export RUMP_SERVER=$SOCKDST
+       atf_check -s exit:0 rump.sysctl -q -w net.inet.ip.allowsrcrt=1
+       export RUMP_SERVER=$SOCKFWD
+       atf_check -s exit:0 rump.sysctl -q -w net.inet.ip.allowsrcrt=1
+       atf_check -s exit:0 rump.sysctl -q -w net.inet.ip.forwsrcrt=1
+
+       export RUMP_SERVER=$SOCKSRC
        # ping -R -g <gateway>
        atf_check -s exit:0 -o save:$out rump.ping $PING_OPTS \
            -R -g $IPSRCGW $IPDST



Home | Main Index | Thread Index | Old Index