[package] firewall:
[openwrt.git] / package / firewall / files / bin / fw
1 #!/bin/sh
2 FW_LIBDIR=/lib/firewall
3
4 . /etc/functions.sh
5 . ${FW_LIBDIR}/fw.sh
6
7 case "$(type fw)" in
8 *function) ;;
9 *) exit 255;;
10 esac
11
12 usage() {
13 echo $0 "<command>" "<family>" "<table>" "<chain>" "<target>" "{" "<rules>" "}"
14 exit 0
15 }
16
17 cmd=$1
18 shift
19 case "$cmd" in
20 --help|help) usage ;;
21 start|stop|reload|restart)
22 . ${FW_LIBDIR}/core.sh
23 fw_$cmd
24 exit $?
25 ;;
26 esac
27
28 fam=$1
29 shift
30 case "$fam" in
31 ip)
32 fam=i
33 if [ $# -gt 2 ]; then
34 for p in $(seq 2 $(($# - 1))); do
35 if eval "[ \$$p == '}' ]"; then
36 fam=I
37 break
38 fi
39 done
40 fi ;;
41 ip4) fam=4 ;;
42 ip6) fam=6 ;;
43 arp) fam=a ;;
44 eth) fam=e ;;
45 -*) exec $0 $cmd ${fam##*-} "$@" ;;
46 esac
47
48 fw "$cmd" "$fam" "$@"
49 exit $?
This page took 0.04694 seconds and 5 git commands to generate.