File: test.debug_iptables

package info (click to toggle)
shellia 5.3.2
  • links: PTS
  • area: main
  • in suites: buster
  • size: 412 kB
  • sloc: sh: 3,235; makefile: 32
file content (40 lines) | stat: -rwxr-xr-x 1,355 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/sh
# vim: set filetype=sh :
#        file: test.debug_iptables
#   copyright: Bernd Schumacher <bernd.schumacher@hpe.com> (2007-2018)
#     license: GNU General Public License, version 3
# description: test provided debug features
#    see also: example.debug_iptables

# The following tests are included:
# (1) Run this script without option

. ./tstlib

shell=""
while [ $# -ne 0 ]; do
  if [ "$1" = "-s" ]; then
    shell="$2"
    shift 2
  else
    echo "ERROR $0: unknown option <$1>" >&2
    exit 1
  fi
done

[ "$shell" ] && set -- "$@" -s "$shell"
[ "$shell" = "mksh" ] && set -- "$@" -u "$UNIFY_mksh"
[ "$shell" = "bash" ] && set -- "$@" -u "$UNIFY_bash"
bug913718_unify UNIFY_posh
[ "$shell" = "posh" ] && set -- "$@" -u "$UNIFY_posh"

cmd="./example.debug_iptables"
bug913718_cmd

check "(1) Run without options" "$@" "$cmd" ""
check "(2) Run without options" "$@" "$cmd -d 1" ""
check "(3) Run without options" "$@" "$cmd -d 2" ""
check "(4) Run without options" "$@" "$cmd -d 3" "iptables -A INPUT -j LOG --log-prefix iptables IPv4-INPUT: 
ip6tables -A INPUT -j LOG --log-prefix iptables IPV6-INPUT: "
check "(5) Run without options" "$@" "$cmd -d IPv4 3" "iptables -A INPUT -j LOG --log-prefix iptables IPv4-INPUT: "
check "(6) Run without options" "$@" "$cmd -d IPv6 3" "ip6tables -A INPUT -j LOG --log-prefix iptables IPV6-INPUT: "