Index: head/etc/mtree/BSD.tests.dist =================================================================== --- head/etc/mtree/BSD.tests.dist (revision 326496) +++ head/etc/mtree/BSD.tests.dist (revision 326497) @@ -1,762 +1,766 @@ # $FreeBSD$ # # Please see the file src/etc/mtree/README before making changes to this file. # /set type=dir uname=root gname=wheel mode=0755 . bin cat .. chflags .. chmod .. date .. dd .. echo .. expr .. ln .. ls .. mkdir .. mv .. pax .. pkill .. pwait .. rmdir .. sh builtins .. errors .. execution .. expansion .. invocation .. parameters .. parser .. set-e .. .. sleep .. test .. .. cddl lib .. sbin .. usr.bin ctfconvert .. .. usr.sbin dtrace common aggs .. arithmetic .. arrays .. assocs .. begin .. bitfields .. buffering .. builtinvar .. cg .. clauses .. cpc .. decls .. drops .. dtraceUtil .. end .. enum .. error .. exit .. fbtprovider .. funcs .. grammar .. include .. inline .. io .. ip .. java_api .. json .. lexer .. llquantize .. mdb .. mib .. misc .. multiaggs .. offsetof .. operators .. pid .. plockstat .. pointers .. pragma .. predicates .. preprocessor .. print .. printa .. printf .. privs .. probes .. proc .. profile-n .. providers .. raise .. rates .. safety .. scalars .. sched .. scripting .. sdt .. sizeof .. speculation .. stability .. stack .. stackdepth .. stop .. strlen .. strtoll .. struct .. sugar .. syscall .. sysevent .. tick-n .. trace .. tracemem .. translators .. typedef .. types .. uctf .. union .. usdt .. ustack .. vars .. version .. .. .. zfsd .. .. .. etc rc.d .. .. games .. gnu lib .. usr.bin diff .. .. .. lib atf libatf-c detail .. .. libatf-c++ detail .. .. test-programs .. .. libarchive .. libc c063 .. db .. gen execve .. posix_spawn .. .. hash data .. .. iconv .. inet .. locale .. net getaddrinfo data .. .. .. nss .. regex data .. .. resolv .. rpc .. ssp .. setjmp .. stdio .. stdlib .. string .. sys .. time .. tls dso .. .. termios .. ttyio .. .. libcam .. libcasper services cap_dns .. cap_grp .. cap_pwd .. cap_sysctl .. .. .. libcrypt .. libdevdctl .. libkvm .. libmp .. libnv .. libproc .. librt .. libsbuf .. libthr dlopen .. .. libutil .. libxo .. msun .. .. libexec atf atf-check .. atf-sh .. .. rtld-elf .. .. sbin dhclient .. devd .. growfs .. ifconfig .. mdconfig .. pfctl files .. .. .. secure lib .. libexec .. usr.bin .. usr.sbin .. .. share examples tests atf .. plain .. tap .. .. .. zoneinfo .. .. sys acl .. aio .. fifo .. file .. fs tmpfs .. .. geom class concat .. eli .. gate .. gpt .. mirror .. nop .. raid3 .. shsec .. stripe .. uzip etalon .. .. .. .. kern acct .. execve .. pipe .. .. kqueue libkqueue .. .. mac bsdextended .. portacl .. .. mqueue .. netinet .. + netipsec + tunnel + .. + .. netpfil pf .. .. opencrypto .. pjdfstest chflags .. chmod .. chown .. ftruncate .. granular .. link .. mkdir .. mkfifo .. mknod .. open .. rename .. rmdir .. symlink .. truncate .. unlink .. utimensat .. .. posixshm .. sys .. vfs .. vm .. .. usr.bin apply .. basename .. bmake archives fmt_44bsd .. fmt_44bsd_mod .. fmt_oldbsd .. .. basic t0 .. t1 .. t2 .. t3 .. .. execution ellipsis .. empty .. joberr .. plus .. .. shell builtin .. meta .. path .. path_select .. replace .. select .. .. suffixes basic .. src_wild1 .. src_wild2 .. .. syntax directive-t0 .. enl .. funny-targets .. semi .. .. sysmk t0 2 1 .. .. mk .. .. t1 2 1 .. .. mk .. .. t2 2 1 .. .. mk .. .. .. variables modifier_M .. modifier_t .. opt_V .. t0 .. .. .. bsdcat .. calendar .. cmp .. compress .. cpio .. col .. comm .. csplit .. cut .. diff .. dirname .. du .. file2c .. fold .. getconf .. grep .. gzip .. head .. hexdump .. ident .. indent .. join .. jot .. lastcomm .. limits .. m4 .. mkimg .. ncal .. opensm .. pr .. printf .. procstat .. rs .. sdiff .. sed regress.multitest.out .. .. soelim .. stat .. tail .. tar .. timeout .. tr .. truncate .. units .. uudecode .. uuencode .. uniq .. xargs .. xinstall .. xo .. yacc yacc .. .. .. usr.sbin chown .. etcupdate .. extattr .. fstyp .. makefs .. newsyslog .. nmtree .. pw .. rpcbind .. sa .. .. .. # vim: set expandtab ts=4 sw=4: Index: head/tests/sys/Makefile =================================================================== --- head/tests/sys/Makefile (revision 326496) +++ head/tests/sys/Makefile (revision 326497) @@ -1,26 +1,27 @@ # $FreeBSD$ TESTSDIR= ${TESTSBASE}/sys TESTS_SUBDIRS+= acl TESTS_SUBDIRS+= aio TESTS_SUBDIRS+= fifo TESTS_SUBDIRS+= file TESTS_SUBDIRS+= fs TESTS_SUBDIRS+= geom TESTS_SUBDIRS+= kern TESTS_SUBDIRS+= kqueue TESTS_SUBDIRS+= mac TESTS_SUBDIRS+= mqueue TESTS_SUBDIRS+= netinet +TESTS_SUBDIRS+= netipsec TESTS_SUBDIRS+= netpfil TESTS_SUBDIRS+= opencrypto TESTS_SUBDIRS+= posixshm TESTS_SUBDIRS+= sys TESTS_SUBDIRS+= vfs TESTS_SUBDIRS+= vm # Items not integrated into kyua runs by default SUBDIR+= pjdfstest .include Index: head/tests/sys/netipsec/Makefile =================================================================== --- head/tests/sys/netipsec/Makefile (nonexistent) +++ head/tests/sys/netipsec/Makefile (revision 326497) @@ -0,0 +1,7 @@ +# $FreeBSD$ + +TESTSDIR= ${TESTSBASE}/sys/netipsec + +TESTS_SUBDIRS+= tunnel + +.include Property changes on: head/tests/sys/netipsec/Makefile ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/tests/sys/netipsec/tunnel/Makefile =================================================================== --- head/tests/sys/netipsec/tunnel/Makefile (nonexistent) +++ head/tests/sys/netipsec/tunnel/Makefile (revision 326497) @@ -0,0 +1,19 @@ +# $FreeBSD$ + +PACKAGE= tests + +TESTSDIR= ${TESTSBASE}/sys/netipsec/tunnel + +ATF_TESTS_SH+= empty \ + aes_cbc_128_hmac_sha1 \ + aes_cbc_256_hmac_sha2_256 \ + aes_gcm_128 \ + aes_gcm_256 \ + aesni_aes_cbc_128_hmac_sha1 \ + aesni_aes_cbc_256_hmac_sha2_256 \ + aesni_aes_gcm_128 \ + aesni_aes_gcm_256 + +${PACKAGE}FILES+= utils.subr + +.include Property changes on: head/tests/sys/netipsec/tunnel/Makefile ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/tests/sys/netipsec/tunnel/aes_cbc_128_hmac_sha1.sh =================================================================== --- head/tests/sys/netipsec/tunnel/aes_cbc_128_hmac_sha1.sh (nonexistent) +++ head/tests/sys/netipsec/tunnel/aes_cbc_128_hmac_sha1.sh (revision 326497) @@ -0,0 +1,47 @@ +# $FreeBSD$ + +. $(atf_get_srcdir)/utils.subr + +atf_test_case "v4" "cleanup" +v4_head() +{ + atf_set descr 'IPSec inet4 tunnel using aes-cbc-128-hmac-sha1' + atf_set require.user root + # Unload AESNI module if loaded + kldstat -q -n aesni && kldunload aesni +} + +v4_body() +{ + ist_test 4 rijndael-cbc "1234567890123456" hmac-sha1 "12345678901234567890" +} + +v4_cleanup() +{ + ist_cleanup +} + +atf_test_case "v6" "cleanup" +v6_head() +{ + atf_set descr 'IPSec inet6 tunnel using aes-cbc-128-hmac-sha1' + atf_set require.user root + # Unload AESNI module if loaded + kldstat -q -n aesni && kldunload aesni +} + +v6_body() +{ + ist_test 6 rijndael-cbc "1234567890123456" hmac-sha1 "12345678901234567890" +} + +v6_cleanup() +{ + ist_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case "v4" + atf_add_test_case "v6" +} Property changes on: head/tests/sys/netipsec/tunnel/aes_cbc_128_hmac_sha1.sh ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/tests/sys/netipsec/tunnel/aes_cbc_256_hmac_sha2_256.sh =================================================================== --- head/tests/sys/netipsec/tunnel/aes_cbc_256_hmac_sha2_256.sh (nonexistent) +++ head/tests/sys/netipsec/tunnel/aes_cbc_256_hmac_sha2_256.sh (revision 326497) @@ -0,0 +1,47 @@ +# $FreeBSD$ + +. $(atf_get_srcdir)/utils.subr + +atf_test_case "v4" "cleanup" +v4_head() +{ + atf_set descr 'IPSec inet4 tunnel using aes-cbc-256-hmac-sha2-256' + atf_set require.user root + # load AESNI module if not already + kldstat -q -n aesni || kldload aesni +} + +v4_body() +{ + ist_test 4 rijndael-cbc "12345678901234567890123456789012" hmac-sha2-256 "12345678901234567890123456789012" +} + +v4_cleanup() +{ + ist_cleanup +} + +atf_test_case "v6" "cleanup" +v6_head() +{ + atf_set descr 'IPSec inet6 tunnel using aes-cbc-256-hmac-sha2-256' + atf_set require.user root + # load AESNI module if not already + kldstat -q -n aesni || kldload aesni +} + +v6_body() +{ + ist_test 6 rijndael-cbc "12345678901234567890123456789012" hmac-sha2-256 "12345678901234567890123456789012" +} + +v6_cleanup() +{ + ist_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case "v4" + atf_add_test_case "v6" +} Property changes on: head/tests/sys/netipsec/tunnel/aes_cbc_256_hmac_sha2_256.sh ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/tests/sys/netipsec/tunnel/aes_gcm_128.sh =================================================================== --- head/tests/sys/netipsec/tunnel/aes_gcm_128.sh (nonexistent) +++ head/tests/sys/netipsec/tunnel/aes_gcm_128.sh (revision 326497) @@ -0,0 +1,47 @@ +# $FreeBSD$ + +. $(atf_get_srcdir)/utils.subr + +atf_test_case "v4" "cleanup" +v4_head() +{ + atf_set descr 'IPSec inet4 tunnel using aes-gcm-128' + atf_set require.user root + # Unload AESNI module if loaded + kldstat -q -n aesni && kldunload aesni +} + +v4_body() +{ + ist_test 4 aes-gcm-16 "12345678901234567890" +} + +v4_cleanup() +{ + ist_cleanup +} + +atf_test_case "v6" "cleanup" +v6_head() +{ + atf_set descr 'IPSec inet6 tunnel using aes-gcm-128' + atf_set require.user root + # Unload AESNI module if loaded + kldstat -q -n aesni && kldunload aesni +} + +v6_body() +{ + ist_test 6 aes-gcm-16 "12345678901234567890" +} + +v6_cleanup() +{ + ist_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case "v4" + atf_add_test_case "v6" +} Property changes on: head/tests/sys/netipsec/tunnel/aes_gcm_128.sh ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/tests/sys/netipsec/tunnel/aes_gcm_256.sh =================================================================== --- head/tests/sys/netipsec/tunnel/aes_gcm_256.sh (nonexistent) +++ head/tests/sys/netipsec/tunnel/aes_gcm_256.sh (revision 326497) @@ -0,0 +1,47 @@ +# $FreeBSD$ + +. $(atf_get_srcdir)/utils.subr + +atf_test_case "v4" "cleanup" +v4_head() +{ + atf_set descr 'IPSec inet4 tunnel using aes-gcm-256' + atf_set require.user root + # Unload AESNI module if loaded + kldstat -q -n aesni && kldunload aesni +} + +v4_body() +{ + ist_test 4 aes-gcm-16 "123456789012345678901234567890123456" +} + +v4_cleanup() +{ + ist_cleanup +} + +atf_test_case "v6" "cleanup" +v6_head() +{ + atf_set descr 'IPSec inet6 tunnel using aes-gcm-256' + atf_set require.user root + # Unload AESNI module if loaded + kldstat -q -n aesni && kldunload aesni +} + +v6_body() +{ + ist_test 6 aes-gcm-16 "123456789012345678901234567890123456" +} + +v6_cleanup() +{ + ist_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case "v4" + atf_add_test_case "v6" +} Property changes on: head/tests/sys/netipsec/tunnel/aes_gcm_256.sh ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/tests/sys/netipsec/tunnel/aesni_aes_cbc_128_hmac_sha1.sh =================================================================== --- head/tests/sys/netipsec/tunnel/aesni_aes_cbc_128_hmac_sha1.sh (nonexistent) +++ head/tests/sys/netipsec/tunnel/aesni_aes_cbc_128_hmac_sha1.sh (revision 326497) @@ -0,0 +1,47 @@ +# $FreeBSD$ + +. $(atf_get_srcdir)/utils.subr + +atf_test_case "v4" "cleanup" +v4_head() +{ + atf_set descr 'IPSec inet4 tunnel using aes-cbc-128-hmac-sha1 and AESNI' + atf_set require.user root + # load AESNI module if not already + kldstat -q -n aesni || kldload aesni +} + +v4_body() +{ + ist_test 4 rijndael-cbc "1234567890123456" hmac-sha1 "12345678901234567890" +} + +v4_cleanup() +{ + ist_cleanup +} + +atf_test_case "v6" "cleanup" +v6_head() +{ + atf_set descr 'IPSec inet6 tunnel using aes-cbc-128-hmac-sha1 and AESNI' + atf_set require.user root + # load AESNI module if not already + kldstat -q -n aesni || kldload aesni +} + +v6_body() +{ + ist_test 6 rijndael-cbc "1234567890123456" hmac-sha1 "12345678901234567890" +} + +v6_cleanup() +{ + ist_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case "v4" + atf_add_test_case "v6" +} Property changes on: head/tests/sys/netipsec/tunnel/aesni_aes_cbc_128_hmac_sha1.sh ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/tests/sys/netipsec/tunnel/aesni_aes_cbc_256_hmac_sha2_256.sh =================================================================== --- head/tests/sys/netipsec/tunnel/aesni_aes_cbc_256_hmac_sha2_256.sh (nonexistent) +++ head/tests/sys/netipsec/tunnel/aesni_aes_cbc_256_hmac_sha2_256.sh (revision 326497) @@ -0,0 +1,47 @@ +# $FreeBSD$ + +. $(atf_get_srcdir)/utils.subr + +atf_test_case "v4" "cleanup" +v4_head() +{ + atf_set descr 'IPSec inet4 tunnel using aes-cbc-256-hmac-sha2-256 and AESNI' + atf_set require.user root + # Unload AESNI module if loaded + kldstat -q -n aesni && kldunload aesni +} + +v4_body() +{ + ist_test 4 rijndael-cbc "12345678901234567890123456789012" hmac-sha2-256 "12345678901234567890123456789012" +} + +v4_cleanup() +{ + ist_cleanup +} + +atf_test_case "v6" "cleanup" +v6_head() +{ + atf_set descr 'IPSec inet6 tunnel using aes-cbc-256-hmac-sha2-256 and AESNI' + atf_set require.user root + # Unload AESNI module if loaded + kldstat -q -n aesni && kldunload aesni +} + +v6_body() +{ + ist_test 6 rijndael-cbc "12345678901234567890123456789012" hmac-sha2-256 "12345678901234567890123456789012" +} + +v6_cleanup() +{ + ist_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case "v4" + atf_add_test_case "v6" +} Property changes on: head/tests/sys/netipsec/tunnel/aesni_aes_cbc_256_hmac_sha2_256.sh ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/tests/sys/netipsec/tunnel/aesni_aes_gcm_128.sh =================================================================== --- head/tests/sys/netipsec/tunnel/aesni_aes_gcm_128.sh (nonexistent) +++ head/tests/sys/netipsec/tunnel/aesni_aes_gcm_128.sh (revision 326497) @@ -0,0 +1,48 @@ +# $FreeBSD$ + +. $(atf_get_srcdir)/utils.subr + +atf_test_case "v4" "cleanup" +v4_head() +{ + atf_set descr 'IPSec inet4 tunnel using aes-gcm-128 and AESNI' + atf_set require.user root + # load AESNI module if not already + kldstat -q -n aesni || kldload aesni +} + +v4_body() +{ + ist_test 4 aes-gcm-16 "12345678901234567890" +} + +v4_cleanup() +{ + ist_cleanup +} + +atf_test_case "v6" "cleanup" +v6_head() +{ + atf_set descr 'IPSec inet6 tunnel using aes-gcm-128 and AESNI' + atf_set require.user root + # load AESNI module if not already + kldstat -q -n aesni || kldload aesni +} + +v6_body() +{ + atf_expect_fail "PR 201447" + ist_test 6 aes-gcm-16 "12345678901234567890" +} + +v6_cleanup() +{ + ist_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case "v4" + atf_add_test_case "v6" +} Property changes on: head/tests/sys/netipsec/tunnel/aesni_aes_gcm_128.sh ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/tests/sys/netipsec/tunnel/aesni_aes_gcm_256.sh =================================================================== --- head/tests/sys/netipsec/tunnel/aesni_aes_gcm_256.sh (nonexistent) +++ head/tests/sys/netipsec/tunnel/aesni_aes_gcm_256.sh (revision 326497) @@ -0,0 +1,48 @@ +# $FreeBSD$ + +. $(atf_get_srcdir)/utils.subr + +atf_test_case "v4" "cleanup" +v4_head() +{ + atf_set descr 'IPSec inet4 tunnel using aes-gcm-256 and AESNI' + atf_set require.user root + # load AESNI module if not already + kldstat -q -n aesni || kldload aesni +} + +v4_body() +{ + ist_test 4 aes-gcm-16 "123456789012345678901234567890123456" +} + +v4_cleanup() +{ + ist_cleanup +} + +atf_test_case "v6" "cleanup" +v6_head() +{ + atf_set descr 'IPSec inet6 tunnel using aes-gcm-256 and AESNI' + atf_set require.user root + # load AESNI module if not already + kldstat -q -n aesni || kldload aesni +} + +v6_body() +{ + atf_expect_fail "PR 201447" + ist_test 6 aes-gcm-16 "123456789012345678901234567890123456" +} + +v6_cleanup() +{ + ist_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case "v4" + atf_add_test_case "v6" +} Property changes on: head/tests/sys/netipsec/tunnel/aesni_aes_gcm_256.sh ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/tests/sys/netipsec/tunnel/empty.sh =================================================================== --- head/tests/sys/netipsec/tunnel/empty.sh (nonexistent) +++ head/tests/sys/netipsec/tunnel/empty.sh (revision 326497) @@ -0,0 +1,44 @@ +# $FreeBSD$ + +. $(atf_get_srcdir)/utils.subr + +atf_test_case "v4" "cleanup" +v4_head() +{ + atf_set descr 'IPSec inet4 tunnel using NULL encryption' + atf_set require.user root +} + +v4_body() +{ + # Can't use filename "null" for this script: PR 223564 + ist_test 4 null "" +} + +v4_cleanup() +{ + ist_cleanup +} + +atf_test_case "v6" "cleanup" +v6_head() +{ + atf_set descr 'IPSec inet6 tunnel using NULL encryption' + atf_set require.user root +} + +v6_body() +{ + ist_test 6 null "" +} + +v6_cleanup() +{ + ist_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case "v4" + atf_add_test_case "v6" +} Property changes on: head/tests/sys/netipsec/tunnel/empty.sh ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/tests/sys/netipsec/tunnel/utils.subr =================================================================== --- head/tests/sys/netipsec/tunnel/utils.subr (nonexistent) +++ head/tests/sys/netipsec/tunnel/utils.subr (revision 326497) @@ -0,0 +1,166 @@ +# $FreeBSD$ +# Utility functions (mainly from pf tests, should be merged one day) +## + +: ${TMPDIR=/tmp} + +ist_init() +{ + if [ "$(sysctl -i -n kern.features.vimage)" != 1 ]; then + atf_skip "This test requires VIMAGE" + fi +} + +pft_mkepair() +{ + ifname=$(ifconfig epair create) + echo $ifname >> created_interfaces.lst + echo ${ifname%a} +} + +pft_mkjail() +{ + jailname=$1 + shift + + vnet_interfaces= + for ifname in $@ + do + vnet_interfaces="${vnet_interfaces} vnet.interface=${ifname}" + done + jail -c name=${jailname} persist vnet ${vnet_interfaces} + + echo $jailname >> created_jails.lst +} + +ist_labsetup () +{ + epair_LAN_A=$(pft_mkepair) + ifconfig ${epair_LAN_A}a up + epair_PUB_A=$(pft_mkepair) + ifconfig ${epair_PUB_A}a up + epair_LAN_B=$(pft_mkepair) + ifconfig ${epair_LAN_B}a up + epair_PUB_B=$(pft_mkepair) + ifconfig ${epair_PUB_B}a up + + pft_mkjail hostA ${epair_LAN_A}a + pft_mkjail ipsecA ${epair_LAN_A}b ${epair_PUB_A}a + pft_mkjail router ${epair_PUB_A}b ${epair_PUB_B}b + pft_mkjail ipsecB ${epair_LAN_B}b ${epair_PUB_B}a + pft_mkjail hostB ${epair_LAN_B}a +} + +ist_v4_setup () +{ + jexec hostA ifconfig ${epair_LAN_A}a 192.0.2.1/30 up + jexec ipsecA ifconfig ${epair_LAN_A}b 192.0.2.2/30 up + jexec ipsecA ifconfig ${epair_PUB_A}a 198.51.100.2/30 up + jexec router ifconfig ${epair_PUB_A}b 198.51.100.1/30 up + jexec router ifconfig ${epair_PUB_B}b 198.51.100.6/30 up + jexec ipsecB ifconfig ${epair_PUB_B}a 198.51.100.7/30 up + jexec ipsecB ifconfig ${epair_LAN_B}b 203.0.113.2/30 up + jexec hostB ifconfig ${epair_LAN_B}a 203.0.113.1/30 up + jexec ipsecA sysctl net.inet.ip.forwarding=1 + jexec router sysctl net.inet.ip.forwarding=1 + jexec ipsecB sysctl net.inet.ip.forwarding=1 + jexec hostA route add default 192.0.2.2 + jexec ipsecA route add default 198.51.100.1 + jexec ipsecB route add default 198.51.100.6 + jexec hostB route add default 203.0.113.2 +} + +ist_v6_setup () +{ + jexec hostA ifconfig ${epair_LAN_A}a inet6 2001:db8:1::1/64 up no_dad + jexec ipsecA ifconfig ${epair_LAN_A}b inet6 2001:db8:1::2/64 up no_dad + jexec ipsecA ifconfig ${epair_PUB_A}a inet6 2001:db8:23::2/64 up no_dad + jexec router ifconfig ${epair_PUB_A}b inet6 2001:db8:23::3/64 up no_dad + jexec router ifconfig ${epair_PUB_B}b inet6 2001:db8:34::3/64 up no_dad + jexec ipsecB ifconfig ${epair_PUB_B}a inet6 2001:db8:34::2/64 up no_dad + jexec ipsecB ifconfig ${epair_LAN_B}b inet6 2001:db8:45::2/64 up no_dad + jexec hostB ifconfig ${epair_LAN_B}a inet6 2001:db8:45::1/64 up no_dad + jexec ipsecA sysctl net.inet6.ip6.forwarding=1 + jexec router sysctl net.inet6.ip6.forwarding=1 + jexec ipsecB sysctl net.inet6.ip6.forwarding=1 + jexec hostA route -6 add default 2001:db8:1::2 + jexec ipsecA route -6 add default 2001:db8:23::3 + jexec ipsecB route -6 add default 2001:db8:34::3 + jexec hostB route -6 add default 2001:db8:45::2 +} + +ist_setkey() +{ + jname=$1 + dir=$2 + afnet=$3 + enc_algo=$4 + enc_key=$5 + auth_algo=$6 + auth_key=$7 + + # Load + ( + printf "#arguments debug: ${jname} ${afnet} ${dir} ${enc_algo} " + printf "${enc_key} ${auth_algo} ${auth_key}\n" + printf "flush;\n" + printf "spdflush;\n" + if [ ${afnet} -eq 4 ]; then + SRC_LAN="192.0.2.0/24" + DST_LAN="203.0.113.0/24" + SRC_GW="198.51.100.2" + DST_GW="198.51.100.7" + else + SRC_LAN="2001:db8:1::/64" + DST_LAN="2001:db8:45::/64" + SRC_GW="2001:db8:23::2" + DST_GW="2001:db8:34::2" + fi + printf "spdadd ${SRC_LAN} ${DST_LAN} any -P " + [ ${dir} = "out" ] && printf "out" || printf "in" + printf " ipsec esp/tunnel/${SRC_GW}-${DST_GW}/require;\n" + printf "spdadd ${DST_LAN} ${SRC_LAN} any -P " + [ ${dir} = "out" ] && printf "in" || printf "out" + printf " ipsec esp/tunnel/${DST_GW}-${SRC_GW}/require;\n" + printf "add ${SRC_GW} ${DST_GW} esp 0x1000 -E ${enc_algo} \"${enc_key}\"" + [ -n "${auth_algo}" ] && printf " -A ${auth_algo} \"${auth_key}\";\n" || printf ";\n" + printf "add ${DST_GW} ${SRC_GW} esp 0x1001 -E ${enc_algo} \"${enc_key}\"" + [ -n "$auth_algo" ] && printf " -A ${auth_algo} \"${auth_key}\";\n" || printf ";\n" + ) > ${TMPDIR}/ipsec.${jname}.conf +} + +ist_test() +{ + ist_init + ist_labsetup + [ $1 -eq 4 ] && ist_v4_setup || ist_v6_setup + ist_setkey ipsecA out $@ + atf_check -s exit:0 -o ignore jexec ipsecA setkey -f ${TMPDIR}/ipsec.ipsecA.conf + ist_setkey ipsecB in $@ + atf_check -s exit:0 -o ignore jexec ipsecB setkey -f ${TMPDIR}/ipsec.ipsecB.conf + # Check ipsec tunnel + if [ $1 -eq 4 ]; then + atf_check -s exit:0 -o ignore jexec hostA ping -c 1 203.0.113.1 + else + atf_check -s exit:0 -o ignore jexec hostA ping6 -c 1 2001:db8:45::1 + fi +} +ist_cleanup() +{ + if [ -f created_jails.lst ]; then + for jailname in $(cat created_jails.lst) + do + jail -r ${jailname} + rm -f ${TMPDIR}/ipsec.${jailname}.conf + done + rm created_jails.lst + fi + + if [ -f created_interfaces.lst ]; then + for ifname in $(cat created_interfaces.lst) + do + ifconfig ${ifname} destroy + done + rm created_interfaces.lst + fi +} Property changes on: head/tests/sys/netipsec/tunnel/utils.subr ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property