Skip to content

Commit

Permalink
Fixing DHCP address issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan-summers committed Apr 19, 2022
1 parent 192ddb4 commit c8dc0c2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/hardware/net_interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ impl NetStorage {
const fn new() -> Self {
NetStorage {
// Placeholder for the real IP address, which is initialized at runtime.
ip_addrs: [smoltcp::wire::IpCidr::Ipv6(
smoltcp::wire::Ipv6Cidr::SOLICITED_NODE_PREFIX,
)],
ip_addrs: [smoltcp::wire::IpCidr::Ipv4(smoltcp::wire::Ipv4Cidr::new(
smoltcp::wire::Ipv4Address::UNSPECIFIED,
24,
))],
neighbor_cache: [None; 8],
routes_cache: [None; 8],
sockets: [smoltcp::iface::SocketStorage::EMPTY; NUM_TCP_SOCKETS + 1],
Expand Down
10 changes: 9 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ mod app {
}) {
Ok(true) => update_settings::spawn().unwrap(),
Ok(false) => {}
Err(miniconf::minimq::Error::Network(smoltcp_nal::NetworkError::NoIpAddress)) => {}
other => log::warn!("Miniconf update failure: {:?}", other),
}

Expand All @@ -317,8 +318,15 @@ mod app {
c.shared
.net_devices
.lock(|net| {
net.control
match net
.control
.poll(|handler, topic, data| main_bus.lock(|bus| handler(bus, topic, data)))
{
Err(minireq::Error::Mqtt(minimq::Error::Network(
smoltcp_nal::NetworkError::NoIpAddress,
))) => Ok(()),
other => other,
}
})
.unwrap();

Expand Down

0 comments on commit c8dc0c2

Please sign in to comment.