From: John Crispin Date: Tue, 26 Aug 2008 11:07:04 +0000 (+0000) Subject: adds more sanity checks to uci firewall X-Git-Tag: reboot~25717 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=4d7f694c438e49f1842ce9af9da778d4c884f6a9;p=openwrt%2Fstaging%2Fjogo.git adds more sanity checks to uci firewall SVN-Revision: 12392 --- 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} \