summaryrefslogtreecommitdiff
path: root/src/sys/socket/sockopt.rs
AgeCommit message (Collapse)Author
2023-05-21Clippy cleanup:Alan Somers
fix the new clippy::non_minimal_cfg lint
2023-03-13Enable socket on redoxNoa
2023-01-15Try enabling LocalPeerPid for iosArmin Ronacher
2023-01-14Added LOCAL_PEERPID/LocalPeerPid sockopt for macosArmin Ronacher
2022-12-04Cleanup old Clippy directives.Alan Somers
2022-12-04Fix clippy lintsAlex Saveau
Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
2022-12-04More annoying formatting changesAlex Saveau
Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
2022-11-28Fix UB in the SO_TYPE sockoptAlan Somers
When reading a value into an enum from getsockopt, we must validate it. Failing to do so can lead to UB for example with SOCK_PACKET on Linux. Perform the validation in GetSockOpt::get. Currently SockType is the only type that requires validation. Fixes #1819
2022-11-23add IpMtu sockoptJonathan de Jong
2022-11-20Adds IP_TOS, IPV6_TCLASS and SO_PRIORITY sockopt wrappersmzachar
2022-11-06Reformat everythingAlex Saveau
Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
2022-10-08Fix clippy warnings on nightlyRyan Zoeller
Clippy is now smarter about detecting unnecessary casts and useless conversions, which means we need to be more explicit about when the conversions are needed for a subset of platforms. Required changes found by repeatedly running the following command against a list of the supported platforms. `xargs -t -I {} sh -c "cargo clippy -Zbuild-std --target {} --all-targets -- -D warnings || exit 255"` I removed the casts it complained about, and then restored them with an `#[allow]` if a later target needed the cast.
2022-09-11Clippy cleanupAlan Somers
2022-08-09remove deprecated itemsSteveLauC
2022-07-26Add support for RecvOrigDstAddr on LinuxBrian May
Fixes #1767
2022-07-11Add DontRoute SockOptLeo Lu
2022-06-06Cleanup cfg blocksRyan Zoeller
Remove obsolete references to target_env = wasi, target_os = nacl, target_os = osx, and a typo'd target_os = fushsia that didn't compile when fixed. - target_env = wasi is dead: https://github.com/rust-lang/rust/pull/60117 - target_os = nacl is dead: https://github.com/rust-lang/rust/pull/45041 - target_os = osx is dead, but I can't find a link.
2022-05-14add haiku supportAl Hoang
* enabled as much functionality and defines that match updated libc definitions for haiku
2022-05-13Fix "unused_macro_rules" warnings with the latest nightly compiler.Alan Somers
It just so happens that Redox, OpenBSD, Dragonfly, and uclibc don't use some of the rules for two internal macros.
2022-04-07Add IP_DONTFRAG and IPV6_DONTFRAG SockOptsJunho Choi
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).
2021-12-29Add support for the SO_TXTIME sockopt and SCM_TXTIME control messageAlessandro Ghedini
2021-12-23feat: Add glibc::SOF_TIMESTAMPING_* supportMichael Baikov
2021-12-20feature-gate most Nix functionsVincent Dagonneau
Using features reduces build time and size for consumer crates. By default all features are enabled.
2021-10-09sockopt's Set and Get traits are not unsafeAlan Somers
They were properly marked as unsafe as originally written. However, when the internal mem::zeroed() was replaced by mem::uninitialized(), these traits actually became safe. Only Get::assume_init() is actually unsafe. Fixes a warning with the latest Clippy.
2021-09-12Add docs for all sockopts that are documented by their respective OSesAlan Somers
2021-09-12Add the ability to set doc strings in sockopts' definitionsAlan Somers
2021-09-12Switch the argument order of sockopt_impl!Alan Somers
This macro is not exported outside of the crate, so there's no danger.
2021-09-07Add IP_TTL/IPV6_UNICAST_HOPS SockOptsConrad Meyer
Test: `cargo test --test test test_ttl_opts`
2021-09-07Merge branch 'master' into socket-mssAlan Somers
2021-09-06Add support for IP_RECVERR and IPV6_RECVERRConrad Meyer
Setting these options enables receiving errors, such as ICMP errors from the network, via `recvmsg()` with `MSG_ERRQUEUE`. Adds new `Ipv{4,6}RecvErr` variants to `ControlMessageOwned`. These control messages are produced when `Ipv4RecvErr` or `Ipv6RecvErr` options are enabled on a raw or datagram socket. New tests for the functionality can be run with `cargo test --test test test_recverr`. This commit builds on an earlier draft of the functionality authored by Matthew McPherrin <git@mcpherrin.ca>.
2021-09-04Merge branch 'master' into socket-msseaon
2021-09-04Support for `TCP_MAXSEG` TCP MSS socket optioneaon
2021-08-26add `TcpRepair` to sockopt0/0
2021-08-12feat: add libc::IP6T_SO_ORIGINAL_DST supportIcemic
2021-08-10Add support for LOCAL_PEER_CREDAlan Somers
On FreeBSD and its derivatives, this socket option gets the credentials of the connected peer.
2021-07-16Add the IPV6_V6ONLY sockoptDaniel Dulaney
2021-07-08Support SO_RXQ_OVFL socket option (android/fuchsia/linux)Junho Choi
This PR implements support of RXQ_OVFL flag and parsing ControlMessage to get the packet drop counter of UDP socket.
2021-07-05Add TcpUserTimeout socket optionAnthony Ramine
2021-06-23Add IpFreebind socket optionAnthony Ramine
2021-04-08Support TIMESTAMPNS for linuxLu, Wangshan
2021-03-21illumos and Solaris supportJason King
Co-authored-by: Dominik Hassler <hadfl@omnios.org> Co-authored-by: Joshua M. Clulow <josh@sysmgr.org>
2020-10-18KEEPCNT/KEEPINTVL aren't available on OpenBSD.Laurence Tratt
Without this commit, nix doesn't currently compile on OpenBSD. Some keepalive settings can be set globally, but not per-socket (see e.g. https://bugzilla.mozilla.org/show_bug.cgi?id=970550 for some digging into this). Since it seems that NetBSD and DragonflyBSD have these settings, it makes more sense to only exclude them on OpenBSD rather than include them on (pretty much every) other operating systems.
2020-10-10Add support for TCP_KEEPCNT and TCP_KEEPINTVL TCP keepalive options.Yoav Steinberg
2020-05-31Convert the crate to edition 2018Alan Somers
2020-05-08Add SO_BINDTODEVICE sockoptJean Pierre Dudey
This is available only on Linux as far I know, [socket(7)](https://linux.die.net/man/7/socket) has some information about the `SO_BINDTODEVICE` sockopt. In simple words it binds a socket to an specific network device (specified as an string like "wlo1", "eth0", etc.), to only process packets from that device. Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
2020-04-25Support UDP GSO and GRO on linuxGleb Pomykalov
2020-04-12Fix UB in getsockoptAlan Somers
The old code tried to zero-initialize an enum for which 0 is not a valid value. That worked for older compilers, but triggers a panic with Rust 1.44.0. The correct technique is to use mem::MaybeUninit. Fixes #1212
2019-09-19Where relevant, replace equality checks in assert! with assert_eq!Xavier L'Heureux
`assert_eq!` gives more debug info when the test fails by default than `assert!`. This should help make debugging easier.
2019-08-29Clippy cleanupAlan Somers
2019-06-09Add extra traits for all typesBryant Mairs
Derive Clone, Copy, Eq, Hash, and PartialEq for all types. Not all traits are supported by all types, which is why many are missing some.