It was previously possible to enter an unreachable path when the HBH
option type was 0b11 and the destination address was multicast. This is
now fixed in the interface.
I also changed the way an HBH option type is parsed. The option type is
only 2 bits, meaning that we can't have an unknown state.
This makes `.poll()` behave the same as before #954. Users affected by DoS
concerns can use the finer-grained egress-only and single-packet-ingress-only fns.
Currently TestingDevice is a loopback device, which causes problems if the iface transmits a packet then receives.
The packet gets looped back to the interface instead of being handled by the test code.
This commit changes TestingDevice to behave more like a "virtual wire" that communicates the
interface with the testing code, with one queue for each direction.
The multicast feature was somewhat broken before, there was no way to do IPv6-only multicast
since a lot of multicast code was gated behind `proto-igmp` which force-enables ipv4.
Solution:
- Added feature `multicast` which enables multicast for ipv4 and/or ipv6, whatever the user has enabled.
- Removed feature `proto-igmp`. IGMP support in `wire` is always built if ipv4 is enabled. This causes no bloat if unused, and the increase in compile time is negligible. `iface` only uses it if the `multicast` feature is enabled.
Instead of eagerly sending the join/leave packet when the user calls join/leave,
we update internal state and send the packet when the interface is polled.
Advantages:
- If the device is exhausted, the packet gets sent later instead of just failing and returning an error to the user.
- Makes the API consistent with everything else in smoltcp: operations only update internal state, poll is what sends/receives packets.
- Enables wrappers to offer simpler APIs with less generics. See https://github.com/embassy-rs/embassy/pull/3329 for an example, which is my original motivation.
- Truncate the servers list to DNS_MAX_SERVER_COUNT to prevent panics.
- Ensure only the first `DNS_MAX_SERVER_COUNT` servers are used when constructing the `Socket`.
- This prevents overflow issues when the provided server list is larger than the allowed maximum.
When looking up the destination link-layer address for a given
destination address, we need to send an ARP or ICMPv6 Neighbor
Solicitation if the destination link-layer address is not in the cache.
When transmitting an ARP or ICMPv6 Neighbor Solicitation packet, use the
source address of the interface instead of the source address of the
packet that is tried to be sent.
By using the source address of the interface, we are sure that a
response will be received on the same interface.
The UDP broadcast test was using the wrong feature flag. This commit
fixes the feature flag to use the correct one.
This must have slipped through the cracks when I updated the tests to
use rstest.
Updating process loop to be defined by socket buffers when possible
Further changes after hardware testing
Fixing test
Adding CHANGELOG entry
Expanding comment after review
Update src/iface/interface/mod.rs
Co-authored-by: Catherine <whitequark@whitequark.org>
Removing redundant phrasing in comment
Updating verbiage to remove references to unsafe and safe