mirror of
http://thekelleys.org.uk/git/dnsmasq.git
synced 2026-11-11 16:40:27 +00:00
Handle async notification of address changes using the event system.
This commit is contained in:
1 parent
a03f8d4c37
commit
a0358e5ddb
7 files changed
+35
-54
No files matched your search
+11
-2
@@ -917,10 +917,10 @@ int main (int argc, char **argv)
|
||||
|
||||
#if defined(HAVE_LINUX_NETWORK)
|
||||
if (FD_ISSET(daemon->netlinkfd, &rset))
|
||||
netlink_multicast(now);
|
||||
netlink_multicast();
|
||||
#elif defined(HAVE_BSD_NETWORK)
|
||||
if (FD_ISSET(daemon->routefd, &rset))
|
||||
route_sock(now);
|
||||
route_sock();
|
||||
#endif
|
||||
|
||||
/* Check for changes to resolv files once per second max. */
|
||||
@@ -1037,6 +1037,11 @@ void send_alarm(time_t event, time_t now)
|
||||
}
|
||||
}
|
||||
|
||||
void send_newaddr(void)
|
||||
{
|
||||
send_event(pipewrite, EVENT_NEWADDR, 0, NULL);
|
||||
}
|
||||
|
||||
void send_event(int fd, int event, int data, char *msg)
|
||||
{
|
||||
struct event_desc ev;
|
||||
@@ -1230,6 +1235,10 @@ static void async_event(int pipe, time_t now)
|
||||
if (daemon->log_file != NULL)
|
||||
log_reopen(daemon->log_file);
|
||||
break;
|
||||
|
||||
case EVENT_NEWADDR:
|
||||
newaddress(now);
|
||||
break;
|
||||
|
||||
case EVENT_TERM:
|
||||
/* Knock all our children on the head. */
|
||||
|
||||
Reference in new issue
Block a user