Age | Commit message (Collapse) | Author |
|
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>
|
|
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>
|
|
Make Linux-only
|
|
|
|
|
|
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>
|
|
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>
|
|
|
|
|
|
1872: Misc internal optimizations r=rtzoeller a=asomers
* Make ipv4addr_to_libc const
* Use mem::transmute in ipv4addr_to_libc and ipv6addr_to_libc
Fixes #1687
Fixes #1688
Co-authored-by: Alan Somers <asomers@gmail.com>
|
|
* Make ipv4addr_to_libc const
* Use mem::transmute in ipv4addr_to_libc and ipv6addr_to_libc
Fixes #1687
Fixes #1688
|
|
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
|
|
|
|
Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
|
|
It returns the mount flags on the BSDs. On Linux, it returns a slightly
different set of flags.
|
|
|
|
And fstatfs64 instead of fstatfs.
|
|
https://github.com/rust-lang/libc/pull/2963
|
|
|
|
See https://github.com/nix-rust/nix/pull/1744 for more details
|
|
New implementation performs no allocations after all the necessary
structures are created, removes potentially unsound code that
was used by the old version (see below) and adds a bit more
documentation about bugs in how timeout is actually handled
```
let timeout = if let Some(mut t) = timeout {
t.as_mut() as *mut libc::timespec
} else {
ptr::null_mut()
};
```
|
|
We'll be using that to reinitialize buffers later
|
|
This is already an unsafe function, dealing with pointers directly
does not make it much more unsafe but simplifies lifetimes later on
and similar to a previous commit allows to alocate a single buffer
to store all the control messages
|
|
CMSG_FIRSTHDR/CMSG_NEXTHDR operate in terms of pointers contained
inside msghdr structure, vector capacity doesn't matter for them.
This would change external behavior of recvmsg/recvmmsg in a sense
that buffer passed to store controll messages won't have it's length
updated but intended way to receive control messages is with cmsgs
iterator on `RecvMsg` which would still work.
This change is required to allow using a single vector to store
control messages from multiple packets
|
|
|
|
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.
|
|
|
|
Namespace filesystem magic is missing from FsType constants.
|
|
|
|
1808: expose memfd on freebsd r=asomers a=i509VCB
Resolves #1775
Co-authored-by: i509VCB <git@i509.me>
|
|
|
|
|
|
|
|
1805: Add `line` field to `Termios` struct r=rtzoeller a=tertsdiepraam
Fixes https://github.com/nix-rust/nix/issues/1802
I have to admit I'm not really sure how to test this properly, so if that's necessary I require some help :)
Co-authored-by: Terts Diepraam <terts.diepraam@gmail.com>
|
|
|
|
1806: Remove MSRV-related workaround for doc aliases r=asomers a=rtzoeller
Remove the MSRV-related workaround added by #1693, since we now can use doc aliases in all supported versions of Rust.
Closes #1674.
Co-authored-by: Ryan Zoeller <rtzoeller@rtzoeller.com>
|
|
|
|
|
|
And fix some documentation lints warned about by the newer rustdoc.
|
|
1776: Add support for the IP_SENDSRCADDR control message r=rtzoeller a=matttpt
This control message is available on FreeBSD, NetBSD, and OpenBSD. When used with `sendmsg`, it sets the IPv4 source address. This adds support through a new `ControlMessage::Ipv4SendSrcAddr` variant that complements `ControlMessageOwned::Ipv4RecvDstAddr`.
A few notes:
* `IP_SENDSRCADDR` is actually just an alias for `IP_RECVDSTADDR` (though the code doesn't depend on this).
* On NetBSD, `IP_PKTINFO` can be used to accomplish the same thing and is already supported by nix. On FreeBSD and OpenBSD, though, `IP_SENDSRCADDR` is the only method I'm aware of.
* The accompanying test binds a UDP socket to all local interfaces (0.0.0.0). If this is not acceptable, please let me know; however, FreeBSD requires this to use `IP_SENDSRCADDR`.
I'll add a change-log entry once I see the PR number.
Thanks!
Co-authored-by: Matthew Ingwersen <matttpt@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This control message (actually just an alias for IP_RECVDSTADDR) sets
the IPv4 source address when used with sendmsg. It is available on
FreeBSD, NetBSD, OpenBSD, and DragonFlyBSD.
|
|
https://rust-lang.github.io/rust-clippy/master/index.html#assertions_on_result_states
|
|
1772: Add support for RecvOrigDstAddr on Linux r=asomers a=brianmay
Fixes #1767
Co-authored-by: Brian May <brian@linuxpenguins.xyz>
|
|
|