aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Crispin <blogic@openwrt.org>2008-08-26 11:07:04 +0000
committerJohn Crispin <blogic@openwrt.org>2008-08-26 11:07:04 +0000
commit9f8fc52bbc87bdb1e2eddafe778f7706dd08a0d2 (patch)
tree6450d035701d3e01c3f26ba5cb24b8d070498c3c
parent1d44d1a5ba914d549aba0577ff70a4ab13e8cb5c (diff)
downloadupstream-9f8fc52bbc87bdb1e2eddafe778f7706dd08a0d2.tar.gz
upstream-9f8fc52bbc87bdb1e2eddafe778f7706dd08a0d2.tar.bz2
upstream-9f8fc52bbc87bdb1e2eddafe778f7706dd08a0d2.zip
adds more sanity checks to uci firewall
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@12392 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rwxr-xr-xpackage/firewall/files/uci_firewall.sh4
1 files changed, 4 insertions, 0 deletions
diff --git a/package/firewall/files/uci_firewall.sh b/package/firewall/files/uci_firewall.sh
index e1c4d4d673..99663c6771 100755
--- a/package/firewall/files/uci_firewall.sh
+++ b/package/firewall/files/uci_firewall.sh
@@ -181,6 +181,8 @@ fw_rule() {
[ -n "$dest" ] && TARGET=zone_${dest}_$target || TARGET=$target
[ -n "$dest_port" -a -z "$proto" ] && { \
echo "dport may only be used it proto is defined"; return; }
+ [ -n "$src_port" -a -z "$proto" ] && { \
+ echo "sport may only be used it proto is defined"; return; }
$IPTABLES -I $ZONE 1 \
${proto:+-p $proto} \
${src_ip:+-s $src_ip} \
@@ -225,6 +227,8 @@ fw_redirect() {
echo "redirect needs src and dest_ip"; return ; }
[ -n "$dest_port" -a -z "$proto" ] && { \
echo "dport may only be used it proto is defined"; return; }
+ [ -n "$src_port" -a -z "$proto" ] && { \
+ echo "sport may only be used it proto is defined"; return; }
$IPTABLES -A zone_${src}_prerouting -t nat \
${proto:+-p $proto} \
${src_ip:+-s $src_ip} \