X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/c6537133132fa5acf0bdd024e6793ff095d8284f..271da7f4e93492f377c0fcf25def4591d60b9fbc:/package/firewall/files/lib/fw.sh diff --git a/package/firewall/files/lib/fw.sh b/package/firewall/files/lib/fw.sh index 3549f8aa4..16a39b6a6 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}" +}