@@ -3097,6 +3097,36 @@ impl crate::Socket {
30973097 )
30983098 }
30993099 }
3100+
3101+ /// Get the value of the `UDP_GRO` option on this socket.
3102+ ///
3103+ /// For more information about this option, see [`set_udp_gro`].
3104+ ///
3105+ /// [`set_udp_gro`]: Socket::set_udp_gro
3106+ #[ cfg( all( feature = "all" , any( target_os = "android" , target_os = "linux" ) ) ) ]
3107+ #[ cfg_attr(
3108+ docsrs,
3109+ doc( cfg( all( feature = "all" , any( target_os = "android" , target_os = "linux" ) ) ) )
3110+ ) ]
3111+ pub fn udp_gro ( & self ) -> io:: Result < bool > {
3112+ unsafe {
3113+ getsockopt :: < c_int > ( self . as_raw ( ) , libc:: SOL_UDP , libc:: UDP_GRO ) . map ( |reuse| reuse != 0 )
3114+ }
3115+ }
3116+
3117+ /// Set value for the `UDP_GRO` option on this socket.
3118+ ///
3119+ /// This indicates that the kernel can combine multiple datagrams into a
3120+ /// single buffer, this needs to be used in combination with [`Self::recvmsg`]
3121+ /// to get the number of segments in the buffer from the [`MsgHdr`].
3122+ #[ cfg( all( feature = "all" , any( target_os = "android" , target_os = "linux" ) ) ) ]
3123+ #[ cfg_attr(
3124+ docsrs,
3125+ doc( cfg( all( feature = "all" , any( target_os = "android" , target_os = "linux" ) ) ) )
3126+ ) ]
3127+ pub fn set_udp_gro ( & self , reuse : bool ) -> io:: Result < ( ) > {
3128+ unsafe { setsockopt ( self . as_raw ( ) , libc:: SOL_UDP , libc:: UDP_GRO , reuse as c_int ) }
3129+ }
31003130}
31013131
31023132/// See [`Socket::dccp_available_ccids`].
0 commit comments