Skip to content

Commit 9c7a326

Browse files
committed
Auto merge of #2674 - devnexen:fbsd_tcp_function, r=Amanieu
freebsd tcp.h data update
2 parents a1286b9 + b4bcbaa commit 9c7a326

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

libc-test/build.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2178,6 +2178,9 @@ fn test_freebsd(target: &str) {
21782178
true
21792179
}
21802180

2181+
// Those were introduced in FreeBSD 12.
2182+
"TCP_FUNCTION_NAME_LEN_MAX" | "TCP_FASTOPEN_PSK_LEN" if Some(11) == freebsd_ver => true,
2183+
21812184
_ => false,
21822185
}
21832186
});
@@ -2221,6 +2224,11 @@ fn test_freebsd(target: &str) {
22212224
// `sockcred2` is not available in FreeBSD 12.
22222225
"sockcred2" if Some(13) > freebsd_ver => true,
22232226

2227+
// `tcp_fastopen` introduced in FreeBSD 12.
2228+
"tcp_fastopen" if Some(11) == freebsd_ver => true,
2229+
// `tcp_function_set` introduced in FreeBSD 12.
2230+
"tcp_function_set" if Some(11) == freebsd_ver => true,
2231+
22242232
_ => false,
22252233
}
22262234
});

libc-test/semver/freebsd.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,6 +1128,8 @@ TABDLY
11281128
TCP_CCALGOOPT
11291129
TCP_CONGESTION
11301130
TCP_FASTOPEN
1131+
TCP_FASTOPEN_PSK_LEN
1132+
TCP_FUNCTION_NAME_LEN_MAX
11311133
TCP_INFO
11321134
TCP_KEEPCNT
11331135
TCP_KEEPIDLE
@@ -1805,6 +1807,8 @@ syscall
18051807
sysctl
18061808
sysctlbyname
18071809
sysctlnametomib
1810+
tcp_fastopen
1811+
tcp_function_set
18081812
telldir
18091813
thr_kill
18101814
thr_kill2

src/unix/bsd/freebsdlike/freebsd/mod.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -978,6 +978,16 @@ s! {
978978
pub ai_termid: au_tid_t,
979979
pub ai_asid: ::au_asid_t,
980980
}
981+
982+
pub struct tcp_fastopen {
983+
pub enable: ::c_int,
984+
pub psk: [u8; ::TCP_FASTOPEN_PSK_LEN as usize],
985+
}
986+
987+
pub struct tcp_function_set {
988+
pub function_set_name: [::c_char; ::TCP_FUNCTION_NAME_LEN_MAX as usize],
989+
pub pcbcnt: u32,
990+
}
981991
}
982992

983993
s_no_extra_traits! {
@@ -2855,6 +2865,8 @@ pub const TCP_KEEPINIT: ::c_int = 128;
28552865
pub const TCP_FASTOPEN: ::c_int = 1025;
28562866
pub const TCP_PCAP_OUT: ::c_int = 2048;
28572867
pub const TCP_PCAP_IN: ::c_int = 4096;
2868+
pub const TCP_FASTOPEN_PSK_LEN: ::c_int = 16;
2869+
pub const TCP_FUNCTION_NAME_LEN_MAX: ::c_int = 32;
28582870

28592871
pub const IP_BINDANY: ::c_int = 24;
28602872
pub const IP_BINDMULTI: ::c_int = 25;

0 commit comments

Comments
 (0)