Skip to content

freebsd tcp.h data update #2674

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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