We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5eced2a commit dc771ecCopy full SHA for dc771ec
examples/dhcp_client.rs
@@ -77,6 +77,7 @@ fn main() {
77
}
78
Some(dhcpv4::Event::Deconfigured) => {
79
debug!("DHCP lost config!");
80
+ iface.update_ip_addrs(|addrs| addrs.clear());
81
set_ipv4_addr(&mut iface, Ipv4Cidr::new(Ipv4Address::UNSPECIFIED, 0));
82
iface.routes_mut().remove_default_ipv4_route();
83
@@ -88,7 +89,6 @@ fn main() {
88
89
90
fn set_ipv4_addr(iface: &mut Interface, cidr: Ipv4Cidr) {
91
iface.update_ip_addrs(|addrs| {
- let dest = addrs.iter_mut().next().unwrap();
92
- *dest = IpCidr::Ipv4(cidr);
+ addrs.push(IpCidr::Ipv4(cidr)).unwrap();
93
});
94
0 commit comments