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.
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user