summaryrefslogtreecommitdiff
path: root/src/sys/socket
AgeCommit message (Collapse)Author
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
2016-01-28Netlink bitsAlexander Polakov
2016-01-28Move errno::Result back to crate rootarcnmx
2016-01-28Errno::result()arcnmx
2016-01-18improve bsd unixes ipv6 supportarthurprs
2016-01-18Disable IPV6_ADD_MEMBERSHIP on freebsdUser Vagrant
2016-01-18fix on macMattis Marjak
2016-01-18update libc to 0.2.2Mattis Marjak
2015-12-22Fix broken tests on nightlyCarl Lerche
2015-12-22Implement support for getsockopt of peer credentials using the Linux ↵Magnus Hoff
specific SO_PEERCRED
2015-12-04socket(): add protocol argument (breaking change)Alexander Polakov
2015-12-03NetBSD tweaks for kqueue supportZachary Tong
2015-11-20netbsd supportJeremy Fitzhardinge
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-10-06Add support for sendmsg(2), recvmsg(2), and cmsg(3)Geoffrey Thomas
The best specification for control message layout appears to be [RFC 2292, section 4](https://tools.ietf.org/html/rfc2292#section-4), despite this not being a wire protocol. These definitions have also been checked against glibc 2.19 <bits/socket.h> and Linux 4.0 <linux/socket.h>, and tested on Debian 8.1 and FreeBSD 10.2 x86_64. The API differs a bit from the cmsg(3) API for type-safety reasons (and also because the cmsg(3) API is terrible). See test/sys/test_socket.rs for an example. Only supports SCM_RIGHTS at the moment. Fixes #88.
2015-09-28Revert "Add support for sendmsg(2), recvmsg(2), and cmsg(4)"Carl Lerche
This reverts commit 046af7d1ba82506f9bc48e62ac0584361025fc02.
2015-09-24Add support for sendmsg(2), recvmsg(2), and cmsg(4)Geoffrey Thomas
The best specification for control message layout appears to be [RFC 2292, section 4](https://tools.ietf.org/html/rfc2292#section-4), despite this not being a wire protocol. These definitions have also been checked against glibc 2.19 <bits/socket.h> and Linux 4.0 <linux/socket.h>, and tested on Debian 8.1 and FreeBSD 10.2 x86_64. The API differs a bit from the cmsg(4) API for type-safety reasons (and also because the cmsg(4) API is terrible). See test/sys/test_socket.rs for an example. Only supports SCM_RIGHTS at the moment. Fixes #88.
2015-09-09Add/Fix support for DragonFly BSDMichael Neumann
2015-09-03Fix test failures on FreeBSDGeoffrey Thomas
2015-07-13Remove import on those platforms where it is unused.Laurence Tratt
2015-07-06Consts are not on all kernelsTilde Engineering
2015-06-24TCP_NODELAY should be in IPPROTO_TCP levelY. T. Chung
2015-06-15TCP_KEEPALIVE, TCP_KEEPIDLE, split SockOpt traitY. T. Chung
* Split SockOpt trait into GetSockOpt and SetSockOpt. * Add support for TCP_KEEPALIVE & TCP_KEEPIDLE
2015-05-29Basic OpenBSD support.Laurence Tratt
Some of the tests are currently unrunnable, but the basic library is at least buildable.
2015-05-28Remove std::os::unix::io::RawFd re-exportCarl Lerche
2015-05-28Pass shutdown enum by valueCarl Lerche
2015-05-27Add sys::socket send and recvPhil Dawes
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-05-21Fix travis testsCarl Lerche
2015-05-21Test sockopt const valuesCarl Lerche