summaryrefslogtreecommitdiff
path: root/package/network/ipv6/map/src/mapcalc.c
diff options
context:
space:
mode:
authorSteven Barth <cyrus@openwrt.org>2015-01-12 10:56:54 +0000
committerSteven Barth <cyrus@openwrt.org>2015-01-12 10:56:54 +0000
commitd73c382a734d54298c615f6b87482e877396862b (patch)
treec4afa0baacfed9fbf1b1ef9120e07e4a4adf433b /package/network/ipv6/map/src/mapcalc.c
parentb0a2d7ad0dbaec2ff9f6f5f87c20c534857c849b (diff)
downloadmtk-20170518-d73c382a734d54298c615f6b87482e877396862b.zip
mtk-20170518-d73c382a734d54298c615f6b87482e877396862b.tar.gz
mtk-20170518-d73c382a734d54298c615f6b87482e877396862b.tar.bz2
map: ignore psid and psidlen if psidlen is 0
Signed-off-by: Steven Barth <steven@midlink.org> SVN-Revision: 43946
Diffstat (limited to 'package/network/ipv6/map/src/mapcalc.c')
-rw-r--r--package/network/ipv6/map/src/mapcalc.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/package/network/ipv6/map/src/mapcalc.c b/package/network/ipv6/map/src/mapcalc.c
index afce6d2..b4b3d73 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);