From 66409193dc23ac6e7376cb1ef36c2ddd801b4e0a Mon Sep 17 00:00:00 2001 From: Simon Kelley Date: Thu, 1 Aug 2013 20:19:32 +0100 Subject: [PATCH] Sanity check for dhcp-range template. --- src/option.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/option.c b/src/option.c index 006e4cc..c94bdd2 100644 --- a/src/option.c +++ b/src/option.c @@ -2460,6 +2460,15 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma if (!is_same_net6(&new->start6, &new->end6, new->prefix)) ret_err(_("inconsistent DHCPv6 range")); + + if (new->flags & CONTEXT_TEMPLATE) + { + struct in6_addr zero; + memset(&zero, 0, sizeof(zero)); + if (!is_same_net6(&zero, &new->start6, new->prefix)) + ret_err(_("prefix must be zero with \"constructor:\" argument")); + } + if (addr6part(&new->start6) > addr6part(&new->end6)) { struct in6_addr tmp = new->start6;