mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 18:28:25 +00:00
Fix botch in new arp-cache linked-list code resulting in 100% CPU spin.
This commit is contained in:
24
src/arp.c
24
src/arp.c
@@ -110,7 +110,7 @@ static int filter_mac(int family, char *addrp, char *mac, size_t maclen, void *p
|
|||||||
/* If in lazy mode, we cache absence of ARP entries. */
|
/* If in lazy mode, we cache absence of ARP entries. */
|
||||||
int find_mac(union mysockaddr *addr, unsigned char *mac, int lazy, time_t now)
|
int find_mac(union mysockaddr *addr, unsigned char *mac, int lazy, time_t now)
|
||||||
{
|
{
|
||||||
struct arp_record *arp, **up;
|
struct arp_record *arp, *tmp, **up;
|
||||||
int updated = 0;
|
int updated = 0;
|
||||||
|
|
||||||
again:
|
again:
|
||||||
@@ -155,15 +155,19 @@ int find_mac(union mysockaddr *addr, unsigned char *mac, int lazy, time_t now)
|
|||||||
iface_enumerate(AF_UNSPEC, NULL, filter_mac);
|
iface_enumerate(AF_UNSPEC, NULL, filter_mac);
|
||||||
|
|
||||||
/* Remove all unconfirmed entries to old list. */
|
/* Remove all unconfirmed entries to old list. */
|
||||||
for (arp = arps, up = &arps; arp; arp = arp->next)
|
for (arp = arps, up = &arps; arp; arp = tmp)
|
||||||
if (arp->status == ARP_MARK)
|
{
|
||||||
{
|
tmp = arp->next;
|
||||||
*up = arp->next;
|
|
||||||
arp->next = old;
|
if (arp->status == ARP_MARK)
|
||||||
old = arp;
|
{
|
||||||
}
|
*up = arp->next;
|
||||||
else
|
arp->next = old;
|
||||||
up = &arp->next;
|
old = arp;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
up = &arp->next;
|
||||||
|
}
|
||||||
|
|
||||||
goto again;
|
goto again;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user