openwrt : simplify iptables in firewall include scripts

This commit is contained in:
bolvan
2019-05-07 11:30:15 +03:00
parent cd7de457e6
commit db5b2c2d39
13 changed files with 125 additions and 110 deletions

View File

@@ -2,8 +2,10 @@ QNUM=200
IPT_FILTER_PRE="-p tcp --sport 80"
IPT_FILTER_POST="-p tcp --dport 80"
iptables -t raw -C PREROUTING $IPT_FILTER_PRE -j NFQUEUE --queue-num $QNUM --queue-bypass ||
iptables -t raw -I PREROUTING $IPT_FILTER_PRE -j NFQUEUE --queue-num $QNUM --queue-bypass
ipt()
{
iptables -C $@ 2>/dev/null || iptables -I $@
}
iptables -t mangle -C POSTROUTING $IPT_FILTER_POST -j NFQUEUE --queue-num $QNUM --queue-bypass ||
iptables -t mangle -I POSTROUTING $IPT_FILTER_POST -j NFQUEUE --queue-num $QNUM --queue-bypass
ipt PREROUTING -t raw $IPT_FILTER_PRE -j NFQUEUE --queue-num $QNUM --queue-bypass
ipt POSTROUTING -t mangle $IPT_FILTER_POST -j NFQUEUE --queue-num $QNUM --queue-bypass