aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2015-01-13 19:02:32 +0000
committerSteven Barth <steven@midlink.org>2015-01-13 19:02:32 +0000
commitae69e6dbf8dbd95128838f2b55b4057bc29ada02 (patch)
treea4e2cb0c4a8347f7d88750d06e545ae5d963d1e6
parent231a34f6204d064d9a88ad9a6c3829137eda969d (diff)
downloadupstream-ae69e6dbf8dbd95128838f2b55b4057bc29ada02.tar.gz
upstream-ae69e6dbf8dbd95128838f2b55b4057bc29ada02.tar.bz2
upstream-ae69e6dbf8dbd95128838f2b55b4057bc29ada02.zip
map: backport fixes from trunk
Signed-off-by: Steven Barth <steven@midlink.org> git-svn-id: svn://svn.openwrt.org/openwrt/branches/barrier_breaker@43962 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rw-r--r--package/network/ipv6/map/Makefile7
-rwxr-xr-xpackage/network/ipv6/map/files/map.sh3
-rw-r--r--package/network/ipv6/map/src/mapcalc.c6
3 files changed, 11 insertions, 5 deletions
diff --git a/package/network/ipv6/map/Makefile b/package/network/ipv6/map/Makefile
index 3e010493a8..ed358defac 100644
--- a/package/network/ipv6/map/Makefile
+++ b/package/network/ipv6/map/Makefile
@@ -1,5 +1,5 @@
#
-# Copyright (C) 2014 OpenWrt.org
+# Copyright (C) 2014-2015 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
@@ -8,8 +8,9 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=map
-PKG_VERSION:=2
-PKG_RELEASE:=1
+PKG_VERSION:=3
+PKG_RELEASE:=2
+PKG_LICENSE:=GPL-2.0
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk
diff --git a/package/network/ipv6/map/files/map.sh b/package/network/ipv6/map/files/map.sh
index 83de4cc4dc..945accdebd 100755
--- a/package/network/ipv6/map/files/map.sh
+++ b/package/network/ipv6/map/files/map.sh
@@ -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,6 +60,7 @@ proto_map_setup() {
return
fi
+ echo "$RULE_DATA" >> /tmp/map-$cfg.rules
eval $RULE_DATA
if [ -z "$RULE_BMR" ]; then
@@ -188,6 +190,7 @@ proto_map_setup() {
proto_map_teardown() {
local cfg="$1"
ifdown "${cfg}_local"
+ rm -f /tmp/map-$cfg.rules
}
proto_map_init_config() {
diff --git a/package/network/ipv6/map/src/mapcalc.c b/package/network/ipv6/map/src/mapcalc.c
index afce6d24d7..b4b3d736f0 100644
--- a/package/network/ipv6/map/src/mapcalc.c
+++ b/package/network/ipv6/map/src/mapcalc.c
@@ -2,7 +2,7 @@
* mapcalc - MAP parameter calculation
*
* Author: Steven Barth <cyrus@openwrt.org>
- * Copyright (c) 2014 cisco Systems, Inc.
+ * Copyright (c) 2014-2015 cisco Systems, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2
@@ -271,8 +271,10 @@ int main(int argc, char *argv[])
if (ealen < 0 && pdlen >= 0)
ealen = pdlen - prefix6len;
- if (psidlen < 0)
+ if (psidlen <= 0) {
psidlen = ealen - (32 - prefix4len);
+ psid = -1;
+ }
if (psid < 0 && psidlen <= 16 && psidlen >= 0 && pdlen >= 0 && ealen >= psidlen) {
bmemcpys64(&psid16, &pd, prefix6len + ealen - psidlen, psidlen);