Age | Commit message (Collapse) | Author |
|
IPv4 and stream sockets are unaffected, but for datagram sockets of
other address types libc::recvfrom might overwrite part of the stack.
Fixes #1762
|
|
|
|
* Remove a redundant closure.
* Comparison with null
* Manual implementation of find
* Suppress a false positive
|
|
Signed-off-by: Costin-Robert Sin <sin.costinrobert@gmail.com>
|
|
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.
|
|
|
|
|
|
* enabled as much functionality and defines that match
updated libc definitions for haiku
|
|
The existing AIO implementation has some problems:
1) The in_progress field is checked at runtime, not compile time.
2) The mutable field is checked at runtime, not compile time.
3) A downstream lio_listio user must store extra state to track whether
the whole operation is partially, completely, or not at all
submitted.
4) Nix does heap allocation itself, rather than allowing the caller to
choose it. This can result in double (or triple, or quadruple)
boxing.
5) There's no easy way to use lio_listio to submit multiple operations with
a single syscall, but poll each individually.
6) The lio_listio usage is far from transparent and zero-cost.
7) No aio_readv or aio_writev support.
8) priority has type c_int; should be i32
9) aio_return should return a usize instead of an isize, since it only
uses negative values to indicate errors, which Rust represents via
the Result type.
This rewrite solves several problems:
1) Unsolved. I don't think it can be solved without something like
C++'s guaranteed type elision. It might require changing the
signature of Future::poll too.
2) Solved.
3) Solved, by the new in_progress method and by removing the complicated
lio_listio resubmit code.
4) Solved.
5) Solved.
6) Solved, by removing the lio_listo resubmit code. It can be
reimplemented downstream if necessary. Or even in Nix, but it
doesn't fit Nix's theme of zero-cost abstractions.
7) Solved.
8) Solved.
9) Solved.
The rewrite includes functions that don't work on FreeBSD, so add CI
testing for FreeBSD 14 too.
By default only enable tests that will pass on FreeBSD 12.3. But run a
CI job on FreeBSD 14 and set a flag that will enable such tests.
|
|
Fixes #1710
|
|
Upgrade sysctl dev-dependency to 0.4 and handle its breaking API changes.
|
|
1643: Replace the IoVec struct with IoSlice and IoSliceMut from the standard library r=asomers a=notgull
As per discussion in #1637, the `IoVec<&[u8]>` and `IoVec<&mut [u8]>` types have been replaced with `std::io::IoSlice` and `IoSliceMut`, respectively. Notable changes made in this pull request include:
- The complete replacement of `IoVec` with `IoSlice*` types in both public API, private API, and tests.
- Replacing `IoVec` with `IoSlice` in docs.
- Replacing `&[IoVec<&mut [u8]>]` with `&mut [IoSliceMut]`, note that the slice requires a mutable reference now. This is how it's done in the standard library, and there might be a soundness issue in doing it the other way.
Resolves #1637
Co-authored-by: not_a_seagull <notaseagull048@gmail.com>
|
|
|
|
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).
|
|
Because they're redundant with types in the standard library.
Fixes #1681
|
|
The SockAddr enum is quite large, and the user must allocate space for
the whole thing even though he usually knows what type he needs.
Furthermore, thanks to the sa_family field, the sockaddr types are
basically an enum even in C.
So replace the ungainly enum with a SockaddrLike trait implemented by
all sockaddr types and a SockaddrStorage union that has safe accessors.
Also, deprecate InetAddr, which only existed to support SockAddr.
Supplants #1504
Fixes #1544
|
|
waitid() has a number of additional features that waitpid() is missing:
- WNOWAIT is only accepted for waitid() on Linux (and possibly other
platforms)
- Support for waiting on PID file descriptors on Linux
For now support is added for all platforms with waitid() that have proper
siginfo_t support in libc. NetBSD support is currently a work in progress
[1].
Tests for the signal/exit code are currently skipped on MIPS platforms due
to bugs in qemu-user's translation of siginfo_t (fixed in [2] and [3]; the
second fix is not in a released qemu version yet).
[1] https://github.com/rust-lang/libc/pull/2476
[2] https://lists.nongnu.org/archive/html/qemu-devel/2021-01/msg04810.html
[3] https://lists.nongnu.org/archive/html/qemu-devel/2021-10/msg05433.html
|
|
|
|
|
|
The previous documentation described the default behavior, rather than
the behavior when the flag was set.
Also fix a test which is failing due to passing this flag erroneously.
|
|
|
|
|
|
|
|
Enable epoll tests on Android, because they are passing.
|
|
This was an oversight from PR #1511
|
|
parking_lot provides synchronization primitives which aren't
poisoned on panic. This makes it easier to determine which tests
are failing, as a test failure no longer causes all subsequent tests
using that mutex to fail.
|
|
Ensure file descriptors are nonnegative and less than `FD_SETSIZE`.
(Fixes #1572.)
|
|
This was an oversight from #1306.
Reported-by: @ocadaruma
|
|
And this time, start running Clippy in CI
|
|
1496: Rework UnixAddr to fix soundness issues r=asomers a=coolreader18
Fixes #1494
I went with making `sun_path` always nul-terminated since that just seems to make things easier, since (at least according to linux man pages) `sockaddr_un`s returned by the kernel will always be nul-terminated.
Co-authored-by: Noa <33094578+coolreader18@users.noreply.github.com>
|
|
|
|
1509: Allow Android to use timerfd r=asomers a=rtzoeller
This is a continuation of #1336 which also enables the timerfd tests.
```
running 3 tests
test sys::test_timerfd::test_timerfd_unset ... ok
test sys::test_timerfd::test_timerfd_oneshot ... ok
test sys::test_timerfd::test_timerfd_interval ... ok
```
1515: Add IP_TTL/IPV6_UNICAST_HOPS SockOpts r=asomers a=cemeyer
Test: `cargo test --test test test_ttl_opts`
Co-authored-by: Ryan Zoeller <rtzoeller@rtzoeller.com>
Co-authored-by: Conrad Meyer <cem@FreeBSD.org>
|
|
Test: `cargo test --test test test_ttl_opts`
|
|
|
|
1317: test_af_alg_aead waits indefinitely r=asomers a=ritzk
Starting with linux kernel 4.9, the crypto interface changed slightly such that the authentication tag memory is only needed in the output buffer for encryption and in the input buffer for decryption. Thus, we have fewer bytes to read than the buffer size. Do not block on read.
alternatively, we can adjust the decrypted buffer size based on kernel version ( ">= 4.9") to not include auth_size .
```
if kernel_version >= "4.9":
let mut decrypted = vec![0u8; payload_len + (assoc_size as usize) ];
```
before
```
test sys::test_socket::test_af_alg_aead ... test sys::test_socket::test_af_alg_aead has been running for over 60 seconds
```
after
```
test sys::test_socket::test_af_alg_aead ... ok
```
Co-authored-by: Ritesh Khadgaray <khadgaray@gmail.com>
|
|
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>.
|
|
|
|
|
|
Co-authored-by: zachoverflow <zach@zachjohnson.net>
|
|
|
|
1506: Test Linux aarch64 on real aarch64 hardware. r=asomers a=asomers
Co-authored-by: Alan Somers <asomers@gmail.com>
|
|
Apparently AWS Graviton containers don't support it. socket() retunrs
EAFNOSUPPORT in that environment.
Also, be more selective about skipping tests under QEMU
Instead of skipping them on architectures where we happen to use QEMU,
only skip them when QEMU is actually being used.
|
|
|
|
|
|
Fixes #1479
|
|
1482: Add support for LOCAL_PEER_CRED r=asomers a=asomers
On FreeBSD and its derivatives, this socket option gets the credentials
of the connected peer.
Co-authored-by: Alan Somers <asomers@gmail.com>
|
|
On FreeBSD and its derivatives, this socket option gets the credentials
of the connected peer.
|
|
|
|
|
|
This PR implements support of RXQ_OVFL flag and parsing ControlMessage
to get the packet drop counter of UDP socket.
|