mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-23 08:00:20 +00:00
DHCPClient: Don't reset the interface if its already configured
Resetting the interface just based on the fact that it already has an IP
assigned doesn't make much sense, considering that we frequently end up
here after having configured an interface via DHCP already.
Instead, just keep the part that prevents us from sending DHCP
discoveries to interfaces that shouldn't be using DHCP.
While we are at it, place some of the logging behind a debug flag, as
this function is apparently meant to be run frequently.
This partially reverts commit e14d4482a1
.
This commit is contained in:
parent
df8df947f6
commit
808855d763
Notes:
sideshowbarker
2024-07-17 10:54:57 +09:00
Author: https://github.com/timschumi Commit: https://github.com/SerenityOS/serenity/commit/808855d763 Pull-request: https://github.com/SerenityOS/serenity/pull/14150
1 changed files with 4 additions and 7 deletions
|
@ -151,18 +151,15 @@ void DHCPv4Client::try_discover_ifs()
|
|||
if (ifs_result.is_error())
|
||||
return;
|
||||
|
||||
dbgln("Interfaces with DHCP enabled: {}", m_interfaces_with_dhcp_enabled);
|
||||
dbgln_if(DHCPV4CLIENT_DEBUG, "Interfaces with DHCP enabled: {}", m_interfaces_with_dhcp_enabled);
|
||||
bool sent_discover_request = false;
|
||||
Interfaces& ifs = ifs_result.value();
|
||||
for (auto& iface : ifs.ready) {
|
||||
dbgln("Checking interface {} / {}", iface.ifname, iface.current_ip_address);
|
||||
dbgln_if(DHCPV4CLIENT_DEBUG, "Checking interface {} / {}", iface.ifname, iface.current_ip_address);
|
||||
if (!m_interfaces_with_dhcp_enabled.contains_slow(iface.ifname))
|
||||
continue;
|
||||
if (iface.current_ip_address != IPv4Address { 0, 0, 0, 0 }) {
|
||||
dbgln_if(DHCPV4CLIENT_DEBUG, "Resetting params for {}", iface.ifname);
|
||||
set_params(iface, IPv4Address { 0, 0, 0, 0 }, IPv4Address { 0, 0, 0, 0 }, {});
|
||||
iface.current_ip_address = IPv4Address { 0, 0, 0, 0 };
|
||||
}
|
||||
if (iface.current_ip_address != IPv4Address { 0, 0, 0, 0 })
|
||||
continue;
|
||||
|
||||
dhcp_discover(iface);
|
||||
sent_discover_request = true;
|
||||
|
|
Loading…
Reference in a new issue