Blame SOURCES/dhcp-4.2.5-range6.patch

45d60a
diff --git a/server/confpars.c b/server/confpars.c
45d60a
index 12ab0e6..4454be9 100644
45d60a
--- a/server/confpars.c
45d60a
+++ b/server/confpars.c
45d60a
@@ -3756,6 +3756,19 @@ add_ipv6_pool_to_subnet(struct subnet *subnet, u_int16_t type,
45d60a
 	share->ipv6_pools[num_pools+1] = NULL;
45d60a
 }
45d60a
 
45d60a
+static void
45d60a
+check_addr_in_subnet(struct subnet *subnet, struct iaddr *addr) {
45d60a
+	char lowbuf [INET6_ADDRSTRLEN], netbuf [INET6_ADDRSTRLEN];
45d60a
+
45d60a
+	if (!addr_eq(subnet->net, subnet_number(*addr, subnet->netmask))) {
45d60a
+		strcpy(lowbuf, piaddr(*addr));
45d60a
+		strcpy(netbuf, piaddr(subnet->net));
45d60a
+		log_fatal("bad range6, address %s not in subnet6 %s/%d",
45d60a
+			lowbuf, netbuf, subnet->prefix_len);
45d60a
+	}
45d60a
+
45d60a
+}
45d60a
+
45d60a
 /* address-range6-declaration :== ip-address6 ip-address6 SEMI
45d60a
 			       | ip-address6 SLASH number SEMI
45d60a
 			       | ip-address6 [SLASH number] TEMPORARY SEMI */
45d60a
@@ -3788,6 +3801,8 @@ parse_address_range6(struct parse *cfile, struct group *group) {
45d60a
 		return;
45d60a
 	}
45d60a
 
45d60a
+	check_addr_in_subnet(group->subnet, &lo);
45d60a
+
45d60a
 	/* 
45d60a
 	 * See if we we're using range or CIDR notation or TEMPORARY
45d60a
 	 */
45d60a
@@ -3855,6 +3870,8 @@ parse_address_range6(struct parse *cfile, struct group *group) {
45d60a
 			return;
45d60a
 		}
45d60a
 
45d60a
+		check_addr_in_subnet(group->subnet, &hi;;
45d60a
+
45d60a
 		/*
45d60a
 		 * Convert our range to a set of CIDR networks.
45d60a
 		 */