summary refs log tree commit diff
path: root/src/libstd/sys_common/net.rs
AgeCommit message (Collapse)AuthorLines
2020-04-14Add illumos triplePatrick Mooney-2/+2
Co-Authored-By: Jason King <jason.brian.king@gmail.com> Co-Authored-By: Joshua M. Clulow <jmc@oxide.computer>
2020-01-20refactor fix using cfg_if! (fix build on Solaris)Vita Batrla-0/+1
2020-01-18refactor fix using cfg_if! (fix build)Vita Batrla-6/+16
2020-01-17refactor fix using cfg_if!Vita Batrla-120/+55
2020-01-17Options IP_MULTICAST_TTL and IP_MULTICAST_LOOP are 1 byte on BSD and SolarisVita Batrla-18/+50
See ip(4P) man page: IP_MULTICAST_TTL Time to live for multicast datagrams. This option takes an unsigned character as an argument. Its value is the TTL that IP uses on outgoing multi- cast datagrams. The default is 1. IP_MULTICAST_LOOP Loopback for multicast datagrams. Normally multi- cast datagrams are delivered to members on the sending host (or sending zone). Setting the unsigned character argument to 0 causes the oppo- site behavior, meaning that when multiple zones are present, the datagrams are delivered to all zones except the sending zone. https://docs.oracle.com/cd/E88353_01/html/E37851/ip-4p.html https://man.openbsd.org/ip.4
2020-01-02Use drop instead of the toilet closure `|_| ()`Lzu Tao-1/+1
2019-11-29Format libstd with rustfmtDavid Tolnay-113/+143
This commit applies rustfmt with rust-lang/rust's default settings to files in src/libstd *that are not involved in any currently open PR* to minimize merge conflicts. THe list of files involved in open PRs was determined by querying GitHub's GraphQL API with this script: https://gist.github.com/dtolnay/aa9c34993dc051a4f344d1b10e4487e8 With the list of files from the script in outstanding_files, the relevant commands were: $ find src/libstd -name '*.rs' \ | xargs rustfmt --edition=2018 --unstable-features --skip-children $ rg libstd outstanding_files | xargs git checkout -- Repeating this process several months apart should get us coverage of most of the rest of libstd. To confirm no funny business: $ git checkout $THIS_COMMIT^ $ git show --pretty= --name-only $THIS_COMMIT \ | xargs rustfmt --edition=2018 --unstable-features --skip-children $ git diff $THIS_COMMIT # there should be no difference
2019-05-13Remove bitrig support from rustMarcel Hellwig-2/+2
2019-04-27Stabilized vectored IOSteven Fackler-3/+3
This renames `std::io::IoVec` to `std::io::IoSlice` and `std::io::IoVecMut` to `std::io::IoSliceMut`, and stabilizes `std::io::IoSlice`, `std::io::IoSliceMut`, `std::io::Read::read_vectored`, and `std::io::Write::write_vectored`. Closes #58452
2019-03-31libstd: deny(elided_lifetimes_in_paths)Mazdak Farrokhzad-3/+3
2019-03-16Add peer_addr function to UdpSocketLinus Unnebäck-0/+6
2019-03-09Use lifetime contravariance to elide more lifetimes in core+alloc+stdScott McMurray-1/+1
2019-02-28libstd => 2018Taiki Endo-19/+20
2019-02-13Add vectored read and write supportSteven Fackler-1/+9
This functionality has lived for a while in the tokio ecosystem, where it can improve performance by minimizing copies.
2018-12-25Remove licensesMark Rousskov-10/+0
2018-12-06Refactor net::each_addr/lookup_host to forward error from resolveJethro Beekman-16/+58
2018-09-15Improve output if no_lookup_host_duplicates failsPhilip Munksgaard-2/+3
If the test fails, output the offending addresses and a helpful error message. Also slightly improve legibility of the preceding line that puts the addresses into a HashMap.
2018-01-16Only link res_init() on GNU/*nixRyan Cumming-21/+3
To workaround a bug in glibc <= 2.26 lookup_host() calls res_init() based on the glibc version detected at runtime. While this avoids calling res_init() on platforms where it's not required we will still end up linking against the symbol. This causes an issue on macOS where res_init() is implemented in a separate library (libresolv.9.dylib) from the main libc. While this is harmless for standalone programs it becomes a problem if Rust code is statically linked against another program. If the linked program doesn't already specify -lresolv it will cause the link to fail. This is captured in issue #46797 Fix this by hooking in to the glibc workaround in `cvt_gai` and only activating it for the "gnu" environment on Unix This should include all glibc platforms while excluding musl, windows-gnu, macOS, FreeBSD, etc. This has the side benefit of removing the #[cfg] in sys_common; only unix.rs has code related to the workaround now.
2017-12-09Use Try syntax for Option in place of macros or matchMatt Brubeck-4/+1
2017-10-05replace libc::res_init with res_init_if_glibc_before_2_26Jack O'Connor-4/+9
The previous workaround for gibc's res_init bug is not thread-safe on other implementations of libc, and it can cause crashes. Use a runtime check to make sure we only call res_init when we need to, which is also when it's safe. See https://github.com/rust-lang/rust/issues/43592.
2017-09-08Re-enable networking module fo rL4ReSebastian Humenda-4/+4
As suggested in the discussion of PR #43972, std should provide a uniform API to all platforms. Since there's no networking on L4Re, this now is a module in `sys::net` providing types and functions/methods returning an error for each action.
2017-08-07addrinfo hint in lookup_host() needs clean initialization on all platformsDanek Duvall-10/+2
Fixes #43649
2017-07-06Implement TcpStream::connect_timeoutSteven Fackler-0/+8
This breaks the "single syscall rule", but it's really annoying to hand write and is pretty foundational.
2017-06-20Add `Read::initializer`.Steven Fackler-4/+0
This is an API that allows types to indicate that they can be passed buffers of uninitialized memory which can improve performance.
2017-05-04Reload nameserver information on lookup failureJon Gjengset-3/+16
As discussed in #41570, UNIX systems often cache the contents of /etc/resolv.conf, which can cause lookup failures to persist even after a network connection becomes available. This patch modifies lookup_host to force a reload of the nameserver entries following a lookup failure. This is in line with what many C programs already do (see #41570 for details). On systems with nscd, this should not be necessary, but not all systems run nscd. Introduces an std linkage dependency on libresolv on macOS/iOS (which also makes it necessary to update run-make/tools.mk). Fixes #41570. Depends on rust-lang/libc#585.
2017-03-25Fix libc::bind call on aarch64-linux-androidMarco A L Barbosa-2/+2
2017-02-04libstd/net: Add `peek` APIs to UdpSocket and TcpStreamTyler Julian-11/+13
These methods enable socket reads without side-effects. That is, repeated calls to peek() return identical data. This is accomplished by providing the POSIX flag MSG_PEEK to the underlying socket read operations. This also moves the current implementation of recv_from out of the platform-independent sys_common and into respective sys/windows and sys/unix implementations. This allows for more platform-dependent implementations.
2016-11-01std: Move sys_common to libstd/sys_commonBrian Anderson-0/+633
Make the directory structure reflect the module structure. I've always found the existing structure confusing.