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