net: Reset DHCP socket when the link up is detected

Previously, because DHCP DISCOVER is sent before the link is
established, socket has to timeout first. Which takes extra 10 s.

Now if the state of the link changed to up, socket is explicitly reset
so the DISCOVER is repeated much earlier and DHCP configuration is
acquired much faster.
This commit is contained in:
Gabriel Górski 2023-10-23 10:56:55 +02:00
parent 88ada52146
commit 18c9bcd44a

View File

@ -860,6 +860,9 @@ impl<D: Driver> Inner<D> {
let socket = s.sockets.get_mut::<dhcpv4::Socket>(dhcp_handle);
if self.link_up {
if old_link_up != self.link_up {
socket.reset();
}
match socket.poll() {
None => {}
Some(dhcpv4::Event::Deconfigured) => {