Skip to content

Commit

Permalink
fix ControlMessageOwned::UdpGroSegments UDP packets processing type.
Browse files Browse the repository at this point in the history
The kernel, since 5.0, process the segmentation offload with a signed
int.

close nix-rust#2403.
  • Loading branch information
devnexen committed May 18, 2024
1 parent ec4beb5 commit 37877d5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/sys/socket/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ pub enum ControlMessageOwned {
#[cfg(target_os = "linux")]
#[cfg(feature = "net")]
#[cfg_attr(docsrs, doc(cfg(feature = "net")))]
UdpGroSegments(u16),
UdpGroSegments(i32),

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

0 comments on commit 37877d5

Please sign in to comment.