diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-09-08 00:23:26 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-08 00:23:26 +0000 |
commit | ccc1434960740dd0cb54e8141a22dd2ae920b956 (patch) | |
tree | 99ca384e66c39e5457c579190372b2018d3314f8 /src | |
parent | 53fea96dd41926fb8527ac1ad35ada2ba106e454 (diff) | |
parent | b06c26f16ff503523aa55adc7588bd3ff8088564 (diff) | |
download | nix-ccc1434960740dd0cb54e8141a22dd2ae920b956.zip |
Merge #1292
1292: Support `TCP_MAXSEG` TCP Maximum Segment Size socket options r=asomers a=eaon
Found myself in a situation where I needed to advertise a specific MSS. Thought this crate is the appropriate place for this feature (especially since the `TCP_MAXSEG` const was exposed through it before), so here goes.
Actual change is of course tiny but it comes with a test. Happy to make changes, especially since I need to do more research on which platforms this works.
Co-authored-by: eaon <eaon@posteo.net>
Co-authored-by: Alan Somers <asomers@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/sys/socket/sockopt.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/sys/socket/sockopt.rs b/src/sys/socket/sockopt.rs index 195479b6..17dd7568 100644 --- a/src/sys/socket/sockopt.rs +++ b/src/sys/socket/sockopt.rs @@ -265,6 +265,13 @@ sockopt_impl!(Both, TcpKeepAlive, libc::IPPROTO_TCP, libc::TCP_KEEPALIVE, u32); target_os = "linux", target_os = "nacl"))] sockopt_impl!(Both, TcpKeepIdle, libc::IPPROTO_TCP, libc::TCP_KEEPIDLE, u32); +cfg_if! { + if #[cfg(any(target_os = "android", target_os = "linux"))] { + sockopt_impl!(Both, TcpMaxSeg, libc::IPPROTO_TCP, libc::TCP_MAXSEG, u32); + } else { + sockopt_impl!(GetOnly, TcpMaxSeg, libc::IPPROTO_TCP, libc::TCP_MAXSEG, u32); + } +} #[cfg(not(target_os = "openbsd"))] sockopt_impl!(Both, TcpKeepCount, libc::IPPROTO_TCP, libc::TCP_KEEPCNT, u32); #[cfg(any(target_os = "android", |