aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi NGUYEN VAN <remi.nguyenvan+openwrt@gmail.com>2020-08-15 17:00:15 +0900
committerHans Dedecker <dedeckeh@gmail.com>2020-08-15 20:37:02 +0200
commit1e696c6ced1ef99179fa4dbdf32f0a45f56120a0 (patch)
treeb0ce1643bb2e48a0d0e9fc5d42404219dac223e0
parent763ce13b0b35892804ce3b1c30b1f69bbc652ec7 (diff)
downloadupstream-1e696c6ced1ef99179fa4dbdf32f0a45f56120a0.tar.gz
upstream-1e696c6ced1ef99179fa4dbdf32f0a45f56120a0.tar.bz2
upstream-1e696c6ced1ef99179fa4dbdf32f0a45f56120a0.zip
map: add a legacymap option
The legacy map version based on the IPv6 Interface Identifier in draft-ietf-softwire-map-03 was typically used by uncommenting the LEGACY variable in the map.sh file, which is not ideal. A proper configuration option is needed instead. The IPv6 Interface Identifier format described in the draft was eventually changed in RFC7597, but is still used by some major ISPs, including in Japan. Signed-off-by: Remi NGUYEN VAN <remi.nguyenvan+openwrt@gmail.com> Signed-off-by: Hans Dedecker <dedeckeh@gmail.com> [PKG_RELEASE increase]
-rw-r--r--package/network/ipv6/map/Makefile2
-rwxr-xr-xpackage/network/ipv6/map/files/map.sh12
2 files changed, 6 insertions, 8 deletions
diff --git a/package/network/ipv6/map/Makefile b/package/network/ipv6/map/Makefile
index 5d0e0bbd3d..4bb29ee57b 100644
--- a/package/network/ipv6/map/Makefile
+++ b/package/network/ipv6/map/Makefile
@@ -8,7 +8,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=map
-PKG_RELEASE:=5
+PKG_RELEASE:=6
PKG_LICENSE:=GPL-2.0
include $(INCLUDE_DIR)/package.mk
diff --git a/package/network/ipv6/map/files/map.sh b/package/network/ipv6/map/files/map.sh
index 6462e810cc..61075bd244 100755
--- a/package/network/ipv6/map/files/map.sh
+++ b/package/network/ipv6/map/files/map.sh
@@ -25,12 +25,9 @@ proto_map_setup() {
local iface="$2"
local link="map-$cfg"
- # uncomment for legacy MAP0 mode
- #export LEGACY=1
-
- local type mtu ttl tunlink zone encaplimit
+ local type legacymap mtu ttl tunlink zone encaplimit
local rule ipaddr ip4prefixlen ip6prefix ip6prefixlen peeraddr ealen psidlen psid offset
- json_get_vars type mtu ttl tunlink zone encaplimit
+ json_get_vars type legacymap mtu ttl tunlink zone encaplimit
json_get_vars rule ipaddr ip4prefixlen ip6prefix ip6prefixlen peeraddr ealen psidlen psid offset
[ "$zone" = "-" ] && zone=""
@@ -56,7 +53,7 @@ proto_map_setup() {
fi
echo "rule=$rule" > /tmp/map-$cfg.rules
- RULE_DATA=$(mapcalc ${tunlink:-\*} $rule)
+ RULE_DATA=$(LEGACY="$legacymap" mapcalc ${tunlink:-\*} $rule)
if [ "$?" != 0 ]; then
proto_notify_error "$cfg" "INVALID_MAP_RULE"
proto_block_restart "$cfg"
@@ -106,7 +103,7 @@ proto_map_setup() {
elif [ "$type" = "map-t" -a -f "/proc/net/nat46/control" ]; then
proto_init_update "$link" 1
local style="MAP"
- [ "$LEGACY" = 1 ] && style="MAP0"
+ [ "$legacymap" = 1 ] && style="MAP0"
echo add $link > /proc/net/nat46/control
local cfgstr="local.style $style local.v4 $(eval "echo \$RULE_${k}_IPV4PREFIX")/$(eval "echo \$RULE_${k}_PREFIX4LEN")"
@@ -229,6 +226,7 @@ proto_map_init_config() {
proto_config_add_int "psidlen"
proto_config_add_int "psid"
proto_config_add_int "offset"
+ proto_config_add_boolean "legacymap"
proto_config_add_string "tunlink"
proto_config_add_int "mtu"