Skip to content

Commit f743197

Browse files
authored
fix ControlMessageOwned::UdpGroSegments UDP packets processing type. (#2406)
* fix ControlMessageOwned::UdpGroSegments UDP packets processing type. The kernel, since 5.0, process the segmentation offload with a signed int. close #2403. * changelog
1 parent 208b80b commit f743197

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

changelog/2406.fixed.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed ControlMessageOwned::UdpGroSegments wrapped type from u16 to i32 to reflect the used kernel's one.

src/sys/socket/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,7 @@ pub enum ControlMessageOwned {
780780
#[cfg(target_os = "linux")]
781781
#[cfg(feature = "net")]
782782
#[cfg_attr(docsrs, doc(cfg(feature = "net")))]
783-
UdpGroSegments(u16),
783+
UdpGroSegments(i32),
784784

785785
/// SO_RXQ_OVFL indicates that an unsigned 32 bit value
786786
/// ancilliary msg (cmsg) should be attached to recieved
@@ -956,7 +956,7 @@ impl ControlMessageOwned {
956956
#[cfg(target_os = "linux")]
957957
#[cfg(feature = "net")]
958958
(libc::SOL_UDP, libc::UDP_GRO) => {
959-
let gso_size: u16 = unsafe { ptr::read_unaligned(p as *const _) };
959+
let gso_size: i32 = unsafe { ptr::read_unaligned(p as *const _) };
960960
ControlMessageOwned::UdpGroSegments(gso_size)
961961
},
962962
#[cfg(any(linux_android, target_os = "fuchsia"))]

0 commit comments

Comments
 (0)