Handle async notification of address changes using the event system.

This commit is contained in:
Simon Kelley
2014-06-07 13:38:48 +01:00
parent a03f8d4c37
commit a0358e5ddb
7 changed files with 35 additions and 54 deletions

View File

@@ -551,7 +551,7 @@ static int iface_allowed_v4(struct in_addr local, int if_index, char *label,
int enumerate_interfaces(int reset)
{
static struct addrlist *spare = NULL;
static int done = 0, active = 0;
static int done = 0;
struct iface_param param;
int errsave, ret = 1;
struct addrlist *addr, *tmp;
@@ -570,14 +570,11 @@ int enumerate_interfaces(int reset)
return 1;
}
if (done || active)
if (done)
return 1;
done = 1;
/* protect against recusive calls from iface_enumerate(); */
active = 1;
if ((param.fd = socket(PF_INET, SOCK_DGRAM, 0)) == -1)
return 0;
@@ -677,10 +674,8 @@ int enumerate_interfaces(int reset)
}
errno = errsave;
spare = param.spare;
active = 0;
return ret;
}