Browse code

ipops: mask subnet address for ipv6 comparison

- coherent with ipv4 behaviour

Daniel-Constantin Mierla authored on 03/04/2018 07:27:19
Showing 1 changed files
... ...
@@ -415,6 +415,7 @@ int _ip_is_in_subnet_v6(struct in6_addr *ip, char *net, size_t netlen,
415 415
 		else ipv6_mask[i] = 0x00;
416 416
 	}
417 417
 	for (i=0; i<16; i++)  ip->s6_addr[i] &= ipv6_mask[i];
418
+	for (i=0; i<16; i++)  net_addr.s6_addr[i] &= ipv6_mask[i];
418 419
 	if (memcmp(ip->s6_addr, net_addr.s6_addr, sizeof(net_addr.s6_addr)) == 0)
419 420
 		return 1;
420 421
 	return 0;