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
diff options
context:
space:
mode:
-rw-r--r--winsup/cygwin/ChangeLog9
-rw-r--r--winsup/cygwin/net.cc54
-rw-r--r--winsup/cygwin/wincap.cc39
-rw-r--r--winsup/cygwin/wincap.h2
4 files changed, 70 insertions, 34 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 7f17cfee8..9cc8ab9cc 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,12 @@
+2006-01-13 Corinna Vinschen <corinna@vinschen.de>
+
+ * net.cc (cygwin_setsockopt): Ignore errors when setting IP_TOS on
+ Windows 2000 and above. Clarify the comment about IP_TOS and move
+ to the place where the magic happens.
+ (get_ifconf): Remove unused code.
+ * wincap.h (wincaps::has_disabled_user_tos_setting): New element.
+ * wincap.cc: Implement above element throughout.
+
2006-01-12 Christopher Faylor <cgf@timesys.com>
* fhandler_console.cc (set_console_state_for_spawn): Fix to recognize
diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc
index a3fde3019..1b3e4aca3 100644
--- a/winsup/cygwin/net.cc
+++ b/winsup/cygwin/net.cc
@@ -1,7 +1,7 @@
/* net.cc: network-related routines.
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
- 2005 Red Hat, Inc.
+ 2005, 2006 Red Hat, Inc.
This file is part of Cygwin.
@@ -682,21 +682,7 @@ cygwin_setsockopt (int fd, int level, int optname, const void *optval,
/* Old applications still use the old Winsock1 IPPROTO_IP values. */
if (level == IPPROTO_IP && CYGWIN_VERSION_CHECK_FOR_USING_WINSOCK1_VALUES)
optname = convert_ws1_ip_optname (optname);
- /* FOR THE RECORDS:
- Setting IP_TOS is disabled by default since W2K, the official
- reason being that IP_TOS setting would interfere with Windows
- QOS settings. As result, setsockopt returns with WinSock error
- 10022, WSAEINVAL, when running under W2K or later, instead of
- handling this gracefully.
-
- The workaround is described in KB article 248611. Add a new
- registry DWORD value HKLM/System/CurrentControlSet/Services/...
- ... Tcpip/Parameters/DisableUserTOSSetting, set to 0, and reboot.
-
- FIXME: Maybe we should simply fake that IP_TOS could be set
- successfully, if DisableUserTOSSetting is not set to 0 on W2K
- and above? */
res = setsockopt (fh->get_socket (), level, optname,
(const char *) optval, optlen);
@@ -704,7 +690,38 @@ cygwin_setsockopt (int fd, int level, int optname, const void *optval,
syscall_printf ("setsockopt optval=%x", *(long *) optval);
if (res)
- set_winsock_errno ();
+ {
+ /* KB 248611:
+
+ Windows 2000 and above don't support setting the IP_TOS field
+ with setsockopt. Additionally, TOS was always (also under 9x
+ and NT) only implemented for UDP and ICMP, never for TCP.
+
+ The difference is that beginning with Windows 2000 the
+ setsockopt call returns WinSock error 10022, WSAEINVAL when
+ trying to set the IP_TOS field, instead of just ignoring the
+ call. This is *not* explained in KB 248611, but only in KB
+ 258978.
+
+ Either case, the official workaround is to add a new registry
+ DWORD value HKLM/System/CurrentControlSet/Services/Tcpip/...
+ ... Parameters/DisableUserTOSSetting, set to 0, and reboot.
+
+ Sidenote: The reasoning for dropping ToS in Win2K is that ToS
+ per RFC 1349 is incompatible with DiffServ per RFC 2474/2475.
+
+ We just ignore the return value of setting IP_TOS under Windows
+ 2000 and above entirely. */
+ if (level == IPPROTO_IP && optname == IP_TOS
+ && WSAGetLastError () == WSAEINVAL
+ && wincap.has_disabled_user_tos_setting ())
+ {
+ debug_printf ("Faked IP_TOS success");
+ res = 0;
+ }
+ else
+ set_winsock_errno ();
+ }
}
syscall_printf ("%d = setsockopt (%d, %d, %x, %p, %d)",
@@ -1750,11 +1767,6 @@ get_ifconf (struct ifconf *ifc, int what)
return -1;
}
- OSVERSIONINFO os_version_info;
-
- memset (&os_version_info, 0, sizeof os_version_info);
- os_version_info.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
- GetVersionEx (&os_version_info);
if (wincap.has_ip_helper_lib ())
get_2k_ifconf (ifc, what);
else if (wincap.is_winnt ())
diff --git a/winsup/cygwin/wincap.cc b/winsup/cygwin/wincap.cc
index 5c6b133e8..bd9fd780d 100644
--- a/winsup/cygwin/wincap.cc
+++ b/winsup/cygwin/wincap.cc
@@ -62,7 +62,8 @@ static NO_COPY wincaps wincap_unknown = {
detect_win16_exe:true,
has_null_console_handler_routine:false,
has_disk_ex_ioctls:false,
- has_working_virtual_lock:false
+ has_working_virtual_lock:false,
+ has_disabled_user_tos_setting:false
};
static NO_COPY wincaps wincap_95 = {
@@ -116,7 +117,8 @@ static NO_COPY wincaps wincap_95 = {
detect_win16_exe:true,
has_null_console_handler_routine:false,
has_disk_ex_ioctls:false,
- has_working_virtual_lock:false
+ has_working_virtual_lock:false,
+ has_disabled_user_tos_setting:false
};
static NO_COPY wincaps wincap_95osr2 = {
@@ -170,7 +172,8 @@ static NO_COPY wincaps wincap_95osr2 = {
detect_win16_exe:true,
has_null_console_handler_routine:false,
has_disk_ex_ioctls:false,
- has_working_virtual_lock:false
+ has_working_virtual_lock:false,
+ has_disabled_user_tos_setting:false
};
static NO_COPY wincaps wincap_98 = {
@@ -224,7 +227,8 @@ static NO_COPY wincaps wincap_98 = {
detect_win16_exe:true,
has_null_console_handler_routine:false,
has_disk_ex_ioctls:false,
- has_working_virtual_lock:false
+ has_working_virtual_lock:false,
+ has_disabled_user_tos_setting:false
};
static NO_COPY wincaps wincap_98se = {
@@ -278,7 +282,8 @@ static NO_COPY wincaps wincap_98se = {
detect_win16_exe:true,
has_null_console_handler_routine:false,
has_disk_ex_ioctls:false,
- has_working_virtual_lock:false
+ has_working_virtual_lock:false,
+ has_disabled_user_tos_setting:false
};
static NO_COPY wincaps wincap_me = {
@@ -332,7 +337,8 @@ static NO_COPY wincaps wincap_me = {
detect_win16_exe:true,
has_null_console_handler_routine:false,
has_disk_ex_ioctls:false,
- has_working_virtual_lock:false
+ has_working_virtual_lock:false,
+ has_disabled_user_tos_setting:false
};
static NO_COPY wincaps wincap_nt3 = {
@@ -386,7 +392,8 @@ static NO_COPY wincaps wincap_nt3 = {
detect_win16_exe:false,
has_null_console_handler_routine:true,
has_disk_ex_ioctls:false,
- has_working_virtual_lock:true
+ has_working_virtual_lock:true,
+ has_disabled_user_tos_setting:false
};
static NO_COPY wincaps wincap_nt4 = {
@@ -440,7 +447,8 @@ static NO_COPY wincaps wincap_nt4 = {
detect_win16_exe:false,
has_null_console_handler_routine:true,
has_disk_ex_ioctls:false,
- has_working_virtual_lock:true
+ has_working_virtual_lock:true,
+ has_disabled_user_tos_setting:false
};
static NO_COPY wincaps wincap_nt4sp4 = {
@@ -494,7 +502,8 @@ static NO_COPY wincaps wincap_nt4sp4 = {
detect_win16_exe:false,
has_null_console_handler_routine:true,
has_disk_ex_ioctls:false,
- has_working_virtual_lock:true
+ has_working_virtual_lock:true,
+ has_disabled_user_tos_setting:false
};
static NO_COPY wincaps wincap_2000 = {
@@ -548,7 +557,8 @@ static NO_COPY wincaps wincap_2000 = {
detect_win16_exe:false,
has_null_console_handler_routine:true,
has_disk_ex_ioctls:false,
- has_working_virtual_lock:true
+ has_working_virtual_lock:true,
+ has_disabled_user_tos_setting:true
};
static NO_COPY wincaps wincap_xp = {
@@ -602,7 +612,8 @@ static NO_COPY wincaps wincap_xp = {
detect_win16_exe:false,
has_null_console_handler_routine:true,
has_disk_ex_ioctls:true,
- has_working_virtual_lock:true
+ has_working_virtual_lock:true,
+ has_disabled_user_tos_setting:true
};
static NO_COPY wincaps wincap_2003 = {
@@ -656,7 +667,8 @@ static NO_COPY wincaps wincap_2003 = {
detect_win16_exe:false,
has_null_console_handler_routine:true,
has_disk_ex_ioctls:true,
- has_working_virtual_lock:true
+ has_working_virtual_lock:true,
+ has_disabled_user_tos_setting:true
};
static NO_COPY wincaps wincap_vista = {
@@ -710,7 +722,8 @@ static NO_COPY wincaps wincap_vista = {
detect_win16_exe:false,
has_null_console_handler_routine:true,
has_disk_ex_ioctls:true,
- has_working_virtual_lock:true
+ has_working_virtual_lock:true,
+ has_disabled_user_tos_setting:true
};
wincapc wincap __attribute__((section (".cygwin_dll_common"), shared));
diff --git a/winsup/cygwin/wincap.h b/winsup/cygwin/wincap.h
index ab8b4baa1..f14b274dd 100644
--- a/winsup/cygwin/wincap.h
+++ b/winsup/cygwin/wincap.h
@@ -64,6 +64,7 @@ struct wincaps
unsigned has_null_console_handler_routine : 1;
unsigned has_disk_ex_ioctls : 1;
unsigned has_working_virtual_lock : 1;
+ unsigned has_disabled_user_tos_setting : 1;
};
class wincapc
@@ -134,6 +135,7 @@ public:
bool IMPLEMENT (has_null_console_handler_routine)
bool IMPLEMENT (has_disk_ex_ioctls)
bool IMPLEMENT (has_working_virtual_lock)
+ bool IMPLEMENT (has_disabled_user_tos_setting)
#undef IMPLEMENT
};