From a4b5dfc059b11e7d463710bfcafa216eee770413 Mon Sep 17 00:00:00 2001 From: Junho Choi Date: Tue, 5 Apr 2022 15:06:13 -0700 Subject: Add IP_DONTFRAG and IPV6_DONTFRAG SockOpts IP_DONTFRAG: iOS, macOS IPV6_DONTFRAG: android, iOS, linux and macOS Test: `cargo test --test test dontfrag_opts` Some CI tests running ENOPROTOOPT are disabled (qemu-based). --- src/sys/socket/sockopt.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/sys/socket') diff --git a/src/sys/socket/sockopt.rs b/src/sys/socket/sockopt.rs index c600391c..e80b09e7 100644 --- a/src/sys/socket/sockopt.rs +++ b/src/sys/socket/sockopt.rs @@ -615,6 +615,19 @@ sockopt_impl!( sockopt_impl!( /// Set the unicast hop limit for the socket. Ipv6Ttl, Both, libc::IPPROTO_IPV6, libc::IPV6_UNICAST_HOPS, libc::c_int); +#[cfg(any(target_os = "ios", target_os = "macos"))] +sockopt_impl!( + /// Set "don't fragment packet" flag on the IP packet. + IpDontFrag, Both, libc::IPPROTO_IP, libc::IP_DONTFRAG, bool); +#[cfg(any( + target_os = "android", + target_os = "ios", + target_os = "linux", + target_os = "macos", +))] +sockopt_impl!( + /// Set "don't fragment packet" flag on the IPv6 packet. + Ipv6DontFrag, Both, libc::IPPROTO_IPV6, libc::IPV6_DONTFRAG, bool); #[allow(missing_docs)] // Not documented by Linux! -- cgit v1.2.3