Fix behaviour of empty dhcp-option=option6:dns-server, which should inhibit sending option.

This commit is contained in:
Simon Kelley
2015-08-25 23:08:39 +01:00
parent 3a3965ac21
commit 5e3e464ac4

View File

@@ -1320,15 +1320,16 @@ static struct dhcp_netid *add_options(struct state *state, int do_refresh)
if (opt_cfg->opt == OPTION6_REFRESH_TIME) if (opt_cfg->opt == OPTION6_REFRESH_TIME)
done_refresh = 1; 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; int len, j;
struct in6_addr *a; 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; for (a = (struct in6_addr *)opt_cfg->val, len = opt_cfg->len, j = 0;
j < opt_cfg->len; j += IN6ADDRSZ, a++) j < opt_cfg->len; j += IN6ADDRSZ, a++)
if ((IN6_IS_ADDR_ULA_ZERO(a) && IN6_IS_ADDR_UNSPECIFIED(state->ula_addr)) || if ((IN6_IS_ADDR_ULA_ZERO(a) && IN6_IS_ADDR_UNSPECIFIED(state->ula_addr)) ||