From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 95284 invoked by alias); 24 Aug 2018 13:10:39 -0000 Mailing-List: contact newlib-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: newlib-cvs-owner@sourceware.org Received: (qmail 94531 invoked by uid 10080); 24 Aug 2018 13:10:38 -0000 Date: Fri, 24 Aug 2018 13:10:00 -0000 Message-ID: <20180824131038.94528.qmail@sourceware.org> Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Sebastian Huber To: newlib-cvs@sourceware.org Subject: [newlib-cygwin] This is an implementation of the client side of TCP Fast Open (TFO) X-Act-Checkin: newlib-cygwin X-Git-Author: pkelsey X-Git-Refname: refs/heads/master X-Git-Oldrev: b43341334e42b30994380f74ec7c7bda4407a666 X-Git-Newrev: b4d6660d85b244191d2e507e9bdaba14ed9cca12 X-SW-Source: 2018-q3/txt/msg00074.txt.bz2 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=b4d6660d85b244191d2e507e9bdaba14ed9cca12 commit b4d6660d85b244191d2e507e9bdaba14ed9cca12 Author: pkelsey Date: Mon Feb 26 02:53:22 2018 +0000 This is an implementation of the client side of TCP Fast Open (TFO) [RFC7413]. It also includes a pre-shared key mode of operation in which the server requires the client to be in possession of a shared secret in order to successfully open TFO connections with that server. The names of some existing fastopen sysctls have changed (e.g., net.inet.tcp.fastopen.enabled -> net.inet.tcp.fastopen.server_enable). Reviewed by: tuexen MFC after: 1 month Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D14047 Diff: --- newlib/libc/sys/rtems/include/netinet/tcp.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/newlib/libc/sys/rtems/include/netinet/tcp.h b/newlib/libc/sys/rtems/include/netinet/tcp.h index 7eb4e9a..4c1c9d4 100644 --- a/newlib/libc/sys/rtems/include/netinet/tcp.h +++ b/newlib/libc/sys/rtems/include/netinet/tcp.h @@ -101,8 +101,6 @@ struct tcphdr { #define TCPOLEN_SIGNATURE 18 #define TCPOPT_FAST_OPEN 34 #define TCPOLEN_FAST_OPEN_EMPTY 2 -#define TCPOLEN_FAST_OPEN_MIN 6 -#define TCPOLEN_FAST_OPEN_MAX 18 /* Miscellaneous constants */ #define MAX_SACK_BLKS 6 /* Max # SACK blocks stored at receiver side */ @@ -152,6 +150,10 @@ struct tcphdr { #define TCP_MAXHLEN (0xf<<2) /* max length of header in bytes */ #define TCP_MAXOLEN (TCP_MAXHLEN - sizeof(struct tcphdr)) /* max space left for options */ + +#define TCP_FASTOPEN_MIN_COOKIE_LEN 4 /* Per RFC7413 */ +#define TCP_FASTOPEN_MAX_COOKIE_LEN 16 /* Per RFC7413 */ +#define TCP_FASTOPEN_PSK_LEN 16 /* Same as TCP_FASTOPEN_KEY_LEN */ #endif /* __BSD_VISIBLE */ /* @@ -252,6 +254,16 @@ struct tcp_info { /* Padding to grow without breaking ABI. */ u_int32_t __tcpi_pad[26]; /* Padding. */ }; + +/* + * If this structure is provided when setting the TCP_FASTOPEN socket + * option, and the enable member is non-zero, a subsequent connect will use + * pre-shared key (PSK) mode using the provided key. + */ +struct tcp_fastopen { + int enable; + uint8_t psk[TCP_FASTOPEN_PSK_LEN]; +}; #endif #define TCP_FUNCTION_NAME_LEN_MAX 32