map: delete map-t device when tearing down map interface
[openwrt/staging/lynxis/omap.git] / package / network / ipv6 / map / files / map.sh
index 98a493dd5714f3f3d8ce0c9e5d291afac588ba9d..fe872828c3b95344689663c339effe4b07ad0564 100755 (executable)
@@ -192,7 +192,17 @@ proto_map_setup() {
 
 proto_map_teardown() {
        local cfg="$1"
-       ifdown "${cfg}_"
+       local link="map-$cfg"
+
+       json_get_var type type
+
+       [ -z "$type" ] && type="map-e"
+
+       case "$type" in
+               "map-e"|"lw4o6") ifdown "${cfg}_" ;;
+               "map-t") [ -f "/proc/net/nat46/control" ] && echo del $link > /proc/net/nat46/control ;;
+       esac
+
        rm -f /tmp/map-$cfg.rules
 }