From 5e3e464ac4022ee0b3794513abe510817e2cf3ca Mon Sep 17 00:00:00 2001 From: Simon Kelley Date: Tue, 25 Aug 2015 23:08:39 +0100 Subject: [PATCH] Fix behaviour of empty dhcp-option=option6:dns-server, which should inhibit sending option. --- src/rfc3315.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/rfc3315.c b/src/rfc3315.c index 2665d0d..3f1f9ee 100644 --- a/src/rfc3315.c +++ b/src/rfc3315.c @@ -1320,15 +1320,16 @@ static struct dhcp_netid *add_options(struct state *state, int do_refresh) if (opt_cfg->opt == OPTION6_REFRESH_TIME) done_refresh = 1; + + if (opt_cfg->opt == OPTION6_DNS_SERVER) + done_dns = 1; - if (opt_cfg->flags & DHOPT_ADDR6) + /* Empty DNS_SERVER option will not set DHOPT_ADDR6 */ + if ((opt_cfg->flags & DHOPT_ADDR6) || opt_cfg->opt == OPTION6_DNS_SERVER) { int len, j; struct in6_addr *a; - if (opt_cfg->opt == OPTION6_DNS_SERVER) - done_dns = 1; - for (a = (struct in6_addr *)opt_cfg->val, len = opt_cfg->len, j = 0; j < opt_cfg->len; j += IN6ADDRSZ, a++) if ((IN6_IS_ADDR_ULA_ZERO(a) && IN6_IS_ADDR_UNSPECIFIED(state->ula_addr)) ||