mirror of
https://github.com/jmcorgan/fips.git
synced 2026-08-09 00:04:54 +00:00
Add per-link MTU support to Transport trait
Add link_mtu(&TransportAddr) method to the Transport trait with a default implementation that falls back to the transport-wide mtu(). This enables transports like BLE to report per-connection MTU values while maintaining backward compatibility for UDP and other transports that use a single MTU for all links. Update the forwarding and session send paths to query link_mtu() with the next-hop peer's current address, falling back to transport-wide mtu() when no address is available.
This commit is contained in:
@@ -64,7 +64,11 @@ impl Node {
|
||||
&& let Some(tid) = peer.transport_id()
|
||||
&& let Some(transport) = self.transports.get(&tid)
|
||||
{
|
||||
datagram.path_mtu = datagram.path_mtu.min(transport.mtu());
|
||||
if let Some(addr) = peer.current_addr() {
|
||||
datagram.path_mtu = datagram.path_mtu.min(transport.link_mtu(addr));
|
||||
} else {
|
||||
datagram.path_mtu = datagram.path_mtu.min(transport.mtu());
|
||||
}
|
||||
}
|
||||
|
||||
// Forward: re-encode (includes 0x00 type byte) and send
|
||||
|
||||
@@ -1062,7 +1062,11 @@ impl Node {
|
||||
&& let Some(tid) = peer.transport_id()
|
||||
&& let Some(transport) = self.transports.get(&tid)
|
||||
{
|
||||
datagram.path_mtu = datagram.path_mtu.min(transport.mtu());
|
||||
if let Some(addr) = peer.current_addr() {
|
||||
datagram.path_mtu = datagram.path_mtu.min(transport.link_mtu(addr));
|
||||
} else {
|
||||
datagram.path_mtu = datagram.path_mtu.min(transport.mtu());
|
||||
}
|
||||
}
|
||||
|
||||
// Source-side: seed our PathMtuState.current_mtu from the outbound
|
||||
|
||||
Reference in New Issue
Block a user