diff options
Diffstat (limited to 'package/network/utils/owipcalc/src')
-rw-r--r-- | package/network/utils/owipcalc/src/owipcalc.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/package/network/utils/owipcalc/src/owipcalc.c b/package/network/utils/owipcalc/src/owipcalc.c index c4df5c7450..5ed609f158 100644 --- a/package/network/utils/owipcalc/src/owipcalc.c +++ b/package/network/utils/owipcalc/src/owipcalc.c @@ -527,18 +527,17 @@ static bool cidr_network6(struct cidr *a) static bool cidr_contains6(struct cidr *a, struct cidr *b) { - struct cidr *n = cidr_clone(a); - struct in6_addr *x = &n->addr.v6; + struct in6_addr *x = &a->addr.v6; struct in6_addr *y = &b->addr.v6; - uint8_t i = (128 - n->prefix) / 8; - uint8_t m = ~((1 << ((128 - n->prefix) % 8)) - 1); + uint8_t i = (128 - a->prefix) / 8; + uint8_t m = ~((1 << ((128 - a->prefix) % 8)) - 1); uint8_t net1 = x->s6_addr[15-i] & m; uint8_t net2 = y->s6_addr[15-i] & m; if (printed) qprintf(" "); - if ((b->prefix >= n->prefix) && (net1 == net2) && + if ((b->prefix >= a->prefix) && (net1 == net2) && ((i == 15) || !memcmp(&x->s6_addr, &y->s6_addr, 15-i))) { qprintf("1"); |