X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/c6537133132fa5acf0bdd024e6793ff095d8284f..ddc9278d09957a5c6cb27ad0ca696f096476e38a:/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}" +}