mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 18:28:25 +00:00
Add --shared-network DHCP configuration.
This commit is contained in:
@@ -134,21 +134,41 @@ static int dhcp6_maybe_relay(struct state *state, void *inbuff, size_t sz,
|
||||
else
|
||||
{
|
||||
struct dhcp_context *c;
|
||||
struct shared_network *share = NULL;
|
||||
state->context = NULL;
|
||||
|
||||
|
||||
if (!IN6_IS_ADDR_LOOPBACK(state->link_address) &&
|
||||
!IN6_IS_ADDR_LINKLOCAL(state->link_address) &&
|
||||
!IN6_IS_ADDR_MULTICAST(state->link_address))
|
||||
for (c = daemon->dhcp6; c; c = c->next)
|
||||
if ((c->flags & CONTEXT_DHCP) &&
|
||||
!(c->flags & (CONTEXT_TEMPLATE | CONTEXT_OLD)) &&
|
||||
is_same_net6(state->link_address, &c->start6, c->prefix) &&
|
||||
is_same_net6(state->link_address, &c->end6, c->prefix))
|
||||
{
|
||||
c->preferred = c->valid = 0xffffffff;
|
||||
c->current = state->context;
|
||||
state->context = c;
|
||||
}
|
||||
{
|
||||
for (share = daemon->shared_networks; share; share = share->next)
|
||||
{
|
||||
if (share->shared_addr.s_addr != 0)
|
||||
continue;
|
||||
|
||||
if (share->if_index != 0 ||
|
||||
!IN6_ARE_ADDR_EQUAL(state->link_address, &share->match_addr6))
|
||||
continue;
|
||||
|
||||
if ((c->flags & CONTEXT_DHCP) &&
|
||||
!(c->flags & (CONTEXT_TEMPLATE | CONTEXT_OLD)) &&
|
||||
is_same_net6(&share->shared_addr6, &c->start6, c->prefix) &&
|
||||
is_same_net6(&share->shared_addr6, &c->end6, c->prefix))
|
||||
break;
|
||||
}
|
||||
|
||||
if (share ||
|
||||
((c->flags & CONTEXT_DHCP) &&
|
||||
!(c->flags & (CONTEXT_TEMPLATE | CONTEXT_OLD)) &&
|
||||
is_same_net6(state->link_address, &c->start6, c->prefix) &&
|
||||
is_same_net6(state->link_address, &c->end6, c->prefix)))
|
||||
{
|
||||
c->preferred = c->valid = 0xffffffff;
|
||||
c->current = state->context;
|
||||
state->context = c;
|
||||
}
|
||||
}
|
||||
|
||||
if (!state->context)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user