Blob Blame Raw
diff -up dhcp-4.3.0a1/server/confpars.c.range6 dhcp-4.3.0a1/server/confpars.c
--- dhcp-4.3.0a1/server/confpars.c.range6	2013-12-20 13:53:44.899161427 +0100
+++ dhcp-4.3.0a1/server/confpars.c	2013-12-20 13:56:31.595835977 +0100
@@ -3925,6 +3925,18 @@ add_ipv6_pond_to_network(struct group *g
 	return;
 }
 
+static void
+check_addr_in_subnet(struct subnet *subnet, struct iaddr *addr) {
+	char lowbuf [INET6_ADDRSTRLEN], netbuf [INET6_ADDRSTRLEN];
+
+	if (!addr_eq(subnet->net, subnet_number(*addr, subnet->netmask))) {
+		strncpy(lowbuf, piaddr(*addr), INET6_ADDRSTRLEN);
+		strncpy(netbuf, piaddr(subnet->net), INET6_ADDRSTRLEN);
+		log_fatal("bad range6, address %s not in subnet6 %s/%d",
+			lowbuf, netbuf, subnet->prefix_len);
+	}
+
+}
 
 /* address-range6-declaration :== ip-address6 ip-address6 SEMI
 			       | ip-address6 SLASH number SEMI
@@ -3967,6 +3979,8 @@ parse_address_range6(struct parse *cfile
 	memset(&net, 0, sizeof(net));
 	net.cidrnet.lo_addr = lo;
 
+	check_addr_in_subnet(group->subnet, &lo);
+
 	/* 
 	 * See if we we're using range or CIDR notation or TEMPORARY
 	 */
@@ -4036,6 +4050,8 @@ parse_address_range6(struct parse *cfile
 			return;
 		}
 
+		check_addr_in_subnet(group->subnet, &hi);
+
 		/*
 		 * Convert our range to a set of CIDR networks.
 		 */