aboutsummaryrefslogtreecommitdiffstats
path: root/package/firewall/files/bin/fw
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2010-05-01 18:22:01 +0000
committerJo-Philipp Wich <jow@openwrt.org>2010-05-01 18:22:01 +0000
commitc284cb51c00625f52090f3fe3d475450eaab7b21 (patch)
tree02c49883956e50f28055df479accfa35c3c6fcdd /package/firewall/files/bin/fw
parent085b2b9ad6216508ff357dcb49757173d269fbb9 (diff)
downloadupstream-c284cb51c00625f52090f3fe3d475450eaab7b21.tar.gz
upstream-c284cb51c00625f52090f3fe3d475450eaab7b21.tar.bz2
upstream-c284cb51c00625f52090f3fe3d475450eaab7b21.zip
firewall: - replace uci firewall with a modular dual stack implementation developed by Malte S. Stretz - bump version to 2
SVN-Revision: 21286
Diffstat (limited to 'package/firewall/files/bin/fw')
-rw-r--r--package/firewall/files/bin/fw49
1 files changed, 49 insertions, 0 deletions
diff --git a/package/firewall/files/bin/fw b/package/firewall/files/bin/fw
new file mode 100644
index 0000000000..0f83b8eed8
--- /dev/null
+++ b/package/firewall/files/bin/fw
@@ -0,0 +1,49 @@
+#!/bin/sh
+FW_LIBDIR=/lib/firewall
+
+. /etc/functions.sh
+. ${FW_LIBDIR}/fw.sh
+
+case "$(type fw)" in
+ *function) ;;
+ *) exit 255;;
+esac
+
+usage() {
+ echo $0 "<command>" "<family>" "<table>" "<chain>" "<target>" "{" "<rules>" "}"
+ exit 0
+}
+
+cmd=$1
+shift
+case "$cmd" in
+ --help|help) usage ;;
+ start|stop|reload|restart)
+ . ${FW_LIBDIR}/core.sh
+ fw_$cmd
+ exit $?
+ ;;
+esac
+
+fam=$1
+shift
+case "$fam" in
+ ip)
+ fam=i
+ if [ $# -gt 2 ]; then
+ for p in $(seq 2 $(($# - 1))); do
+ if eval "[ \$$p == '}' ]"; then
+ fam=I
+ break
+ fi
+ done
+ fi ;;
+ ip4) fam=4 ;;
+ ip6) fam=6 ;;
+ arp) fam=a ;;
+ eth) fam=e ;;
+ -*) exec $0 $cmd ${fam##*-} "$@" ;;
+esac
+
+fw "$cmd" "$fam" "$@"
+exit $?