Skip to content

Commit

Permalink
clear addresses instead of setting unspecified
Browse files Browse the repository at this point in the history
  • Loading branch information
jlogan03 committed Feb 10, 2024
1 parent 28b9901 commit b78ab0e
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions examples/dhcp_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ fn main() {
config.random_seed = rand::random();
let mut iface = Interface::new(config, &mut device, Instant::now());

// Initialize with an unspecified address
set_ipv4_addr(&mut iface, Ipv4Cidr::new(Ipv4Address::UNSPECIFIED, 0));

// Create sockets
let mut dhcp_socket = dhcpv4::Socket::new();

Expand Down Expand Up @@ -80,7 +77,7 @@ fn main() {
}
Some(dhcpv4::Event::Deconfigured) => {
debug!("DHCP lost config!");
set_ipv4_addr(&mut iface, Ipv4Cidr::new(Ipv4Address::UNSPECIFIED, 0));
iface.update_ip_addrs(|addrs| addrs.clear());
iface.routes_mut().remove_default_ipv4_route();
}
}
Expand Down

0 comments on commit b78ab0e

Please sign in to comment.