Cygwin: tcp: Support TCP_FASTOPEN
TCP_FASTOPEN is supported since W10 1607. Fake otherwise. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
parent
e037192b50
commit
0feb77c260
winsup/cygwin
|
@ -719,6 +719,7 @@ class fhandler_socket_inet: public fhandler_socket_wsock
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
bool oobinline; /* True if option SO_OOBINLINE is set */
|
bool oobinline; /* True if option SO_OOBINLINE is set */
|
||||||
|
bool tcp_fastopen; /* True if TCP_FASTOPEN is set on older systems */
|
||||||
protected:
|
protected:
|
||||||
int af_local_connect () { return 0; }
|
int af_local_connect () { return 0; }
|
||||||
|
|
||||||
|
|
|
@ -691,7 +691,8 @@ fhandler_socket_wsock::set_socket_handle (SOCKET sock, int af, int type,
|
||||||
|
|
||||||
fhandler_socket_inet::fhandler_socket_inet () :
|
fhandler_socket_inet::fhandler_socket_inet () :
|
||||||
fhandler_socket_wsock (),
|
fhandler_socket_wsock (),
|
||||||
oobinline (false)
|
oobinline (false),
|
||||||
|
tcp_fastopen (false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1693,6 +1694,20 @@ fhandler_socket_inet::setsockopt (int level, int optname, const void *optval,
|
||||||
ignore = true;
|
ignore = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case TCP_FASTOPEN:
|
||||||
|
/* Fake FastOpen on older systems. */
|
||||||
|
if (!wincap.has_tcp_fastopen ())
|
||||||
|
{
|
||||||
|
if (type != SOCK_STREAM)
|
||||||
|
{
|
||||||
|
set_errno (EOPNOTSUPP);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
ignore = true;
|
||||||
|
tcp_fastopen = *(int *) optval ? true : false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1825,6 +1840,29 @@ fhandler_socket_inet::getsockopt (int level, int optname, const void *optval,
|
||||||
optname = convert_ws1_ip_optname (optname);
|
optname = convert_ws1_ip_optname (optname);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case IPPROTO_TCP:
|
||||||
|
switch (optname)
|
||||||
|
{
|
||||||
|
case TCP_FASTOPEN:
|
||||||
|
/* Fake FastOpen on older systems */
|
||||||
|
if (!wincap.has_tcp_fastopen ())
|
||||||
|
{
|
||||||
|
if (type != SOCK_STREAM)
|
||||||
|
{
|
||||||
|
set_errno (EOPNOTSUPP);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
*(int *) optval = tcp_fastopen ? 1 : 0;
|
||||||
|
*optlen = sizeof (int);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1869,6 +1907,10 @@ fhandler_socket_inet::getsockopt (int level, int optname, const void *optval,
|
||||||
onebyte = true;
|
onebyte = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case TCP_FASTOPEN:
|
||||||
|
onebyte = true;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1881,8 +1923,7 @@ fhandler_socket_inet::getsockopt (int level, int optname, const void *optval,
|
||||||
/* Regression in Vista and later: instead of a 4 byte BOOL value, a
|
/* Regression in Vista and later: instead of a 4 byte BOOL value, a
|
||||||
1 byte BOOLEAN value is returned, in contrast to older systems and
|
1 byte BOOLEAN value is returned, in contrast to older systems and
|
||||||
the documentation. Since an int type is expected by the calling
|
the documentation. Since an int type is expected by the calling
|
||||||
application, we convert the result here. For some reason only three
|
application, we convert the result here. */
|
||||||
BSD-compatible socket options seem to be affected. */
|
|
||||||
BOOLEAN *in = (BOOLEAN *) optval;
|
BOOLEAN *in = (BOOLEAN *) optval;
|
||||||
int *out = (int *) optval;
|
int *out = (int *) optval;
|
||||||
*out = *in;
|
*out = *in;
|
||||||
|
|
|
@ -125,5 +125,6 @@ struct tcphdr {
|
||||||
*/
|
*/
|
||||||
#define TCP_NODELAY 0x01 /* don't delay send to coalesce packets */
|
#define TCP_NODELAY 0x01 /* don't delay send to coalesce packets */
|
||||||
#define TCP_MAXSEG 0x04 /* get maximum segment size (r/o on windows) */
|
#define TCP_MAXSEG 0x04 /* get maximum segment size (r/o on windows) */
|
||||||
|
#define TCP_FASTOPEN 0x0f /* enable FastOpen on listeners */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -46,6 +46,7 @@ wincaps wincap_vista __attribute__((section (".cygwin_dll_common"), shared)) = {
|
||||||
has_con_broken_il_dl:false,
|
has_con_broken_il_dl:false,
|
||||||
has_con_esc_rep:false,
|
has_con_esc_rep:false,
|
||||||
has_extended_mem_api:false,
|
has_extended_mem_api:false,
|
||||||
|
has_tcp_fastopen:false,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -77,6 +78,7 @@ wincaps wincap_7 __attribute__((section (".cygwin_dll_common"), shared)) = {
|
||||||
has_con_broken_il_dl:false,
|
has_con_broken_il_dl:false,
|
||||||
has_con_esc_rep:false,
|
has_con_esc_rep:false,
|
||||||
has_extended_mem_api:false,
|
has_extended_mem_api:false,
|
||||||
|
has_tcp_fastopen:false,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -108,6 +110,7 @@ wincaps wincap_8 __attribute__((section (".cygwin_dll_common"), shared)) = {
|
||||||
has_con_broken_il_dl:false,
|
has_con_broken_il_dl:false,
|
||||||
has_con_esc_rep:false,
|
has_con_esc_rep:false,
|
||||||
has_extended_mem_api:false,
|
has_extended_mem_api:false,
|
||||||
|
has_tcp_fastopen:false,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -139,6 +142,7 @@ wincaps wincap_8_1 __attribute__((section (".cygwin_dll_common"), shared)) = {
|
||||||
has_con_broken_il_dl:false,
|
has_con_broken_il_dl:false,
|
||||||
has_con_esc_rep:false,
|
has_con_esc_rep:false,
|
||||||
has_extended_mem_api:false,
|
has_extended_mem_api:false,
|
||||||
|
has_tcp_fastopen:false,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -170,6 +174,39 @@ wincaps wincap_10_1507 __attribute__((section (".cygwin_dll_common"), shared))
|
||||||
has_con_broken_il_dl:false,
|
has_con_broken_il_dl:false,
|
||||||
has_con_esc_rep:false,
|
has_con_esc_rep:false,
|
||||||
has_extended_mem_api:false,
|
has_extended_mem_api:false,
|
||||||
|
has_tcp_fastopen:false,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
wincaps wincap_10_1607 __attribute__((section (".cygwin_dll_common"), shared)) = {
|
||||||
|
def_guard_pages:2,
|
||||||
|
mmap_storage_high:0x700000000000LL,
|
||||||
|
{
|
||||||
|
is_server:false,
|
||||||
|
needs_count_in_si_lpres2:false,
|
||||||
|
needs_query_information:false,
|
||||||
|
has_gaa_largeaddress_bug:false,
|
||||||
|
has_broken_alloc_console:true,
|
||||||
|
has_console_logon_sid:true,
|
||||||
|
has_precise_system_time:true,
|
||||||
|
has_microsoft_accounts:true,
|
||||||
|
has_processor_groups:true,
|
||||||
|
has_broken_prefetchvm:true,
|
||||||
|
has_new_pebteb_region:false,
|
||||||
|
has_broken_whoami:false,
|
||||||
|
has_unprivileged_createsymlink:false,
|
||||||
|
has_unbiased_interrupt_time:true,
|
||||||
|
has_precise_interrupt_time:true,
|
||||||
|
has_posix_unlink_semantics:false,
|
||||||
|
has_case_sensitive_dirs:false,
|
||||||
|
has_posix_rename_semantics:false,
|
||||||
|
no_msv1_0_s4u_logon_in_wow64:false,
|
||||||
|
has_con_24bit_colors:false,
|
||||||
|
has_con_broken_csi3j:false,
|
||||||
|
has_con_broken_il_dl:false,
|
||||||
|
has_con_esc_rep:false,
|
||||||
|
has_extended_mem_api:false,
|
||||||
|
has_tcp_fastopen:true,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -201,6 +238,7 @@ wincaps wincap_10_1703 __attribute__((section (".cygwin_dll_common"), shared)) =
|
||||||
has_con_broken_il_dl:false,
|
has_con_broken_il_dl:false,
|
||||||
has_con_esc_rep:false,
|
has_con_esc_rep:false,
|
||||||
has_extended_mem_api:false,
|
has_extended_mem_api:false,
|
||||||
|
has_tcp_fastopen:true,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -232,6 +270,7 @@ wincaps wincap_10_1709 __attribute__((section (".cygwin_dll_common"), shared)) =
|
||||||
has_con_broken_il_dl:false,
|
has_con_broken_il_dl:false,
|
||||||
has_con_esc_rep:false,
|
has_con_esc_rep:false,
|
||||||
has_extended_mem_api:false,
|
has_extended_mem_api:false,
|
||||||
|
has_tcp_fastopen:true,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -263,6 +302,7 @@ wincaps wincap_10_1803 __attribute__((section (".cygwin_dll_common"), shared)) =
|
||||||
has_con_broken_il_dl:false,
|
has_con_broken_il_dl:false,
|
||||||
has_con_esc_rep:false,
|
has_con_esc_rep:false,
|
||||||
has_extended_mem_api:true,
|
has_extended_mem_api:true,
|
||||||
|
has_tcp_fastopen:true,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -294,6 +334,7 @@ wincaps wincap_10_1809 __attribute__((section (".cygwin_dll_common"), shared)) =
|
||||||
has_con_broken_il_dl:false,
|
has_con_broken_il_dl:false,
|
||||||
has_con_esc_rep:false,
|
has_con_esc_rep:false,
|
||||||
has_extended_mem_api:true,
|
has_extended_mem_api:true,
|
||||||
|
has_tcp_fastopen:true,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -325,6 +366,7 @@ wincaps wincap_10_1903 __attribute__((section (".cygwin_dll_common"), shared)) =
|
||||||
has_con_broken_il_dl:true,
|
has_con_broken_il_dl:true,
|
||||||
has_con_esc_rep:true,
|
has_con_esc_rep:true,
|
||||||
has_extended_mem_api:true,
|
has_extended_mem_api:true,
|
||||||
|
has_tcp_fastopen:true,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -378,6 +420,8 @@ wincapc::init ()
|
||||||
caps = &wincap_10_1709;
|
caps = &wincap_10_1709;
|
||||||
else if (version.dwBuildNumber >= 15063)
|
else if (version.dwBuildNumber >= 15063)
|
||||||
caps = &wincap_10_1703;
|
caps = &wincap_10_1703;
|
||||||
|
else if (version.dwBuildNumber >= 14393)
|
||||||
|
caps = &wincap_10_1607;
|
||||||
else
|
else
|
||||||
caps = & wincap_10_1507;
|
caps = & wincap_10_1507;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,7 @@ struct wincaps
|
||||||
unsigned has_con_broken_il_dl : 1;
|
unsigned has_con_broken_il_dl : 1;
|
||||||
unsigned has_con_esc_rep : 1;
|
unsigned has_con_esc_rep : 1;
|
||||||
unsigned has_extended_mem_api : 1;
|
unsigned has_extended_mem_api : 1;
|
||||||
|
unsigned has_tcp_fastopen : 1;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -103,6 +104,7 @@ public:
|
||||||
bool IMPLEMENT (has_con_broken_il_dl)
|
bool IMPLEMENT (has_con_broken_il_dl)
|
||||||
bool IMPLEMENT (has_con_esc_rep)
|
bool IMPLEMENT (has_con_esc_rep)
|
||||||
bool IMPLEMENT (has_extended_mem_api)
|
bool IMPLEMENT (has_extended_mem_api)
|
||||||
|
bool IMPLEMENT (has_tcp_fastopen)
|
||||||
|
|
||||||
void disable_case_sensitive_dirs ()
|
void disable_case_sensitive_dirs ()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue