diff --git a/docs/tcp.html b/docs/tcp.html
index 9cc173e..f15196c 100644
--- a/docs/tcp.html
+++ b/docs/tcp.html
@@ -485,6 +485,10 @@ disables the Nagle's algorithm for the connection;
'tcp-keepintvl': value for TCP_KEEPINTVL Linux only!!
+ 'tcp-fastopen': value for TCP_FASTOPEN Linux only!!
+
+ 'tcp-fastopen-connect': value for TCP_FASTOPEN_CONNECT Linux only!!
+
'ipv6-v6only':
Setting this option to true restricts an inet6 socket to
sending and receiving only IPv6 packets.
diff --git a/src/options.c b/src/options.c
index 2b53c67..51ea351 100644
--- a/src/options.c
+++ b/src/options.c
@@ -190,6 +190,22 @@ int opt_set_send_buf_size(lua_State *L, p_socket ps)
return opt_setint(L, ps, SOL_SOCKET, SO_SNDBUF);
}
+// /*------------------------------------------------------*/
+
+#ifdef TCP_FASTOPEN
+int opt_set_tcp_fastopen(lua_State *L, p_socket ps)
+{
+ return opt_setint(L, ps, IPPROTO_TCP, TCP_FASTOPEN);
+}
+#endif
+
+#ifdef TCP_FASTOPEN_CONNECT
+int opt_set_tcp_fastopen_connect(lua_State *L, p_socket ps)
+{
+ return opt_setint(L, ps, IPPROTO_TCP, TCP_FASTOPEN_CONNECT);
+}
+#endif
+
/*------------------------------------------------------*/
int opt_set_ip6_unicast_hops(lua_State *L, p_socket ps)
{
diff --git a/src/options.h b/src/options.h
index 41f7337..a4d5d75 100644
--- a/src/options.h
+++ b/src/options.h
@@ -64,6 +64,13 @@ int opt_get_recv_buf_size(lua_State *L, p_socket ps);
int opt_set_send_buf_size(lua_State *L, p_socket ps);
int opt_get_send_buf_size(lua_State *L, p_socket ps);
+#ifdef TCP_FASTOPEN
+int opt_set_tcp_fastopen(lua_State *L, p_socket ps);
+#endif
+#ifdef TCP_FASTOPEN_CONNECT
+int opt_set_tcp_fastopen_connect(lua_State *L, p_socket ps);
+#endif
+
int opt_set_ip6_unicast_hops(lua_State *L, p_socket ps);
int opt_get_ip6_unicast_hops(lua_State *L, p_socket ps);
diff --git a/src/tcp.c b/src/tcp.c
index 5876bfb..e24cb0c 100644
--- a/src/tcp.c
+++ b/src/tcp.c
@@ -109,6 +109,12 @@ static t_opt optset[] = {
{"linger", opt_set_linger},
{"recv-buffer-size", opt_set_recv_buf_size},
{"send-buffer-size", opt_set_send_buf_size},
+#ifdef TCP_FASTOPEN
+ {"tcp-fastopen", opt_set_tcp_fastopen},
+#endif
+#ifdef TCP_FASTOPEN_CONNECT
+ {"tcp-fastopen-connect", opt_set_tcp_fastopen_connect},
+#endif
{NULL, NULL}
};