summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/net.cc
Commit message (Collapse)AuthorAgeFilesLines
* Throughout, update copyrights to reflect dates which correspond to main-branchChristopher Faylor2013-01-211-2/+2
| | | | checkins. Regularize copyright format.
* * fhandler_registry.cc: Drop Mingw.org considerations.Corinna Vinschen2012-11-261-63/+0
| | | | | | | | | | | * fhandler_serial.cc: Ditto. * fhandler_socket.cc: Ditto. * fhandler_tape.cc: Ditto. * fhandler_tty.cc: Ditto. * net.cc: Ditto. * ntdll.h: Ditto. * sched.cc: Ditto. * sec_helper.cc: Ditto.
* * net.cc (get_adapters_addresses): Drop FIXME part of comment.Christopher Faylor2012-08-211-3/+1
|
* whitespace cleanupChristopher Faylor2012-08-161-1/+1
|
* Add files missing in previous checkinCorinna Vinschen2012-07-061-58/+43
|
* * Makefile.in: Add some more optimization flags for cygwait, malloc and ↵Christopher Faylor2012-07-021-0/+2
| | | | | | | | | | | | | | | | | | | | | path. Explain why -fomit-frame-pointer doesn't work right for passwd.o and path.o. Add -static to link command line for cygwin0.dll. * fhandler_disk_file.cc (fhandler_disk_file::facl): Reorganize slightly to silence compiler warning when compiling with -fstack-check. * net.cc (inet_ntop6): Initialize structure members to silence compiler warning when compiling with -fstack-check. * pseudo-reloc.cc (_pei386_runtime_relocator): Make this a C function. Detect NULL u. * winsup.h (_pei386_runtime_relocator): Declare this as extern "C". * lib/_cygwin_crt0_common.cc (_pei386_runtime_relocator): Call with NULL argument. * signal.cc (sigaction_worker): Eliminate last argument. Let callers report their own strace info. Regparmize. (sigaction): Reflect sigaction_worker changes. (siginterrupt): Ditto. * exceptions.cc: Update copyright.
* * net.cc (cygwin_recvfrom): Don't shortcircuit if len == 0. Add commentCorinna Vinschen2012-05-211-3/+15
| | | | | | to explain why. (cygwin_recv): Ditto. (cygwin_recvmsg): Ditto.
* * net.cc (get_adapters_addresses): Only create thread on affectedCorinna Vinschen2012-05-031-4/+8
| | | | | | | | | systems. Change comment acordingly. * wincap.h (wincaps::has_gaa_largeaddress_bug): New element. * wincap.cc: Implement above element throughout. (wincap_8): New globale wincaps to support Windows 8. (wincapc::init): Take Windows 8 into account. Set new has_gaa_largeaddress_bug member to false on 32 bit systems.
* * net.cc (call_gaa): New thread function to call GetAdaptersAddresses.Corinna Vinschen2012-03-081-15/+50
| | | | | (get_adapters_addresses): Call call_gaa. If necessary, call it as child thread. Explain why that's necessary.
* * cygtls.cc (dll_cmp): New comparison function for bsearch.Corinna Vinschen2012-02-271-12/+26
| | | | | | (well_known_dlls): New array containing well-known DLLs. (_cygtls::call2): Add code for BLODA detection. * net.cc (fdsock): Ditto.
* Clean up whitespace.Christopher Faylor2011-12-171-1/+1
|
* Throughout, remove extra space after function name from debugging output.Christopher Faylor2011-12-031-18/+18
| | | | | | | | | | | | | | | Throughout, change syscalls to report on return values using new %R format option. * smallprint.cc (__small_vsprintf): Add parsing for %R to report on return values and possible errno from syscalls. * errno.cc (errmap): Add PRIVILEGE_NOT_HELD. * fhandler_tty.cc (fhandler_pty_master::setup): When creating a thread use shorter name to reduce debuggging output. * select.cc (start_thread_pipe): Ditto. (start_thread_serial): Ditto. (start_thread_socket): Ditto. (start_thread_mailslot): Ditto. * sigproc.cc (talktome): Ditto.
* * net.cc (socketpair): Bind first socket to loopback only as well.Corinna Vinschen2011-10-051-1/+1
|
* * net.cc (cygwin_getsockopt): Drop erroneous double conversion of errorCorinna Vinschen2011-09-021-12/+3
| | | | code returned by SOL_SOCKET/SO_ERROR. Fix error handling.
* 2011-08-16 Pierre Humblet <Pierre.Humblet@ieee.org>Pierre Humblet2011-08-161-50/+17
| | | | | * net.cc (gethostby_helper): Remove DEBUGGING code from and streamline the second pass.
* * net.cc (socketpair): Release sb0 if there's no space left for sb1.Corinna Vinschen2011-08-041-0/+2
|
* Throughout change "WinSock" to "Winsock" in comments.Corinna Vinschen2011-07-291-5/+22
| | | | | | | | * fhandler_socket.cc (fhandler_socket::sendmsg): Add missing call to get_inet_addr to convert AF_LOCAL to AF_INET sockets. * net.cc (cygwin_socket): Workaround UDP Winsock problem. Add comment to explain why. * select.cc: Include winsock2.h rather than winsock.h.
* whitespace eliminationChristopher Faylor2011-06-061-6/+6
|
* * net.cc (fdsock): Drop setting uninterruptible_io to true.Corinna Vinschen2011-05-011-1/+0
|
* * net.cc (get_ipv4fromreg_ipcnt): Rearrange to fetch all registryCorinna Vinschen2011-04-191-66/+83
| | | | | values at once using RtlQueryRegistryValues. (get_ipv4fromreg): Ditto.
* Drop NT4 support.Corinna Vinschen2011-04-041-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * autoload.cc (DnsQuery_A): Fatal if not available. (DnsRecordListFree): Ditto. (DsGetDcNameW): Ditto. (NetGetAnyDCName): Remove. (NetGetDCName): Remove. (EnumProcessModules): Fatal if not available. (GetModuleFileNameExW): Ditto. (GetModuleInformation): Ditto. (GetProcessMemoryInfo): Ditto. (QueryWorkingSet): Ditto. (LsaRegisterLogonProcess): Ditto. * fenv.cc (_feinitialise): Drop supports_sse condition. * fhandler_disk_file.cc (path_conv::isgood_inode): Fix comment. (fhandler_base::fstat_by_name): Drop has_fileid_dirinfo condition. (fhandler_disk_file::opendir): Ditto. * fhandler_netdrive.cc (fhandler_netdrive::readdir): Fix comment. * fhandler_proc.cc (format_proc_partitions): Drop NT4-only code. * fhandler_process.cc (get_process_state): Ditto. * kernel32.cc (GetWindowsDirectoryW): Remove. (GetWindowsDirectoryA): Remove. * miscfuncs.cc (nice_to_winprio): Drop NT4-only code. * mount.cc (fs_info::update): Fix comments. * net.cc (get_2k_ifs): Drop NT4-only code. * sec_auth.cc (get_logon_server): Ditto. (lsaauth): Drop NT4-specific error handling. * security.cc (alloc_sd): Set SE_DACL_PROTECTED unconditionally. * select.cc (select_stuff::wait): Always use MWMO_INPUTAVAILABLE. (peek_windows): Drop NT4-only condition in call to PeekMessage. * syscalls.cc (gethostid): Remove NT4-only workaround. * wincap.cc: Througout, drop has_dacl_protect, has_broken_if_oper_status, has_process_io_counters, has_terminal_services, has_extended_priority_class, has_guid_volumes, has_fileid_dirinfo, has_mwmo_inputavailable and supports_sse from wincaps. (wincap_nt4sp4): Remove. (wincap_minimal): Set to wincap_2000. (wincapc::init): Rely on availability of OSVERSIONINFOEX structure. Treat error from GetVersionEx as fatal. Treat NT4 as fatal. * wincap.h (struct wincaps): Drop has_dacl_protect, has_broken_if_oper_status, has_process_io_counters, has_terminal_services, has_extended_priority_class, has_guid_volumes, has_fileid_dirinfo, has_mwmo_inputavailable and supports_sse flags and methods. * winlean.h (GetWindowsDirectoryW) Define as GetSystemWindowsDirectoryW. (GetWindowsDirectoryA): Define as GetSystemWindowsDirectoryA.
* * net.cc (SIO_BASE_HANDLE): Define.Corinna Vinschen2011-03-291-36/+59
| | | | | (fdsock): If we got an LSP handle, try to create a copy of the base handle instead. Change comment to explain.
* * fhandler_socket (fhandler_socket::readv): Call recv_internal directly,Corinna Vinschen2011-02-211-4/+24
| | | | | | | | | | rather than recvmsg. (fhandler_socket::writev): Call send_internal directly, rather than sendmsg. * net.cc (cygwin_recv): Call fhandler_socket::recvfrom directly, rather than cygwin_recvfrom. (cygwin_send): Call fhandler_socket::sendto directly, rather than cygwin_sendto.
* * Throughout fix copyright dates.Corinna Vinschen2011-02-151-1/+1
|
* * fhandler_socket.cc (address_in_use): Disable. Add comment.Corinna Vinschen2011-01-301-5/+14
| | | | | | | | | | | (fhandler_socket::bind): Change comment to explain setting the SO_EXCLUSIVEADDRUSE socket option. Remove code which checks for address in use. * net.cc (cygwin_setsockopt): Never set SO_REUSEADDR option. Improve comment to compensate for the deleted comment in fhandler_socket::bind. * wincap.cc: Throughout, drop has_enhanced_socket_security from wincaps. * wincap.h (struct wincaps): Drop has_enhanced_socket_security flags and method.
* * net.cc (get_xp_ifs): Fix counting of idx to return stable interfaceCorinna Vinschen2010-12-021-3/+4
| | | | alias names for interfaces with multiple IPv4 addresses.
* * autoload.cc (SendARP): Remove.Corinna Vinschen2010-11-231-9/+5
| | | | | | * net.cc (get_flags): Set IFF_NOARP flag for PPP and SLIP devices. (get_xp_ifs): Unify IFF_BROADCAST setting. Drop calling SendARP to set IFF_NOARP flag.
* * net.cc (get_ipv4fromreg_ipcnt): Fix debug output. Only create debugCorinna Vinschen2010-11-221-2/+4
| | | | | output if error is not ERROR_FILE_NOT_FOUND. (get_ipv4fromreg): Ditto.
* * net.cc (getdomainname): Drop special case for NT4.Corinna Vinschen2010-09-281-16/+0
|
* * fhandler_socket.cc (fhandler_socket::bind): Drop has_exclusiveaddruseCorinna Vinschen2010-09-251-257/+5
| | | | | | | | | | | | | | | | | | | | | | condition. Fix comment about availability. Move remaining comment to the right spot. Drop has_ip_helper_lib condition. * net.cc (cygwin_setsockopt): Drop has_disabled_user_tos_setting condition. Fix comment. (get_2k_ifs): Fix comment. (get_nt_ifs): Remove. (getifaddrs): Drop call to get_nt_ifs. (get_ifconf): Ditto. * wincap.cc: Throughout, drop has_ip_helper_lib, has_disabled_user_tos_setting, and has_exclusiveaddruse settings from wincaps. (wincap_unknown): Remove. (wincap_nt4): Remove. (wincap_minimal): New macro, set to wincap_nt4sp4 for now. (wincapc::init): Drop test for pre-SP4 NT4. Just imply at least NT SP4. Replace references to wincap_unknown with references to wincap_minimal. * wincap.h (struct wincaps): Drop has_ip_helper_lib, has_disabled_user_tos_setting, and has_exclusiveaddruse flags and methods.
* * autoload.cc (LoadDLLprime): Change dllname storage to string16.Corinna Vinschen2010-08-281-21/+19
| | | | | | | | | | | | | | | | (struct dll_info): Convert name to WCHAR. (std_dll_init): Load DLLs with full path to windows system directory. Add hint to Microsoft security advisory. * dcrt0.cc (init_windows_system_directory): New function. (dll_crt0_0): Call init_windows_system_directory first. * exceptions.cc (windows_system_directory): Move to globals.cc. (windows_system_directory_length): Ditto. (events_init): Drop code fetching windows_system_directory. * globals.cc (windows_system_directory): New global variable. (windows_system_directory_length): Ditto. * net.cc (load_ipv6_funcs): Use windows_system_directory rather than GetSystemDirectoryW. * netdb.cc (open_system_file): Ditto. Simplify debug output.
* * net.cc (cygwin_getsockopt): Make sure SO_PEERCRED is only handledCorinna Vinschen2010-07-021-1/+29
| | | | | in level SOL_SOCKET. Workaround a return value regression in Vista and later. Add comment to explain.
* * net.cc: Remove calls to sig_dispatch_pending throughout.Corinna Vinschen2010-03-301-20/+0
| | | | * libc/rexec.cc: Ditto.
* Throughout change all calls of low_priority_sleep (0) to yield ().Christopher Faylor2010-03-121-1/+1
| | | | | | | | | | * miscfuncs.cc (yield): Rename from low_priority_sleep. Remove all of the logic which called Sleep() and just use SwitchToThread. * miscfuncs.h (yield): Rename from low_priority_sleep. (SLEEP_0_STAY_LOW): Delete unused define. * shared.cc (memory_init): Move heap_init() call directly after shared memory initialization to more closely mimic long-standing program flow. * tty.cc (tty_list::terminate): Replace call to low_priority_sleep with Sleep.
* * fhandler_socket.cc (fhandler_socket::accept4): Set nonblockingCorinna Vinschen2010-01-151-1/+1
| | | | | flag exactly according to flags, as on Linux. * net.cc (cygwin_accept): Maintain BSD semantics here.
* * cygwin.din (accept4): Export.Corinna Vinschen2010-01-151-4/+57
| | | | | | | | | | | | | | | | | | | * fhandler.h (fhandler_socket::accept4): Rename from accept. Take additional flag parameter. * fhandler_socket.cc (fhandler_socket::accept4): Ditto. Handle SOCK_NONBLOCK and SOCK_CLOEXEC flags. * net.cc (cygwin_socket): Handle SOCK_NONBLOCK and SOCK_CLOEXEC flags in type. Check for invalid flag values. (socketpair): Ditto. (cygwin_accept): Accommodate renaming of fhandler_socket::accept function to accept4. (accept4): New function. * posix.sgml: Mention accept4 as GNU extensions. * include/cygwin/socket.h (SOCK_NONBLOCK): Define. (SOCK_CLOEXEC): Define. (_SOCK_FLAG_MASK): Define when building Cygwin. * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump. * include/sys/socket.h (accept4): Declare.
* * net.cc (cygwin_setsockopt): Only skip calling setsockopt(SO_REUSEADDR)Corinna Vinschen2009-12-151-4/+5
| | | | on stream sockets under systems supporting enhanced socket security.
* * fhandler_socket.cc (fhandler_socket::fixup_before_fork_exec): AddCorinna Vinschen2009-11-231-2/+12
| | | | | | | | socket handle value to debug output. (fhandler_socket::fixup_after_fork): Ditto. Make new socket handle OVERLAPPED, just as if it has been created with socket(). * net.cc (fdsock): Close duplicated socket and explain why. Disable the entire WSADuplicateSocket test for now and explain why.
* Reintegrate socket duplication via WSADuplicateSocket/WSASocket.Corinna Vinschen2009-11-171-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * autoload.cc (WSADuplicateSocketW): Define. (WSASocketW): Define. * dtable.cc (dtable::release): Call dec_need_fixup_before if necessary. (dtable::fixup_before_fork): New function. (dtable::fixup_before_exec): New function. * dtable.h (class dtable): Add member cnt_need_fixup_before. Add declarations for above new functions. (dtable::dec_need_fixup_before): New inline method. (dtable::inc_need_fixup_before): New inline method. (dtable::need_fixup_before): New inline method. * fhandler.h (fhandler_base::fixup_before_fork_exec): New virtual method. (fhandler_base::need_fixup_before): New virtual method. (class fhandler_socket): Add member prot_info_ptr. (fhandler_socket::init_fixup_before): Declare. (fhandler_socket::need_fixup_before): New inline method. (fhandler_socket::fixup_before_fork_exec): Declare. (fhandler_socket::fixup_after_exec): Declare. * fhandler_socket.cc (fhandler_socket::fhandler_socket): Initialize prot_info_ptr to NULL. (fhandler_socket::~fhandler_socket): Free prot_info_ptr conditionally. (fhandler_socket::init_fixup_before): New method. (fhandler_socket::fixup_before_fork_exec): Ditto. (fhandler_socket::fixup_after_fork): Use WSASocketW to duplicate socket if necessary. (fhandler_socket::fixup_after_exec): New method. (fhandler_socket::dup): Use fixup_before_fork_exec/fixup_after_fork to duplicate socket if necessary. * fork.cc (frok::parent): Start child suspended if some fhandler needs fixup before fork. If so, call dtable::fixup_before_fork after CreateProcess and resume child. * net.cc (fdsock): Try to find out if socket needs fixup before and initialize socket accordingly. Add HUGE comment to explain what happens and why. * spawn.cc (spawn_guts): Start child suspended if some fhandler needs fixup before exec. If so, call dtable::fixup_before_exec after CreateProcess.
* * net.cc (fdsock): Fill _rmem and _wmem with valid values returnedCorinna Vinschen2009-11-131-3/+16
| | | | from getsockopt if setsockopt with desired values failed.
* * (fhandler_socket::getsockname): Fix length returned for unboundCorinna Vinschen2009-08-141-4/+0
| | | | | | | | AF_LOCAL sockets. (fhandler_socket::getpeername): Ditto. * net.cc (socketpair): Don't set sun_path and peer_sun_path to make sure getsockname and getpeername return the correct values for AF_LOCAL sockets.
* * fhandler.h (class fhandler_socket): Add peer_sun_path member.Corinna Vinschen2009-08-131-0/+2
| | | | | | | | | | | | | | | | | | | (fhandler_socket::set_peer_sun_path): New method. (fhandler_socket::get_peer_sun_path): New method. * fhandler_socket.cc (fhandler_socket::fhandler_socket): Initialize peer_sun_path to NULL. (fhandler_socket::~fhandler_socket): Free peer_sun_path if necessary. (fhandler_socket::dup): Duplicate peer_sun_path. (fhandler_socket::accept): Ditto. Return fake unbound peer content and len in case of AF_LOCAL sockets. (fhandler_socket::getsockname): Always use local sockaddr_storage to store socket address and copy over to incoming address. Handle every namelen correctly per POSIX. (fhandler_socket::getpeername): Ditto. Add code path to return correct value for AF_LOCAL sockets. (fhandler_socket::set_peer_sun_path): New method. * net.cc (socketpair): Set peer_sun_path to empty string, just like sun_path.
* * net.cc (cygwin_getnameinfo): Force setting NI_NUMERICSERV onlyCorinna Vinschen2009-08-061-12/+19
| | | | | on Windows 2003 and earlier, only if the port number doesn't resolve to a well-known service. Change comment accordingly.
* * fhandler_socket.cc (fhandler_socket::send_internal): Just use wmem size ifChristopher Faylor2009-08-041-2/+2
| | | | | | | | the length exceeds it. * net.cc (fdsock): Use 65535 as window size, just like the comment says or we run into problems with DuplicateHandle. * path.cc (patch_conv::check): Use set_path to set invalid filename. * path.h (path_conv::path_conv): Ditto.
* * net.cc (get_xp_ifs): Fix typo in comment.Corinna Vinschen2009-07-011-1/+1
|
* * fhandler.h (class fhandler_socket): Add class members and methodsCorinna Vinschen2009-07-011-13/+29
| | | | | | | | | | | | | | | | to store and retrieve the SO_RCVBUF and SO_SNDBUF sizes. * fhandler_socket.cc (fhandler_socket::dup): Duplicate new members. (fhandler_socket::send_internal): Check for SO_SNDBUF size and restrict send to 1 byte less per KB 823764. Leave loop immediately if WSASendMsg has been used. * net.cc (fdsock): Change comment again. Set buffer sizes to 65536. Store values in fhandler_socket. (cygwin_setsockopt): Store SO_RCVBUF and SO_SNDBUF sizes in fhandler_socket. (cygwin_sendto): Drop call to sig_dispatch_pending. (cygwin_recvfrom): Ditto. (cygwin_recvmsg): Ditto. (cygwin_sendmsg): Ditto.
* * net.cc (fdsock): Set default socket buffer sizes to 65520. ChangeCorinna Vinschen2009-06-301-12/+9
| | | | | | comment accordingly. * fhandler_socket.cc (fhandler_socket::send_internal): Set maximum send size to 65520 as well.
* * net.cc (get_flags): New static function to generate interface flagsCorinna Vinschen2009-06-151-115/+287
| | | | | | | | | | | | value. (get_ipv4fromreg_ipcnt): New static function to fetch number of configured IPv4 addresses for a given NIC from registry. (get_ipv4fromreg): New static function to fetch configured IPv4 addresses for a given NIC from registry. (get_friendlyname): New static function to generate friendly name. (get_hwaddr): New static function to copy hardware address. (get_xp_ifs): Restructure slightly. Add code to generate IPv4 entries entries for interfaces which are disconnected.
* * path.cc (cwdstuff::set): Avoid removing a nonexistent trailing slash.Christopher Faylor2009-05-281-2/+0
|
* * net.cc (gethostby_helper): Use correct signedness.Christopher Faylor2009-05-201-35/+36
|