File tree 5 files changed +16
-17
lines changed
5 files changed +16
-17
lines changed Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ untrusted = "0.6.2"
35
35
webpki = " 0.19"
36
36
webpki-roots = " 0.16"
37
37
ct-logs = " 0.5"
38
- libc = " 0.2.46 "
38
+ libc = " 0.2.49 "
39
39
mio = " 0.6"
40
40
41
41
[dev-dependencies ]
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ impl<'a> Encoder<'a> {
36
36
assert ! ( mem:: align_of:: <T >( ) <= mem:: align_of:: <libc:: cmsghdr>( ) ) ;
37
37
let space = unsafe { libc:: CMSG_SPACE ( mem:: size_of_val ( & value) as _ ) as usize } ;
38
38
assert ! (
39
- self . hdr. msg_controllen >= self . len + space,
39
+ self . hdr. msg_controllen as usize >= self . len + space,
40
40
"control message buffer too small"
41
41
) ;
42
42
let cmsg = self . cmsg . take ( ) . expect ( "no control buffer space remaining" ) ;
@@ -60,7 +60,7 @@ impl<'a> Encoder<'a> {
60
60
// by `sendmsg`.
61
61
impl < ' a > Drop for Encoder < ' a > {
62
62
fn drop ( & mut self ) {
63
- self . hdr . msg_controllen = self . len ;
63
+ self . hdr . msg_controllen = self . len as _ ;
64
64
}
65
65
}
66
66
Original file line number Diff line number Diff line change 2
2
use quinn_proto:: EcnCodepoint ;
3
3
use std:: { io, net:: SocketAddr } ;
4
4
5
- // The Linux code should work for most unixes, but as of this writing nobody's ported the
6
- // CMSG_... macros to the libc crate for any of the BSDs.
7
- #[ cfg( target_os = "linux" ) ]
5
+ #[ cfg( unix) ]
8
6
mod cmsg;
9
- #[ cfg( target_os = "linux" ) ]
10
- mod linux ;
7
+ #[ cfg( unix ) ]
8
+ mod unix ;
11
9
12
10
// No ECN support
13
- #[ cfg( not( target_os = "linux" ) ) ]
11
+ #[ cfg( not( unix ) ) ]
14
12
mod fallback;
15
13
16
14
pub trait UdpExt {
Original file line number Diff line number Diff line change @@ -22,24 +22,25 @@ impl super::UdpExt for UdpSocket {
22
22
mem:: size_of:: <SocketAddrV6 >( ) ,
23
23
mem:: size_of:: <libc:: sockaddr_in6>( )
24
24
) ;
25
- assert_eq ! ( CMSG_LEN , unsafe {
26
- libc:: CMSG_SPACE ( mem:: size_of:: <libc:: c_int>( ) as _) as usize
27
- } ) ;
25
+ assert ! (
26
+ CMSG_LEN >= unsafe { libc:: CMSG_SPACE ( mem:: size_of:: <libc:: c_int>( ) as _) as usize }
27
+ ) ;
28
28
assert ! (
29
29
mem:: align_of:: <libc:: cmsghdr>( ) <= mem:: align_of:: <cmsg:: Aligned <[ u8 ; 0 ] >>( ) ,
30
30
"control message buffers will be misaligned"
31
31
) ;
32
32
33
33
let addr = self . local_addr ( ) ?;
34
34
35
- if addr. is_ipv4 ( ) || !self . only_v6 ( ) ? {
35
+ if addr. is_ipv4 ( ) || ( !cfg ! ( target_os = "macos" ) && !self . only_v6 ( ) ?) {
36
+ let on: libc:: c_int = 1 ;
36
37
let rc = unsafe {
37
38
libc:: setsockopt (
38
39
self . as_raw_fd ( ) ,
39
40
libc:: IPPROTO_IP ,
40
41
libc:: IP_RECVTOS ,
41
- & true as * const _ as _ ,
42
- 1 ,
42
+ & on as * const _ as _ ,
43
+ mem :: size_of_val ( & on ) as _ ,
43
44
)
44
45
} ;
45
46
if rc == -1 {
@@ -54,7 +55,7 @@ impl super::UdpExt for UdpSocket {
54
55
libc:: IPPROTO_IPV6 ,
55
56
libc:: IPV6_RECVTCLASS ,
56
57
& on as * const _ as _ ,
57
- mem:: size_of :: < libc :: c_int > ( ) as _ ,
58
+ mem:: size_of_val ( & on ) as _ ,
58
59
)
59
60
} ;
60
61
if rc == -1 {
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ fn echo_v4() {
25
25
}
26
26
27
27
#[ test]
28
- #[ cfg( target_os = "linux" ) ] // Dual-stack sockets aren't the default anywhere else.
28
+ // #[cfg(target_os = "linux")] // Dual-stack sockets aren't the default anywhere else.
29
29
fn echo_dualstack ( ) {
30
30
run_echo (
31
31
SocketAddr :: new ( IpAddr :: V6 ( Ipv6Addr :: UNSPECIFIED ) , 0 ) ,
You can’t perform that action at this time.
0 commit comments