etc/protocols - sync with NetBSD-8
[minix.git] / tests / ipf / t_nat_ipf_exec.sh
blob663edb94498520d4eabbbd5b2fd830d4bb6a8a44
1 # $NetBSD: t_nat_ipf_exec.sh,v 1.7 2012/07/07 23:29:44 pgoyette Exp $
3 # Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
4 # All rights reserved.
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions
8 # are met:
9 # 1. Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
11 # 2. Redistributions in binary form must reproduce the above copyright
12 # notice, this list of conditions and the following disclaimer in the
13 # documentation and/or other materials provided with the distribution.
15 # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
16 # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
17 # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
19 # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 # POSSIBILITY OF SUCH DAMAGE.
28 # (C)opyright 1993-1996 by Darren Reed.
30 # See the IPFILTER.LICENCE file for details on licencing.
33 natipftest()
35 h_copydata $1
36 cp $(atf_get_srcdir)/regress/$1.nat nat
37 cp $(atf_get_srcdir)/regress/$1.ipf ipf
38 many=$2
39 infmt=$3
40 outfmt=$4
41 shift
42 shift
43 shift
44 shift
45 args=$@
47 if [ $outfmt = hex ] ; then
48 format="-xF $infmt"
49 else
50 format="-F $infmt"
53 case $many in
54 single)
55 { while read rule; do
56 atf_check -o save:save -x "echo \"$rule\" | \
57 ipftest -R $format -b -r ipf -N - -i in $args"
58 cat save >>out
59 echo "-------------------------------" >>out
60 done; } <nat
62 multi)
63 atf_check -o save:out ipftest -R $args \
64 $format -b -r ipf -N nat -i in
65 echo "-------------------------------" >>out
67 esac
69 diff -u exp out || atf_fail "results differ"
72 test_case ni1 natipftest multi hex hex -T update_ipid=1
73 test_case ni2 natipftest single hex hex -T update_ipid=1
74 test_case ni3 natipftest single hex hex -T update_ipid=1
75 test_case ni4 natipftest single hex hex -T update_ipid=1
76 test_case ni5 natipftest single hex hex -T update_ipid=1
77 test_case ni6 natipftest multi hex text -T update_ipid=1 -D
78 test_case ni7 natipftest single hex hex -T update_ipid=1
79 test_case ni8 natipftest single hex hex -T update_ipid=1
80 test_case ni9 natipftest single hex hex -T update_ipid=1
81 test_case ni10 natipftest single hex hex -T update_ipid=1
82 test_case ni11 natipftest single hex hex -T update_ipid=1
83 test_case ni12 natipftest single hex hex -T update_ipid=1
84 test_case ni13 natipftest single hex hex -T update_ipid=1
85 test_case ni14 natipftest single hex hex -T update_ipid=1
86 test_case ni15 natipftest single hex hex -T update_ipid=1
87 test_case ni16 natipftest single hex hex -T update_ipid=1
88 test_case ni17 natipftest multi text text
89 test_case ni18 natipftest multi text text
90 test_case ni19 natipftest single hex hex -T update_ipid=0
91 test_case ni20 natipftest single hex hex -T update_ipid=0 -D
92 test_case ni21 natipftest multi text text
93 test_case ni23 natipftest multi text text -D
95 atf_init_test_cases()
97 atf_add_test_case ni1
98 atf_add_test_case ni2
99 atf_add_test_case ni3
100 atf_add_test_case ni4
101 atf_add_test_case ni5
102 atf_add_test_case ni6
103 atf_add_test_case ni7
104 atf_add_test_case ni8
105 atf_add_test_case ni9
106 atf_add_test_case ni10
107 atf_add_test_case ni11
108 atf_add_test_case ni12
109 atf_add_test_case ni13
110 atf_add_test_case ni14
111 atf_add_test_case ni15
112 atf_add_test_case ni16
113 atf_add_test_case ni17
114 atf_add_test_case ni18
115 atf_add_test_case ni19
116 atf_add_test_case ni20
117 atf_add_test_case ni21
118 atf_add_test_case ni23