From 9386cde871c750464073772409615e90344b80e9 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Mon, 18 Nov 2024 16:15:36 +1100 Subject: [PATCH] Only set `segment_size` if it is different from the transmit length --- quinn-udp/src/unix.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/quinn-udp/src/unix.rs b/quinn-udp/src/unix.rs index 02acdf0e0..38b322e24 100644 --- a/quinn-udp/src/unix.rs +++ b/quinn-udp/src/unix.rs @@ -593,7 +593,12 @@ fn prepare_msg( encoder.push(libc::IPPROTO_IPV6, libc::IPV6_TCLASS, ecn); } - if let Some(segment_size) = transmit.segment_size { + // Only set the segment size if it is different from the size of the contents. + // Some network drivers don't like being told to do GSO even if there is effectively only a single segment. + if let Some(segment_size) = transmit + .segment_size + .filter(|segment_size| *segment_size != transmit.contents.len()) + { gso::set_segment_size(&mut encoder, segment_size as u16); }