tcp: fix handling of broken syn options

Change-Id: Ia8b2a077ba4897ddd15cf33221b191cd7a3f1d33
Signed-off-by: Florin Coras <fcoras@cisco.com>
This commit is contained in:
Florin Coras
2018-12-16 20:57:29 -08:00
committed by Florin Coras
parent 91236ce011
commit 8124cb7840
4 changed files with 15 additions and 5 deletions

View File

@ -246,7 +246,7 @@ tcp_connection_del (tcp_connection_t * tc)
}
tcp_connection_t *
tcp_connection_new (u8 thread_index)
tcp_connection_alloc (u8 thread_index)
{
tcp_main_t *tm = vnet_get_tcp_main ();
tcp_connection_t *tc;
@ -258,6 +258,15 @@ tcp_connection_new (u8 thread_index)
return tc;
}
void
tcp_connection_free (tcp_connection_t * tc)
{
tcp_main_t *tm = &tcp_main;
pool_put (tm->connections[tc->c_thread_index], tc);
if (CLIB_DEBUG > 0)
clib_memset (tc, 0xFA, sizeof (*tc));
}
/** Notify session that connection has been reset.
*
* Switch state to closed and wait for session to call cleanup.

View File

@ -565,7 +565,8 @@ void tcp_connection_close (tcp_connection_t * tc);
void tcp_connection_cleanup (tcp_connection_t * tc);
void tcp_connection_del (tcp_connection_t * tc);
int tcp_half_open_connection_cleanup (tcp_connection_t * tc);
tcp_connection_t *tcp_connection_new (u8 thread_index);
tcp_connection_t *tcp_connection_alloc (u8 thread_index);
void tcp_connection_free (tcp_connection_t * tc);
void tcp_connection_reset (tcp_connection_t * tc);
int tcp_configure_v4_source_address_range (vlib_main_t * vm,
ip4_address_t * start,

View File

@ -3097,7 +3097,7 @@ tcp46_listen_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
}
/* Create child session and send SYN-ACK */
child0 = tcp_connection_new (my_thread_index);
child0 = tcp_connection_alloc (my_thread_index);
child0->c_lcl_port = th0->dst_port;
child0->c_rmt_port = th0->src_port;
child0->c_is_ip4 = is_ip4;
@ -3119,7 +3119,8 @@ tcp46_listen_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
if (tcp_options_parse (th0, &child0->rcv_opts, 1))
{
clib_warning ("options parse fail");
error0 = TCP_ERROR_OPTIONS;
tcp_connection_free (child0);
goto drop;
}

View File

@ -447,7 +447,6 @@ tcp_init_mss (tcp_connection_t * tc)
if (tc->snd_mss < 45)
{
clib_warning ("snd mss is 0");
/* Assume that at least the min default mss works */
tc->snd_mss = default_min_mss;
tc->rcv_opts.mss = default_min_mss;