summaryrefslogtreecommitdiff
path: root/src/sys/socket/sockopt.rs
AgeCommit message (Collapse)Author
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-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.
2019-06-06Fix the is_so_mark_functional test in Linux containersAlan Somers
It's not sufficient to check for root privileges. In a container, the euid may be root even though the user lacks some capabilities. Replace this test's root check with a check for the CAP_NET_ADMIN capability instead.
2019-06-03Check euid, not uid, for socket testsAlan Somers
2019-05-31libc::uint8_t deprecated in favor of rust u8Johannes Schilling
2019-03-12Support AF_ALGGleb Pomykalov
2019-01-23Add IP_RECVIF & IP_RECVDSTADDR.Tom Pusateri
Include IP_PKTINFO and IP6_PKTINFO on netbsd/openbsd.
2018-12-17Merge #990bors[bot]
990: Add cmsg PKTINFO for IPv4 and IPv6. r=asomers a=pusateri Replaces #891 and attempts to address all previous concerns. Co-authored-by: Tom Pusateri <pusateri@bangj.com>
2018-12-15Add cmsg PKTINFO for IPv4 and IPv6.Tom Pusateri
ignore pktinfo tests on qemu mips,mips64,powerpc64 Original work by @mcginty.
2018-12-08Replace try! with ?Alan Somers
try! is not available in Rust 2018
2018-12-06Add support of TCP_CONGESTION for setsockoptFensteer
2018-07-27Fix *decoding* of cmsgs and add `ScmCredentials`.Jonas Schievink
2018-07-05Get `SO_PEERCRED` working on all Linux targetsJonas Schievink
2018-05-22TypoXavier Bestel
2018-03-21add SO_MARK SetSockOpt for LinuxJake McGinty
2018-02-15socket get-/setsockopt: document internal macros, types and traitsmexus
2018-01-11Add socket options for IP_TRANSPARENT / BIND_ANYJustin Latimer
2017-12-10Replace ip(v6)_mreq structs with libc equivalentBryant Mairs
2017-12-10Replace custom ucred struct with newtype wrapper around libc::ucredBryant Mairs
2017-12-10Use libc::lingerBryant Mairs
2017-12-04Stop reexporting `Errno` and its variantsJonas Schievink
cc #664 (unsure if this is everything needed)
2017-09-04Add support for SO_TIMESTAMPWesley Wolfe
2017-08-26Replace more FFI instancesBryant Mairs
2017-08-11Fix safety of sockopt helper traitsJonas Schievink
2017-08-11Get rid of a lot of transmutesJonas Schievink
Most could be replaced by simple raw pointer casts (or even perfectly safe coercions!). cc #373
2017-08-01add SockProtocol type for third argument of socket and socketpairNicolas Dusart
2017-08-01add socket constants already present in libcNicolas Dusart
2017-08-01remove sys::sockets::consts module as it's libc goal to define themNicolas Dusart
2017-04-09Removed tests on ARM for non-existant constants.Zac Berkowitz
2017-04-09Removed some socket constants from arch=armZac Berkowitz
2016-08-10Fix the sockopt_impl matcher rule order.Alan Somers
Rules for generic types were located above rules for specific types, so the rules for specific types never got matched. This caused the sys::socket::sockopt::test::can_get_listen_on_tcp_socket test to fail on FreeBSD. The solution is to put all of the generic rules at the bottom.
2016-05-02Add SO_ORIGINAL_DSTJustin Latimer
2016-02-25Fix IPV6 group membership options on OpenBSDVasily Kolobkov