diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2009-01-16 18:09:19 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2009-01-16 18:09:19 +0000 |
commit | 83c9ac173d105243ffe346165d17f5109f9d4fa7 (patch) | |
tree | f22b603ed0196ff42d13d3e0fd318fab132c77e9 /package/firewall/files/uci_firewall.sh | |
parent | b693945d4fa1bc234c3332cf7fa04c67586197d3 (diff) | |
download | mtk-20170518-83c9ac173d105243ffe346165d17f5109f9d4fa7.zip mtk-20170518-83c9ac173d105243ffe346165d17f5109f9d4fa7.tar.gz mtk-20170518-83c9ac173d105243ffe346165d17f5109f9d4fa7.tar.bz2 |
firewall: introduce drop_invalid option to allow disabling the invalid state match
SVN-Revision: 14061
Diffstat (limited to 'package/firewall/files/uci_firewall.sh')
-rwxr-xr-x | package/firewall/files/uci_firewall.sh | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/package/firewall/files/uci_firewall.sh b/package/firewall/files/uci_firewall.sh index fd10899..f38bd6b 100755 --- a/package/firewall/files/uci_firewall.sh +++ b/package/firewall/files/uci_firewall.sh @@ -159,16 +159,19 @@ fw_defaults() { $IPTABLES -t mangle -X $IPTABLES -t nat -X $IPTABLES -X - - $IPTABLES -A INPUT -m state --state INVALID -j DROP + + config_get_bool drop_invalid $1 drop_invalid 1 + + [ "$drop_invalid" -gt 0 ] && { + $IPTABLES -A INPUT -m state --state INVALID -j DROP + $IPTABLES -A OUTPUT -m state --state INVALID -j DROP + $IPTABLES -A FORWARD -m state --state INVALID -j DROP + } + $IPTABLES -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT - - $IPTABLES -A OUTPUT -m state --state INVALID -j DROP $IPTABLES -A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT - - $IPTABLES -A FORWARD -m state --state INVALID -j DROP $IPTABLES -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT - + $IPTABLES -A INPUT -i lo -j ACCEPT $IPTABLES -A OUTPUT -o lo -j ACCEPT |