summaryrefslogtreecommitdiff
path: root/src/sys/socket
AgeCommit message (Collapse)Author
2017-09-04Add support for SO_TIMESTAMPWesley Wolfe
2017-08-26Replace more FFI instancesBryant Mairs
2017-08-17Merge #725bors[bot]
725: Match syntax of libc_bitflags! with bitflags! r=asomers Also update a couple of constant declarations while we're at it.
2017-08-16Match libc_bitflags! syntax to upstream bitflags!Bryant Mairs
2017-08-16Replace extra SOCK_ constants with libc versionsBryant Mairs
Fixes #244
2017-08-11Fix safety of sockopt helper traitsJonas Schievink
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-05Correct access of cmsg ancillary data on first headerWesley Moore
Also updates cmsg types to match structs on non-Linux OSes. The implementation of CmsgInterator did not correctly mirror the way the CMSG_FIRSTHDR and CMSG_NEXTHDR macros work in C. CMSG_FIRSTHDR does not attempt to align access since the pointer is already aligned due to being part of the msghdr struct. CmsgInterator was always aligning access which happened to work on all platforms except OpenBSD where the use of alignment was adding unexpected bytes to the expected size and causing the `cmsg_align(cmsg_len) > self.buf.len()` guard clause to return early.
2017-08-01Document AddressFamily and SockTypeNicolas Dusart
2017-08-01add SockProtocol type for third argument of socket and socketpairNicolas Dusart
2017-08-01Document `MsgFlags` constantsNicolas 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
2017-07-10Fix sendmsg on macOS when passing a zero entry cmsgs array.Matthew Gregan
2017-07-10Simplify Vec allocation in sendmsg after 077d979a removed alignment hacks.Matthew Gregan
2017-07-04Allow nix to compile on android targetsroblabla
2017-07-02Rely on libc for more socket constantsBryant Mairs
2017-06-18Update bitflags to 0.9equal-l2
2017-04-09Split socket consts. test across ARM arch.Zac Berkowitz
2017-04-09Removed tests on ARM for non-existant constants.Zac Berkowitz
2017-04-09Removed some socket constants from arch=armZac Berkowitz
2017-04-09Fixed constants for MIPSZac Berkowitz
2017-02-16Update bitflags to 0.7Simon Sapin
2017-01-11Auto merge of #489 - fiveop:fixcopyinto, r=fiveopHomu
Fix ControlMessage::encode_into when encoding multiple messages copy_bytes updates dst so that it points after the bytes that were just copied into it. encode_into did not advance the buffer in the same way when encoding the data. See #473
2017-01-11Auto merge of #496 - fiveop:consolidate_socketaddr_storage, r=@fiveopHomu
Always use libc's socketaddr_storage Since rust-lang/rust#23425 is closed, we no longer need the special case.
2017-01-10Always use libc's socketaddr_storagePhilipp Matthias Schaefer
Since rust-lang/rust#23425 is closed, we no longer need the special case.
2016-12-10Fix ControlMessage::encode_into when encoding multiple messagesPhilipp Matthias Schaefer
copy_bytes updates dst so that it points after the bytes that were just copied into it. encode_into did not advance the buffer in the same way when encoding the data.
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-09-09Add MSG_CMSG_CLOEXEC to MsgFlags on LinuxSebastian Dröge
Fixes #421.
2016-08-10Fix nix on FreeBSD amd64Alan Somers
On Linux, the cmsg_len field of struct cmsghdr has type size_t, but it has size socklen_t on POSIX-compliant operating systems. So on POSIX-compliant 64-bit operating systems, struct cmsghdr has padding gaps that aren't present on Linux. Most of the issues fixed by this commit related to those gaps. src/sys/socket/ffi.rs Fix the type of the cmsg_data field so the struct layout will be correct. src/sys/socket/mod.rs In CmsgIterator.next, only return a single file descriptor. sendmsg(2) can only stuff a single file descriptor into each cmsg. In cmsg_align, fix the rounding calculation, and eliminate a division instruction. Add a missing cmsg_align call in ControlMessage.len In ControlMessage.encode_into, add any necessary padding bytes between the cmsghdr and the data. In sendmsg, fix some len<->capacity confusion.
2016-08-10Fix the sockopt_impl matcher rule order.Alan Somers
Rules for generic types were located above rules for specific types, so the rules for specific types never got matched. This caused the sys::socket::sockopt::test::can_get_listen_on_tcp_socket test to fail on FreeBSD. The solution is to put all of the generic rules at the bottom.
2016-05-03Auto merge of #367 - justinlatimer:so-original-dst, r=kamalmarhubiHomu
Add SO_ORIGINAL_DST In Linux, the SO_ORIGINAL_DST socket option can be used to get the original destination, which can be needed if the connection is translated by a NAT, i.e. iptables. In C, this information can be obtained by ``getsockopt(fd, SOL_IP, SO_ORIGINAL_DST, &remote, &remote_len)`` and returns a ``sockaddr_in`` struct. I've added a binding for this option. Thanks!
2016-05-02Add SO_ORIGINAL_DSTJustin Latimer
2016-05-01Support sockaddr_nl in sockaddr_storage_to_addr().James Peach
Add support for converting AF_NETLINK sockaddr_nl addresses to Sockaddr::Netlink(). This lets socket::recvmsg() work on netlink sockets.
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-25Fix IPV6 group membership options on OpenBSDVasily Kolobkov
2016-02-25Use libc with OpenBSD kinVasily Kolobkov
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-02-01Implement SO_ACCEPTCONN sockoptStanisław Pitucha
Only known on linux, nacl, freebsd
2016-02-01Add SO_TYPE handling in getsockoptStanisław Pitucha
2016-01-29Convert MSG_ flags to bitflags! type.Philipp Matthias Schaefer
2016-01-29Add support for SO_{RCV,SND}BUF(FORCE)? sockoptsFrank Denis
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