diff options
Diffstat (limited to 'package/firewall/files/lib/fw.sh')
-rw-r--r-- | package/firewall/files/lib/fw.sh | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/package/firewall/files/lib/fw.sh b/package/firewall/files/lib/fw.sh index 3549f8aa4c..16a39b6a66 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}" +} |