diff options
author | Nick Hainke <vincent@systemli.org> | 2021-01-13 16:06:03 +0100 |
---|---|---|
committer | Adrian Schmutzler <freifunk@adrianschmutzler.de> | 2021-01-15 17:40:27 +0100 |
commit | 5beea4c3fd6b671e102430ba934442f69b1332b0 (patch) | |
tree | 5a51426ff6d731d5fa63e33c8a3266960ceb86de /package | |
parent | 05707e6460106c931ece26df7883cd214560d14c (diff) | |
download | upstream-5beea4c3fd6b671e102430ba934442f69b1332b0.tar.gz upstream-5beea4c3fd6b671e102430ba934442f69b1332b0.tar.bz2 upstream-5beea4c3fd6b671e102430ba934442f69b1332b0.zip |
owipcalc: use v6 in cidr_parse6 function
The cidr_parse6 function parses a string to an ipv6-address.
The cidr struct contains a union called buf for the ipv4 and ipv6
address. Since it is a char pointer and the struct is initialized with
the maximum size (so ipv6 string) it does not make any difference.
However, we should access the buffer using the v6 name, since it could
be confusing otherwise.
Signed-off-by: Nick Hainke <vincent@systemli.org>
Diffstat (limited to 'package')
-rw-r--r-- | package/network/utils/owipcalc/Makefile | 2 | ||||
-rw-r--r-- | package/network/utils/owipcalc/src/owipcalc.c | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/package/network/utils/owipcalc/Makefile b/package/network/utils/owipcalc/Makefile index fd193ea11f..1f4c98bb48 100644 --- a/package/network/utils/owipcalc/Makefile +++ b/package/network/utils/owipcalc/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=owipcalc -PKG_RELEASE:=3 +PKG_RELEASE:=4 PKG_LICENSE:=Apache-2.0 include $(INCLUDE_DIR)/package.mk diff --git a/package/network/utils/owipcalc/src/owipcalc.c b/package/network/utils/owipcalc/src/owipcalc.c index f95280cd1c..c4df5c7450 100644 --- a/package/network/utils/owipcalc/src/owipcalc.c +++ b/package/network/utils/owipcalc/src/owipcalc.c @@ -361,11 +361,11 @@ static struct cidr * cidr_parse6(const char *s) if (!addr || (strlen(s) >= sizeof(addr->buf.v6))) goto err; - snprintf(addr->buf.v4, sizeof(addr->buf.v6), "%s", s); + snprintf(addr->buf.v6, sizeof(addr->buf.v6), "%s", s); addr->family = AF_INET6; - if ((p = strchr(addr->buf.v4, '/')) != NULL) + if ((p = strchr(addr->buf.v6, '/')) != NULL) { *p++ = 0; @@ -379,9 +379,9 @@ static struct cidr * cidr_parse6(const char *s) addr->prefix = 128; } - if (p == addr->buf.v4+1) + if (p == addr->buf.v6+1) memset(&addr->addr.v6, 0, sizeof(addr->addr.v6)); - else if (inet_pton(AF_INET6, addr->buf.v4, &addr->addr.v6) != 1) + else if (inet_pton(AF_INET6, addr->buf.v6, &addr->addr.v6) != 1) goto err; return addr; |