map: ignore psid and psidlen if psidlen is 0
authorSteven Barth <cyrus@openwrt.org>
Mon, 12 Jan 2015 10:56:54 +0000 (10:56 +0000)
committerSteven Barth <cyrus@openwrt.org>
Mon, 12 Jan 2015 10:56:54 +0000 (10:56 +0000)
Signed-off-by: Steven Barth <steven@midlink.org>
SVN-Revision: 43946

package/network/ipv6/map/Makefile
package/network/ipv6/map/src/mapcalc.c

index 382fe0a8ba0bc4b5c5154517a937b6cc7103cad3..2848fe9ea28ac153044c145368922c0c6e5e3cfd 100644 (file)
@@ -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.
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -8,7 +8,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=map
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=map
-PKG_VERSION:=2
+PKG_VERSION:=3
 PKG_RELEASE:=1
 PKG_LICENSE:=GPL-2.0
 
 PKG_RELEASE:=1
 PKG_LICENSE:=GPL-2.0
 
index afce6d24d7007059fea8735d81a755fdc2457c82..b4b3d736f006730c2fe56315c0d637e4cc42accf 100644 (file)
@@ -2,7 +2,7 @@
  * mapcalc - MAP parameter calculation
  *
  * Author: Steven Barth <cyrus@openwrt.org>
  * 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
  *
  * 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 (ealen < 0 && pdlen >= 0)
                        ealen = pdlen - prefix6len;
 
-               if (psidlen < 0)
+               if (psidlen <= 0) {
                        psidlen = ealen - (32 - prefix4len);
                        psidlen = ealen - (32 - prefix4len);
+                       psid = -1;
+               }
 
                if (psid < 0 && psidlen <= 16 && psidlen >= 0 && pdlen >= 0 && ealen >= psidlen) {
                        bmemcpys64(&psid16, &pd, prefix6len + ealen - psidlen, psidlen);
 
                if (psid < 0 && psidlen <= 16 && psidlen >= 0 && pdlen >= 0 && ealen >= psidlen) {
                        bmemcpys64(&psid16, &pd, prefix6len + ealen - psidlen, psidlen);