aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2020-02-10 17:44:13 +0000
committerJohn Lo <loj@cisco.com>2020-02-18 16:56:33 +0000
commitff19e3bf4fc10d17e3bafa798e6048ad473c6bd8 (patch)
tree8006344ab974399a04624b1c50b080a63af5b185
parentaa3886993c13d71d93ef01dc73b79985d6ec997f (diff)
tcp: allow custom mss on connects
Type: feature Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ie4bd68a387f706b3e6868bece2ec4c8c1d92a9c3
-rw-r--r--src/vnet/session/transport_types.h1
-rw-r--r--src/vnet/tcp/tcp.c5
2 files changed, 6 insertions, 0 deletions
diff --git a/src/vnet/session/transport_types.h b/src/vnet/session/transport_types.h
index 214a6380d88..459fb0c5833 100644
--- a/src/vnet/session/transport_types.h
+++ b/src/vnet/session/transport_types.h
@@ -184,6 +184,7 @@ typedef struct transport_endpoint_
#define foreach_transport_endpoint_cfg_fields \
foreach_transport_endpoint_fields \
_(transport_endpoint_t, peer) \
+ _(u16, mss) \
typedef struct transport_endpoint_pair_
{
diff --git a/src/vnet/tcp/tcp.c b/src/vnet/tcp/tcp.c
index f24ddb3a879..28231763da1 100644
--- a/src/vnet/tcp/tcp.c
+++ b/src/vnet/tcp/tcp.c
@@ -599,6 +599,10 @@ tcp_init_rcv_mss (tcp_connection_t * tc)
{
u8 ip_hdr_len;
+ /* Already provided at connection init time */
+ if (tc->mss)
+ return;
+
ip_hdr_len = tc->c_is_ip4 ? sizeof (ip4_header_t) : sizeof (ip6_header_t);
tc->mss = tcp_cfg.default_mtu - sizeof (tcp_header_t) - ip_hdr_len;
}
@@ -763,6 +767,7 @@ tcp_session_open (transport_endpoint_cfg_t * rmt)
tc->cc_algo = tcp_cc_algo_get (tcp_cfg.cc_algo);
/* The other connection vars will be initialized after SYN ACK */
tcp_connection_timers_init (tc);
+ tc->mss = rmt->mss;
TCP_EVT (TCP_EVT_OPEN, tc);
tc->state = TCP_STATE_SYN_SENT;