Check assumed SLAAC addresses by pinging them.
diff --git a/src/dnsmasq.c b/src/dnsmasq.c
index 515f08f..b2810c5 100644
--- a/src/dnsmasq.c
+++ b/src/dnsmasq.c
@@ -23,6 +23,7 @@
static volatile pid_t pid = 0;
static volatile int pipewrite;
+static int alarm_queued = 0;
static int set_dns_listeners(time_t now, fd_set *set, int *maxfdp);
static void check_dns_listeners(fd_set *set, time_t now);
@@ -864,9 +865,23 @@
}
}
-void send_alarm(void)
+/* now == 0 -> queue immediate callback */
+void send_alarm(time_t event, time_t now)
{
- send_event(pipewrite, EVENT_ALARM, 0, NULL);
+
+ if (now != 0 && event == 0)
+ return;
+
+ if ((now == 0 || difftime(event, now) <= 0.0))
+ {
+ if (!alarm_queued)
+ {
+ send_event(pipewrite, EVENT_ALARM, 0, NULL);
+ alarm_queued = 1;
+ }
+ }
+ else
+ alarm((unsigned)difftime(event, now));
}
void send_event(int fd, int event, int data, char *msg)
@@ -980,6 +995,7 @@
break;
case EVENT_ALARM:
+ alarm_queued = 0;
#ifdef HAVE_DHCP
if (daemon->dhcp || daemon->dhcp6)
{
@@ -988,13 +1004,8 @@
}
#ifdef HAVE_DHCP6
else if (daemon->ra_contexts)
- {
- /* Not doing DHCP, so no lease system, manage
- alarms for ra only */
- time_t next_event = periodic_ra(now);
- if (next_event != 0)
- alarm((unsigned)difftime(next_event, now));
- }
+ /* Not doing DHCP, so no lease system, manage alarms for ra only */
+ send_alarm(periodic_ra(now), now);
#endif
#endif
break;
@@ -1158,7 +1169,7 @@
check_dhcp_hosts(0);
lease_update_from_configs();
lease_update_file(now);
- lease_update_dns();
+ lease_update_dns(1);
}
#ifdef HAVE_DHCP6
else if (daemon->ra_contexts)