net: tcp2: Extract the MSS from the TCP option value

Extract the maximum segment size (MSS) from the TCP option value.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
This commit is contained in:
Oleg Zhurakivskyy 2020-05-13 19:52:59 +03:00 committed by Carles Cufí
commit 58b7847afb
2 changed files with 6 additions and 1 deletions

View file

@ -433,8 +433,9 @@ static bool tcp_options_check(struct tcp_options *recv_options,
goto end;
}
recv_options->mss = opt;
recv_options->mss = ntohs(*((u16_t *)(options + 2)));
recv_options->mss_found = true;
NET_DBG("MSS=%hu", recv_options->mss);
break;
case TCPOPT_WINDOW:
if (opt_len != 3) {

View file

@ -77,6 +77,10 @@
#define conn_ack(_conn, _req) (_conn)->ack += (_req)
#endif
#define conn_mss(_conn) \
((_conn)->recv_options.mss_found ? \
(_conn)->recv_options.mss : NET_IPV6_MTU)
#define conn_state(_conn, _s) \
({ \
NET_DBG("%s->%s", \