mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-04 15:40:44 +00:00
if_tun: Add basic connectivity test with nc tun support
Reviewed by: kevans Sponsored by: Zenarmor Sponsored by: OPNsense Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D37435
This commit is contained in:
parent
cef7ab70ff
commit
fe701c39e8
|
@ -2,7 +2,7 @@
|
|||
|
||||
. $(atf_get_srcdir)/../common/vnet.subr
|
||||
|
||||
atf_test_case "235704" "cleanup"
|
||||
atf_test_case "235704" "basic" "cleanup"
|
||||
235704_head()
|
||||
{
|
||||
atf_set descr "Test PR #235704"
|
||||
|
@ -24,7 +24,44 @@ atf_test_case "235704" "cleanup"
|
|||
vnet_cleanup
|
||||
}
|
||||
|
||||
basic_head()
|
||||
{
|
||||
atf_set descr "Test if_tun using nc"
|
||||
atf_set require.user root
|
||||
}
|
||||
|
||||
basic_body()
|
||||
{
|
||||
vnet_init
|
||||
|
||||
epair=$(vnet_mkepair)
|
||||
|
||||
tun_duke=$(ifconfig tun create)
|
||||
tun_bass=$(ifconfig tun create)
|
||||
|
||||
vnet_mkjail duke ${epair}a ${tun_duke}
|
||||
vnet_mkjail bass ${epair}b ${tun_bass}
|
||||
|
||||
jexec duke ifconfig ${epair}a inet 10.0.0.1/24 up
|
||||
jexec bass ifconfig ${epair}b inet 10.0.0.2/24 up
|
||||
|
||||
jexec duke nc -u -l --tun /dev/${tun_duke} 10.0.0.1 2600 &
|
||||
jexec bass nc -u --tun /dev/${tun_bass} 10.0.0.1 2600 &
|
||||
|
||||
jexec duke ifconfig ${tun_duke} inet 10.100.0.1/24 10.100.0.2 up
|
||||
jexec bass ifconfig ${tun_bass} inet 10.100.0.2/24 10.100.0.1 up
|
||||
|
||||
atf_check -s exit:0 -o ignore \
|
||||
jexec bass ping -c 1 10.100.0.1
|
||||
}
|
||||
|
||||
basic_clean()
|
||||
{
|
||||
vnet_cleanup
|
||||
}
|
||||
|
||||
atf_init_test_cases()
|
||||
{
|
||||
atf_add_test_case "235704"
|
||||
atf_add_test_case "basic"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue