changeset 4685:dc5875c28aac HEAD

When matching allowed_nets IPs, convert IPv6-mapped-IPv4 addresses to actual IPv4 addresses first.
author Timo Sirainen <tss@iki.fi>
date Sun, 15 Oct 2006 19:20:01 +0300
parents 4f1df4b90500
children ba802ac3b743
files src/auth/auth-request.c
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/auth/auth-request.c	Sun Oct 15 19:19:17 2006 +0300
+++ b/src/auth/auth-request.c	Sun Oct 15 19:20:01 2006 +0300
@@ -669,11 +669,14 @@
 static int is_ip_in_network(const char *network, const struct ip_addr *ip)
 {
 	const uint32_t *ip1, *ip2;
-	struct ip_addr net_ip;
+	struct ip_addr src_ip, net_ip;
 	const char *p;
 	unsigned int max_bits, bits, pos, i;
 	uint32_t mask;
 
+	if (net_ipv6_mapped_ipv4_convert(ip, &src_ip) == 0)
+		ip = &src_ip;
+
 	max_bits = IPADDR_IS_V4(ip) ? 32 : 128;
 	p = strchr(network, '/');
 	if (p == NULL) {