mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 18:28:25 +00:00
Add DHCPv6 ntp-server (56) option handling.
There was discussion in the past regarding DHCPv6 NTP server option which needs special subclassing per RFC5908. Patch adds support for unicast, multicast IPv6 address and for FQDN string, preserving possibly used (as suggested earlier) hex value. Unfortunately it's still not fully free from limitations - only address list or only fqdn value list is possible, not mixed due current state option parsing & flagging.
This commit is contained in:
committed by
Simon Kelley
parent
b594e8defa
commit
dded78b233
@@ -1311,23 +1311,39 @@ static struct dhcp_netid *add_options(struct state *state, int do_refresh)
|
||||
|
||||
for (a = (struct in6_addr *)opt_cfg->val, j = 0; j < opt_cfg->len; j+=IN6ADDRSZ, a++)
|
||||
{
|
||||
struct in6_addr *p = NULL;
|
||||
|
||||
if (IN6_IS_ADDR_UNSPECIFIED(a))
|
||||
{
|
||||
if (!add_local_addrs(state->context))
|
||||
put_opt6(state->fallback, IN6ADDRSZ);
|
||||
p = state->fallback;
|
||||
}
|
||||
else if (IN6_IS_ADDR_ULA_ZERO(a))
|
||||
{
|
||||
if (!IN6_IS_ADDR_UNSPECIFIED(state->ula_addr))
|
||||
put_opt6(state->ula_addr, IN6ADDRSZ);
|
||||
p = state->ula_addr;
|
||||
}
|
||||
else if (IN6_IS_ADDR_LINK_LOCAL_ZERO(a))
|
||||
{
|
||||
if (!IN6_IS_ADDR_UNSPECIFIED(state->ll_addr))
|
||||
put_opt6(state->ll_addr, IN6ADDRSZ);
|
||||
p = state->ll_addr;
|
||||
}
|
||||
else
|
||||
put_opt6(a, IN6ADDRSZ);
|
||||
p = a;
|
||||
|
||||
if (!p)
|
||||
continue;
|
||||
else if (opt_cfg->opt == OPTION6_NTP_SERVER)
|
||||
{
|
||||
if (IN6_IS_ADDR_MULTICAST(p))
|
||||
o1 = new_opt6(NTP_SUBOPTION_MC_ADDR);
|
||||
else
|
||||
o1 = new_opt6(NTP_SUBOPTION_SRV_ADDR);
|
||||
put_opt6(p, IN6ADDRSZ);
|
||||
end_opt6(o1);
|
||||
}
|
||||
else
|
||||
put_opt6(p, IN6ADDRSZ);
|
||||
}
|
||||
|
||||
end_opt6(o);
|
||||
|
||||
Reference in New Issue
Block a user