* limitations under the License.
*/
#include <vnet/tcp/tcp.h>
+#include <vnet/tcp/tcp_inlines.h>
#define TCP_TEST_I(_cond, _comment, _args...) \
({ \
sb->last_sacked_bytes);
TCP_TEST ((sb->last_bytes_delivered == 0), "last bytes delivered %d",
sb->last_bytes_delivered);
+ /* Hole should be split in 2 lost holes that add up to 300 */
TCP_TEST ((sb->lost_bytes == 300), "lost bytes %u", sb->lost_bytes);
+ TCP_TEST ((sb->reorder == 7), "reorder %u", sb->reorder);
/*
* Ack [100 300] in two steps
sb->last_sacked_bytes);
TCP_TEST ((sb->last_bytes_delivered == 0), "last bytes delivered %d",
sb->last_bytes_delivered);
- TCP_TEST ((sb->lost_bytes == 200), "lost bytes %u", sb->lost_bytes);
+ /* No bytes lost because of reorder */
+ TCP_TEST ((sb->lost_bytes == 0), "lost bytes %u", sb->lost_bytes);
+ TCP_TEST ((sb->reorder == 7), "reorder %u", sb->reorder);
TCP_TEST ((!sb->is_reneging), "is not reneging");
/*
TCP_TEST ((sb->rxt_sacked == 300), "last rxt sacked bytes %d",
sb->rxt_sacked);
+ /*
+ * Restart
+ */
+ scoreboard_clear (sb);
+ vec_reset_length (tc->rcv_opts.sacks);
+
+ /*
+ * Broken sacks:
+ * block.start > snd_nxt
+ * && block.start < blk.end
+ * && block.end <= snd_nxt
+ */
+ tc->flags = 0;
+ block.start = 2147483647;
+ block.end = 4294967295;
+ vec_add1 (tc->rcv_opts.sacks, block);
+ tc->snd_una = tc->snd_nxt = 1969067947;
+
+ tcp_rcv_sacks (tc, tc->snd_una);
+
+ /*
+ * Clear
+ */
+ scoreboard_clear (sb);
+ vec_reset_length (tc->rcv_opts.sacks);
+
return 0;
}
tcp_test_lookup (vlib_main_t * vm, unformat_input_t * input)
{
session_main_t *smm = &session_main;
- tcp_main_t *tm = &tcp_main;
transport_connection_t _tc1, *tc1 = &_tc1, _tc2, *tc2 = &_tc2, *tconn;
tcp_connection_t *tc;
session_t *s, *s1;
clib_memset (s, 0, sizeof (*s));
s->session_index = sidx = s - smm->wrk[0].sessions;
- pool_get (tm->connections[0], tc);
- clib_memset (tc, 0, sizeof (*tc));
- tc->connection.c_index = tc - tm->connections[0];
+ tc = tcp_connection_alloc (0);
tc->connection.s_index = s->session_index;
s->connection_index = tc->connection.c_index;
clib_memset (s, 0, sizeof (*s));
s->session_index = s - smm->wrk[0].sessions;
- pool_get (tm->connections[0], tc);
- clib_memset (tc, 0, sizeof (*tc));
- tc->connection.c_index = tc - tm->connections[0];
+ tc = tcp_connection_alloc (0);
tc->connection.s_index = s->session_index;
s->connection_index = tc->connection.c_index;
tcp_connection_t *tc0;
ip4_address_t local, remote;
u16 local_port, remote_port;
- tcp_main_t *tm = vnet_get_tcp_main ();
int is_add = 1;
local_port = clib_host_to_net_u16 (1234);
remote_port = clib_host_to_net_u16 (11234);
- pool_get (tm->connections[0], tc0);
- clib_memset (tc0, 0, sizeof (*tc0));
+ tc0 = tcp_connection_alloc (0);
tc0->state = TCP_STATE_ESTABLISHED;
tc0->rcv_las = 1;
- tc0->c_c_index = tc0 - tm->connections[0];
tc0->c_lcl_port = local_port;
tc0->c_rmt_port = remote_port;
tc0->c_is_ip4 = 1;
{
int res = 0;
+ vnet_session_enable_disable (vm, 1);
+
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
{
if (unformat (input, "sack"))