[LWIP] Correctly synchronize to lwIP 1.4.1 (#6123)

* [TCPIP] Rename lwip library to lwipcore

* [TCPIP] Remove ReactOS-specific code from LWIP library

* [TCPIP] Synchronize LWIP code to 1.4.1

Update to LWIP 1.4.1 should have been done by bd3b0e8ef4
However, I was unable to find the exact revision used in this commit.

So, do the following
- take code from STABLE-1_4_1 commit on https://git.savannah.gnu.org/git/lwip.git
- cherry-pick LWIP 32aa9a41e2013e5ee6eee09317a848647e37badf (CORE-8978)
- cherry-pick LWIP c0b534e5318baf870e2152c70d4d11a3a86181f3
- add a ReactOS-specific change in src/api/tcpip.c (missing include)
- add ReactOS specific file CMakeLists.txt

NOTE: Changes are mostly in unit test files (not used) and CHANGELOG file.

CORE-7140
This commit is contained in:
hpoussin 2023-12-29 13:05:41 +01:00 committed by GitHub
parent d8108a64a4
commit 9cfd8dd918
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
126 changed files with 2251 additions and 1554 deletions

View file

@ -1,4 +1,9 @@
set(LWIP_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lwip)
set(LWIP_INCLUDE_DIRS
${LWIP_DIR}/src/include
${CMAKE_CURRENT_SOURCE_DIR}/include/lwip
)
add_subdirectory(lwip)
add_subdirectory(ip)
@ -25,7 +30,7 @@ list(APPEND SOURCE
tcpip/proto.c
tcpip/tinfo.c
tcpip/wait.c
include/precomp.h)
include/lwip/precomp.h)
add_library(tcpip MODULE
${SOURCE}
@ -33,10 +38,11 @@ add_library(tcpip MODULE
${CMAKE_CURRENT_BINARY_DIR}/tcpip.def)
target_include_directories(tcpip BEFORE
PRIVATE ${LWIP_INCLUDE_DIRS}
PRIVATE include)
target_link_libraries(tcpip ip ${PSEH_LIB})
set_module_type(tcpip kernelmodedriver)
add_importlibs(tcpip ndis ntoskrnl hal)
add_pch(tcpip include/precomp.h SOURCE)
add_pch(tcpip include/lwip/precomp.h SOURCE)
add_cd_file(TARGET tcpip DESTINATION reactos/system32/drivers FOR all)

View file

@ -1,6 +1,6 @@
#ifndef _LWIP_PCH_
#define _LWIP_PCH_
#include "src/include/lwip/opt.h"
#include "lwip/opt.h"
#endif /* _LWIP_PCH_ */

View file

@ -31,9 +31,10 @@ list(APPEND SOURCE
add_library(ip OBJECT ${SOURCE} ${ip_asm})
target_link_libraries(ip lwip)
target_link_libraries(ip lwipcore)
target_include_directories(ip BEFORE
PRIVATE ${LWIP_INCLUDE_DIRS}
PRIVATE ${REACTOS_SOURCE_DIR}/drivers/network/tcpip/include)
add_pch(ip precomp.h SOURCE)

View file

@ -55,43 +55,17 @@ HISTORY
Also added code to allow ip_forward() to forward non-broadcast packets to
the input netif (set IP_FORWARD_ALLOW_TX_ON_RX_NETIF==1).
2011-07-21: Simon Goldschmidt
* sockets.c, opt.h: (bug #30185): added LWIP_FIONREAD_LINUXMODE that makes
ioctl/FIONREAD return the size of the next pending datagram.
2011-06-26: Simon Goldschmidt (patch by Cameron Gutman)
* tcp.c, tcp_out.c: bug #33604: added some more asserts to check that
pcb->state != LISTEN
2011-05-25: Simon Goldschmidt
* again nearly the whole stack, renamed ip.c to ip4.c, ip_addr.c to ip4_addr.c,
combined ipv4/ipv6 inet_chksum.c, added ip.h, ip_addr.h: Combined IPv4
and IPv6 code where possible, added defines to access IPv4/IPv6 in non-IP
code so that the code is more readable.
2011-05-17: Patch by Ivan Delamer (only checked in by Simon Goldschmidt)
* nearly the whole stack: Finally, we got decent IPv6 support, big thanks to
Ivan! (this is work in progress: we're just post release anyway :-)
2011-05-14: Simon Goldschmidt (patch by St?phane Lesage)
2011-05-14: Simon Goldschmidt (patch by Stéphane Lesage)
* tcpip.c/.h: patch #7449 allow tcpip callback from interrupt with static
memory message
++ Bugfixes:
2013-01-15: Simon Goldschmidt
* ip4.c: fixed bug #37665 ip_canforward operates on address in wrong byte order
2013-01-15: Simon Goldschmidt
* pbuf.h: fixed bug #38097 pbuf_free_ooseq() warning
2013-01-14: Simon Goldschmidt
* dns.c: fixed bug #37705 Possible memory corruption in DNS query
2013-01-11: Simon Goldschmidt
* raw.c: fixed bug #38066 Raw pcbs can alter packet without eating it
2012-09-26: Simon Goldschmidt
* api_msg.c: fixed bug #37405 'err_tcp()' uses already freed 'netconn' object
@ -104,33 +78,10 @@ HISTORY
2012-08-22: Simon Goldschmidt
* memp.c: fixed bug #37166: memp_sanity check loops itself
2012-08-13: Simon Goldschmidt
* dhcp.c: fixed bug #36645: Calling dhcp_release before dhcp_start
dereferences NULL
2012-08-13: Simon Goldschmidt
* msg_out.c: fixed bug #36840 snmp_send_trap() NULL de-reference if traps
configured but no interfaces available
2012-08-13: Simon Goldschmidt
* dns.c: fixed bug #36899 DNS TTL 0 is cached for a long time
2012-05-11: Simon Goldschmidt (patch by Marty)
* memp.c: fixed bug #36412: memp.c does not compile when
MEMP_OVERFLOW_CHECK > zero and MEMP_SEPARATE_POOLS == 1
2012-05-08: Simon Goldschmidt
* tcp_out.c: fixed bug #36380: unsent_oversize mismatch in 1.4.1RC1 (this was
* tcp_out.c: fixed bug: #36380 unsent_oversize mismatch in 1.4.1RC1 (this was
a debug-check issue only)
2012-05-03: Simon Goldschmidt (patch by Sylvain Rochet)
* ppp.c: fixed bug #36283 (PPP struct used on header size computation and
not packed)
2012-05-03: Simon Goldschmidt (patch by David Empson)
* ppp.c: fixed bug #36388 (PPP: checksum-only in last pbuf leads to pbuf with
zero length)
2012-03-27: Simon Goldschmidt
* vj.c: fixed bug #35756 header length calculation problem in ppp/vj.c
@ -138,14 +89,6 @@ HISTORY
* tcp_out.c: fixed bug #35945: SYN packet should provide the recv MSS not the
send MSS
2012-03-25: Simon Goldschmidt
* api_msg.c: Fixed bug #35817: do_connect() invalidly signals op_completed
for UDP/RAW with LWIP_TCPIP_CORE_LOCKING==1
2012-03-25: Simon Goldschmidt
* api_msg.h, api_lib.c, api_msg.c, netifapi.c: fixed bug #35931: Name space
pollution in api_msg.c and netifapi.c
2012-03-22: Simon Goldschmidt
* ip4.c: fixed bug #35927: missing refragmentaion in ip_forward
@ -168,7 +111,7 @@ HISTORY
* etharp.c: fixed bug #35531: Impossible to send multicast without a gateway
(introduced when fixing bug# 33551)
2012-02-16: Simon Goldschmidt (patch by St?phane Lesage)
2012-02-16: Simon Goldschmidt (patch by Stéphane Lesage)
* msg_in.c, msg_out.c: fixed bug #35536 SNMP: error too big response is malformed
2012-02-15: Simon Goldschmidt
@ -304,9 +247,6 @@ HISTORY
2011-09-01: Simon Goldschmidt
* tcp_in.c: fixed bug #34111 RST for ACK to listening pcb has wrong seqno
2011-08-24: Simon Goldschmidt
* inet6.h: fixed bug #34124 struct in6_addr does not conform to the standard
2011-08-24: Simon Goldschmidt
* api_msg.c, sockets.c: fixed bug #33956 Wrong error returned when calling
accept() on UDP connections
@ -356,6 +296,9 @@ HISTORY
2011-06-26: Simon Goldschmidt
* mem.c: fixed bug #33544 "warning in mem.c in lwip 1.4.0 with NO_SYS=1"
2011-05-25: Simon Goldschmidt
* tcp.c: fixed bug #33398 (pointless conversion when checking TCP port range)
(STABLE-1.4.0)

View file

@ -43,15 +43,14 @@ list(APPEND SOURCE
src/core/snmp/msg_in.c
src/core/snmp/msg_out.c)
add_library(lwip ${SOURCE})
add_library(lwipcore ${SOURCE})
target_include_directories(lwip
PUBLIC src/include
target_include_directories(lwipcore
PRIVATE ${LWIP_INCLUDE_DIRS}
PUBLIC src/include/ipv4)
add_dependencies(lwip bugcodes xdk)
add_pch(lwip precomp.h SOURCE)
add_dependencies(lwipcore bugcodes xdk)
if(NOT MSVC)
target_compile_options(lwip PRIVATE -fno-builtin-malloc -fno-builtin-free)
target_compile_options(lwipcore PRIVATE -fno-builtin-malloc -fno-builtin-free)
endif()

View file

@ -46,7 +46,9 @@
#include "lwip/pbuf.h"
#include "lwip/tcpip.h"
#include "lwip/init.h"
#ifdef __REACTOS__
#include "lwip/ip.h"
#endif
#include "netif/etharp.h"
#include "netif/ppp_oe.h"

View file

@ -47,7 +47,7 @@ extern "C" {
/** For release candidates, this is set to 1..254
* For official releases, this is set to 255 (LWIP_RC_RELEASE)
* For development versions (CVS), this is set to 0 (LWIP_RC_DEVELOPMENT) */
#define LWIP_VERSION_RC 255U
#define LWIP_VERSION_RC 0U
/** LWIP_VERSION_RC is set to LWIP_RC_RELEASE for official releases */
#define LWIP_RC_RELEASE 255U

View file

@ -1,7 +1,9 @@
/**
* @file
* This file is a posix wrapper for lwip/netdb.h.
*/
/*
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
@ -26,28 +28,6 @@
*
* This file is part of the lwIP TCP/IP stack.
*
* Author: Adam Dunkels <adam@sics.se>
*
*/
#ifndef __NETIF_LOOPIF_H__
#define __NETIF_LOOPIF_H__
#include "lwip/opt.h"
#include "lwip/netif.h"
#include "lwip/err.h"
#ifdef __cplusplus
extern "C" {
#endif
#if !LWIP_NETIF_LOOPBACK_MULTITHREADING
#define loopif_poll netif_poll
#endif /* !LWIP_NETIF_LOOPBACK_MULTITHREADING */
err_t loopif_init(struct netif *netif);
#ifdef __cplusplus
}
#endif
#endif /* __NETIF_LOOPIF_H__ */
#include "lwip/netdb.h"

View file

@ -0,0 +1,33 @@
/**
* @file
* This file is a posix wrapper for lwip/sockets.h.
*/
/*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*
* This file is part of the lwIP TCP/IP stack.
*
*/
#include "lwip/sockets.h"

View file

@ -0,0 +1,363 @@
/*****************************************************************************
* ppp.h - Network Point to Point Protocol header file.
*
* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc.
* portions Copyright (c) 1997 Global Election Systems Inc.
*
* The authors hereby grant permission to use, copy, modify, distribute,
* and license this software and its documentation for any purpose, provided
* that existing copyright notices are retained in all copies and that this
* notice and the following disclaimer are included verbatim in any
* distributions. No written agreement, license, or royalty fee is required
* for any of the authorized uses.
*
* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
* REVISION HISTORY
*
* 03-01-01 Marc Boucher <marc@mbsi.ca>
* Ported to lwIP.
* 97-11-05 Guy Lancaster <glanca@gesn.com>, Global Election Systems Inc.
* Original derived from BSD codes.
*****************************************************************************/
#ifndef PPP_IMPL_H
#define PPP_IMPL_H
#include "lwip/opt.h"
#if PPP_SUPPORT /* don't build if not configured for use in lwipopts.h */
#include "ppp.h"
#include "lwip/def.h"
#include "lwip/sio.h"
#include "lwip/stats.h"
#include "lwip/mem.h"
#include "lwip/netif.h"
#include "lwip/sys.h"
#include "lwip/timers.h"
/** Some defines for code we skip compared to the original pppd.
* These are just here to minimise the use of the ugly "#if 0". */
#define PPP_ADDITIONAL_CALLBACKS 0
/** Some error checks to test for unsupported code */
#if CBCP_SUPPORT
#error "CBCP is not supported in lwIP PPP"
#endif
#if CCP_SUPPORT
#error "CCP is not supported in lwIP PPP"
#endif
/*
* pppd.h - PPP daemon global declarations.
*
* Copyright (c) 1989 Carnegie Mellon University.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by Carnegie Mellon University. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
*/
/*
* ppp_defs.h - PPP definitions.
*
* Copyright (c) 1994 The Australian National University.
* All rights reserved.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation is hereby granted, provided that the above copyright
* notice appears in all copies. This software is provided without any
* warranty, express or implied. The Australian National University
* makes no representations about the suitability of this software for
* any purpose.
*
* IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY
* PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
* THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*
* THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO
* OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
* OR MODIFICATIONS.
*/
#define TIMEOUT(f, a, t) do { sys_untimeout((f), (a)); sys_timeout((t)*1000, (f), (a)); } while(0)
#define UNTIMEOUT(f, a) sys_untimeout((f), (a))
/*
* Constants and structures defined by the internet system,
* Per RFC 790, September 1981, and numerous additions.
*/
/*
* The basic PPP frame.
*/
#define PPP_HDRLEN 4 /* octets for standard ppp header */
#define PPP_FCSLEN 2 /* octets for FCS */
/*
* Significant octet values.
*/
#define PPP_ALLSTATIONS 0xff /* All-Stations broadcast address */
#define PPP_UI 0x03 /* Unnumbered Information */
#define PPP_FLAG 0x7e /* Flag Sequence */
#define PPP_ESCAPE 0x7d /* Asynchronous Control Escape */
#define PPP_TRANS 0x20 /* Asynchronous transparency modifier */
/*
* Protocol field values.
*/
#define PPP_IP 0x21 /* Internet Protocol */
#define PPP_AT 0x29 /* AppleTalk Protocol */
#define PPP_VJC_COMP 0x2d /* VJ compressed TCP */
#define PPP_VJC_UNCOMP 0x2f /* VJ uncompressed TCP */
#define PPP_COMP 0xfd /* compressed packet */
#define PPP_IPCP 0x8021 /* IP Control Protocol */
#define PPP_ATCP 0x8029 /* AppleTalk Control Protocol */
#define PPP_CCP 0x80fd /* Compression Control Protocol */
#define PPP_LCP 0xc021 /* Link Control Protocol */
#define PPP_PAP 0xc023 /* Password Authentication Protocol */
#define PPP_LQR 0xc025 /* Link Quality Report protocol */
#define PPP_CHAP 0xc223 /* Cryptographic Handshake Auth. Protocol */
#define PPP_CBCP 0xc029 /* Callback Control Protocol */
/*
* Values for FCS calculations.
*/
#define PPP_INITFCS 0xffff /* Initial FCS value */
#define PPP_GOODFCS 0xf0b8 /* Good final FCS value */
#define PPP_FCS(fcs, c) (((fcs) >> 8) ^ fcstab[((fcs) ^ (c)) & 0xff])
/*
* Extended asyncmap - allows any character to be escaped.
*/
typedef u_char ext_accm[32];
/*
* What to do with network protocol (NP) packets.
*/
enum NPmode {
NPMODE_PASS, /* pass the packet through */
NPMODE_DROP, /* silently drop the packet */
NPMODE_ERROR, /* return an error */
NPMODE_QUEUE /* save it up for later. */
};
/*
* Inline versions of get/put char/short/long.
* Pointer is advanced; we assume that both arguments
* are lvalues and will already be in registers.
* cp MUST be u_char *.
*/
#define GETCHAR(c, cp) { \
(c) = *(cp)++; \
}
#define PUTCHAR(c, cp) { \
*(cp)++ = (u_char) (c); \
}
#define GETSHORT(s, cp) { \
(s) = *(cp); (cp)++; (s) <<= 8; \
(s) |= *(cp); (cp)++; \
}
#define PUTSHORT(s, cp) { \
*(cp)++ = (u_char) ((s) >> 8); \
*(cp)++ = (u_char) (s & 0xff); \
}
#define GETLONG(l, cp) { \
(l) = *(cp); (cp)++; (l) <<= 8; \
(l) |= *(cp); (cp)++; (l) <<= 8; \
(l) |= *(cp); (cp)++; (l) <<= 8; \
(l) |= *(cp); (cp)++; \
}
#define PUTLONG(l, cp) { \
*(cp)++ = (u_char) ((l) >> 24); \
*(cp)++ = (u_char) ((l) >> 16); \
*(cp)++ = (u_char) ((l) >> 8); \
*(cp)++ = (u_char) (l); \
}
#define INCPTR(n, cp) ((cp) += (n))
#define DECPTR(n, cp) ((cp) -= (n))
#define BCMP(s0, s1, l) memcmp((u_char *)(s0), (u_char *)(s1), (l))
#define BCOPY(s, d, l) MEMCPY((d), (s), (l))
#define BZERO(s, n) memset(s, 0, n)
#if PPP_DEBUG
#define PRINTMSG(m, l) { m[l] = '\0'; LWIP_DEBUGF(LOG_INFO, ("Remote message: %s\n", m)); }
#else /* PPP_DEBUG */
#define PRINTMSG(m, l)
#endif /* PPP_DEBUG */
/*
* MAKEHEADER - Add PPP Header fields to a packet.
*/
#define MAKEHEADER(p, t) { \
PUTCHAR(PPP_ALLSTATIONS, p); \
PUTCHAR(PPP_UI, p); \
PUTSHORT(t, p); }
/************************
*** PUBLIC DATA TYPES ***
************************/
/*
* The following struct gives the addresses of procedures to call
* for a particular protocol.
*/
struct protent {
u_short protocol; /* PPP protocol number */
/* Initialization procedure */
void (*init) (int unit);
/* Process a received packet */
void (*input) (int unit, u_char *pkt, int len);
/* Process a received protocol-reject */
void (*protrej) (int unit);
/* Lower layer has come up */
void (*lowerup) (int unit);
/* Lower layer has gone down */
void (*lowerdown) (int unit);
/* Open the protocol */
void (*open) (int unit);
/* Close the protocol */
void (*close) (int unit, char *reason);
#if PPP_ADDITIONAL_CALLBACKS
/* Print a packet in readable form */
int (*printpkt) (u_char *pkt, int len,
void (*printer) (void *, char *, ...),
void *arg);
/* Process a received data packet */
void (*datainput) (int unit, u_char *pkt, int len);
#endif /* PPP_ADDITIONAL_CALLBACKS */
int enabled_flag; /* 0 if protocol is disabled */
char *name; /* Text name of protocol */
#if PPP_ADDITIONAL_CALLBACKS
/* Check requested options, assign defaults */
void (*check_options) (u_long);
/* Configure interface for demand-dial */
int (*demand_conf) (int unit);
/* Say whether to bring up link for this pkt */
int (*active_pkt) (u_char *pkt, int len);
#endif /* PPP_ADDITIONAL_CALLBACKS */
};
/*
* The following structure records the time in seconds since
* the last NP packet was sent or received.
*/
struct ppp_idle {
u_short xmit_idle; /* seconds since last NP packet sent */
u_short recv_idle; /* seconds since last NP packet received */
};
struct ppp_settings {
u_int disable_defaultip : 1; /* Don't use hostname for default IP addrs */
u_int auth_required : 1; /* Peer is required to authenticate */
u_int explicit_remote : 1; /* remote_name specified with remotename opt */
u_int refuse_pap : 1; /* Don't wanna auth. ourselves with PAP */
u_int refuse_chap : 1; /* Don't wanna auth. ourselves with CHAP */
u_int usehostname : 1; /* Use hostname for our_name */
u_int usepeerdns : 1; /* Ask peer for DNS adds */
u_short idle_time_limit; /* Shut down link if idle for this long */
int maxconnect; /* Maximum connect time (seconds) */
char user [MAXNAMELEN + 1]; /* Username for PAP */
char passwd [MAXSECRETLEN + 1]; /* Password for PAP, secret for CHAP */
char our_name [MAXNAMELEN + 1]; /* Our name for authentication purposes */
char remote_name[MAXNAMELEN + 1]; /* Peer's name for authentication */
};
/*****************************
*** PUBLIC DATA STRUCTURES ***
*****************************/
/* Buffers for outgoing packets. */
extern u_char outpacket_buf[NUM_PPP][PPP_MRU+PPP_HDRLEN];
extern struct ppp_settings ppp_settings;
extern struct protent *ppp_protocols[]; /* Table of pointers to supported protocols */
/***********************
*** PUBLIC FUNCTIONS ***
***********************/
/*
* Write n characters to a ppp link.
* RETURN: >= 0 Number of characters written, -1 Failed to write to device.
*/
int pppWrite(int pd, const u_char *s, int n);
void pppInProcOverEthernet(int pd, struct pbuf *pb);
struct pbuf *pppSingleBuf(struct pbuf *p);
void pppLinkTerminated(int pd);
void pppLinkDown(int pd);
/* Configure i/f transmit parameters */
void ppp_send_config (int, u16_t, u32_t, int, int);
/* Set extended transmit ACCM */
void ppp_set_xaccm (int, ext_accm *);
/* Configure i/f receive parameters */
void ppp_recv_config (int, int, u32_t, int, int);
/* Find out how long link has been idle */
int get_idle_time (int, struct ppp_idle *);
/* Configure VJ TCP header compression */
int sifvjcomp (int, int, u8_t, u8_t);
/* Configure i/f down (for IP) */
int sifup (int);
/* Set mode for handling packets for proto */
int sifnpmode (int u, int proto, enum NPmode mode);
/* Configure i/f down (for IP) */
int sifdown (int);
/* Configure IP addresses for i/f */
int sifaddr (int, u32_t, u32_t, u32_t, u32_t, u32_t);
/* Reset i/f IP addresses */
int cifaddr (int, u32_t, u32_t);
/* Create default route through i/f */
int sifdefaultroute (int, u32_t, u32_t);
/* Delete default route through i/f */
int cifdefaultroute (int, u32_t, u32_t);
/* Get appropriate netmask for address */
u32_t GetMask (u32_t);
#endif /* PPP_SUPPORT */
#endif /* PPP_IMPL_H */

View file

@ -0,0 +1,73 @@
#include "test_mem.h"
#include "lwip/mem.h"
#include "lwip/stats.h"
#if !LWIP_STATS || !MEM_STATS
#error "This tests needs MEM-statistics enabled"
#endif
#if LWIP_DNS
#error "This test needs DNS turned off (as it mallocs on init)"
#endif
/* Setups/teardown functions */
static void
mem_setup(void)
{
}
static void
mem_teardown(void)
{
}
/* Test functions */
/** Call mem_malloc, mem_free and mem_trim and check stats */
START_TEST(test_mem_one)
{
#define SIZE1 16
#define SIZE1_2 12
#define SIZE2 16
void *p1, *p2;
mem_size_t s1, s2;
LWIP_UNUSED_ARG(_i);
#if LWIP_DNS
fail("This test needs DNS turned off (as it mallocs on init)");
#endif
fail_unless(lwip_stats.mem.used == 0);
p1 = mem_malloc(SIZE1);
fail_unless(p1 != NULL);
fail_unless(lwip_stats.mem.used >= SIZE1);
s1 = lwip_stats.mem.used;
p2 = mem_malloc(SIZE2);
fail_unless(p2 != NULL);
fail_unless(lwip_stats.mem.used >= SIZE2 + s1);
s2 = lwip_stats.mem.used;
mem_trim(p1, SIZE1_2);
mem_free(p2);
fail_unless(lwip_stats.mem.used <= s2 - SIZE2);
mem_free(p1);
fail_unless(lwip_stats.mem.used == 0);
}
END_TEST
/** Create the suite including all tests for this module */
Suite *
mem_suite(void)
{
TFun tests[] = {
test_mem_one
};
return create_suite("MEM", tests, sizeof(tests)/sizeof(TFun), mem_setup, mem_teardown);
}

View file

@ -0,0 +1,8 @@
#ifndef __TEST_MEM_H__
#define __TEST_MEM_H__
#include "../lwip_check.h"
Suite *mem_suite(void);
#endif

View file

@ -0,0 +1,262 @@
#include "test_etharp.h"
#include "lwip/udp.h"
#include "netif/etharp.h"
#include "lwip/stats.h"
#if !LWIP_STATS || !UDP_STATS || !MEMP_STATS || !ETHARP_STATS
#error "This tests needs UDP-, MEMP- and ETHARP-statistics enabled"
#endif
#if !ETHARP_SUPPORT_STATIC_ENTRIES
#error "This test needs ETHARP_SUPPORT_STATIC_ENTRIES enabled"
#endif
static struct netif test_netif;
static ip_addr_t test_ipaddr, test_netmask, test_gw;
struct eth_addr test_ethaddr = {1,1,1,1,1,1};
struct eth_addr test_ethaddr2 = {1,1,1,1,1,2};
struct eth_addr test_ethaddr3 = {1,1,1,1,1,3};
struct eth_addr test_ethaddr4 = {1,1,1,1,1,4};
static int linkoutput_ctr;
/* Helper functions */
static void
etharp_remove_all(void)
{
int i;
/* call etharp_tmr often enough to have all entries cleaned */
for(i = 0; i < 0xff; i++) {
etharp_tmr();
}
}
static err_t
default_netif_linkoutput(struct netif *netif, struct pbuf *p)
{
fail_unless(netif == &test_netif);
fail_unless(p != NULL);
linkoutput_ctr++;
return ERR_OK;
}
static err_t
default_netif_init(struct netif *netif)
{
fail_unless(netif != NULL);
netif->linkoutput = default_netif_linkoutput;
netif->output = etharp_output;
netif->mtu = 1500;
netif->flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP | NETIF_FLAG_LINK_UP;
netif->hwaddr_len = ETHARP_HWADDR_LEN;
return ERR_OK;
}
static void
default_netif_add(void)
{
IP4_ADDR(&test_gw, 192,168,0,1);
IP4_ADDR(&test_ipaddr, 192,168,0,1);
IP4_ADDR(&test_netmask, 255,255,0,0);
fail_unless(netif_default == NULL);
netif_set_default(netif_add(&test_netif, &test_ipaddr, &test_netmask,
&test_gw, NULL, default_netif_init, NULL));
netif_set_up(&test_netif);
}
static void
default_netif_remove(void)
{
fail_unless(netif_default == &test_netif);
netif_remove(&test_netif);
}
static void
create_arp_response(ip_addr_t *adr)
{
int k;
struct eth_hdr *ethhdr;
struct etharp_hdr *etharphdr;
struct pbuf *p = pbuf_alloc(PBUF_RAW, sizeof(struct eth_hdr) + sizeof(struct etharp_hdr), PBUF_RAM);
if(p == NULL) {
FAIL_RET();
}
ethhdr = (struct eth_hdr*)p->payload;
etharphdr = (struct etharp_hdr*)(ethhdr + 1);
ethhdr->dest = test_ethaddr;
ethhdr->src = test_ethaddr2;
ethhdr->type = htons(ETHTYPE_ARP);
etharphdr->hwtype = htons(/*HWTYPE_ETHERNET*/ 1);
etharphdr->proto = htons(ETHTYPE_IP);
etharphdr->hwlen = ETHARP_HWADDR_LEN;
etharphdr->protolen = sizeof(ip_addr_t);
etharphdr->opcode = htons(ARP_REPLY);
SMEMCPY(&etharphdr->sipaddr, adr, sizeof(ip_addr_t));
SMEMCPY(&etharphdr->dipaddr, &test_ipaddr, sizeof(ip_addr_t));
k = 6;
while(k > 0) {
k--;
/* Write the ARP MAC-Addresses */
etharphdr->shwaddr.addr[k] = test_ethaddr2.addr[k];
etharphdr->dhwaddr.addr[k] = test_ethaddr.addr[k];
/* Write the Ethernet MAC-Addresses */
ethhdr->dest.addr[k] = test_ethaddr.addr[k];
ethhdr->src.addr[k] = test_ethaddr2.addr[k];
}
ethernet_input(p, &test_netif);
}
/* Setups/teardown functions */
static void
etharp_setup(void)
{
etharp_remove_all();
default_netif_add();
}
static void
etharp_teardown(void)
{
etharp_remove_all();
default_netif_remove();
}
/* Test functions */
START_TEST(test_etharp_table)
{
#if ETHARP_SUPPORT_STATIC_ENTRIES
err_t err;
#endif /* ETHARP_SUPPORT_STATIC_ENTRIES */
s8_t idx;
ip_addr_t *unused_ipaddr;
struct eth_addr *unused_ethaddr;
struct udp_pcb* pcb;
LWIP_UNUSED_ARG(_i);
if (netif_default != &test_netif) {
fail("This test needs a default netif");
}
linkoutput_ctr = 0;
pcb = udp_new();
fail_unless(pcb != NULL);
if (pcb != NULL) {
ip_addr_t adrs[ARP_TABLE_SIZE + 2];
int i;
for(i = 0; i < ARP_TABLE_SIZE + 2; i++) {
IP4_ADDR(&adrs[i], 192,168,0,i+2);
}
/* fill ARP-table with dynamic entries */
for(i = 0; i < ARP_TABLE_SIZE; i++) {
struct pbuf *p = pbuf_alloc(PBUF_TRANSPORT, 10, PBUF_RAM);
fail_unless(p != NULL);
if (p != NULL) {
err_t err = udp_sendto(pcb, p, &adrs[i], 123);
fail_unless(err == ERR_OK);
/* etharp request sent? */
fail_unless(linkoutput_ctr == (2*i) + 1);
pbuf_free(p);
/* create an ARP response */
create_arp_response(&adrs[i]);
/* queued UDP packet sent? */
fail_unless(linkoutput_ctr == (2*i) + 2);
idx = etharp_find_addr(NULL, &adrs[i], &unused_ethaddr, &unused_ipaddr);
fail_unless(idx == i);
etharp_tmr();
}
}
linkoutput_ctr = 0;
#if ETHARP_SUPPORT_STATIC_ENTRIES
/* create one static entry */
err = etharp_add_static_entry(&adrs[ARP_TABLE_SIZE], &test_ethaddr3);
fail_unless(err == ERR_OK);
idx = etharp_find_addr(NULL, &adrs[ARP_TABLE_SIZE], &unused_ethaddr, &unused_ipaddr);
fail_unless(idx == 0);
fail_unless(linkoutput_ctr == 0);
#endif /* ETHARP_SUPPORT_STATIC_ENTRIES */
linkoutput_ctr = 0;
/* fill ARP-table with dynamic entries */
for(i = 0; i < ARP_TABLE_SIZE; i++) {
struct pbuf *p = pbuf_alloc(PBUF_TRANSPORT, 10, PBUF_RAM);
fail_unless(p != NULL);
if (p != NULL) {
err_t err = udp_sendto(pcb, p, &adrs[i], 123);
fail_unless(err == ERR_OK);
/* etharp request sent? */
fail_unless(linkoutput_ctr == (2*i) + 1);
pbuf_free(p);
/* create an ARP response */
create_arp_response(&adrs[i]);
/* queued UDP packet sent? */
fail_unless(linkoutput_ctr == (2*i) + 2);
idx = etharp_find_addr(NULL, &adrs[i], &unused_ethaddr, &unused_ipaddr);
if (i < ARP_TABLE_SIZE - 1) {
fail_unless(idx == i+1);
} else {
/* the last entry must not overwrite the static entry! */
fail_unless(idx == 1);
}
etharp_tmr();
}
}
#if ETHARP_SUPPORT_STATIC_ENTRIES
/* create a second static entry */
err = etharp_add_static_entry(&adrs[ARP_TABLE_SIZE+1], &test_ethaddr4);
fail_unless(err == ERR_OK);
idx = etharp_find_addr(NULL, &adrs[ARP_TABLE_SIZE], &unused_ethaddr, &unused_ipaddr);
fail_unless(idx == 0);
idx = etharp_find_addr(NULL, &adrs[ARP_TABLE_SIZE+1], &unused_ethaddr, &unused_ipaddr);
fail_unless(idx == 2);
/* and remove it again */
err = etharp_remove_static_entry(&adrs[ARP_TABLE_SIZE+1]);
fail_unless(err == ERR_OK);
idx = etharp_find_addr(NULL, &adrs[ARP_TABLE_SIZE], &unused_ethaddr, &unused_ipaddr);
fail_unless(idx == 0);
idx = etharp_find_addr(NULL, &adrs[ARP_TABLE_SIZE+1], &unused_ethaddr, &unused_ipaddr);
fail_unless(idx == -1);
#endif /* ETHARP_SUPPORT_STATIC_ENTRIES */
/* check that static entries don't time out */
etharp_remove_all();
idx = etharp_find_addr(NULL, &adrs[ARP_TABLE_SIZE], &unused_ethaddr, &unused_ipaddr);
fail_unless(idx == 0);
#if ETHARP_SUPPORT_STATIC_ENTRIES
/* remove the first static entry */
err = etharp_remove_static_entry(&adrs[ARP_TABLE_SIZE]);
fail_unless(err == ERR_OK);
idx = etharp_find_addr(NULL, &adrs[ARP_TABLE_SIZE], &unused_ethaddr, &unused_ipaddr);
fail_unless(idx == -1);
idx = etharp_find_addr(NULL, &adrs[ARP_TABLE_SIZE+1], &unused_ethaddr, &unused_ipaddr);
fail_unless(idx == -1);
#endif /* ETHARP_SUPPORT_STATIC_ENTRIES */
udp_remove(pcb);
}
}
END_TEST
/** Create the suite including all tests for this module */
Suite *
etharp_suite(void)
{
TFun tests[] = {
test_etharp_table
};
return create_suite("ETHARP", tests, sizeof(tests)/sizeof(TFun), etharp_setup, etharp_teardown);
}

View file

@ -0,0 +1,8 @@
#ifndef __TEST_ETHARP_H__
#define __TEST_ETHARP_H__
#include "../lwip_check.h"
Suite* etharp_suite(void);
#endif

View file

@ -4,9 +4,7 @@
#include "tcp/test_tcp.h"
#include "tcp/test_tcp_oos.h"
#include "core/test_mem.h"
#include "core/test_pbuf.h"
#include "etharp/test_etharp.h"
#include "dhcp/test_dhcp.h"
#include "lwip/init.h"
@ -21,9 +19,7 @@ int main()
tcp_suite,
tcp_oos_suite,
mem_suite,
pbuf_suite,
etharp_suite,
dhcp_suite
etharp_suite
};
size_t num = sizeof(suites)/sizeof(void*);
LWIP_ASSERT("No suites defined", num > 0);

View file

@ -0,0 +1,50 @@
/*
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*
* This file is part of the lwIP TCP/IP stack.
*
* Author: Simon Goldschmidt
*
*/
#ifndef __LWIPOPTS_H__
#define __LWIPOPTS_H__
/* Prevent having to link sys_arch.c (we don't test the API layers in unit tests) */
#define NO_SYS 1
#define LWIP_NETCONN 0
#define LWIP_SOCKET 0
/* Minimal changes to opt.h required for tcp unit tests: */
#define MEM_SIZE 16000
#define TCP_SND_QUEUELEN 40
#define MEMP_NUM_TCP_SEG TCP_SND_QUEUELEN
#define TCP_SND_BUF (12 * TCP_MSS)
#define TCP_WND (10 * TCP_MSS)
/* Minimal changes to opt.h required for etharp unit tests: */
#define ETHARP_SUPPORT_STATIC_ENTRIES 1
#endif /* __LWIPOPTS_H__ */

View file

@ -92,8 +92,8 @@ tcp_create_segment_wnd(ip_addr_t* src_ip, ip_addr_t* dst_ip,
/* calculate checksum */
tcphdr->chksum = inet_chksum_pseudo(p,
IP_PROTO_TCP, p->tot_len, src_ip, dst_ip);
tcphdr->chksum = inet_chksum_pseudo(p, src_ip, dst_ip,
IP_PROTO_TCP, p->tot_len);
pbuf_header(p, sizeof(struct ip_hdr));
@ -238,21 +238,17 @@ test_tcp_new_counters_pcb(struct test_tcp_counters* counters)
void test_tcp_input(struct pbuf *p, struct netif *inp)
{
struct ip_hdr *iphdr = (struct ip_hdr*)p->payload;
/* these lines are a hack, don't use them as an example :-) */
ip_addr_copy(*ipX_current_dest_addr(), iphdr->dest);
ip_addr_copy(*ipX_current_src_addr(), iphdr->src);
ip_current_netif() = inp;
ip_current_header() = iphdr;
/* since adding IPv6, p->payload must point to tcp header, not ip header */
pbuf_header(p, -(s16_t)sizeof(struct ip_hdr));
ip_addr_copy(current_iphdr_dest, iphdr->dest);
ip_addr_copy(current_iphdr_src, iphdr->src);
current_netif = inp;
current_header = iphdr;
tcp_input(p, inp);
ipX_current_dest_addr()->addr = 0;
ipX_current_src_addr()->addr = 0;
ip_current_netif() = NULL;
ip_current_header() = NULL;
current_iphdr_dest.addr = 0;
current_iphdr_src.addr = 0;
current_netif = NULL;
current_header = NULL;
}
static err_t test_tcp_netif_output(struct netif *netif, struct pbuf *p,
@ -260,8 +256,6 @@ static err_t test_tcp_netif_output(struct netif *netif, struct pbuf *p,
{
struct test_tcp_txcounters *txcounters = (struct test_tcp_txcounters*)netif->state;
LWIP_UNUSED_ARG(ipaddr);
if (txcounters != NULL)
{
txcounters->num_tx_calls++;
txcounters->num_tx_bytes += p->tot_len;
if (txcounters->copy_tx_packets) {
@ -276,7 +270,6 @@ static err_t test_tcp_netif_output(struct netif *netif, struct pbuf *p,
pbuf_cat(txcounters->tx_packets, p_copy);
}
}
}
return ERR_OK;
}
@ -285,11 +278,9 @@ void test_tcp_init_netif(struct netif *netif, struct test_tcp_txcounters *txcoun
{
struct netif *n;
memset(netif, 0, sizeof(struct netif));
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);

View file

@ -45,9 +45,8 @@ tcp_setup(void)
static void
tcp_teardown(void)
{
tcp_remove_all();
netif_list = NULL;
netif_default = NULL;
tcp_remove_all();
}
@ -78,19 +77,16 @@ START_TEST(test_tcp_recv_inseq)
struct tcp_pcb* pcb;
struct pbuf* p;
char data[] = {1, 2, 3, 4};
ip_addr_t remote_ip, local_ip, netmask;
ip_addr_t remote_ip, local_ip;
u16_t data_len;
u16_t remote_port = 0x100, local_port = 0x101;
struct netif netif;
struct test_tcp_txcounters txcounters;
LWIP_UNUSED_ARG(_i);
/* initialize local vars */
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, &txcounters, &local_ip, &netmask);
data_len = sizeof(data);
/* initialize counter struct */
memset(&counters, 0, sizeof(counters));

View file

@ -127,8 +127,6 @@ static void
tcp_oos_teardown(void)
{
tcp_remove_all();
netif_list = NULL;
netif_default = NULL;
}
@ -148,7 +146,7 @@ START_TEST(test_tcp_recv_ooseq_FIN_OOSEQ)
5, 6, 7, 8,
9, 10, 11, 12,
13, 14, 15, 16};
ip_addr_t remote_ip, local_ip, netmask;
ip_addr_t remote_ip, local_ip;
u16_t data_len;
u16_t remote_port = 0x100, local_port = 0x101;
struct netif netif;
@ -158,8 +156,6 @@ START_TEST(test_tcp_recv_ooseq_FIN_OOSEQ)
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));
@ -290,7 +286,7 @@ START_TEST(test_tcp_recv_ooseq_FIN_INSEQ)
5, 6, 7, 8,
9, 10, 11, 12,
13, 14, 15, 16};
ip_addr_t remote_ip, local_ip, netmask;
ip_addr_t remote_ip, local_ip;
u16_t data_len;
u16_t remote_port = 0x100, local_port = 0x101;
struct netif netif;
@ -300,8 +296,6 @@ START_TEST(test_tcp_recv_ooseq_FIN_INSEQ)
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));
@ -463,7 +457,7 @@ START_TEST(test_tcp_recv_ooseq_overrun_rxwin)
struct test_tcp_counters counters;
struct tcp_pcb* pcb;
struct pbuf *pinseq, *p_ovr;
ip_addr_t remote_ip, local_ip, netmask;
ip_addr_t remote_ip, local_ip;
u16_t remote_port = 0x100, local_port = 0x101;
struct netif netif;
int datalen = 0;
@ -477,8 +471,6 @@ START_TEST(test_tcp_recv_ooseq_overrun_rxwin)
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;
@ -555,7 +547,7 @@ START_TEST(test_tcp_recv_ooseq_max_bytes)
struct test_tcp_counters counters;
struct tcp_pcb* pcb;
struct pbuf *p_ovr;
ip_addr_t remote_ip, local_ip, netmask;
ip_addr_t remote_ip, local_ip;
u16_t remote_port = 0x100, local_port = 0x101;
struct netif netif;
int datalen = 0;
@ -569,8 +561,6 @@ START_TEST(test_tcp_recv_ooseq_max_bytes)
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;
@ -636,7 +626,7 @@ START_TEST(test_tcp_recv_ooseq_max_pbufs)
struct test_tcp_counters counters;
struct tcp_pcb* pcb;
struct pbuf *p_ovr;
ip_addr_t remote_ip, local_ip, netmask;
ip_addr_t remote_ip, local_ip;
u16_t remote_port = 0x100, local_port = 0x101;
struct netif netif;
int datalen = 0;
@ -650,8 +640,6 @@ START_TEST(test_tcp_recv_ooseq_max_pbufs)
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;
@ -739,7 +727,7 @@ static void test_tcp_recv_ooseq_double_FINs(int delay_packet)
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, netmask;
ip_addr_t remote_ip, local_ip;
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;
@ -754,8 +742,6 @@ static void test_tcp_recv_ooseq_double_FINs(int delay_packet)
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;