Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-08-04Cygwin: net.cc: convert wsock_errmap into a simple array of error codesCorinna Vinschen
Avoid linear searches for error codes by converting wsock_errmap to a ordered array, indexed by WinSock error code (subtracted by WSABASEERR. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-04Cygwin: net.cc: create own type host_errmap_t for host_errmapCorinna Vinschen
This decouples host_errmap from the errmap_t definition which is about to be changed in a followup patch. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-04Cygwin: net.cc: constify gai_errmapCorinna Vinschen
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-03Cygwin: drop macro and code for CYGWIN_VERSION_CHECK_FOR_OLD_IFREQCorinna Vinschen
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-05-30Cygwin: remove miscellaneous 32-bit codeKen Brown
2022-05-13Cygwin: wincap: drop has_gaa_largeaddress_bug flag and related codeCorinna Vinschen
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-10-29Cygwin: remove support for Vista entirelyCorinna Vinschen
Fix up a few comments while at it Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-07-30Cygwin: getaddrinfo: return valid ai_socktype and ai_protocol valuesCorinna Vinschen
If a service is supported as TCP and UDP service, GetAddrInfo does not return two entries, one for TCP, one for UDP, as on Linux. Rather, it just returns a single entry with ai_socktype and ai_protocol set to 0. If the service only exists as TCP or UDP service, then ai->ai_socktype is set, but ai_protocol isn't. Fortunately we copy over the result from Windows into local storage anyway, so this patch adds code to fix up the fields neglected by Windows. In case ai_socktype as well as ai_protocol are 0, duplicate the entry with valid values for ai_socktype and ai_protocol. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-07-28Cygwin: getifaddrs: don't return a zero IPv4 addressKen Brown
If an interface is disconnected, net.cc:get_ifs tries to fetch IPv4 addresses from the registry. If it fails, it currently returns pointers to sockaddr structs with zero address. Return a NULL pointer instead, to signal the caller of getifaddrs that we do not have a valid struct sockaddr. Partially addresses: https://cygwin.com/pipermail/cygwin/2021-July/248970.html
2021-07-28Cygwin: getifaddrs: fix address family for IPv6 netmasksKen Brown
The code in net.cc:get_ifs that sets the netmask omitted setting the address family in the IPv6 case. Fix this by setting it to AF_INET6. Partially addresses: https://cygwin.com/pipermail/cygwin/2021-July/248970.html
2020-12-07Fix trace output for getdomainname()Anton Lavrentiev via Cygwin-patches
2020-03-11Cygwin: fix formatting: drop trailing whitespaceCorinna Vinschen
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-03-11Cygwin: fix formatting: collapse whitespace-only linesCorinna Vinschen
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-03-11Cygwin: fix formatting: drop spaces leading tabsCorinna Vinschen
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-01-30Cygwin: AF_LOCAL: set appropriate errno on system callsKen Brown
If an AF_LOCAL socket is opened with O_PATH, all socket system calls that take a file descriptor argument fail on the resulting descriptor. Make sure that errno is set as on Linux for those calls that are implemented on Linux. In almost all cases it is ENOTSOCK. There are two exceptions: - sockatatmark(3); errno is EBADF. - bindresvport(3); errno is EAFNOSUPPORT if the second argument sin (of type struct sockaddr_in *) is non-NULL and satisfies sin->sin_family == AF_INET. Finally, there are two BSD socket system calls implemented on Cygwin but not Linux: getpeereid(3) and bindresvport_sa(3). Set errno to ENOTSOCK for these for consistency with the majority of the other calls.
2019-04-23Minor improvements to socket error handling:Erik M. Bray
* Change default fallback for failed winsock error -> POSIX error mappings to EACCES, which is a valid errno for more socket-related syscalls. * Added a few previously missing entries to the wsock_errmap table that have obvious POSIX errno.h analogues.
2019-01-24Cygwin: net: unify gethostname/getdomainnameCorinna Vinschen
Use info from same source (GetNetworkParams). Also move getdomainname near gethostname in source. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-24Cygwin: gethostname: fix fetching hostname from non-winsock functionCorinna Vinschen
If gethostname() fails we call GetComputerNameEx with ComputerNameDnsFullyQualified. This is wrong, gethostname should return the hostname only, not the FQDN. Fix this by calling GetComputerNameEx with ComputerNameDnsHostname. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-14Cygwin: minor cleanupsCorinna Vinschen
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-10-29Cygwin: fix memory corruption/SEGV if certain socket functions failCorinna Vinschen
Regression introduced with 2.11.0: The failure paths in socket, socketpair and accept4 functions and methods accidentally release *unused* cygheap_fdmanip objects. The subsequently called dtable::release method was designed to be called for *used* cygheap_fdmanip objects only. Using them on unused objects leads to NULL pointer member dereferencing. Worse, the inet/local accept4 methods only release the cygheap_fdmanip object but neglect to delete the just created fhandler_socket_* object. Fix this by removing the erroneous release calls in the aforementioned failure paths and delete the fhandler_socket_* object in accept4 instead. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-06-26Cygwin: Allow to build without experimental AF_UNIX code by defaultCorinna Vinschen
Introduce __WITH_AF_UNIX preprocessor flag to enable the new code Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-09Cygwin: fix socketpair prototypeCorinna Vinschen
Last parameter is a vector of 2 ints, not a pointer to int Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-28Cygwin: cleanup header including within network-releated filesCorinna Vinschen
* Rearrange includes and drop unneccessary ones. * Don't pull in cygwin/socket.h into sys/un.h just to get sa_family_t. Include sys/types.h and use __sa_family_t instead. * start including Windows headers using the w32api/ path prefix Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-26Cygwin: sockets: Add missing cleanup if socket/socketpair creation failsCorinna Vinschen
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-26Cygwin: sockets: move type and proto checks into fhandler_socket classesCorinna Vinschen
Encapsulation required Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-26Cygwin: fhandler_socket: define socketpair as virtual functionCorinna Vinschen
...in preparation of moving the type and protocol test into the actual classes. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-23Cygwin: Create empty fhandler_socket_unixCorinna Vinschen
* Make distinct from AF_LOCAL for testing purposes. This will have to be reverted as soon as fhandler_socket_unix goes life. * Move saw_reuseaddr flag back to fhandler_socket status Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-23Cygwin: encapsulate Winsock based fhandler_socket classesCorinna Vinschen
Insert another class fhandler_socket_wsock between fhandler_socket and fhandler_socket_inet/fhandler_socket_local. Also, add a new method fhandler::is_wsock_socket to allow asking for sockets in general (is_socket) vs. Winsock-based sockets (is_wsock_socket). This allows to develop a new handler_socket_unix class as derived class from fhandler_socket without any trace of wsock code left in fhandler_socket. While this is basically a temporary measure at this time, it may prove useful for later interoperability with the upcoming Windows 10 AF_UNIX implementation at one point. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-23Cygwin: drop unused device nodes and clean up socket devicesCorinna Vinschen
* Rename DEV_TCP_MAJOR to DEV_SOCK_MAJOR * Drop FH_TCP, FH_UDP, FH_ICMP in favor of single FH_INET * Drop FH_UNIX, FH_STREAM, FH_DGRAM in favor of single FH_LOCAL Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-22Cygwin: make socketpair an AF_LOCAL-only methodCorinna Vinschen
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-21Cygwin: split out fhandler_socket into inet and local classesCorinna Vinschen
First cut, still incomplete * fhandler_socket is now base class for other socket classes * fhandler_socket_inet handles AF_INET and AF_INET6 sockets * fhandler_socket_local handles AF_LOCAL/AF_UNIX sockets * finally get rid of fdsock by using set_socket_handle in accept4 * align file-related calls (fstat, fstatvfs, fchown, fchmod, facl) to Linux. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-20Cygwin: net.cc: drop redundant declarationsCorinna Vinschen
Replace cygwin_inet_aton call with cygwin_inet_pton Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-20Cygwin: set/getsockopt: Move implementation into fhandler_socket classCorinna Vinschen
This requires to export find_winsock_errno from net.cc. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-20Cygwin: clean error mappingCorinna Vinschen
- Move definition of windows to POSIX error mapping struct into cygerrno.h - Move declaration of winsock errno functions to cygerrno.h - Input to error mapping functions is DWORD Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-16Cygwin: net: Improve standars conformance commentsCorinna Vinschen
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-16Cygwin: socketpair: Move socketpair creation inside fhandler_socket classCorinna Vinschen
Add fhandler_socket::socketpair method Deliberately disable AF_INET socketpairs for now Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-15Cygwin: socket: move socket creation inside fhandler_socket classCorinna Vinschen
Add fhandler_socket::socket method Add fhandler_socket::set_socket_handle method, basically duplicating what fdsock is doing. This is the first step in getting rid of fdsock. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-13Cygwin: Drop HZ usage in favor of MSPERSEC and CLOCKS_PER_SECCorinna Vinschen
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-07Cygwin: sockets: Handle SO_RCVTIMEO and SO_SNDTIMEOCorinna Vinschen
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-07Cygwin: setsockopt/getsockopt: Add missing optlen checksCorinna Vinschen
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-06Cygwin: setsockopt/getsockopt: Clean up codeCorinna Vinschen
Rearrange setsockopt/getsockopt into per level/per optname preprocessing switch, actual call, per level/per optname postprocessing switch for better readability as well as extensibility. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-05Cygwin: bindresvport: Try hard to find unused portCorinna Vinschen
Workaround the problem that bind doesn't fail with EADDRINUSE if a socket with the same local address is still in TIME_WAIT. Use IP Helper functions to check if such a socket exist and don't even try this port, if so. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-05Cygwin: bindresvport: check correctness of address familyCorinna Vinschen
Assuming the address parameter is non-NULL, the test in cygwin_bindresvport_sa only tests if the address family is supported at all, which is insufficient. Check if the incoming address family matches the socket address family and for being AF_INET in cygwin_bindresvport since the latter doesn't support any other family. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-05Cygwin: bindresvport_sa: Ignore incoming port numberCorinna Vinschen
Ignore port number just like glibc, otherwise suffer EADDRINUSE in subsequent connect calls. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-10-10cygwin: fix gethostbyaddr argument typesYaakov Selkowitz
The first argument of gethostbyaddr needs to accept a generic pointer to be compatible with e.g. struct in_addr *. This caused an issue compiling krb5-1.15. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-02-03Fix limited Internet speeds caused by inappropriate socket bufferingCorinna Vinschen
Don't set SO_RCVBUF/SO_SNDBUF to fixed values, thus disabling autotuning. Patch modeled after a patch suggestion from Daniel Havey <dhavey@gmail.com> in https://cygwin.com/ml/cygwin-patches/2017-q1/msg00010.html: At Windows we love what you are doing with Cygwin. However, we have been getting reports from our hardware vendors that iperf is slow on Windows. Iperf is of course compiled against the cygwin1.dll and we believe we have traced the problem down to the function fdsock in net.cc. SO_RCVBUF and SO_SNDBUF are being manually set. The comments indicate that the idea was to increase the buffer size, but, this code must have been written long ago because Windows has used autotuning for a very long time now. Please do not manually set SO_RCVBUF or SO_SNDBUF as this will limit your internet speed. I am providing a patch, an STC and my cygcheck -svr output. Hope we can fix this. Please let me know if I can help further. Simple Test Case: I have a script that pings 4 times and then iperfs for 10 seconds to debit.k-net.fr With patch $ bash buffer_test.sh 178.250.209.22 usage: bash buffer_test.sh <iperf server name> Pinging 178.250.209.22 with 32 bytes of data: Reply from 178.250.209.22: bytes=32 time=167ms TTL=34 Reply from 178.250.209.22: bytes=32 time=173ms TTL=34 Reply from 178.250.209.22: bytes=32 time=173ms TTL=34 Reply from 178.250.209.22: bytes=32 time=169ms TTL=34 Ping statistics for 178.250.209.22: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 167ms, Maximum = 173ms, Average = 170ms ------------------------------------------------------------ Client connecting to 178.250.209.22, TCP port 5001 TCP window size: 64.0 KByte (default) ------------------------------------------------------------ [ 3] local 10.137.196.108 port 58512 connected with 178.250.209.22 port 5001 [ ID] Interval Transfer Bandwidth [ 3] 0.0- 1.0 sec 768 KBytes 6.29 Mbits/sec [ 3] 1.0- 2.0 sec 9.25 MBytes 77.6 Mbits/sec [ 3] 2.0- 3.0 sec 18.0 MBytes 151 Mbits/sec [ 3] 3.0- 4.0 sec 18.0 MBytes 151 Mbits/sec [ 3] 4.0- 5.0 sec 18.0 MBytes 151 Mbits/sec [ 3] 5.0- 6.0 sec 18.0 MBytes 151 Mbits/sec [ 3] 6.0- 7.0 sec 18.0 MBytes 151 Mbits/sec [ 3] 7.0- 8.0 sec 18.0 MBytes 151 Mbits/sec [ 3] 8.0- 9.0 sec 18.0 MBytes 151 Mbits/sec [ 3] 9.0-10.0 sec 18.0 MBytes 151 Mbits/sec [ 3] 0.0-10.0 sec 154 MBytes 129 Mbits/sec Without patch: dahavey@DMH-DESKTOP ~ $ bash buffer_test.sh 178.250.209.22 Pinging 178.250.209.22 with 32 bytes of data: Reply from 178.250.209.22: bytes=32 time=168ms TTL=34 Reply from 178.250.209.22: bytes=32 time=167ms TTL=34 Reply from 178.250.209.22: bytes=32 time=170ms TTL=34 Reply from 178.250.209.22: bytes=32 time=169ms TTL=34 Ping statistics for 178.250.209.22: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 167ms, Maximum = 170ms, Average = 168ms ------------------------------------------------------------ Client connecting to 178.250.209.22, TCP port 5001 TCP window size: 208 KByte (default) ------------------------------------------------------------ [ 3] local 10.137.196.108 port 58443 connected with 178.250.209.22 port 5001 [ ID] Interval Transfer Bandwidth [ 3] 0.0- 1.0 sec 512 KBytes 4.19 Mbits/sec [ 3] 1.0- 2.0 sec 1.50 MBytes 12.6 Mbits/sec [ 3] 2.0- 3.0 sec 1.50 MBytes 12.6 Mbits/sec [ 3] 3.0- 4.0 sec 1.50 MBytes 12.6 Mbits/sec [ 3] 4.0- 5.0 sec 1.50 MBytes 12.6 Mbits/sec [ 3] 5.0- 6.0 sec 1.50 MBytes 12.6 Mbits/sec [ 3] 6.0- 7.0 sec 1.50 MBytes 12.6 Mbits/sec [ 3] 7.0- 8.0 sec 1.50 MBytes 12.6 Mbits/sec [ 3] 8.0- 9.0 sec 1.50 MBytes 12.6 Mbits/sec [ 3] 9.0-10.0 sec 1.50 MBytes 12.6 Mbits/sec [ 3] 0.0-10.1 sec 14.1 MBytes 11.7 Mbits/sec The output shows that the RTT from my machine to the iperf server is similar in both cases (about 170ms) however with the patch the throughput averages 129 Mbps while without the patch the throughput only averages 11.7 Mbps. If we calculate the maximum throughput using Bandwidth = Queue/RTT we get (212992 * 8)/0.170 = 10.0231 Mbps. This is just about what iperf is showing us without the patch since the buffer size is set to 212992 I believe that the buffer size is limiting the throughput. With the patch we have no buffer limitation (autotuning) and can develop the full potential bandwidth on the link. If you want to duplicate the STC you will have to find an iperf server (I found an extreme case) that has a large enough RTT distance from you and try a few times. I get varying results depending on Internet traffic but without the patch never exceed the limit caused by the buffering. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-01-09Return the correct value for getsockopt(SO_REUSEADDR) after setting ↵Erik M. Bray
setsockopt(SO_REUSEADDR, 1).
2016-08-23Send thread names to debuggerJon Turney
GDB since commit 24cdb46e [1] can report and use these names. Add utility function SetThreadName(), which sends a thread name to the debugger. Use that: - to set the default thread name for main thread and newly created pthreads. - in pthread_setname_np() for user thread names. - for helper thread names in cygthread::create() - for helper threads which are created directly with CreateThread. Note that there can still be anonymous threads, created by system or injected DLLs. [1] https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=24cdb46e9f0a694b4fbc11085e094857f08c0419
2016-06-25Remove CYGWIN=detect_bloda optionCorinna Vinschen
2016-06-25Fix various OS-related commentsCorinna Vinschen
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>