X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/4fbc2d59b99ae0f94ee595c209fb157e7425f7e8..c73bc2f9f68d8d8567cc3ddf972ab68699765995:/package/firewall/files/reflection.hotplug?ds=sidebyside diff --git a/package/firewall/files/reflection.hotplug b/package/firewall/files/reflection.hotplug index af88fe024..027d2ed8b 100644 --- a/package/firewall/files/reflection.hotplug +++ b/package/firewall/files/reflection.hotplug @@ -2,7 +2,7 @@ . /etc/functions.sh -if [ "$ACTION" = "ifup" ] && [ "$INTERFACE" = "wan" ]; then +if [ "$ACTION" = "add" ] && [ "$INTERFACE" = "wan" ]; then local wanip=$(uci -P/var/state get network.wan.ipaddr) iptables -t nat -F nat_reflection_in 2>/dev/null || { @@ -41,7 +41,10 @@ if [ "$ACTION" = "ifup" ] && [ "$INTERFACE" = "wan" ]; then local src config_get src "$cfg" src - [ "$src" = wan ] && { + local target + config_get target "$cfg" target DNAT + + [ "$src" = wan ] && [ "$target" = DNAT ] && { local dest config_get dest "$cfg" dest "lan" @@ -53,6 +56,10 @@ if [ "$ACTION" = "ifup" ] && [ "$INTERFACE" = "wan" ]; then local proto config_get proto "$cfg" proto + local reflection + config_get_bool reflection "$cfg" reflection 1 + [ "$reflection" == 1 ] || return + local epmin epmax extport config_get extport "$cfg" src_dport [ -n "$extport" ] || return