@@ -128,15 +128,15 @@ impl UdpSocketState {
128128 // Enable IP_RECVERR and IPV6_RECVERR for ICMP Errors
129129 #[ cfg( target_os = "linux" ) ]
130130 if is_ipv4 {
131- if let Err ( e) = set_socket_option ( & * io, libc:: IPPROTO_IP , libc:: IP_RECVERR , OPTION_ON ) {
132- crate :: log:: warn!( "Failed to enable IP_RECVERR: {}" , e) ;
133- }
134- } else {
135- if let Err ( e) =
136- set_socket_option ( & * io, libc:: IPPROTO_IPV6 , libc:: IPV6_RECVERR , OPTION_ON )
131+ if let Err ( _err) =
132+ set_socket_option ( & * io, libc:: IPPROTO_IP , libc:: IP_RECVERR , OPTION_ON )
137133 {
138- crate :: log:: warn!( "Failed to enable IPV6_RECVERR : {}" , e ) ;
134+ crate :: log:: warn!( "Failed to enable IP_RECVERR : {}" , _err ) ;
139135 }
136+ } else if let Err ( _err) =
137+ set_socket_option ( & * io, libc:: IPPROTO_IPV6 , libc:: IPV6_RECVERR , OPTION_ON )
138+ {
139+ crate :: log:: warn!( "Failed to enable IPV6_RECVERR: {}" , _err) ;
140140 }
141141
142142 let mut may_fragment = false ;
@@ -523,22 +523,24 @@ fn recv(io: SockRef<'_>, bufs: &mut [IoSliceMut<'_>], meta: &mut [RecvMeta]) ->
523523 {
524524 use std:: os:: fd:: AsFd ;
525525 // Clear the error queue after processing normal packets
526- while let Ok ( Some ( ( addr , err) ) ) = recv_err ( & io. as_fd ( ) ) {
526+ while let Ok ( Some ( ( _addr , err) ) ) = recv_err ( & io. as_fd ( ) ) {
527527 crate :: log:: debug!(
528528 "ICMP error from {}: origin: {}, type: {}, code: {}, err_no: {} " ,
529- addr ,
529+ _addr ,
530530 err. ee_origin,
531531 err. ee_type,
532532 err. ee_code,
533533 err. ee_errno
534534 ) ;
535535 match ( err. ee_origin , err. ee_type , err. ee_code ) {
536536 ( libc:: SO_EE_ORIGIN_ICMP , 3 , 0 ) => {
537- crate :: log:: warn!( "Network Unreachable: {}" , addr)
537+ crate :: log:: warn!( "Network Unreachable: {}" , _addr)
538+ }
539+ ( libc:: SO_EE_ORIGIN_ICMP , 3 , 1 ) => crate :: log:: warn!( "Host Unreachable: {}" , _addr) ,
540+ ( libc:: SO_EE_ORIGIN_ICMP , 3 , 2 ) => crate :: log:: warn!( "PORT Unreachable: {}" , _addr) ,
541+ ( libc:: SO_EE_ORIGIN_ICMP6 , 1 , 0 ) => {
542+ crate :: log:: warn!( "IPv6 Unreachable: {}" , _addr)
538543 }
539- ( libc:: SO_EE_ORIGIN_ICMP , 3 , 1 ) => crate :: log:: warn!( "Host Unreachable: {}" , addr) ,
540- ( libc:: SO_EE_ORIGIN_ICMP , 3 , 2 ) => crate :: log:: warn!( "PORT Unreachable: {}" , addr) ,
541- ( libc:: SO_EE_ORIGIN_ICMP6 , 1 , 0 ) => crate :: log:: warn!( "IPv6 Unreachable: {}" , addr) ,
542544 _ => crate :: log:: warn!( "Other ICMP error: {:?}" , err) ,
543545 } ;
544546 }
@@ -924,10 +926,10 @@ fn recv_err(io: &impl AsRawFd) -> io::Result<Option<(SocketAddr, SockExtendedErr
924926}
925927
926928// I don't know about how other platforms handle this.
927- #[ cfg( not( target_os = "linux" ) ) ]
928- fn recv_error_queue ( _io : & impl AsRawFd ) -> io:: Result < Option < ( SocketAddr , ( ) ) > > {
929- Ok ( None )
930- }
929+ // #[cfg(not(target_os = "linux"))]
930+ // fn recv_err (_io: &impl AsRawFd) -> io::Result<Option<(SocketAddr, ())>> {
931+ // Ok(None)
932+ // }
931933
932934#[ cfg( not( apple_slow) ) ]
933935// Chosen somewhat arbitrarily; might benefit from additional tuning.
0 commit comments