{
struct test_tcp_txcounters *txcounters = (struct test_tcp_txcounters*)netif->state;
LWIP_UNUSED_ARG(ipaddr);
- txcounters->num_tx_calls++;
- txcounters->num_tx_bytes += p->tot_len;
- if (txcounters->copy_tx_packets) {
- struct pbuf *p_copy = pbuf_alloc(PBUF_LINK, p->tot_len, PBUF_RAM);
- err_t err;
- EXPECT(p_copy != NULL);
- err = pbuf_copy(p_copy, p);
- EXPECT(err == ERR_OK);
- if (txcounters->tx_packets == NULL) {
- txcounters->tx_packets = p_copy;
- } else {
- pbuf_cat(txcounters->tx_packets, p_copy);
+ if (txcounters != NULL)
+ {
+ txcounters->num_tx_calls++;
+ txcounters->num_tx_bytes += p->tot_len;
+ if (txcounters->copy_tx_packets) {
+ struct pbuf *p_copy = pbuf_alloc(PBUF_LINK, p->tot_len, PBUF_RAM);
+ err_t err;
+ EXPECT(p_copy != NULL);
+ err = pbuf_copy(p_copy, p);
+ EXPECT(err == ERR_OK);
+ if (txcounters->tx_packets == NULL) {
+ txcounters->tx_packets = p_copy;
+ } else {
+ pbuf_cat(txcounters->tx_packets, p_copy);
+ }
}
}
return ERR_OK;
{
struct netif *n;
memset(netif, 0, sizeof(struct netif));
- memset(txcounters, 0, sizeof(struct test_tcp_txcounters));
+ if (txcounters != NULL) {
+ memset(txcounters, 0, sizeof(struct test_tcp_txcounters));
+ netif->state = txcounters;
+ }
netif->output = test_tcp_netif_output;
- netif->state = txcounters;
netif->flags |= NETIF_FLAG_UP;
ip_addr_copy(netif->netmask, *netmask);
ip_addr_copy(netif->ip_addr, *ip_addr);
tcp_oos_teardown(void)
{
tcp_remove_all();
+ netif_list = NULL;
+ netif_default = NULL;
}
5, 6, 7, 8,
9, 10, 11, 12,
13, 14, 15, 16};
- ip_addr_t remote_ip, local_ip;
+ ip_addr_t remote_ip, local_ip, netmask;
u16_t data_len;
u16_t remote_port = 0x100, local_port = 0x101;
struct netif netif;
memset(&netif, 0, sizeof(netif));
IP4_ADDR(&local_ip, 192, 168, 1, 1);
IP4_ADDR(&remote_ip, 192, 168, 1, 2);
+ IP4_ADDR(&netmask, 255, 255, 255, 0);
+ test_tcp_init_netif(&netif, NULL, &local_ip, &netmask);
data_len = sizeof(data);
/* initialize counter struct */
memset(&counters, 0, sizeof(counters));
5, 6, 7, 8,
9, 10, 11, 12,
13, 14, 15, 16};
- ip_addr_t remote_ip, local_ip;
+ ip_addr_t remote_ip, local_ip, netmask;
u16_t data_len;
u16_t remote_port = 0x100, local_port = 0x101;
struct netif netif;
memset(&netif, 0, sizeof(netif));
IP4_ADDR(&local_ip, 192, 168, 1, 1);
IP4_ADDR(&remote_ip, 192, 168, 1, 2);
+ IP4_ADDR(&netmask, 255, 255, 255, 0);
+ test_tcp_init_netif(&netif, NULL, &local_ip, &netmask);
data_len = sizeof(data);
/* initialize counter struct */
memset(&counters, 0, sizeof(counters));
struct test_tcp_counters counters;
struct tcp_pcb* pcb;
struct pbuf *pinseq, *p_ovr;
- ip_addr_t remote_ip, local_ip;
+ ip_addr_t remote_ip, local_ip, netmask;
u16_t remote_port = 0x100, local_port = 0x101;
struct netif netif;
int datalen = 0;
memset(&netif, 0, sizeof(netif));
IP4_ADDR(&local_ip, 192, 168, 1, 1);
IP4_ADDR(&remote_ip, 192, 168, 1, 2);
+ IP4_ADDR(&netmask, 255, 255, 255, 0);
+ test_tcp_init_netif(&netif, NULL, &local_ip, &netmask);
/* initialize counter struct */
memset(&counters, 0, sizeof(counters));
counters.expected_data_len = TCP_WND;
struct test_tcp_counters counters;
struct tcp_pcb* pcb;
struct pbuf *p_ovr;
- ip_addr_t remote_ip, local_ip;
+ ip_addr_t remote_ip, local_ip, netmask;
u16_t remote_port = 0x100, local_port = 0x101;
struct netif netif;
int datalen = 0;
memset(&netif, 0, sizeof(netif));
IP4_ADDR(&local_ip, 192, 168, 1, 1);
IP4_ADDR(&remote_ip, 192, 168, 1, 2);
+ IP4_ADDR(&netmask, 255, 255, 255, 0);
+ test_tcp_init_netif(&netif, NULL, &local_ip, &netmask);
/* initialize counter struct */
memset(&counters, 0, sizeof(counters));
counters.expected_data_len = TCP_WND;
struct test_tcp_counters counters;
struct tcp_pcb* pcb;
struct pbuf *p_ovr;
- ip_addr_t remote_ip, local_ip;
+ ip_addr_t remote_ip, local_ip, netmask;
u16_t remote_port = 0x100, local_port = 0x101;
struct netif netif;
int datalen = 0;
memset(&netif, 0, sizeof(netif));
IP4_ADDR(&local_ip, 192, 168, 1, 1);
IP4_ADDR(&remote_ip, 192, 168, 1, 2);
+ IP4_ADDR(&netmask, 255, 255, 255, 0);
+ test_tcp_init_netif(&netif, NULL, &local_ip, &netmask);
/* initialize counter struct */
memset(&counters, 0, sizeof(counters));
counters.expected_data_len = TCP_WND;
struct test_tcp_counters counters;
struct tcp_pcb* pcb;
struct pbuf *p_normal_fin, *p_data_after_fin, *p, *p_2nd_fin_ooseq;
- ip_addr_t remote_ip, local_ip;
+ ip_addr_t remote_ip, local_ip, netmask;
u16_t remote_port = 0x100, local_port = 0x101;
struct netif netif;
u32_t exp_rx_calls = 0, exp_rx_bytes = 0, exp_close_calls = 0, exp_oos_pbufs = 0, exp_oos_tcplen = 0;
memset(&netif, 0, sizeof(netif));
IP4_ADDR(&local_ip, 192, 168, 1, 1);
IP4_ADDR(&remote_ip, 192, 168, 1, 2);
+ IP4_ADDR(&netmask, 255, 255, 255, 0);
+ test_tcp_init_netif(&netif, NULL, &local_ip, &netmask);
/* initialize counter struct */
memset(&counters, 0, sizeof(counters));
counters.expected_data_len = TCP_WND;