[backfire] merge r22806
[openwrt-10.03/.git] / package / firewall / files / reflection.hotplug
index dc6780a720053d2da4af69371485915995817b06..76ef6e7a99ffbe8dcd4cc28d62d593610755eef9 100644 (file)
@@ -41,7 +41,10 @@ if [ "$ACTION" = "add" ] && [ "$INTERFACE" = "wan" ]; then
                local src
                config_get src "$cfg" src
 
-               [ "$src" = wan ] && {
+               local target
+               config_get target "$cfg" target
+
+               [ "$src" = wan ] && [ "${target:-DNAT}" = DNAT ] && {
                        local dest
                        config_get dest "$cfg" dest "lan"
 
@@ -53,6 +56,10 @@ if [ "$ACTION" = "add" ] && [ "$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