map: add debug-code for mapcalc

Signed-off-by: Steven Barth <steven@midlink.org>

SVN-Revision: 46763
This commit is contained in:
Steven Barth 2015-09-01 18:48:22 +00:00
parent 37160e21bb
commit 7e009c1598
2 changed files with 25 additions and 15 deletions

View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=map PKG_NAME:=map
PKG_VERSION:=4 PKG_VERSION:=4
PKG_RELEASE:=2 PKG_RELEASE:=3
PKG_LICENSE:=GPL-2.0 PKG_LICENSE:=GPL-2.0
include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/package.mk

View File

@ -157,6 +157,8 @@ enum {
OPT_PSID, OPT_PSID,
OPT_BR, OPT_BR,
OPT_DMR, OPT_DMR,
OPT_PD,
OPT_PDLEN,
OPT_MAX OPT_MAX
}; };
@ -173,6 +175,8 @@ static char *const token[] = {
[OPT_PSID] = "psid", [OPT_PSID] = "psid",
[OPT_BR] = "br", [OPT_BR] = "br",
[OPT_DMR] = "dmr", [OPT_DMR] = "dmr",
[OPT_PD] = "pd",
[OPT_PDLEN] = "pdlen",
[OPT_MAX] = NULL [OPT_MAX] = NULL
}; };
@ -239,10 +243,14 @@ int main(int argc, char *argv[])
// dummy // dummy
} else if (idx == OPT_IPV6PREFIX && inet_pton(AF_INET6, value, &ipv6prefix) == 1) { } else if (idx == OPT_IPV6PREFIX && inet_pton(AF_INET6, value, &ipv6prefix) == 1) {
// dummy // dummy
} else if (idx == OPT_PD && inet_pton(AF_INET6, value, &pd) == 1) {
// dummy
} else if (idx == OPT_OFFSET && (intval = strtoul(value, NULL, 0)) <= 16 && !errno) { } else if (idx == OPT_OFFSET && (intval = strtoul(value, NULL, 0)) <= 16 && !errno) {
offset = intval; offset = intval;
} else if (idx == OPT_PSIDLEN && (intval = strtoul(value, NULL, 0)) <= 16 && !errno) { } else if (idx == OPT_PSIDLEN && (intval = strtoul(value, NULL, 0)) <= 16 && !errno) {
psidlen = intval; psidlen = intval;
} else if (idx == OPT_PDLEN && (intval = strtoul(value, NULL, 0)) <= 128 && !errno) {
pdlen = intval;
} else if (idx == OPT_PSID && (intval = strtoul(value, NULL, 0)) <= 65535 && !errno) { } else if (idx == OPT_PSID && (intval = strtoul(value, NULL, 0)) <= 65535 && !errno) {
psid = intval; psid = intval;
} else if (idx == OPT_DMR) { } else if (idx == OPT_DMR) {
@ -270,6 +278,7 @@ int main(int argc, char *argv[])
} }
// Find PD // Find PD
if (pdlen < 0) {
struct blob_attr *c; struct blob_attr *c;
unsigned rem; unsigned rem;
blobmsg_for_each_attr(c, dump, rem) { blobmsg_for_each_attr(c, dump, rem) {
@ -290,6 +299,7 @@ int main(int argc, char *argv[])
break; break;
} }
} }
}
if (ealen < 0 && pdlen >= 0) if (ealen < 0 && pdlen >= 0)
ealen = pdlen - prefix6len; ealen = pdlen - prefix6len;