diff --git a/embassy-net/src/lib.rs b/embassy-net/src/lib.rs index 86a11e92..2fb34f43 100644 --- a/embassy-net/src/lib.rs +++ b/embassy-net/src/lib.rs @@ -583,9 +583,6 @@ impl SocketStack { impl Inner { #[cfg(feature = "proto-ipv4")] fn apply_config_v4(&mut self, s: &mut SocketStack, config: StaticConfigV4) { - #[cfg(any(feature = "medium-ethernet", feature = "medium-ieee802154"))] - let medium = self.device.capabilities().medium; - debug!("Acquired IP configuration:"); debug!(" IP address: {}", config.address); @@ -600,8 +597,12 @@ impl Inner { addrs.push(IpCidr::Ipv4(config.address)).unwrap(); }); - #[cfg(feature = "medium-ethernet")] - if medium == Medium::Ethernet { + #[cfg(feature = "medium-ip")] + let skip_gateway = self.device.capabilities().medium != Medium::Ip; + #[cfg(not(feature = "medium-ip"))] + let skip_gateway = false; + + if !skip_gateway { if let Some(gateway) = config.gateway { debug!(" Default gateway: {}", gateway); s.iface.routes_mut().add_default_ipv4_route(gateway).unwrap();