map: Fix white space errors
[lede-git/.git] / package / network / ipv6 / map / files / map.sh
index 83de4cc4dc52d49413429ee702fb7b41dfa585fe..10789f07ca30d229b4387c79515929d19e11d675 100755 (executable)
@@ -52,6 +52,7 @@ proto_map_setup() {
                fi
        fi
 
+       echo "rule=$rule" > /tmp/map-$cfg.rules
        RULE_DATA=$(mapcalc ${tunlink:-\*} $rule)
        if [ "$?" != 0 ]; then
                proto_notify_error "$cfg" "INVALID_MAP_RULE"
@@ -59,8 +60,9 @@ proto_map_setup() {
                return
        fi
 
+       echo "$RULE_DATA" >> /tmp/map-$cfg.rules
        eval $RULE_DATA
-       
+
        if [ -z "$RULE_BMR" ]; then
                proto_notify_error "$cfg" "NO_MATCHING_PD"
                proto_block_restart "$cfg"
@@ -71,7 +73,7 @@ proto_map_setup() {
        if [ "$type" = "lw4o6" -o "$type" = "map-e" ]; then
                proto_init_update "$link" 1
                proto_add_ipv4_address $(eval "echo \$RULE_${k}_IPV4ADDR") "" "" ""
-       
+
                proto_add_tunnel
                json_add_string mode ipip6
                json_add_int mtu "${mtu:-1280}"
@@ -188,10 +190,11 @@ proto_map_setup() {
 proto_map_teardown() {
        local cfg="$1"
        ifdown "${cfg}_local"
+       rm -f /tmp/map-$cfg.rules
 }
 
 proto_map_init_config() {
-       no_device=1             
+       no_device=1
        available=1
 
        proto_config_add_string "rule"