Home | History | Annotate | Line # | Download | only in if_pppoe
t_pppoe.sh revision 1.1.2.2
      1  1.1.2.2  pgoyette #	$NetBSD: t_pppoe.sh,v 1.1.2.2 2017/01/07 08:56:56 pgoyette Exp $
      2      1.1     ozaki #
      3      1.1     ozaki # Copyright (c) 2016 Internet Initiative Japan Inc.
      4      1.1     ozaki # All rights reserved.
      5      1.1     ozaki #
      6      1.1     ozaki # Redistribution and use in source and binary forms, with or without
      7      1.1     ozaki # modification, are permitted provided that the following conditions
      8      1.1     ozaki # are met:
      9      1.1     ozaki # 1. Redistributions of source code must retain the above copyright
     10      1.1     ozaki #    notice, this list of conditions and the following disclaimer.
     11      1.1     ozaki # 2. Redistributions in binary form must reproduce the above copyright
     12      1.1     ozaki #    notice, this list of conditions and the following disclaimer in the
     13      1.1     ozaki #    documentation and/or other materials provided with the distribution.
     14      1.1     ozaki #
     15      1.1     ozaki # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     16      1.1     ozaki # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     17      1.1     ozaki # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     18      1.1     ozaki # PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     19      1.1     ozaki # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     20      1.1     ozaki # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     21      1.1     ozaki # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     22      1.1     ozaki # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     23      1.1     ozaki # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     24      1.1     ozaki # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     25      1.1     ozaki # POSSIBILITY OF SUCH DAMAGE.
     26      1.1     ozaki #
     27      1.1     ozaki 
     28  1.1.2.2  pgoyette server="rump_server -lrump -lrumpnet -lrumpnet_net -lrumpnet_netinet	\
     29  1.1.2.2  pgoyette 		    -lrumpnet_netinet6 -lrumpnet_shmif -lrumpdev	\
     30  1.1.2.2  pgoyette 		    -lrumpnet_pppoe"
     31  1.1.2.2  pgoyette # pppoectl doesn't work with RUMPHIJACK=sysctl=yes
     32      1.1     ozaki HIJACKING="env LD_PRELOAD=/usr/lib/librumphijack.so"
     33      1.1     ozaki 
     34      1.1     ozaki SERVER=unix://commsock1
     35      1.1     ozaki CLIENT=unix://commsock2
     36      1.1     ozaki 
     37      1.1     ozaki SERVER_IP=10.3.3.1
     38      1.1     ozaki CLIENT_IP=10.3.3.3
     39  1.1.2.1  pgoyette SERVER_IP6=fc00::1
     40  1.1.2.1  pgoyette CLIENT_IP6=fc00::3
     41      1.1     ozaki AUTHNAME=foobar@baz.com
     42      1.1     ozaki SECRET=oink
     43      1.1     ozaki BUS=bus0
     44      1.1     ozaki TIMEOUT=3
     45  1.1.2.2  pgoyette WAITTIME=10
     46  1.1.2.2  pgoyette DEBUG=${DEBUG:-false}
     47      1.1     ozaki 
     48      1.1     ozaki atf_test_case pap cleanup
     49      1.1     ozaki 
     50      1.1     ozaki setup()
     51      1.1     ozaki {
     52  1.1.2.1  pgoyette 	inet=true
     53  1.1.2.1  pgoyette 
     54  1.1.2.1  pgoyette 	if [ $# -ne 0 ]; then
     55  1.1.2.1  pgoyette 		eval $@
     56  1.1.2.1  pgoyette 	fi
     57  1.1.2.1  pgoyette 
     58      1.1     ozaki 	atf_check -s exit:0 ${server} $SERVER
     59      1.1     ozaki 	atf_check -s exit:0 ${server} $CLIENT
     60      1.1     ozaki 
     61      1.1     ozaki 	export RUMP_SERVER=$SERVER
     62      1.1     ozaki 	atf_check -s exit:0 rump.ifconfig shmif0 create
     63      1.1     ozaki 	atf_check -s exit:0 rump.ifconfig shmif0 linkstr $BUS
     64      1.1     ozaki 	atf_check -s exit:0 rump.ifconfig shmif0 up
     65      1.1     ozaki 
     66      1.1     ozaki 	atf_check -s exit:0 rump.ifconfig pppoe0 create
     67  1.1.2.1  pgoyette 	$inet && atf_check -s exit:0 rump.ifconfig pppoe0 \
     68  1.1.2.1  pgoyette 	    inet $SERVER_IP $CLIENT_IP down
     69      1.1     ozaki 	atf_check -s exit:0 rump.ifconfig pppoe0 link0
     70      1.1     ozaki 
     71      1.1     ozaki 	$DEBUG && rump.ifconfig
     72      1.1     ozaki 	$DEBUG && $HIJACKING pppoectl -d pppoe0
     73      1.1     ozaki 
     74      1.1     ozaki 	atf_check -s exit:0 -x "$HIJACKING pppoectl -e shmif0 pppoe0"
     75      1.1     ozaki 	unset RUMP_SERVER
     76      1.1     ozaki 
     77      1.1     ozaki 	export RUMP_SERVER=$CLIENT
     78      1.1     ozaki 	atf_check -s exit:0 rump.ifconfig shmif0 create
     79      1.1     ozaki 	atf_check -s exit:0 rump.ifconfig shmif0 linkstr $BUS
     80      1.1     ozaki 	atf_check -s exit:0 rump.ifconfig shmif0 up
     81      1.1     ozaki 
     82      1.1     ozaki 	atf_check -s exit:0 rump.ifconfig pppoe0 create
     83  1.1.2.1  pgoyette 	$inet && atf_check -s exit:0 rump.ifconfig pppoe0 \
     84  1.1.2.1  pgoyette 	    inet 0.0.0.0 0.0.0.1 down
     85      1.1     ozaki 
     86      1.1     ozaki 	atf_check -s exit:0 -x "$HIJACKING pppoectl -e shmif0 pppoe0"
     87      1.1     ozaki 	unset RUMP_SERVER
     88      1.1     ozaki }
     89      1.1     ozaki cleanup()
     90      1.1     ozaki {
     91      1.1     ozaki 	env RUMP_SERVER=$SERVER rump.halt
     92      1.1     ozaki 	env RUMP_SERVER=$CLIENT rump.halt
     93      1.1     ozaki }
     94      1.1     ozaki 
     95      1.1     ozaki pap_head()
     96      1.1     ozaki {
     97      1.1     ozaki 	atf_set "descr" "Does simple pap tests"
     98      1.1     ozaki 	atf_set "require.progs" "rump_server pppoectl"
     99      1.1     ozaki }
    100      1.1     ozaki 
    101      1.1     ozaki wait_for_session_established()
    102      1.1     ozaki {
    103      1.1     ozaki 	local dontfail=$1
    104      1.1     ozaki 	local n=$WAITTIME
    105      1.1     ozaki 
    106      1.1     ozaki 	for i in $(seq $n); do
    107      1.1     ozaki 		$HIJACKING pppoectl -d pppoe0 |grep -q "state = session"
    108      1.1     ozaki 		[ $? = 0 ] && return
    109      1.1     ozaki 		sleep 1
    110      1.1     ozaki 	done
    111      1.1     ozaki 
    112  1.1.2.1  pgoyette 	if [ "$dontfail" != "dontfail" ]; then
    113      1.1     ozaki 		atf_fail "Couldn't connect to the server for $n seconds."
    114      1.1     ozaki 	fi
    115      1.1     ozaki }
    116      1.1     ozaki 
    117  1.1.2.1  pgoyette wait_for_disconnected()
    118  1.1.2.1  pgoyette {
    119  1.1.2.1  pgoyette 	local dontfail=$1
    120  1.1.2.1  pgoyette 	local n=$WAITTIME
    121  1.1.2.1  pgoyette 
    122  1.1.2.1  pgoyette 	for i in $(seq $n); do
    123  1.1.2.2  pgoyette 		$HIJACKING pppoectl -d pppoe0 | grep -q "state = initial"
    124  1.1.2.2  pgoyette 		[ $? = 0 ] && return
    125  1.1.2.2  pgoyette 		# If PPPoE client is disconnected by PPPoE server and then
    126  1.1.2.2  pgoyette 		# the client kicks callout of pppoe_timeout(), the client
    127  1.1.2.2  pgoyette 		# state is changed to PPPOE_STATE_PADI_SENT while padi retrying.
    128  1.1.2.2  pgoyette 		$HIJACKING pppoectl -d pppoe0 | grep -q "state = PADI sent"
    129  1.1.2.2  pgoyette 		[ $? = 0 ] && return
    130  1.1.2.2  pgoyette 
    131  1.1.2.1  pgoyette 		sleep 1
    132  1.1.2.1  pgoyette 	done
    133  1.1.2.1  pgoyette 
    134  1.1.2.1  pgoyette 	if [ "$dontfail" != "dontfail" ]; then
    135  1.1.2.1  pgoyette 		atf_fail "Couldn't disconnect for $n seconds."
    136  1.1.2.1  pgoyette 	fi
    137  1.1.2.1  pgoyette }
    138  1.1.2.1  pgoyette 
    139  1.1.2.1  pgoyette run_test()
    140      1.1     ozaki {
    141      1.1     ozaki 	local auth=pap
    142      1.1     ozaki 	setup
    143      1.1     ozaki 
    144      1.1     ozaki 	export RUMP_SERVER=$SERVER
    145      1.1     ozaki 	local setup_serverparam="pppoectl pppoe0 hisauthproto=$auth \
    146      1.1     ozaki 				    'hisauthname=$AUTHNAME' \
    147      1.1     ozaki 				    'hisauthsecret=$SECRET' \
    148      1.1     ozaki 				    'myauthproto=none'"
    149      1.1     ozaki 	atf_check -s exit:0 -x "$HIJACKING $setup_serverparam"
    150      1.1     ozaki 	atf_check -s exit:0 rump.ifconfig pppoe0 up
    151      1.1     ozaki 	unset RUMP_SERVER
    152      1.1     ozaki 
    153      1.1     ozaki 	export RUMP_SERVER=$CLIENT
    154      1.1     ozaki 	local setup_clientparam="pppoectl pppoe0 myauthproto=$auth \
    155      1.1     ozaki 				    'myauthname=$AUTHNAME' \
    156      1.1     ozaki 				    'myauthsecret=$SECRET' \
    157      1.1     ozaki 				    'hisauthproto=none'"
    158      1.1     ozaki 	atf_check -s exit:0 -x "$HIJACKING $setup_clientparam"
    159      1.1     ozaki 	atf_check -s exit:0 rump.ifconfig pppoe0 up
    160      1.1     ozaki 	$DEBUG && rump.ifconfig
    161      1.1     ozaki 	wait_for_session_established
    162      1.1     ozaki 	atf_check -s exit:0 -o ignore rump.ping -c 1 -w $TIMEOUT $SERVER_IP
    163      1.1     ozaki 	unset RUMP_SERVER
    164      1.1     ozaki 
    165      1.1     ozaki 	# test for disconnection from server
    166  1.1.2.2  pgoyette 	export RUMP_SERVER=$SERVER
    167  1.1.2.2  pgoyette 	atf_check -s exit:0 rump.ifconfig pppoe0 down
    168  1.1.2.2  pgoyette 	wait_for_disconnected
    169      1.1     ozaki 	export RUMP_SERVER=$CLIENT
    170  1.1.2.2  pgoyette 	wait_for_disconnected
    171      1.1     ozaki 	atf_check -s not-exit:0 -o ignore -e ignore \
    172      1.1     ozaki 	    rump.ping -c 1 -w $TIMEOUT $SERVER_IP
    173      1.1     ozaki 	atf_check -s exit:0 -o match:'PADI sent' -x "$HIJACKING pppoectl -d pppoe0"
    174      1.1     ozaki 	unset RUMP_SERVER
    175      1.1     ozaki 
    176      1.1     ozaki 	# test for recoonecting
    177      1.1     ozaki 	atf_check -s exit:0 -x "env RUMP_SERVER=$SERVER rump.ifconfig pppoe0 up"
    178      1.1     ozaki 	export RUMP_SERVER=$CLIENT
    179      1.1     ozaki 	wait_for_session_established
    180      1.1     ozaki 	atf_check -s exit:0 -o ignore rump.ping -c 1 -w $TIMEOUT $SERVER_IP
    181      1.1     ozaki 	unset RUMP_SERVER
    182      1.1     ozaki 
    183      1.1     ozaki 	# test for disconnection from client
    184  1.1.2.2  pgoyette 	export RUMP_SERVER=$CLIENT
    185  1.1.2.2  pgoyette 	atf_check -s exit:0 -x rump.ifconfig pppoe0 down
    186  1.1.2.2  pgoyette 	wait_for_disconnected
    187      1.1     ozaki 	export RUMP_SERVER=$SERVER
    188  1.1.2.2  pgoyette 	wait_for_disconnected
    189      1.1     ozaki 	$DEBUG && $HIJACKING pppoectl -d pppoe0
    190      1.1     ozaki 	atf_check -s not-exit:0 -o ignore -e ignore \
    191      1.1     ozaki 	    rump.ping -c 1 -w $TIMEOUT $CLIENT_IP
    192      1.1     ozaki 	atf_check -s exit:0 -o match:'initial' -x "$HIJACKING pppoectl -d pppoe0"
    193      1.1     ozaki 	unset RUMP_SERVER
    194      1.1     ozaki 
    195  1.1.2.1  pgoyette 	# test for reconnecting
    196      1.1     ozaki 	export RUMP_SERVER=$CLIENT
    197      1.1     ozaki 	atf_check -s exit:0 -x rump.ifconfig pppoe0 up
    198      1.1     ozaki 	wait_for_session_established
    199      1.1     ozaki 	$DEBUG && rump.ifconfig pppoe0
    200      1.1     ozaki 	$DEBUG && $HIJACKING pppoectl -d pppoe0
    201      1.1     ozaki 	unset RUMP_SERVER
    202      1.1     ozaki 
    203      1.1     ozaki 	export RUMP_SERVER=$SERVER
    204  1.1.2.1  pgoyette 	atf_check -s exit:0 rump.ifconfig -w 10
    205      1.1     ozaki 	atf_check -s exit:0 -o ignore rump.ping -c 1 -w $TIMEOUT $CLIENT_IP
    206      1.1     ozaki 	atf_check -s exit:0 -o match:'session' -x "$HIJACKING pppoectl -d pppoe0"
    207      1.1     ozaki 	$DEBUG && HIJACKING pppoectl -d pppoe0
    208      1.1     ozaki 	unset RUMP_SERVER
    209      1.1     ozaki 
    210      1.1     ozaki 	# test for invalid password
    211      1.1     ozaki 	export RUMP_SERVER=$CLIENT
    212      1.1     ozaki 	atf_check -s exit:0 rump.ifconfig pppoe0 down
    213  1.1.2.2  pgoyette 	wait_for_disconnected
    214      1.1     ozaki 	local setup_clientparam="pppoectl pppoe0 myauthproto=$auth \
    215      1.1     ozaki 				    'myauthname=$AUTHNAME' \
    216      1.1     ozaki 				    'myauthsecret=invalidsecret' \
    217      1.1     ozaki 				    'hisauthproto=none'"
    218      1.1     ozaki 	atf_check -s exit:0 -x "$HIJACKING $setup_clientparam"
    219      1.1     ozaki 	atf_check -s exit:0 rump.ifconfig pppoe0 up
    220      1.1     ozaki 	wait_for_session_established dontfail
    221      1.1     ozaki 	atf_check -s not-exit:0 -o ignore -e ignore \
    222      1.1     ozaki 	    rump.ping -c 1 -w $TIMEOUT $SERVER_IP
    223  1.1.2.2  pgoyette 	atf_check -s exit:0 -o match:'DETACHED' rump.ifconfig pppoe0
    224      1.1     ozaki 	unset RUMP_SERVER
    225      1.1     ozaki }
    226      1.1     ozaki 
    227  1.1.2.1  pgoyette atf_test_case pppoe_pap cleanup
    228  1.1.2.1  pgoyette 
    229  1.1.2.1  pgoyette pppoe_pap_head()
    230  1.1.2.1  pgoyette {
    231  1.1.2.1  pgoyette 	atf_set "descr" "Does simple pap tests"
    232  1.1.2.1  pgoyette 	atf_set "require.progs" "rump_server pppoectl"
    233  1.1.2.1  pgoyette }
    234  1.1.2.1  pgoyette 
    235  1.1.2.1  pgoyette pppoe_pap_body()
    236  1.1.2.1  pgoyette {
    237  1.1.2.1  pgoyette 	run_test pap
    238  1.1.2.1  pgoyette }
    239  1.1.2.1  pgoyette 
    240  1.1.2.1  pgoyette pppoe_pap_cleanup()
    241  1.1.2.1  pgoyette {
    242  1.1.2.1  pgoyette 	cleanup
    243  1.1.2.1  pgoyette }
    244  1.1.2.1  pgoyette 
    245  1.1.2.1  pgoyette atf_test_case pppoe_chap cleanup
    246  1.1.2.1  pgoyette 
    247  1.1.2.1  pgoyette pppoe_chap_head()
    248  1.1.2.1  pgoyette {
    249  1.1.2.1  pgoyette 	atf_set "descr" "Does simple chap tests"
    250  1.1.2.1  pgoyette 	atf_set "require.progs" "rump_server pppoectl"
    251  1.1.2.1  pgoyette }
    252  1.1.2.1  pgoyette 
    253  1.1.2.1  pgoyette pppoe_chap_body()
    254  1.1.2.1  pgoyette {
    255  1.1.2.1  pgoyette 	run_test chap
    256  1.1.2.1  pgoyette }
    257  1.1.2.1  pgoyette 
    258  1.1.2.1  pgoyette pppoe_chap_cleanup()
    259  1.1.2.1  pgoyette {
    260  1.1.2.1  pgoyette 	cleanup
    261  1.1.2.1  pgoyette }
    262  1.1.2.1  pgoyette 
    263  1.1.2.1  pgoyette run_test6()
    264  1.1.2.1  pgoyette {
    265  1.1.2.1  pgoyette 	local auth=$1
    266  1.1.2.1  pgoyette 	setup "inet=false"
    267  1.1.2.1  pgoyette 
    268  1.1.2.1  pgoyette 	# As pppoe client doesn't support rechallenge yet.
    269  1.1.2.1  pgoyette 	local server_optparam=""
    270  1.1.2.1  pgoyette 	if [ $auth = "chap" ]; then
    271  1.1.2.1  pgoyette 		server_optparam="norechallenge"
    272  1.1.2.1  pgoyette 	fi
    273  1.1.2.1  pgoyette 
    274  1.1.2.1  pgoyette 	export RUMP_SERVER=$SERVER
    275  1.1.2.1  pgoyette 	local setup_serverparam="pppoectl pppoe0 hisauthproto=$auth \
    276  1.1.2.1  pgoyette 				    'hisauthname=$AUTHNAME' \
    277  1.1.2.1  pgoyette 				    'hisauthsecret=$SECRET' \
    278  1.1.2.1  pgoyette 				    'myauthproto=none' \
    279  1.1.2.1  pgoyette 				    $server_optparam"
    280  1.1.2.1  pgoyette 	atf_check -s exit:0 -x "$HIJACKING $setup_serverparam"
    281  1.1.2.1  pgoyette 	atf_check -s exit:0 rump.ifconfig pppoe0 inet6 $SERVER_IP6/64 down
    282  1.1.2.1  pgoyette 	atf_check -s exit:0 rump.ifconfig pppoe0 up
    283  1.1.2.1  pgoyette 	unset RUMP_SERVER
    284  1.1.2.1  pgoyette 
    285  1.1.2.1  pgoyette 	export RUMP_SERVER=$CLIENT
    286  1.1.2.1  pgoyette 	local setup_clientparam="pppoectl pppoe0 myauthproto=$auth \
    287  1.1.2.1  pgoyette 				    'myauthname=$AUTHNAME' \
    288  1.1.2.1  pgoyette 				    'myauthsecret=$SECRET' \
    289  1.1.2.1  pgoyette 				    'hisauthproto=none'"
    290  1.1.2.1  pgoyette 	atf_check -s exit:0 -x "$HIJACKING $setup_clientparam"
    291  1.1.2.1  pgoyette 	atf_check -s exit:0 rump.ifconfig pppoe0 inet6 $CLIENT_IP6/64 down
    292  1.1.2.1  pgoyette 	atf_check -s exit:0 rump.ifconfig pppoe0 up
    293  1.1.2.1  pgoyette 	$DEBUG && rump.ifconfig
    294  1.1.2.1  pgoyette 	wait_for_session_established
    295  1.1.2.1  pgoyette 	atf_check -s exit:0 -o ignore rump.ifconfig -w 10
    296  1.1.2.1  pgoyette 	export RUMP_SERVER=$SERVER
    297  1.1.2.1  pgoyette 	atf_check -s exit:0 -o ignore rump.ifconfig -w 10
    298  1.1.2.1  pgoyette 	export RUMP_SERVER=$CLIENT
    299  1.1.2.1  pgoyette 	atf_check -s exit:0 -o ignore rump.ping6 -c 1 -X $TIMEOUT $SERVER_IP6
    300  1.1.2.1  pgoyette 	unset RUMP_SERVER
    301  1.1.2.1  pgoyette 
    302  1.1.2.1  pgoyette 	# test for disconnection from server
    303  1.1.2.1  pgoyette 	export RUMP_SERVER=$SERVER
    304  1.1.2.1  pgoyette 	session_id=`$HIJACKING pppoectl -d pppoe0 | grep state`
    305  1.1.2.1  pgoyette 	atf_check -s exit:0 rump.ifconfig pppoe0 down
    306  1.1.2.1  pgoyette 	wait_for_disconnected
    307  1.1.2.1  pgoyette 	export RUMP_SERVER=$CLIENT
    308  1.1.2.1  pgoyette 	wait_for_disconnected
    309  1.1.2.1  pgoyette 	atf_check -s not-exit:0 -o ignore -e ignore \
    310  1.1.2.2  pgoyette 	    rump.ping6 -c 1 -X $TIMEOUT $SERVER_IP6
    311  1.1.2.1  pgoyette 	atf_check -s exit:0 -o not-match:"$session_id" -x "$HIJACKING pppoectl -d pppoe0"
    312  1.1.2.1  pgoyette 	unset RUMP_SERVER
    313  1.1.2.1  pgoyette 
    314  1.1.2.1  pgoyette 	# test for recoonecting
    315  1.1.2.1  pgoyette 	export RUMP_SERVER=$SERVER
    316  1.1.2.1  pgoyette 	atf_check -s exit:0 rump.ifconfig pppoe0 up
    317  1.1.2.1  pgoyette 	wait_for_session_established
    318  1.1.2.1  pgoyette 	atf_check -s exit:0 rump.ifconfig -w 10
    319  1.1.2.1  pgoyette 	$DEBUG && $HIJACKING pppoectl -d pppoe0
    320  1.1.2.1  pgoyette 	$DEBUG && rump.ifconfig pppoe0
    321  1.1.2.1  pgoyette 	export RUMP_SERVER=$CLIENT
    322  1.1.2.1  pgoyette 	atf_check -s exit:0 -o ignore rump.ifconfig -w 10
    323  1.1.2.1  pgoyette 	atf_check -s exit:0 -o ignore rump.ping6 -c 1 -X $TIMEOUT $SERVER_IP6
    324  1.1.2.1  pgoyette 	unset RUMP_SERVER
    325  1.1.2.1  pgoyette 
    326  1.1.2.1  pgoyette 	# test for disconnection from client
    327  1.1.2.1  pgoyette 	export RUMP_SERVER=$CLIENT
    328  1.1.2.1  pgoyette 	atf_check -s exit:0 rump.ifconfig pppoe0 down
    329  1.1.2.1  pgoyette 	wait_for_disconnected
    330  1.1.2.1  pgoyette 
    331  1.1.2.1  pgoyette 	export RUMP_SERVER=$SERVER
    332  1.1.2.1  pgoyette 	wait_for_disconnected
    333  1.1.2.2  pgoyette 	$DEBUG && $HIJACKING pppoectl -d pppoe0
    334  1.1.2.1  pgoyette 	atf_check -s not-exit:0 -o ignore -e ignore \
    335  1.1.2.1  pgoyette 	    rump.ping6 -c 1 -X $TIMEOUT $CLIENT_IP6
    336  1.1.2.1  pgoyette 	atf_check -s exit:0 -o match:'initial' -x "$HIJACKING pppoectl -d pppoe0"
    337  1.1.2.1  pgoyette 	unset RUMP_SERVER
    338  1.1.2.1  pgoyette 
    339  1.1.2.1  pgoyette 	# test for reconnecting
    340  1.1.2.1  pgoyette 	export RUMP_SERVER=$CLIENT
    341  1.1.2.1  pgoyette 	atf_check -s exit:0 rump.ifconfig pppoe0 up
    342  1.1.2.1  pgoyette 	wait_for_session_established
    343  1.1.2.1  pgoyette 	atf_check -s exit:0 rump.ifconfig -w 10
    344  1.1.2.1  pgoyette 
    345  1.1.2.1  pgoyette 	$DEBUG && rump.ifconfig pppoe0
    346  1.1.2.1  pgoyette 	$DEBUG && $HIJACKING pppoectl -d pppoe0
    347  1.1.2.1  pgoyette 	unset RUMP_SERVER
    348  1.1.2.1  pgoyette 
    349  1.1.2.1  pgoyette 	export RUMP_SERVER=$SERVER
    350  1.1.2.1  pgoyette 	atf_check -s exit:0 rump.ifconfig -w 10
    351  1.1.2.1  pgoyette 	atf_check -s exit:0 -o ignore rump.ping6 -c 1 -X $TIMEOUT $CLIENT_IP6
    352  1.1.2.1  pgoyette 	atf_check -s exit:0 -o match:'session' -x "$HIJACKING pppoectl -d pppoe0"
    353  1.1.2.1  pgoyette 	$DEBUG && HIJACKING pppoectl -d pppoe0
    354  1.1.2.1  pgoyette 	unset RUMP_SERVER
    355  1.1.2.1  pgoyette 
    356  1.1.2.1  pgoyette 	# test for invalid password
    357  1.1.2.1  pgoyette 	export RUMP_SERVER=$CLIENT
    358  1.1.2.1  pgoyette 	atf_check -s exit:0 rump.ifconfig pppoe0 down
    359  1.1.2.1  pgoyette 	wait_for_disconnected
    360  1.1.2.1  pgoyette 	local setup_clientparam="pppoectl pppoe0 myauthproto=$auth \
    361  1.1.2.1  pgoyette 				    'myauthname=$AUTHNAME' \
    362  1.1.2.1  pgoyette 				    'myauthsecret=invalidsecret' \
    363  1.1.2.1  pgoyette 				    'hisauthproto=none'"
    364  1.1.2.1  pgoyette 	atf_check -s exit:0 -x "$HIJACKING $setup_clientparam"
    365  1.1.2.1  pgoyette 	atf_check -s exit:0 rump.ifconfig pppoe0 up
    366  1.1.2.1  pgoyette 	wait_for_session_established dontfail
    367  1.1.2.1  pgoyette 	atf_check -s not-exit:0 -o ignore -e ignore \
    368  1.1.2.1  pgoyette 	    rump.ping6 -c 1 -X $TIMEOUT $SERVER_IP6
    369  1.1.2.1  pgoyette 	atf_check -s exit:0 -o match:'DETACHED' rump.ifconfig pppoe0
    370  1.1.2.1  pgoyette 	unset RUMP_SERVER
    371  1.1.2.1  pgoyette }
    372  1.1.2.1  pgoyette 
    373  1.1.2.1  pgoyette atf_test_case pppoe6_pap cleanup
    374  1.1.2.1  pgoyette 
    375  1.1.2.1  pgoyette pppoe6_pap_head()
    376  1.1.2.1  pgoyette {
    377  1.1.2.1  pgoyette 	atf_set "descr" "Does simple pap using IPv6 tests"
    378  1.1.2.1  pgoyette 	atf_set "require.progs" "rump_server pppoectl"
    379  1.1.2.1  pgoyette }
    380  1.1.2.1  pgoyette 
    381  1.1.2.1  pgoyette pppoe6_pap_body()
    382  1.1.2.1  pgoyette {
    383  1.1.2.1  pgoyette 	run_test6 pap
    384  1.1.2.1  pgoyette }
    385  1.1.2.1  pgoyette 
    386  1.1.2.1  pgoyette pppoe6_pap_cleanup()
    387      1.1     ozaki {
    388      1.1     ozaki 	cleanup
    389      1.1     ozaki }
    390  1.1.2.1  pgoyette 
    391  1.1.2.1  pgoyette atf_test_case pppoe6_chap cleanup
    392  1.1.2.1  pgoyette 
    393  1.1.2.1  pgoyette pppoe6_chap_head()
    394  1.1.2.1  pgoyette {
    395  1.1.2.1  pgoyette 	atf_set "descr" "Does simple chap using IPv6 tests"
    396  1.1.2.1  pgoyette 	atf_set "require.progs" "rump_server pppoectl"
    397  1.1.2.1  pgoyette }
    398  1.1.2.1  pgoyette 
    399  1.1.2.1  pgoyette pppoe6_chap_body()
    400  1.1.2.1  pgoyette {
    401  1.1.2.1  pgoyette 	run_test6 chap
    402  1.1.2.1  pgoyette }
    403  1.1.2.1  pgoyette 
    404  1.1.2.1  pgoyette pppoe6_chap_cleanup()
    405  1.1.2.1  pgoyette {
    406  1.1.2.1  pgoyette 	cleanup
    407  1.1.2.1  pgoyette }
    408  1.1.2.1  pgoyette 
    409      1.1     ozaki atf_init_test_cases()
    410      1.1     ozaki {
    411  1.1.2.1  pgoyette 	atf_add_test_case pppoe_pap
    412  1.1.2.1  pgoyette 	atf_add_test_case pppoe_chap
    413  1.1.2.1  pgoyette 	atf_add_test_case pppoe6_pap
    414  1.1.2.1  pgoyette 	atf_add_test_case pppoe6_chap
    415      1.1     ozaki }
    416