Commit Graph

113 Commits

Author SHA1 Message Date
bors[bot]
f9d3a224e2
Merge #2088
2088: sockopt add OpenBSD's SO_RTABLE to set the route table. r=asomers a=devnexen

Also SO_ACCEPTFILTER for FreeBSD/NetBSD.

Co-authored-by: David Carlier <devnexen@gmail.com>
Co-authored-by: David CARLIER <devnexen@gmail.com>
2023-08-06 23:24:32 +00:00
bors[bot]
53b033267f
Merge #1823
1823: Support AIX operating system r=asomers a=ecnelises



Co-authored-by: Qiu Chaofan <qcf@ecnelises.com>
2023-08-06 22:38:56 +00:00
David Carlier
2ab1eafbdd sockopt add OpenBSD's SO_RTABLE to set the route table.
Also SO_ACCEPTFILTER for FreeBSD/NetBSD.
2023-08-07 00:13:21 +01:00
David CARLIER
5378cceff0 Adding new sockopt entries for FreeBSD related to routing 2023-08-06 21:15:51 +01:00
Qiu Chaofan
8345f3e694 Initial support for AIX operating system 2023-07-19 10:32:51 +08:00
Chris Spencer
87190dab19 Enable socket timestamping options on Android 2023-07-17 10:27:37 +01:00
Alan Somers
e42c3589a3 Clippy cleanup:
fix the new clippy::non_minimal_cfg lint
2023-05-21 08:52:42 -06:00
Noa
b878d0a7cb
Enable socket on redox 2023-03-13 14:31:12 -05:00
Armin Ronacher
960199daf9 Try enabling LocalPeerPid for ios 2023-01-15 22:41:33 +01:00
Armin Ronacher
61bd3e2a8f Added LOCAL_PEERPID/LocalPeerPid sockopt for macos 2023-01-14 19:51:00 +01:00
Alan Somers
2b827ad79c Cleanup old Clippy directives. 2022-12-04 16:15:28 -07:00
Alex Saveau
fb802462a6
Fix clippy lints
Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
2022-12-04 13:44:50 -08:00
Alex Saveau
5fd4b8a4d4
More annoying formatting changes
Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
2022-12-04 12:44:28 -08:00
Alan Somers
8e91b28b64 Fix UB in the SO_TYPE sockopt
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-28 23:07:54 -07:00
Jonathan de Jong
e9f07eea61 add IpMtu sockopt 2022-11-23 10:48:48 +00:00
mzachar
faac24c779 Adds IP_TOS, IPV6_TCLASS and SO_PRIORITY sockopt wrappers 2022-11-20 13:41:26 +01:00
Alex Saveau
17833268cb
Reformat everything
Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
2022-11-06 11:39:09 -08:00
Ryan Zoeller
6e7bddd154 Fix clippy warnings on nightly
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-10-08 14:08:54 -05:00
Alan Somers
3aedbfa08e Clippy cleanup 2022-09-11 16:25:33 -06:00
SteveLauC
d458ecd4e1 remove deprecated items 2022-08-09 12:15:52 +08:00
Brian May
c45cd74f42 Add support for RecvOrigDstAddr on Linux
Fixes #1767
2022-07-26 07:39:00 +10:00
Leo Lu
ba376e8577
Add DontRoute SockOpt 2022-07-11 06:45:34 +08:00
Ryan Zoeller
80f8320ffd Cleanup cfg blocks
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-06-06 18:50:19 -05:00
Al Hoang
d02e27476c add haiku support
* enabled as much functionality and defines that match
  updated libc definitions for haiku
2022-05-14 18:45:18 -05:00
Alan Somers
7dff51fbfc Fix "unused_macro_rules" warnings with the latest nightly compiler.
It just so happens that Redox, OpenBSD, Dragonfly, and uclibc don't use
some of the rules for two internal macros.
2022-05-13 21:01:21 -06:00
Junho Choi
a4b5dfc059 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).
2022-04-07 17:39:46 -07:00
Alessandro Ghedini
a9829853df Add support for the SO_TXTIME sockopt and SCM_TXTIME control message 2021-12-29 14:15:54 +00:00
Michael Baikov
9aa61ef975 feat: Add glibc::SOF_TIMESTAMPING_* support 2021-12-23 06:41:30 +08:00
Vincent Dagonneau
5f5b7d4d7a feature-gate most Nix functions
Using features reduces build time and size for consumer crates.  By
default all features are enabled.
2021-12-20 18:47:16 -07:00
Alan Somers
b4aa64d0f9 sockopt's Set and Get traits are not unsafe
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-10-09 10:42:16 -06:00
Alan Somers
af29f2e958 Add docs for all sockopts that are documented by their respective OSes 2021-09-12 16:55:03 -06:00
Alan Somers
920809e41a Add the ability to set doc strings in sockopts' definitions 2021-09-12 11:00:57 -06:00
Alan Somers
3ad0d9a16c Switch the argument order of sockopt_impl!
This macro is not exported outside of the crate, so there's no danger.
2021-09-12 10:46:31 -06:00
Conrad Meyer
1ce595f526 Add IP_TTL/IPV6_UNICAST_HOPS SockOpts
Test: `cargo test --test test test_ttl_opts`
2021-09-07 19:19:41 -07:00
Alan Somers
b06c26f16f
Merge branch 'master' into socket-mss 2021-09-07 18:22:54 -06:00
Conrad Meyer
d23e7c7575 Add support for IP_RECVERR and IPV6_RECVERR
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-06 16:59:35 -07:00
eaon
67b487283e
Merge branch 'master' into socket-mss 2021-09-04 22:53:24 -04:00
eaon
76fe409f4b
Support for TCP_MAXSEG TCP MSS socket option 2021-09-04 22:39:55 -04:00
0/0
d5fdacbb4f
add TcpRepair to sockopt 2021-08-26 21:37:26 -06:00
Icemic
9844ba825b
feat: add libc::IP6T_SO_ORIGINAL_DST support 2021-08-12 01:11:11 +08:00
Alan Somers
0d3bc089d5 Add support for LOCAL_PEER_CRED
On FreeBSD and its derivatives, this socket option gets the credentials
of the connected peer.
2021-08-10 17:57:32 -06:00
Daniel Dulaney
5d4f3c2692 Add the IPV6_V6ONLY sockopt 2021-07-16 14:06:21 -04:00
Junho Choi
0b596a11e0 Support SO_RXQ_OVFL socket option (android/fuchsia/linux)
This PR implements support of RXQ_OVFL flag and parsing ControlMessage
to get the packet drop counter of UDP socket.
2021-07-08 16:00:39 -07:00
Anthony Ramine
2e84b63ba7 Add TcpUserTimeout socket option 2021-07-05 10:59:21 +02:00
Anthony Ramine
c916e5274e Add IpFreebind socket option 2021-06-23 16:19:50 +02:00
Lu, Wangshan
830bab64a8
Support TIMESTAMPNS for linux 2021-04-08 10:41:38 +08:00
Jason King
d444f1bcf2 illumos and Solaris support
Co-authored-by: Dominik Hassler <hadfl@omnios.org>
Co-authored-by: Joshua M. Clulow <josh@sysmgr.org>
2021-03-21 23:04:03 +00:00
Laurence Tratt
b0d1996911 KEEPCNT/KEEPINTVL aren't available on OpenBSD.
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-18 22:05:30 +01:00
Yoav Steinberg
fde7181f93 Add support for TCP_KEEPCNT and TCP_KEEPINTVL TCP keepalive options. 2020-10-10 23:51:57 +03:00
Alan Somers
1ae5dd8b16 Convert the crate to edition 2018 2020-05-31 19:07:15 -06:00