mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 18:28:25 +00:00
Improve the performance of DHCP relay.
On machines with many interfaces, enumerating them via netlink on each packet reciept is slow, and unneccesary. All we need is the local address->interface mapping, which can be cached in the relay structures.
This commit is contained in:
@@ -1743,6 +1743,8 @@ int reload_servers(char *fname)
|
||||
/* Called when addresses are added or deleted from an interface */
|
||||
void newaddress(time_t now)
|
||||
{
|
||||
struct dhcp_relay *relay;
|
||||
|
||||
(void)now;
|
||||
|
||||
if (option_bool(OPT_CLEVERBIND) || option_bool(OPT_LOCAL_SERVICE) ||
|
||||
@@ -1751,6 +1753,12 @@ void newaddress(time_t now)
|
||||
|
||||
if (option_bool(OPT_CLEVERBIND))
|
||||
create_bound_listeners(0);
|
||||
|
||||
#ifdef HAVE_DHCP
|
||||
/* clear cache of subnet->relay index */
|
||||
for (relay = daemon->relay4; relay; relay = relay->next)
|
||||
relay->iface_index = 0;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DHCP6
|
||||
if (daemon->doing_dhcp6 || daemon->relay6 || daemon->doing_ra)
|
||||
@@ -1761,5 +1769,8 @@ void newaddress(time_t now)
|
||||
|
||||
if (daemon->doing_dhcp6)
|
||||
lease_find_interfaces(now);
|
||||
|
||||
for (relay = daemon->relay6; relay; relay = relay->next)
|
||||
relay->iface_index = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user