summaryrefslogtreecommitdiff
path: root/package/firewall
diff options
context:
space:
mode:
authorJohn Crispin <john@openwrt.org>2008-08-26 11:07:04 +0000
committerJohn Crispin <john@openwrt.org>2008-08-26 11:07:04 +0000
commit4d7f694c438e49f1842ce9af9da778d4c884f6a9 (patch)
treea7590ce6b54bf037843b6ecd0c2aecfcb0cdbcb1 /package/firewall
parentaa6c019c11e77e34e02fe4884016a82fa37ab5ed (diff)
downloadmtk-20170518-4d7f694c438e49f1842ce9af9da778d4c884f6a9.zip
mtk-20170518-4d7f694c438e49f1842ce9af9da778d4c884f6a9.tar.gz
mtk-20170518-4d7f694c438e49f1842ce9af9da778d4c884f6a9.tar.bz2
adds more sanity checks to uci firewall
SVN-Revision: 12392
Diffstat (limited to 'package/firewall')
-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 e1c4d4d..99663c6 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} \