smoltcp-rs / smoltcp

a smol tcp/ip stack
BSD Zero Clause License
3.63k stars 402 forks source link

Panic when solving URI with mDNS #941

Open ODCA117 opened 1 week ago

ODCA117 commented 1 week ago

I tried to enable the following feature in embassy-net #[cfg(feature = "socket-mdns")] to be able to resolve this URI homeassistant.local in rp pico. I was able to enable mdns feature but when trying to resolve the URI smoltcp panics with

smoltcp-0.11.0/src/iface/interface/mod.rs:882:14:
called `Option::unwrap()` on a `None` value
Dirbaio commented 1 week ago

panic is here https://github.com/smoltcp-rs/smoltcp/blob/v0.11.0/src/iface/interface/mod.rs#L882

it happens because you haven't configured any ipv6 address in the interface. Are you actually intending to use IPv6? if no, disable it. if yes, configure an address.

(we should probably look into preventing mDNS from trying to use ipv6 if you have no ipv6 addr, or at least not panic...)

aurelj commented 3 days ago

Note that the panic seems to already be fixed in the current git tree.

You can try the git version adding this in your Cargo.toml:

[patch.crates-io]
smoltcp = { git = "https://github.com/smoltcp-rs/smoltcp.git" }