Age | Commit message (Collapse) | Author |
|
This was an oversight from PR #1002
|
|
On some platforms the alignment of cmsg_data could be less than the
alignment of the messages that it contains. That led to unaligned
reads
on those platforms. This change fixes the issue by always copying the
message contents into aligned objects. The change is not 100%
backwards
compatible when using recvmsg. Users may have to replace code like
this:
```rust
if let ControlMessage::ScmRights(&fds) = cmsg {
```
with this:
```rust
if let ControlMessageOwned::ScmRights(fds) = cmsg {
```
Fixes #999
|
|
CmsgSpace had three problems:
1) It would oversize buffers that expect multiple control messages
2) It didn't use the libc CMSG_SPACE(3) macro, so it might actually
undersize a buffer for a single control message.
3) It could do bad things on drop, if you instantiate it with a type
that implements Drop (which none of the currently supported
ControlMessage types do).
Fixes #994
|
|
There were two problems:
1) It would always return Ok, even on error
2) It could panic if there was an error, because
sockaddr_storage_to_addr would be called on uninitialized memory.
|
|
Our hand-rolled logic had subtle alignment bugs that caused
test_scm_rights to fail on OpenBSD (and probably could cause problems on
other platforms too). Using cmsg(3) is much cleaner, shorter, and more
portable. No user-visible changes.
|
|
Include IP_PKTINFO and IP6_PKTINFO on netbsd/openbsd.
|
|
The old test made assumptions about the responsiveness of the test
environment. The new test does not, and it's simpler too.
|
|
993: Don't reference packed structs. r=asomers a=pusateri
Fixes #992.
Don't merge this yet. I have more testing to do. I just am pushing it up for others.
Co-authored-by: Tom Pusateri <pusateri@bangj.com>
|
|
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>
|
|
Some tests have been disabled and will need further review.
|
|
ignore pktinfo tests on qemu mips,mips64,powerpc64
Original work by @mcginty.
|
|
try! is not available in Rust 2018
|
|
|
|
Makes it easier for newcomers :)
|
|
Signed-off-by: Levente Kurusa <lkurusa@acm.org>
|
|
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
|
|
|
|
921: Get `SO_PEERCRED` working on all Linux targets r=asomers a=jonas-schievink
These were disabled for ARM way back in 0db6ed1a28b4fb4d408cd9b7c4dba0a79bccf1f7 and 09c00ed7d9d92db2a79baa3ed212e7e239edceb9. Try to enable them for all arches and Android as well, since the removal wasn't really explained and I see no reason why this shouldn't work.
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
|
|
|
|
|
|
Rather than using the native implementation of these constants
on supported platforms, the native implementation was instead
emulated. This was also hidden from the user even though this
could result in data races and the functionality being broken.
Native functionality is, however, not support on macos/ios.
Rather than enable this emulation solely for this platform, it
should be removed as this is a dangerous abstraction.
|
|
libc fixed `bind()` for Android 64-bit targets, so change our
code to match.
|
|
|
|
* Split `ioctl!` into separate macros. This makes documentation easier to read.
* For every `ioctl_*!` macro include a description of the macro arguments as, the
function prototype for the generated wrapper function, and an example if we have one.
* Expose `request_code_*!` in the documentation to make the `ioctl_*_bad` macros easier to use.
* Reorganize the file hierarchy to be simpler
|
|
|
|
825: FreeBSD: cfmakesane, EVFILT_* r=Susurrus a=myfreeweb
Depends on: https://github.com/rust-lang/libc/pull/887
|
|
|
|
|
|
|
|
Also alter Debug to output all fields.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
799: Fix nix on Dragonfly r=Susurrus a=mneumann
This commit replaces pull request https://github.com/nix-rust/nix/pull/684. It fixes building `nix` on DragonFly. All tests pass. This requires most recent libc to build: https://github.com/rust-lang/libc/pull/851.
|
|
* DragonFly does not have a O_DSYNC flag
* Fix type_of_cmsg_data on DragonFly
* No fexecve() on DragonFly
* Do not run aio test cases on DragonFly
* Keep target lists in alphabetical order
* Unscrable #[cfg] directives and use cfg_if! macro instead
* Fix errno on DragonFly
Below follows an explanation why we have to use a C extension
to get errno working on DragonFly:
DragonFly uses a thread-local errno variable, but #[thread_local] is
feature-gated and not available in stable Rust as of this writing (Rust
1.21.0). We have to use a C extension (src/errno_dragonfly.c) to access
it.
Tracking issue for `thread_local` stabilization:
https://github.com/rust-lang/rust/issues/29594
Once this becomes stable, we can remove build.rs, src/errno_dragonfly.c,
remove the build-dependency from Cargo.toml, and use:
extern {
#[thread_local]
static errno: c_int;
}
Now all targets will use the build.rs script, but only on DragonFly this
will do something. Also, there are no additional dependencies for
targets other than DragonFly (no gcc dep).
|
|
|
|
|
|
|