aboutsummaryrefslogtreecommitdiff
path: root/embassy-net/src/lib.rs
diff options
context:
space:
mode:
authorRuben De Smet <[email protected]>2023-07-31 12:25:57 +0200
committerRuben De Smet <[email protected]>2023-07-31 14:21:27 +0200
commitbdd59b89885bff676a73d990613c1b74955885b3 (patch)
treecef12de47a47ab086b9032cc9e3124fec3fdbf0b /embassy-net/src/lib.rs
parent9f55228be07cb4edf680a57afc0fefd69fed7742 (diff)
Only skip default-gateway assignment with Medium::Ip
Diffstat (limited to 'embassy-net/src/lib.rs')
-rw-r--r--embassy-net/src/lib.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/embassy-net/src/lib.rs b/embassy-net/src/lib.rs
index 86a11e92e..2fb34f43a 100644
--- a/embassy-net/src/lib.rs
+++ b/embassy-net/src/lib.rs
@@ -583,9 +583,6 @@ impl SocketStack {
583impl<D: Driver + 'static> Inner<D> { 583impl<D: Driver + 'static> Inner<D> {
584 #[cfg(feature = "proto-ipv4")] 584 #[cfg(feature = "proto-ipv4")]
585 fn apply_config_v4(&mut self, s: &mut SocketStack, config: StaticConfigV4) { 585 fn apply_config_v4(&mut self, s: &mut SocketStack, config: StaticConfigV4) {
586 #[cfg(any(feature = "medium-ethernet", feature = "medium-ieee802154"))]
587 let medium = self.device.capabilities().medium;
588
589 debug!("Acquired IP configuration:"); 586 debug!("Acquired IP configuration:");
590 587
591 debug!(" IP address: {}", config.address); 588 debug!(" IP address: {}", config.address);
@@ -600,8 +597,12 @@ impl<D: Driver + 'static> Inner<D> {
600 addrs.push(IpCidr::Ipv4(config.address)).unwrap(); 597 addrs.push(IpCidr::Ipv4(config.address)).unwrap();
601 }); 598 });
602 599
603 #[cfg(feature = "medium-ethernet")] 600 #[cfg(feature = "medium-ip")]
604 if medium == Medium::Ethernet { 601 let skip_gateway = self.device.capabilities().medium != Medium::Ip;
602 #[cfg(not(feature = "medium-ip"))]
603 let skip_gateway = false;
604
605 if !skip_gateway {
605 if let Some(gateway) = config.gateway { 606 if let Some(gateway) = config.gateway {
606 debug!(" Default gateway: {}", gateway); 607 debug!(" Default gateway: {}", gateway);
607 s.iface.routes_mut().add_default_ipv4_route(gateway).unwrap(); 608 s.iface.routes_mut().add_default_ipv4_route(gateway).unwrap();