From 67fa43155821ba85c95c9062cd0b85f2294da8f2 Mon Sep 17 00:00:00 2001 From: Red Bear OS Date: Sun, 26 Jul 2026 21:30:36 +0900 Subject: [PATCH] netstack: hardcode hop_limit to 64 in IpScheme for smoltcp 0.13.1 smoltcp 0.13.1 made RawSocket::hop_limit a private field with no public accessor or setter. The trait methods on IpScheme cannot usefully read or write the value (anything returned is just a default, anything written is dropped on the floor). Return the smoltcp default of 64 from hop_limit() and accept the write in set_hop_limit() as a no-op. The actual TTL field in outgoing IPv4 packets is set by smoltcp's default TTL of 64 when constructing the Repr, so the wire behavior is unchanged from a fresh smoltcp 0.13.1 stack. This is the minimal-surface fix that keeps the trait method implementations compilable on smoltcp 0.13.1 without introducing a per-socket hop_limit cache. A future refinement could add a hop_limit field to the SchemeSocket data type for schemes that need explicit control. --- netstack/src/scheme/ip.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/netstack/src/scheme/ip.rs b/netstack/src/scheme/ip.rs index 1d629e3860..733696c33d 100644 --- a/netstack/src/scheme/ip.rs +++ b/netstack/src/scheme/ip.rs @@ -53,11 +53,14 @@ impl<'a> SchemeSocket for RawSocket<'a> { } fn hop_limit(&self) -> u8 { - self.hop_limit() + // smoltcp 0.13.1 made RawSocket::hop_limit a private field + // with no public setter; the underlying default is 64 and + // outgoing packets use that. Return the default here. + 64 } - fn set_hop_limit(&mut self, hop_limit: u8) { - self.set_hop_limit(hop_limit); + fn set_hop_limit(&mut self, _hop_limit: u8) { + // smoltcp 0.13.1: no public setter; accepted for API compat. } fn new_socket(