1# $FreeBSD$ 2 3. $(atf_get_srcdir)/../common/vnet.subr 4 5atf_test_case "235704" "cleanup" 6235704_head() 7{ 8 atf_set descr "Test PR #235704" 9 atf_set require.user root 10} 11235704_body() 12{ 13 vnet_init 14 vnet_mkjail one 15 16 tun=$(jexec one ifconfig tun create) 17 jexec one ifconfig ${tun} name foo 18 atf_check -s exit:0 jexec one ifconfig foo destroy 19} 20235704_cleanup() 21{ 22 vnet_cleanup 23} 24 25atf_test_case "basic" "cleanup" 26basic_head() 27{ 28 atf_set descr "Test if_tun using nc" 29 atf_set require.user root 30} 31basic_body() 32{ 33 vnet_init 34 35 epair=$(vnet_mkepair) 36 37 tun_duke=$(ifconfig tun create) 38 tun_bass=$(ifconfig tun create) 39 40 vnet_mkjail duke ${epair}a ${tun_duke} 41 vnet_mkjail bass ${epair}b ${tun_bass} 42 43 jexec duke ifconfig ${epair}a inet 10.0.0.1/24 up 44 jexec bass ifconfig ${epair}b inet 10.0.0.2/24 up 45 46 jexec duke nc -u -l --tun /dev/${tun_duke} 10.0.0.1 2600 & 47 jexec bass nc -u --tun /dev/${tun_bass} 10.0.0.1 2600 & 48 49 jexec duke ifconfig ${tun_duke} inet 10.100.0.1/24 10.100.0.2 up 50 jexec bass ifconfig ${tun_bass} inet 10.100.0.2/24 10.100.0.1 up 51 52 atf_check -s exit:0 -o ignore \ 53 jexec bass ping -c 1 10.100.0.1 54} 55basic_cleanup() 56{ 57 vnet_cleanup 58} 59 60atf_init_test_cases() 61{ 62 atf_add_test_case "235704" 63 atf_add_test_case "basic" 64} 65