summaryrefslogtreecommitdiff
path: root/package/firewall/files/lib/fw.sh
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2010-09-28 10:42:56 +0000
committerJo-Philipp Wich <jow@openwrt.org>2010-09-28 10:42:56 +0000
commit6a335579b8e63886c2beed4aee72ab2f335a7d2e (patch)
tree01abaef74996070e6b60c987b51d9a12da73dbff /package/firewall/files/lib/fw.sh
parent2fdc8aea047bcc7ca142e2fc960263647e79eda1 (diff)
downloadmtk-20170518-6a335579b8e63886c2beed4aee72ab2f335a7d2e.zip
mtk-20170518-6a335579b8e63886c2beed4aee72ab2f335a7d2e.tar.gz
mtk-20170518-6a335579b8e63886c2beed4aee72ab2f335a7d2e.tar.bz2
fireall: - support negations for src_ip, dest_ip, src_dip options in rules and redirects - add NOTRACK target to rule sections, allows to define fine grained notrack rules
SVN-Revision: 23141
Diffstat (limited to 'package/firewall/files/lib/fw.sh')
-rw-r--r--package/firewall/files/lib/fw.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/package/firewall/files/lib/fw.sh b/package/firewall/files/lib/fw.sh
index 3549f8a..16a39b6 100644
--- a/package/firewall/files/lib/fw.sh
+++ b/package/firewall/files/lib/fw.sh
@@ -218,3 +218,12 @@ fw_get_family_mode() {
esac
}
+fw_get_negation() {
+ local _var="$1"
+ local _flag="$2"
+ local _ipaddr="$3"
+
+ [ "${_ipaddr#!}" != "$_ipaddr" ] && \
+ export -n -- "$_var=! $_flag ${_ipaddr#!}" || \
+ export -n -- "$_var=${_ipaddr:+$_flag $_ipaddr}"
+}