Check assumed SLAAC addresses by pinging them.

This commit is contained in:
Simon Kelley
2012-03-19 20:07:51 +00:00
parent e759d426fa
commit 353ae4d270
13 changed files with 414 additions and 177 deletions

View File

@@ -23,6 +23,7 @@ struct daemon *daemon;
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 @@ static void sig_handler(int sig)
}
}
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 @@ static void async_event(int pipe, time_t now)
break;
case EVENT_ALARM:
alarm_queued = 0;
#ifdef HAVE_DHCP
if (daemon->dhcp || daemon->dhcp6)
{
@@ -988,13 +1004,8 @@ static void async_event(int pipe, time_t now)
}
#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 @@ void clear_cache_and_reload(time_t now)
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)