summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-12-04Merge #1908bors[bot]
1908: Move some pure formatting changes out of #1863 r=asomers a=SUPERCILEX Co-authored-by: Alex Saveau <saveau.alexandre@gmail.com>
2022-12-04Move some pure formatting changes out of #1863Alex Saveau
Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
2022-12-04Merge #1905bors[bot]
1905: Drop x86_64-unknown-darwin to Tier 2 r=rtzoeller a=asomers And promote aarch64-unknown-darwin to Tier 1. Because that's what Cirrus CI is doing. Fixes #1904 Co-authored-by: Alan Somers <asomers@gmail.com>
2022-12-03Drop x86_64-unknown-darwin to Tier 2Alan Somers
And promote aarch64-unknown-darwin to Tier 1. Because that's what Cirrus CI is doing. Fixes #1904
2022-12-03Merge #1861bors[bot]
1861: Nuke deprecated net APIs r=asomers a=SUPERCILEX This one's a little more questionable since it's only been one release, but it removes a ton of code which is sweet. Co-authored-by: Alex Saveau <saveau.alexandre@gmail.com>
2022-12-03Nuke deprecated net APIsAlex Saveau
Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
2022-12-03Merge #1902bors[bot]
1902: Enable ucontext module on aarch64-unknown-linux-gnu r=asomers a=rtzoeller Untested, but I saw https://github.com/rust-lang/libc/commit/fd32da6e7dfa2afcae86e176904244cf45a90c06 and figured we should uptake it. Co-authored-by: Ryan Zoeller <rtzoeller@rtzoeller.com>
2022-12-03Merge #1855bors[bot]
1855: Nuke IoVec r=asomers a=SUPERCILEX A release cycle went by... it's be nice to remove some bloat. Closes https://github.com/nix-rust/nix/issues/1647, closes https://github.com/nix-rust/nix/issues/1371, closes https://github.com/nix-rust/nix/issues/305 Co-authored-by: Alex Saveau <saveau.alexandre@gmail.com>
2022-12-02Nuke IoVecAlex Saveau
Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
2022-12-02Enable ucontext module on aarch64-unknown-linux-gnuRyan Zoeller
2022-11-29Merge #1867bors[bot]
1867: Add routing socket type on macOS r=asomers a=pinkisemils This is a small change to add the routing socket type to the list of socket types one can open with `nix`. I've added a smoke test to see that a socket of such type can actually be opened, but I'm not sure if such a test belongs in the codebase here. Co-authored-by: Emils <emils@mullvad.net>
2022-11-29Add routing socket typeEmils
2022-11-28[skip ci] add a CHANGELOG section for the next releaseAlan Somers
2022-11-28(cargo-release) version 0.26.1Alan Somers
2022-11-29Merge #1821bors[bot]
1821: Fix UB in the SO_TYPE sockopt r=rtzoeller a=asomers 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 Co-authored-by: Alan Somers <asomers@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-28[skip ci] add a CHANGELOG section for the next releaseAlan Somers
2022-11-28(cargo-release) version 0.26.0Alan Somers
2022-11-29Merge #1891bors[bot]
1891: Prepare for release 0.26.0 r=rtzoeller a=asomers Co-authored-by: Alan Somers <asomers@gmail.com>
2022-11-28Prepare for release 0.26.0Alan Somers
2022-11-28Merge pull request #1890 from asomers/old-changelogsAlan Somers
[skip ci] add CHANGELOG entries for old point releases.
2022-11-28[skip ci] add CHANGELOG entries for old point releases.Alan Somers
I opted to preserve explicit entries for backports in both the original feature release and the backported point release, rather than trying to pretend that the releases were actually sequential. Also, remove some empty subsections from the file.
2022-11-28Merge pull request #1888 from asomers/0.26.0-CHANGELOGAlan Somers
[skip ci] fix CHANGELOG formatting
2022-11-28[skip ci] fix CHANGELOG formattingAlan Somers
2022-11-29Merge #1788bors[bot]
1788: Workaround XNU bug in getifaddrs netmasks r=asomers a=roblabla Fixes #1709 Co-authored-by: roblabla <unfiltered@roblab.la> Co-authored-by: Alan Somers <asomers@gmail.com>
2022-11-28Elaborate CHANGELOG entry for PR #1788Alan Somers
2022-11-29Merge #1885bors[bot]
1885: Update to memoffset 0.7 r=asomers a=sdroege Co-authored-by: Sebastian Dröge <sebastian@centricular.com>
2022-11-29Merge #1877bors[bot]
1877: PollFd utility functions r=asomers a=JonathanWoollett-Light Adds `poll::PollFd::any()` and `poll::PollFd::all()` functions which returns if any/all of the events of interest occurred in the last call to `poll` or `ppoll`. Consider the case: ```rust let (first_fd, second_fd) = /* ... */; let mut poll_fds = [ poll::PollFd::new(interrupt_fd, poll::PollFlags::POLLIN), poll::PollFd::new(transfer_fd, poll::PollFlags::POLLIN), ]; let _ = poll::poll(&mut poll_fds, -1)?; let first = poll_fds[0].revents()? != poll::PollFlags::empty(); let second = poll_fds[1].revents()? != poll::PollFlags::empty();; if first { /* ... */ } if second { /* ... */ } ``` which can now be reduced: ```rust let (first_fd, second_fd) = /* ... */; let mut poll_fds = [ poll::PollFd::new(interrupt_fd, poll::PollFlags::POLLIN), poll::PollFd::new(transfer_fd, poll::PollFlags::POLLIN), ]; let _ = poll::poll(&mut poll_fds, -1)?; let first = poll_fds[0].any()?; let second = poll_fds[1].any()?; if first { /* ... */ } if second { /* ... */ } ``` Co-authored-by: Jonathan <jonathanwoollettlight@gmail.com>
2022-11-29PollFd utility functionsJonathan
2022-11-28Merge #1886bors[bot]
1886: Update use of libc::timespec to prepare for future libc version r=asomers a=wesleywiser In a future release of the `libc` crate, `libc::timespec` will contain private padding fields on `*-linux-musl` targets and so the struct will no longer be able to be created using the literal initialization syntax. Update places where `libc::timespec` is created to first zero initialize the value and then update the `tv_sec` and `tv_nsec` fields manually. Many of these places are in `const fn`s so a helper function `zero_init_timespec()` is introduced to help with this as `std::mem::MaybeUninit::zeroed()` is not a `const` function. Some matches on `libc::timespec` are also updated to include a trailing `..` pattern which works when `libc::timespec` has additional, private fields as well as when it does not (like for `x86_64-unknown-linux-gnu`). See also https://github.com/rust-lang/libc/pull/2088 Co-authored-by: Wesley Wiser <wesleywiser@microsoft.com>
2022-11-28Update use of libc::timespec to prepare for future libc versionWesley Wiser
In a future release of the `libc` crate, `libc::timespec` will contain private padding fields on `*-linux-musl` targets and so the struct will no longer be able to be created using the literal initialization syntax. Update places where `libc::timespec` is created to first zero initialize the value and then update the `tv_sec` and `tv_nsec` fields manually. Many of these places are in `const fn`s so a helper function `zero_init_timespec()` is introduced to help with this as `std::mem::MaybeUninit::zeroed()` is not a `const` function. Some matches on `libc::timespec` are also updated to include a trailing `..` pattern which works when `libc::timespec` has additional, private fields as well as when it does not (like for `x86_64-unknown-linux-gnu`).
2022-11-28Update to memoffset 0.7Sebastian Dröge
2022-11-25Merge #1865bors[bot]
1865: Add IpMtu sockopt r=asomers a=ShadowJonathan Resolves https://github.com/nix-rust/nix/issues/1864 Co-authored-by: Jonathan de Jong <jonathandejong02@gmail.com>
2022-11-25Merge #1883bors[bot]
1883: Clippy cleanup with the latest nightly. r=rtzoeller a=asomers Co-authored-by: Alan Somers <asomers@gmail.com>
2022-11-25Clippy cleanup with the latest nightly.Alan Somers
2022-11-23add IpMtu sockoptJonathan de Jong
2022-11-21Merge #1848bors[bot]
1848: SockProtocol::Raw = libc::IPPROTO_RAW for raw sockets r=asomers a=StackOverflowExcept1on Hey, I wanna to make call like `socket(af_type, SOCK_RAW, IPPROTO_RAW)` but currently there is no way to do it with rust https://github.com/rickettm/SendIP/blob/aad12a001157489ab9053c8665e09aec24a2ff6d/sendip.c#L143 Update: Feel free to add `#[cfg]` attribute if I made mistakes that might cause errors on some platforms Co-authored-by: StackOverflowExcept1on <109800286+StackOverflowExcept1on@users.noreply.github.com>
2022-11-21Merge #1880bors[bot]
1880: Use the new UnixAddr::new_unnamed in the unit tests r=rtzoeller a=asomers Use it in the from_sockaddr_un_abstract_unnamed test. That test and this method were introduced by PRs #1871 and #1857, which crossed each other. Co-authored-by: Alan Somers <asomers@gmail.com>
2022-11-21Use the new UnixAddr::new_unnamed in the unit testsAlan Somers
Use it in the from_sockaddr_un_abstract_unnamed test. That test and this method were introduced by PRs #1871 and #1857, which crossed each other.
2022-11-21Added `SockProtocol::Raw = libc::IPPROTO_RAW` for raw socketsStackOverflowExcept1on
2022-11-21Merge #1857bors[bot]
1857: Add better support for unnamed unix socket addrs r=asomers a=stevenengler This adds the following 2 functions/methods: `UnixAddr::new_unnamed` and `UnixAddr::is_unnamed`. Closes #1585 unix(7) on Linux: > unnamed: A stream socket that has not been bound to a pathname using bind(2) has no name. Likewise, the two sockets created by socketpair(2) are unnamed. When the address of an unnamed socket is returned, its length is `sizeof(sa_family_t)`, and `sun_path` should not be inspected. **Edit:** This currently isn't working on BSD, but I see why. Will fix it shortly. Co-authored-by: Steven Engler <opara@cs.georgetown.edu>
2022-11-21Merge #1871bors[bot]
1871: Fix using SockaddrStorage to store Unix domain addresses on Linux r=rtzoeller a=asomers Since it has variable length, the user of a sockaddr_un must keep track of its true length. On the BSDs, this is handled by the builtin sun_len field. But on Linux-like operating systems it isn't. Fix this bug by explicitly tracking it for SockaddrStorage just like we already do for UnixAddr. Fixes #1866 Co-authored-by: Alan Somers <asomers@gmail.com>
2022-11-21fixup! Added better support for unnamed unix socket addrsSteven Engler
Removed test assertion
2022-11-21fixup! Added better support for unnamed unix socket addrsSteven Engler
Changelog
2022-11-21fixup! Added better support for unnamed unix socket addrsSteven Engler
Make Linux-only
2022-11-21Added better support for unnamed unix socket addrsSteven Engler
2022-11-21Merge #1873bors[bot]
1873: mmap non-zero length r=asomers a=JonathanWoollett-Light When calling [`mmap`](https://man7.org/linux/man-pages/man2/mmap.2.html) the passed length needs to be greater than zero, else an error is returned: > EINVAL (since Linux 2.6.12) length was 0. By specifying the argument as `std::num::NonZeroUsize` we eliminate this error case. Co-authored-by: Jonathan <jonathanwoollettlight@gmail.com>
2022-11-20mmap non-zero lengthJonathan
2022-11-20Merge #1853bors[bot]
1853: Adds IP_TOS, IPV6_TCLASS and SO_PRIORITY sockopt wrappers for Linux r=asomers a=mzachar Added socket option wrappers for DiffServ related parameters on Linux Co-authored-by: mzachar <mzachar@users.noreply.github.com>
2022-11-20Merge #1870bors[bot]
1870: mmap addr r=asomers a=JonathanWoollett-Light Uses `Some<size_t>` instead of `*mut c_void` for the `addr` passed to [`sys::mman::mmap`](https://docs.rs/nix/latest/nix/sys/mman/fn.mmap.html). In this instance we are not usefully passing a pointer, it will never be dereferenced. We are passing a location which represents where to attach the shared memory to. In this case `size_t` better represents an address and not a pointer, and `Option<size_t>` better represents an optional argument than `NULLPTR`. In C since there is no optional type this is a pointer as this allows it be null which is an alias here for `None`. Co-authored-by: Jonathan <jonathanwoollettlight@gmail.com>