diff options
| author | Roy Buitenhuis <[email protected]> | 2023-04-18 22:11:15 +0200 |
|---|---|---|
| committer | Roy Buitenhuis <[email protected]> | 2023-04-18 22:11:15 +0200 |
| commit | a2ac1eed1bd357f31c8a0cd5f8957f3017c5df21 (patch) | |
| tree | 091718309456b1a69d08aadb7c99c20a803714ec /embassy-net/src/lib.rs | |
| parent | bfa3cbaf30fae513c7569a2f5c88a45b0911f02e (diff) | |
Add extra feature flags to fix build without dhcp.
Diffstat (limited to 'embassy-net/src/lib.rs')
| -rw-r--r-- | embassy-net/src/lib.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/embassy-net/src/lib.rs b/embassy-net/src/lib.rs index 7b9d0e773..5dfb5843e 100644 --- a/embassy-net/src/lib.rs +++ b/embassy-net/src/lib.rs | |||
| @@ -27,12 +27,10 @@ use embassy_sync::waitqueue::WakerRegistration; | |||
| 27 | use embassy_time::{Instant, Timer}; | 27 | use embassy_time::{Instant, Timer}; |
| 28 | use futures::pin_mut; | 28 | use futures::pin_mut; |
| 29 | use heapless::Vec; | 29 | use heapless::Vec; |
| 30 | use smoltcp::iface::{Interface, SocketHandle, SocketSet, SocketStorage}; | ||
| 30 | #[cfg(feature = "dhcpv4")] | 31 | #[cfg(feature = "dhcpv4")] |
| 31 | use smoltcp::iface::SocketHandle; | 32 | use smoltcp::socket::dhcpv4::{self, RetryConfig}; |
| 32 | use smoltcp::iface::{Interface, SocketSet, SocketStorage}; | ||
| 33 | #[cfg(feature = "dhcpv4")] | 33 | #[cfg(feature = "dhcpv4")] |
| 34 | use smoltcp::socket::dhcpv4; | ||
| 35 | use smoltcp::socket::dhcpv4::RetryConfig; | ||
| 36 | use smoltcp::time::Duration; | 34 | use smoltcp::time::Duration; |
| 37 | // smoltcp reexports | 35 | // smoltcp reexports |
| 38 | pub use smoltcp::time::{Duration as SmolDuration, Instant as SmolInstant}; | 36 | pub use smoltcp::time::{Duration as SmolDuration, Instant as SmolInstant}; |
| @@ -76,6 +74,7 @@ pub struct StaticConfig { | |||
| 76 | pub dns_servers: Vec<Ipv4Address, 3>, | 74 | pub dns_servers: Vec<Ipv4Address, 3>, |
| 77 | } | 75 | } |
| 78 | 76 | ||
| 77 | #[cfg(feature = "dhcpv4")] | ||
| 79 | #[derive(Debug, Clone, PartialEq, Eq)] | 78 | #[derive(Debug, Clone, PartialEq, Eq)] |
| 80 | pub struct DhcpConfig { | 79 | pub struct DhcpConfig { |
| 81 | pub max_lease_duration: Option<Duration>, | 80 | pub max_lease_duration: Option<Duration>, |
| @@ -88,6 +87,7 @@ pub struct DhcpConfig { | |||
| 88 | pub client_port: u16, | 87 | pub client_port: u16, |
| 89 | } | 88 | } |
| 90 | 89 | ||
| 90 | #[cfg(feature = "dhcpv4")] | ||
| 91 | impl Default for DhcpConfig { | 91 | impl Default for DhcpConfig { |
| 92 | fn default() -> Self { | 92 | fn default() -> Self { |
| 93 | Self { | 93 | Self { |
| @@ -384,6 +384,7 @@ impl<D: Driver + 'static> Inner<D> { | |||
| 384 | self.config = Some(config) | 384 | self.config = Some(config) |
| 385 | } | 385 | } |
| 386 | 386 | ||
| 387 | #[cfg(feature = "dhcpv4")] | ||
| 387 | fn apply_dhcp_config(&self, socket: &mut smoltcp::socket::dhcpv4::Socket, config: DhcpConfig) { | 388 | fn apply_dhcp_config(&self, socket: &mut smoltcp::socket::dhcpv4::Socket, config: DhcpConfig) { |
| 388 | socket.set_ignore_naks(config.ignore_naks); | 389 | socket.set_ignore_naks(config.ignore_naks); |
| 389 | socket.set_max_lease_duration(config.max_lease_duration); | 390 | socket.set_max_lease_duration(config.max_lease_duration); |
