Skip to content

Commit

Permalink
Auto merge of #2674 - devnexen:fbsd_tcp_function, r=Amanieu
Browse files Browse the repository at this point in the history
freebsd tcp.h data update
  • Loading branch information
bors committed Feb 10, 2022
2 parents a1286b9 + b4bcbaa commit 9c7a326
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
8 changes: 8 additions & 0 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2178,6 +2178,9 @@ fn test_freebsd(target: &str) {
true
}

// Those were introduced in FreeBSD 12.
"TCP_FUNCTION_NAME_LEN_MAX" | "TCP_FASTOPEN_PSK_LEN" if Some(11) == freebsd_ver => true,

_ => false,
}
});
Expand Down Expand Up @@ -2221,6 +2224,11 @@ fn test_freebsd(target: &str) {
// `sockcred2` is not available in FreeBSD 12.
"sockcred2" if Some(13) > freebsd_ver => true,

// `tcp_fastopen` introduced in FreeBSD 12.
"tcp_fastopen" if Some(11) == freebsd_ver => true,
// `tcp_function_set` introduced in FreeBSD 12.
"tcp_function_set" if Some(11) == freebsd_ver => true,

_ => false,
}
});
Expand Down
4 changes: 4 additions & 0 deletions libc-test/semver/freebsd.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1128,6 +1128,8 @@ TABDLY
TCP_CCALGOOPT
TCP_CONGESTION
TCP_FASTOPEN
TCP_FASTOPEN_PSK_LEN
TCP_FUNCTION_NAME_LEN_MAX
TCP_INFO
TCP_KEEPCNT
TCP_KEEPIDLE
Expand Down Expand Up @@ -1805,6 +1807,8 @@ syscall
sysctl
sysctlbyname
sysctlnametomib
tcp_fastopen
tcp_function_set
telldir
thr_kill
thr_kill2
Expand Down
12 changes: 12 additions & 0 deletions src/unix/bsd/freebsdlike/freebsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,16 @@ s! {
pub ai_termid: au_tid_t,
pub ai_asid: ::au_asid_t,
}

pub struct tcp_fastopen {
pub enable: ::c_int,
pub psk: [u8; ::TCP_FASTOPEN_PSK_LEN as usize],
}

pub struct tcp_function_set {
pub function_set_name: [::c_char; ::TCP_FUNCTION_NAME_LEN_MAX as usize],
pub pcbcnt: u32,
}
}

s_no_extra_traits! {
Expand Down Expand Up @@ -2855,6 +2865,8 @@ pub const TCP_KEEPINIT: ::c_int = 128;
pub const TCP_FASTOPEN: ::c_int = 1025;
pub const TCP_PCAP_OUT: ::c_int = 2048;
pub const TCP_PCAP_IN: ::c_int = 4096;
pub const TCP_FASTOPEN_PSK_LEN: ::c_int = 16;
pub const TCP_FUNCTION_NAME_LEN_MAX: ::c_int = 32;

pub const IP_BINDANY: ::c_int = 24;
pub const IP_BINDMULTI: ::c_int = 25;
Expand Down

0 comments on commit 9c7a326

Please sign in to comment.