cfg-gate unapply_config_v4

This commit is contained in:
bjoernQ 2023-07-18 10:57:05 +02:00
parent f581831b86
commit 6bf4717b0a

View File

@ -648,16 +648,17 @@ impl<D: Driver + 'static> Inner<D> {
socket.set_retry_config(config.retry_config); socket.set_retry_config(config.retry_config);
} }
#[allow(unused)] // used only with dhcp #[cfg(feature = "dhcpv4")]
fn unapply_config_v4(&mut self, s: &mut SocketStack) { fn unapply_config_v4(&mut self, s: &mut SocketStack) {
#[cfg(feature = "medium-ethernet")] #[cfg(feature = "medium-ethernet")]
let medium = self.device.capabilities().medium; let medium = self.device.capabilities().medium;
debug!("Lost IP configuration"); debug!("Lost IP configuration");
s.iface.update_ip_addrs(|ip_addrs| { s.iface.update_ip_addrs(|ip_addrs| {
#[cfg(feature = "proto-ipv4")]
if let Some((index, _)) = ip_addrs if let Some((index, _)) = ip_addrs
.iter() .iter()
.enumerate() .enumerate()
.find(|(index, &addr)| matches!(addr, IpCidr::Ipv4(_))) .find(|(_, &addr)| matches!(addr, IpCidr::Ipv4(_)))
{ {
ip_addrs.remove(index); ip_addrs.remove(index);
} }