From 054e635183e3db30cff424865cb0970a78715813 Mon Sep 17 00:00:00 2001 From: James L Date: Sat, 7 Mar 2026 21:39:15 -0500 Subject: [PATCH] fix: prevent MTU clamp to zero when previous-hop has no HW_MTU When forwarding a LINKREQUEST through a transport node, the MTU clamping logic uses std::min(nh_mtu, ph_mtu) to pick the lower of the next-hop and previous-hop interface MTUs. However, when the previous-hop interface has no HW_MTU configured (ph_mtu == 0), this clamps the path MTU to 0 instead of using the next-hop MTU. This can happen when the LINKREQUEST enters via an interface that doesn't report an HW_MTU but nh_mtu < path_mtu is true (so we enter the clamping branch). The result is a zero-byte MTU in the signalling bytes, which causes the link to fail. Fix: use std::min(nh_mtu, (ph_mtu > 0) ? ph_mtu : nh_mtu) so that when ph_mtu is 0 (unknown), we fall back to nh_mtu rather than clamping to 0. --- src/Transport.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Transport.cpp b/src/Transport.cpp index 05def93..ed94e29 100644 --- a/src/Transport.cpp +++ b/src/Transport.cpp @@ -1517,7 +1517,7 @@ Transport::DestinationEntry empty_destination_entry; else { if (nh_mtu < path_mtu || (ph_mtu != 0 && ph_mtu < path_mtu)) { try { - path_mtu = std::min(nh_mtu, ph_mtu); + path_mtu = std::min(nh_mtu, (ph_mtu > 0) ? ph_mtu : nh_mtu); Bytes clamped_mtu = Link::signalling_bytes(path_mtu, mode); DEBUGF("Clamping link MTU to %u", path_mtu); new_raw = new_raw.left(new_raw.size()-Type::Link::LINK_MTU_SIZE)+clamped_mtu;