Commit Graph

623 Commits

Author SHA1 Message Date
Alan Somers
1e3f062fd8 (cargo-release) version 0.26.2 2023-01-17 17:09:07 -07:00
Alan Somers
975a3d5c7c Tidy up the CHANGELOG a bit. 2023-01-17 14:19:16 -07:00
Aaron Drew
6fd7418158 Fix endian swap on SocketAddrV6.
flowinfo and scope_id should not be byte swapped.
2023-01-17 14:16:48 -07:00
Alan Somers
e7a646ddff (cargo-release) version 0.26.1 2022-11-28 23:28:58 -07: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
Alan Somers
12fb35434f [skip ci] add a CHANGELOG section for the next release 2022-11-28 23:00:24 -07:00
Alan Somers
e0af65b0a0 (cargo-release) version 0.26.0 2022-11-28 22:56:21 -07:00
Alan Somers
ff219e3c42 [skip ci] add CHANGELOG entries for old point releases.
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-28 22:18:29 -07:00
Alan Somers
345fd36f17 [skip ci] fix CHANGELOG formatting 2022-11-28 21:35:45 -07:00
bors[bot]
5db5581e70
Merge #1788
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-29 04:11:50 +00:00
Alan Somers
9e6951fd16
Elaborate CHANGELOG entry for PR #1788 2022-11-28 21:01:57 -07:00
Jonathan
92dd754759 PollFd utility functions 2022-11-29 01:41:31 +00:00
Jonathan de Jong
e9f07eea61 add IpMtu sockopt 2022-11-23 10:48:48 +00:00
StackOverflowExcept1on
38597988f4
Added SockProtocol::Raw = libc::IPPROTO_RAW for raw sockets 2022-11-21 21:13:59 +03:00
bors[bot]
79f04fb3a3
Merge #1857
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-21 17:45:29 +00:00
bors[bot]
9ea1493a81
Merge #1871
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-21 17:26:56 +00:00
Steven Engler
500baa1633 fixup! Added better support for unnamed unix socket addrs
Changelog
2022-11-21 12:10:40 -05:00
Jonathan
63c56263fb mmap non-zero length 2022-11-20 22:53:40 +00:00
bors[bot]
33b5f928ea
Merge #1853
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-20 22:03:22 +00:00
Jonathan
d34696c84b mmap addr 2022-11-20 17:16:25 +00:00
roblabla
16f8ff9b26 Workaround XNU bug in getifaddrs netmasks 2022-11-20 17:16:02 +01:00
mzachar
faac24c779 Adds IP_TOS, IPV6_TCLASS and SO_PRIORITY sockopt wrappers 2022-11-20 13:41:26 +01:00
Alan Somers
fa62534a23 Fix using SockaddrStorage to store Unix domain addresses on Linux
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
2022-11-19 13:54:07 -07:00
Alex Saveau
9374e60809
Nuke deprecated Errno flags
Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
2022-11-11 20:28:11 -08:00
Alan Somers
b2c0361647 Add a Statfs::flags method
It returns the mount flags on the BSDs.  On Linux, it returns a slightly
different set of flags.
2022-10-23 22:42:00 -06:00
Alan Somers
3f66d1f4ce Define MntFlags and unmount on all of the BSDs. 2022-10-23 22:41:07 -06:00
Michael Baikov
7f0fdf237c Update changelog 2022-10-14 08:57:41 -04:00
Steve Lau
04e409b376 add eaccess on FreeBSD, DragonFly and Linux (musl and glibc) 2022-10-13 09:23:09 +08:00
Steve Lau
d19f1d3ce5 add faccessat on illumos 2022-10-10 21:17:55 +08:00
Steve Lau
e7992231a3 add syncfs on linux 2022-10-08 12:53:37 +08:00
Steve Lau
5ec038e915 re-export RLIM_INFINITY from libc 2022-10-02 10:46:22 +08:00
Pedro Tammela
c20fab79b0 statfs: add namespace fs magic
Namespace filesystem magic is missing from FsType constants.
2022-09-30 11:07:13 -03:00
bors[bot]
a40d49b82b
Merge #1825
1825: Add a `sched_getcpu` wrapper r=rtzoeller a=jonas-schievink



Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2022-09-27 13:18:10 +00:00
Jonas Schievink
945f743aa7 Add a sched_getcpu wrapper 2022-09-27 14:26:35 +02:00
wdsgyj
9b232dd581 fix crash on Android platform 2022-09-25 02:17:51 +08:00
SteveLau
50b41a8c4c
Merge branch 'master' into issue1814-expose-domainname-of-utsname 2022-09-12 13:41:35 +08:00
bors[bot]
1038ee5340
Merge #1808
1808: expose memfd on freebsd r=asomers a=i509VCB

Resolves #1775

Co-authored-by: i509VCB <git@i509.me>
2022-09-12 03:28:23 +00:00
Steve Lau
e0918dc4d1 fix issue1814 2022-09-12 07:07:36 +08:00
WATANABE Yuki
4d38456cab Handle unacceptable name gracefully in {User,Group}::from_name
Calling `unwrap` on the result of `CString::new` may cause the current
thread to panic, which is a bit surprising undocumented behavior. It
would be more reasonable to treat the erroneous name as a non-existing
user or group.
2022-09-11 23:07:34 +09:00
i509VCB
cf15c2bb55
expose memfd on freebsd 2022-09-07 22:00:38 -05:00
Ryan Zoeller
3dc163e780 Add sched_getaffinity and sched_setaffinity on FreeBSD 2022-08-25 18:42:20 -05:00
bors[bot]
97d6b43bcb
Merge #1805
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>
2022-08-22 20:46:21 +00:00
Terts Diepraam
810f74abbe add line field to Termios struct 2022-08-22 06:32:11 +02:00
S.J.R. van Schaik
7109eb9d2e fix microsecond calculation for TimeSpec 2022-08-20 20:15:51 -04:00
Alan Somers
2cba3afa78 Raise the MSRV to 1.56.1 in anticipation of the next release
And fix some documentation lints warned about by the newer rustdoc.
2022-08-14 09:53:42 -06:00
Alan Somers
596db4ed00 [skip ci] add a CHANGELOG section for the next release 2022-08-13 10:06:30 -06:00
Alan Somers
4d4754a14b (cargo-release) version 0.25.0 2022-08-13 10:02:42 -06:00
Alan Somers
92c76bdab0 [skip ci] reformat CHANGELOG prior to 0.25.0 release 2022-08-13 08:46:51 -06:00
bors[bot]
ffc793ed4d
Merge #1776
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>
2022-08-12 04:38:44 +00:00
Zhang Miaolei
f8c79c63e5 add faccessat 2022-08-05 20:15:51 -04:00