mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 18:28:25 +00:00
Check for new SLAAC addresses when we add new prefixes.
This commit is contained in:
18
src/dhcp6.c
18
src/dhcp6.c
@@ -475,7 +475,7 @@ static int make_duid1(int index, unsigned int type, char *mac, size_t maclen, vo
|
|||||||
|
|
||||||
struct cparam {
|
struct cparam {
|
||||||
time_t now;
|
time_t now;
|
||||||
int newone;
|
int newone, newname;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int construct_worker(struct in6_addr *local, int prefix,
|
static int construct_worker(struct in6_addr *local, int prefix,
|
||||||
@@ -549,6 +549,10 @@ static int construct_worker(struct in6_addr *local, int prefix,
|
|||||||
lease_update_file to get periodic functions called */
|
lease_update_file to get periodic functions called */
|
||||||
param->newone = 1;
|
param->newone = 1;
|
||||||
|
|
||||||
|
/* Will need to add new putative SLAAC addresses to existing leases */
|
||||||
|
if (context->flags & CONTEXT_RA_NAME)
|
||||||
|
param->newname = 1;
|
||||||
|
|
||||||
log_context(AF_INET6, context);
|
log_context(AF_INET6, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -561,6 +565,7 @@ void dhcp_construct_contexts(time_t now)
|
|||||||
struct dhcp_context *tmp, *context, **up;
|
struct dhcp_context *tmp, *context, **up;
|
||||||
struct cparam param;
|
struct cparam param;
|
||||||
param.newone = 0;
|
param.newone = 0;
|
||||||
|
param.newname = 0;
|
||||||
param.now = now;
|
param.now = now;
|
||||||
|
|
||||||
for (context = daemon->dhcp6; context; context = context->next)
|
for (context = daemon->dhcp6; context; context = context->next)
|
||||||
@@ -578,10 +583,11 @@ void dhcp_construct_contexts(time_t now)
|
|||||||
|
|
||||||
if (context->flags & CONTEXT_GC)
|
if (context->flags & CONTEXT_GC)
|
||||||
{
|
{
|
||||||
if (daemon->dhcp6 == context)
|
|
||||||
daemon->dhcp6 = context->next;
|
|
||||||
*up = context->next;
|
*up = context->next;
|
||||||
free(context);
|
free(context);
|
||||||
|
param.newone = 1; /* include deletion */
|
||||||
|
if (context->flags & CONTEXT_RA_NAME)
|
||||||
|
param.newname = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
up = &context->next;
|
up = &context->next;
|
||||||
@@ -590,7 +596,11 @@ void dhcp_construct_contexts(time_t now)
|
|||||||
if (param.newone)
|
if (param.newone)
|
||||||
{
|
{
|
||||||
if (daemon->dhcp || daemon->doing_dhcp6)
|
if (daemon->dhcp || daemon->doing_dhcp6)
|
||||||
lease_update_file(now);
|
{
|
||||||
|
if (param.newname)
|
||||||
|
lease_update_slaac(now);
|
||||||
|
lease_update_file(now);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
/* Not doing DHCP, so no lease system, manage alarms for ra only */
|
/* Not doing DHCP, so no lease system, manage alarms for ra only */
|
||||||
send_alarm(periodic_ra(now), now);
|
send_alarm(periodic_ra(now), now);
|
||||||
|
|||||||
@@ -1047,6 +1047,7 @@ void lease6_filter(int lease_type, int iaid, struct dhcp_context *context);
|
|||||||
struct dhcp_lease *lease6_find_by_addr(struct in6_addr *net, int prefix, u64 addr);
|
struct dhcp_lease *lease6_find_by_addr(struct in6_addr *net, int prefix, u64 addr);
|
||||||
u64 lease_find_max_addr6(struct dhcp_context *context);
|
u64 lease_find_max_addr6(struct dhcp_context *context);
|
||||||
void lease_ping_reply(struct in6_addr *sender, unsigned char *packet, char *interface);
|
void lease_ping_reply(struct in6_addr *sender, unsigned char *packet, char *interface);
|
||||||
|
void lease_update_slaac(time_t now);
|
||||||
#endif
|
#endif
|
||||||
void lease_set_hwaddr(struct dhcp_lease *lease, unsigned char *hwaddr,
|
void lease_set_hwaddr(struct dhcp_lease *lease, unsigned char *hwaddr,
|
||||||
unsigned char *clid, int hw_len, int hw_type, int clid_len, time_t now, int force);
|
unsigned char *clid, int hw_len, int hw_type, int clid_len, time_t now, int force);
|
||||||
|
|||||||
12
src/lease.c
12
src/lease.c
@@ -389,6 +389,18 @@ void lease_ping_reply(struct in6_addr *sender, unsigned char *packet, char *inte
|
|||||||
slaac_ping_reply(sender, packet, interface, leases);
|
slaac_ping_reply(sender, packet, interface, leases);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void lease_update_slaac(time_t now)
|
||||||
|
{
|
||||||
|
/* Called when we contruct a new RA-names context, to add putative
|
||||||
|
new SLAAC addresses to existing leases. */
|
||||||
|
|
||||||
|
struct dhcp_lease *lease;
|
||||||
|
|
||||||
|
if (daemon->dhcp)
|
||||||
|
for (lease = leases; lease; lease = lease->next)
|
||||||
|
slaac_add_addrs(lease, now, 0);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user