You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a UDP server is bound to more than a single address (typically because it's bound to the unspecified address) and the system can have more than a single address at an interface (not uncommon at IPv6), then an unconnected UDP server's send function needs a function that allows setting the source address (basically to the .1 of the result of a receive call). Otherwise, the OS will fill in that information -- and if the peer is picky about addresses (as CoAP is), it may guess wrong. (For example, Linux will pick the most recent address).
Adding support for this in a fully reliable way would probably mean adding a trait with an ugly name (UdpServerMultiaddress::send_to_from?). A more compatible, softer but prone-to-silent-misbehavior way forward would be to introduce UdpSever::send_to_from with a default implementation that disregards the from address (which is an OK behavior in the may cases when there is only one legal value anyway). Ideally, that default implementation would go away with the next incompatible version bump. (We can't have Rust show deprecation warnings when relying on a default implementation, can we?)
I'm happy to do a PR for this (just can't do it right now), but it would be good to have some initial feedback first.
The text was updated successfully, but these errors were encountered:
Starting to use the embedded-nal server side, I noted that the bind function doesn't even take an address. This eliminates the workaround I'd otherwise have used here (to only ever bind a socket to a single unicast address).
If a UDP server is bound to more than a single address (typically because it's bound to the unspecified address) and the system can have more than a single address at an interface (not uncommon at IPv6), then an unconnected UDP server's send function needs a function that allows setting the source address (basically to the .1 of the result of a receive call). Otherwise, the OS will fill in that information -- and if the peer is picky about addresses (as CoAP is), it may guess wrong. (For example, Linux will pick the most recent address).
Adding support for this in a fully reliable way would probably mean adding a trait with an ugly name (
UdpServerMultiaddress::send_to_from
?). A more compatible, softer but prone-to-silent-misbehavior way forward would be to introduceUdpSever::send_to_from
with a default implementation that disregards the from address (which is an OK behavior in the may cases when there is only one legal value anyway). Ideally, that default implementation would go away with the next incompatible version bump. (We can't have Rust show deprecation warnings when relying on a default implementation, can we?)I'm happy to do a PR for this (just can't do it right now), but it would be good to have some initial feedback first.
The text was updated successfully, but these errors were encountered: