summaryrefslogtreecommitdiff
path: root/src/sys/socket/addr.rs
AgeCommit message (Collapse)Author
2020-05-31Convert the crate to edition 2018Alan Somers
2020-04-12Remove sys::socket::addr::from_libc_sockaddr from the public APIAlan Somers
This function never should've been public, since it's basically impossible to use directly. It's only public due to an oversight from PR #667 .
2019-09-04Merge #1120bors[bot]
1120: Fix length of abstract socket address r=asomers a=yshui NULL bytes have no special significance in an abstrace address, and the length of the address is solely decided by the length member. If the length is set to sun_path.len(), all the NULL bytes will be considered part of the address. Tests are updated accordingly. Closes #1119 Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com> Co-authored-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-04Fix length of abstract socket addressYuxuan Shui
NULL bytes have no special significance in an abstrace address, and the length of the address is solely decided by the length member. If the length is set to sun_path.len(), all the NULL bytes will be considered part of the address. Tests are updated accordingly. Closes #1119 Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-03Replace most instances of mem::uninitialized with mem::MaybeUninitAlan Somers
Only two instances remain: * For the deprecated sys::socket::CmsgSpace::new. We should probably just remove that method. * For sys::termios::Termios::default_uninit. This will require some more thought. Fixes #1096
2019-08-29Clippy: remove unnecessary mem::transmuteAlan Somers
2019-08-29Clippy cleanupAlan Somers
2019-07-12socket: add support for AF_VSOCKStefano Garzarella
This patch adds AF_VSOCK support to AddressFamily in order to use VSOCK socket. Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
2019-06-11Fix tests for abstract socketsBryant Mairs
Abstract paths should always be N-1 in length where N is the length of the `sun_path` field (first byte is \0). Given that, `UnixAddr::new_abstract()` should always return this N-1 length, not just the length of the string provided (the rest of the array will be \0s).
2019-06-09Add extra traits for all typesBryant Mairs
Derive Clone, Copy, Eq, Hash, and PartialEq for all types. Not all traits are supported by all types, which is why many are missing some.
2019-05-31fix more uintXY_t instancesJohannes Schilling
2019-04-09Uncomment to_std and from_std methods for IpAddrrabbott99
2019-03-12Support AF_ALGGleb Pomykalov
2018-12-16Allow 'cargo test' to complete successfully on NetBSD 8.0.Tom Pusateri
Some tests have been disabled and will need further review.
2018-12-08Replace try! with ?Alan Somers
try! is not available in Rust 2018
2018-10-15socket: add AF_UNSPEC to AddressFamilyLevente Kurusa
Signed-off-by: Levente Kurusa <lkurusa@acm.org>
2018-04-10Refactor the ioctl API and documentationBryant Mairs
* 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
2018-01-28Replace sockaddr_ctl with one from libcBryant Mairs
Also alter Debug to output all fields.
2018-01-28Implement Copy/Clone for all types missing itBryant Mairs
2018-01-28Disallow unnecessary import bracesBryant Mairs
2018-01-08Impl LinkAddr(MAC Addr)luozijun
2018-01-08impl `Debug` for all sockaddr typesluozijun
2017-12-20Remove unnecessary impl ClonesBryant Mairs
2017-12-20Merge redundant match armsBryant Mairs
2017-12-05Merge #696bors[bot]
696: Stop reexporting `Errno` variants r=Susurrus a=jonas-schievink Closes #664 (unsure if this is everything needed)
2017-12-04Stop reexporting `Errno` and its variantsJonas Schievink
cc #664 (unsure if this is everything needed)
2017-12-03Add support for getifaddrs. Closes: #650.Markus Wanner
2017-11-19sys/socket: add UnixAddr abstract name getterLuca Bruno
This introduces an `as_abstract()` getter to `UnixAddr` in order to retrieve the name of an abstract unix socket. This also adds tests around abstract addresses and clarify docs, adding explicit semantics.
2017-08-11Get rid of a lot of transmutesJonas Schievink
Most could be replaced by simple raw pointer casts (or even perfectly safe coercions!). cc #373
2017-08-01Document AddressFamily and SockTypeNicolas Dusart
2017-08-01add socket constants already present in libcNicolas Dusart
2017-08-01remove sys::sockets::consts module as it's libc goal to define themNicolas Dusart
2016-12-10Add support for system control sockets for XNUConrad Kramer
2016-11-18Fix Unix domain sockets.Alan Somers
There were multiple errors regarding Unix domain sockets: * UnixAddr::path assumed that gethostbyname and similar functions would include the terminating null as part of len. That is not universally true. In fact, POSIX only guarantees that len will be at least large enough to store the non-null-terminated path. So it could be larger or smaller than nix was assuming. Since abstract sockets' paths are not strings, we can't modify gethostbyname. Instead, I implemented the fix in UnixAddr::path and UnixAddr::new. I clarified the documentation too. * SockAddr::as_ffi_pair contained a Linuxism. * sockaddr_storage_to_addr forgot to adjust sun_len when creating a UnixAddr
2016-09-17Fixed a bug where UnixAddr::new_abstract forgot to count the null-byte.Mathias Svensson
2016-04-14fixed a few clippy warningsAndre Bogus
2016-03-30socket: Respect IPv6 flowinfo and scope_id in InetAddr::from_stdKamal Marhubi
Fixes #329
2016-02-23Add support for AF_PACKET on linuxHerman J. Radtke III
2016-02-04Add comment on IPv6 address endianness.Philipp Matthias Schaefer
2016-02-04IPv6 addresses are always in big endian orderFrank Denis
no matter what the architecture is.
2016-01-28Use sockaddr_nl from libcKamal Marhubi
2016-01-28Derive all the thingsAlexander Polakov
as suggested by @kamalmarhubi
2016-01-28Fix style suggestions regarding #cfgAlexander Polakov
as pointed out by @kamalmarhubi
2016-01-28Netlink bitsAlexander Polakov
2016-01-28Move errno::Result back to crate rootarcnmx
2016-01-28Errno::result()arcnmx
2016-01-18update libc to 0.2.2Mattis Marjak
2015-10-28Fix handling of sockaddr_un lengthsGeoffrey Thomas
The returned length of AF_UNIX sockaddrs is significant, and generally does not match the length of the entire structure. For filesystem sockets, this is ignorable because the path is also NUL-terminated, but for unbound sockets (e.g., a socketpair) or abstract-namespace sockets (a Linux extension where the address is an arbitrary bytestring), we need to keep track of the length. Fixes #177. Also add a UnixAddr::new_abstract function and some better handling of abstract-namespace socket addresses to fix #169.
2015-05-21Fix NixPath yield with CStr instead of OsStrCarl Lerche
As described in #117, the `AsExtStr` trait is defined to return a raw `*const libc::c_char`. Its impl for `OsStr` simply borrowed the byte slice from its `OsStr` argument and cast it to a `*const libc::c_char`, which does not construct a proper null-terminated C string. Given this, the `AsExtStr` is not necessary and is removed. `NixPath` is updated to yield `CStr`. Fixes #117, #120 Thanks to @dead10ck
2015-04-24FromPrimitive is no moreFlorian Hartwig