mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-20 02:38:32 +00:00
Fix bug resulting in tight-loop when new interfaces arrive.
This commit is contained in:
@@ -443,7 +443,7 @@ static int iface_allowed_v4(struct in_addr local, int if_index, char *label,
|
|||||||
int enumerate_interfaces(int reset)
|
int enumerate_interfaces(int reset)
|
||||||
{
|
{
|
||||||
static struct addrlist *spare = NULL;
|
static struct addrlist *spare = NULL;
|
||||||
static int done = 0;
|
static int done = 0, active = 0;
|
||||||
struct iface_param param;
|
struct iface_param param;
|
||||||
int errsave, ret = 1;
|
int errsave, ret = 1;
|
||||||
struct addrlist *addr, *tmp;
|
struct addrlist *addr, *tmp;
|
||||||
@@ -458,11 +458,14 @@ int enumerate_interfaces(int reset)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (done)
|
if (done || active)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
done = 1;
|
done = 1;
|
||||||
|
|
||||||
|
/* protect against recusive calls from iface_enumerate(); */
|
||||||
|
active = 1;
|
||||||
|
|
||||||
if ((param.fd = socket(PF_INET, SOCK_DGRAM, 0)) == -1)
|
if ((param.fd = socket(PF_INET, SOCK_DGRAM, 0)) == -1)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@@ -504,6 +507,7 @@ int enumerate_interfaces(int reset)
|
|||||||
errno = errsave;
|
errno = errsave;
|
||||||
|
|
||||||
spare = param.spare;
|
spare = param.spare;
|
||||||
|
active = 0;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user