7#if !LWIP_STATS || !TCP_STATS || !MEMP_STATS
8#error "This tests needs TCP- and MEMP-statistics enabled"
11#error "This tests needs TCP_QUEUE_OOSEQ enabled"
17#define CHECK_SEGMENTS_ON_OOSEQ 1
19#if CHECK_SEGMENTS_ON_OOSEQ
20#define EXPECT_OOSEQ(x) EXPECT(x)
22#define EXPECT_OOSEQ(x)
31 struct tcp_seg* seg = pcb->ooseq;
39#if TCP_OOSEQ_MAX_PBUFS && (TCP_OOSEQ_MAX_PBUFS < ((TCP_WND / TCP_MSS) + 1)) && (PBUF_POOL_BUFSIZE >= (TCP_MSS + PBUF_LINK_ENCAPSULATION_HLEN + PBUF_LINK_HLEN + PBUF_IP_HLEN + PBUF_TRANSPORT_HLEN))
41static int tcp_oos_pbuf_count(
struct tcp_pcb* pcb)
44 struct tcp_seg* seg = pcb->ooseq;
63 struct tcp_seg* seg = pcb->ooseq;
67 if(
num == seg_index) {
68 return seg->tcphdr->seqno;
87 struct tcp_seg* seg = pcb->ooseq;
91 if(
num == seg_index) {
92 return TCP_TCPLEN(seg);
110 struct tcp_seg* seg = pcb->ooseq;
114 len += TCP_TCPLEN(seg);
158 struct pbuf *p_8_9, *p_4_8, *p_4_10, *p_2_14, *p_fin, *pinseq;
170 data_len =
sizeof(
data);
173 counters.expected_data_len = data_len;
204 if ((pinseq !=
NULL) && (p_8_9 !=
NULL) && (p_4_8 !=
NULL) && (p_4_10 !=
NULL) && (p_2_14 !=
NULL) && (p_fin !=
NULL)) {
294 struct pbuf *p_1_2, *p_4_8, *p_3_11, *p_2_12, *p_15_1, *p_15_1a, *pinseq, *pinseqFIN;
306 data_len =
sizeof(
data);
309 counters.expected_data_len = data_len;
349 if ((pinseq !=
NULL) && (p_1_2 !=
NULL) && (p_4_8 !=
NULL) && (p_3_11 !=
NULL) && (p_2_12 !=
NULL)
350 && (p_15_1 !=
NULL) && (p_15_1a !=
NULL) && (pinseqFIN !=
NULL)) {
462#if !TCP_OOSEQ_MAX_BYTES && !TCP_OOSEQ_MAX_PBUFS
466 struct pbuf *pinseq, *p_ovr;
486 pcb->rcv_nxt = 0x8000;
493 int count, expected_datalen;
513 if (
datalen != expected_datalen) {
549#if !TCP_OOSEQ_MAX_BYTES && !TCP_OOSEQ_MAX_PBUFS
553 struct pbuf *pinseq, *p_ovr;
573 pcb->rcv_nxt = 0xffffffff - (
TCP_WND / 2);
580 int count, expected_datalen;
600 if (
datalen != expected_datalen) {
635#if TCP_OOSEQ_MAX_BYTES && (TCP_OOSEQ_MAX_BYTES < (TCP_WND + 1)) && (PBUF_POOL_BUFSIZE >= (TCP_MSS + PBUF_LINK_ENCAPSULATION_HLEN + PBUF_LINK_HLEN + PBUF_IP_HLEN + PBUF_TRANSPORT_HLEN))
659 pcb->rcv_nxt = 0x8000;
678 count = tcp_oos_pbuf_count(pcb);
710#if TCP_OOSEQ_MAX_PBUFS && (TCP_OOSEQ_MAX_PBUFS < ((TCP_WND / TCP_MSS) + 1)) && (PBUF_POOL_BUFSIZE >= (TCP_MSS + PBUF_LINK_ENCAPSULATION_HLEN + PBUF_LINK_HLEN + PBUF_IP_HLEN + PBUF_TRANSPORT_HLEN))
734 pcb->rcv_nxt = 0x8000;
753 count = tcp_oos_pbuf_count(pcb);
785 u32_t exp_rx_bytes,
u32_t exp_err_calls,
int exp_oos_count,
int exp_oos_len)
811 struct pbuf *p_normal_fin, *p_data_after_fin, *
p, *p_2nd_fin_ooseq;
813 u32_t exp_rx_calls = 0, exp_rx_bytes = 0, exp_close_calls = 0, exp_oos_pbufs = 0, exp_oos_tcplen = 0;
814 int first_dropped = 0xff;
831 pcb->rcv_nxt = 0x8000;
840 if(delay_packet & 1) {
852 if(delay_packet & 2) {
854 if(first_dropped > 2) {
860 if (first_dropped < 2) {
872 if(delay_packet & 4) {
874 if(first_dropped > 3) {
880 if (first_dropped < 3) {
882 if (delay_packet & 2) {
894 if(delay_packet & 8) {
896 if(first_dropped > 4) {
902 if (first_dropped < 3) {
904 if (delay_packet & 2) {
916 if(delay_packet & 1) {
921 if((delay_packet & 2) == 0) {
924 exp_oos_pbufs = exp_oos_tcplen = 0;
930 if(delay_packet & 2) {
934 exp_oos_pbufs = exp_oos_tcplen = 0;
939 if(delay_packet & 4) {
946 if(delay_packet & 8) {
964#define FIN_TEST(name, num) \
967 LWIP_UNUSED_ARG(_i); \
968 test_tcp_recv_ooseq_double_FINs(num); \
971FIN_TEST(test_tcp_recv_ooseq_double_FIN_0, 0)
972FIN_TEST(test_tcp_recv_ooseq_double_FIN_1, 1)
973FIN_TEST(test_tcp_recv_ooseq_double_FIN_2, 2)
974FIN_TEST(test_tcp_recv_ooseq_double_FIN_3, 3)
975FIN_TEST(test_tcp_recv_ooseq_double_FIN_4, 4)
976FIN_TEST(test_tcp_recv_ooseq_double_FIN_5, 5)
977FIN_TEST(test_tcp_recv_ooseq_double_FIN_6, 6)
978FIN_TEST(test_tcp_recv_ooseq_double_FIN_7, 7)
979FIN_TEST(test_tcp_recv_ooseq_double_FIN_8, 8)
980FIN_TEST(test_tcp_recv_ooseq_double_FIN_9, 9)
981FIN_TEST(test_tcp_recv_ooseq_double_FIN_10, 10)
982FIN_TEST(test_tcp_recv_ooseq_double_FIN_11, 11)
983FIN_TEST(test_tcp_recv_ooseq_double_FIN_12, 12)
984FIN_TEST(test_tcp_recv_ooseq_double_FIN_13, 13)
985FIN_TEST(test_tcp_recv_ooseq_double_FIN_14, 14)
986FIN_TEST(test_tcp_recv_ooseq_double_FIN_15, 15)
994 TESTFUNC(test_tcp_recv_ooseq_FIN_OOSEQ),
995 TESTFUNC(test_tcp_recv_ooseq_FIN_INSEQ),
996 TESTFUNC(test_tcp_recv_ooseq_overrun_rxwin),
997 TESTFUNC(test_tcp_recv_ooseq_overrun_rxwin_edge),
998 TESTFUNC(test_tcp_recv_ooseq_max_bytes),
999 TESTFUNC(test_tcp_recv_ooseq_max_pbufs),
1000 TESTFUNC(test_tcp_recv_ooseq_double_FIN_0),
1001 TESTFUNC(test_tcp_recv_ooseq_double_FIN_1),
1002 TESTFUNC(test_tcp_recv_ooseq_double_FIN_2),
1003 TESTFUNC(test_tcp_recv_ooseq_double_FIN_3),
1004 TESTFUNC(test_tcp_recv_ooseq_double_FIN_4),
1005 TESTFUNC(test_tcp_recv_ooseq_double_FIN_5),
1006 TESTFUNC(test_tcp_recv_ooseq_double_FIN_6),
1007 TESTFUNC(test_tcp_recv_ooseq_double_FIN_7),
1008 TESTFUNC(test_tcp_recv_ooseq_double_FIN_8),
1009 TESTFUNC(test_tcp_recv_ooseq_double_FIN_9),
1010 TESTFUNC(test_tcp_recv_ooseq_double_FIN_10),
1011 TESTFUNC(test_tcp_recv_ooseq_double_FIN_11),
1012 TESTFUNC(test_tcp_recv_ooseq_double_FIN_12),
1013 TESTFUNC(test_tcp_recv_ooseq_double_FIN_13),
1014 TESTFUNC(test_tcp_recv_ooseq_double_FIN_14),
1015 TESTFUNC(test_tcp_recv_ooseq_double_FIN_15)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
GLuint GLuint GLsizei count
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLint GLint GLsizei GLuint * counters
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define LWIP_UNUSED_ARG(x)
#define TCP_OOSEQ_MAX_PBUFS
#define TCP_OOSEQ_MAX_BYTES
int const JOCTET unsigned int datalen
Suite * create_suite(const char *name, testfunc *tests, size_t num_tests, SFun setup, SFun teardown)
void lwip_check_ensure_no_alloc(unsigned int skip)
static struct test_info tests[]
struct netif * netif_list
struct netif * netif_default
u16_t pbuf_clen(const struct pbuf *p)
#define MEMP_STATS_GET(x, i)
void test_tcp_init_netif(struct netif *netif, struct test_tcp_txcounters *txcounters, const ip_addr_t *ip_addr, const ip_addr_t *netmask)
void test_tcp_input(struct pbuf *p, struct netif *inp)
struct pbuf * tcp_create_rx_segment(struct tcp_pcb *pcb, void *data, size_t data_len, u32_t seqno_offset, u32_t ackno_offset, u8_t headerflags)
struct tcp_pcb * test_tcp_new_counters_pcb(struct test_tcp_counters *counters)
void tcp_remove_all(void)
const ip_addr_t test_local_ip
const ip_addr_t test_remote_ip
static __inline void tcp_set_state(struct sock *sk, int state)
static ip4_addr_t test_netmask
static int tcp_oos_seg_tcplen(struct tcp_pcb *pcb, int seg_index)
static END_TEST void check_rx_counters(struct tcp_pcb *pcb, struct test_tcp_counters *counters, u32_t exp_close_calls, u32_t exp_rx_calls, u32_t exp_rx_bytes, u32_t exp_err_calls, int exp_oos_count, int exp_oos_len)
static void test_tcp_recv_ooseq_double_FINs(int delay_packet)
#define FIN_TEST(name, num)
Suite * tcp_oos_suite(void)
static END_TEST char data_full_wnd[TCP_WND+TCP_MSS]
static int tcp_oos_tcplen(struct tcp_pcb *pcb)
static void tcp_oos_setup(void)
static struct netif * old_netif_list
static struct netif * old_netif_default
static void tcp_oos_teardown(void)
static int tcp_oos_count(struct tcp_pcb *pcb)
static u32_t tcp_oos_seg_seqno(struct tcp_pcb *pcb, int seg_index)