Commit Graph

3590 Commits

Author SHA1 Message Date
Sylvain Rochet
4beacc4ca0 PPP, VJ, fixed TCP retransmission
We used to modify in place the packet payload during compression but TCP
stack requires that we don't change the packet payload, therefore we now
copy the whole packet before compression.

Signed-off-by: Sylvain Rochet <gradator@gradator.net>
2016-01-24 20:07:54 +01:00
Sylvain Rochet
9c7231ee75 PPP, VJ, move pbuf length check so all TYPE_IP return value are within the same code block
Prepare for VJ packet copy, reorder a bit VJ compressor so all TYPE_IP
return value are within the same code block. We do that because we don't
need to copy the packet if we are not able to compress it.

Signed-off-by: Sylvain Rochet <gradator@gradator.net>
2016-01-24 19:36:19 +01:00
Sylvain Rochet
e31902dc4c PPP, prepare for chained compressors (e.g. VJ+MPPE) requiring packet copy
lwIP TCP stack requires that we don't change the packet payload in netif
output functions in order to resend the pbuf if we don't receive a TCP
ACK in time, therefore we copy the whole packet before compression or
encryption.

It gets tricky because we should keep track of whether we previously
copied the buffer in PPP output netif function in order to free the
previous pbuf if necessary, BUT the first pbuf passed to the netif
output function must not be freed.

The worst case is VJ compression followed by MPPE encryption, in this
case we should free the packet allocated by VJ compressor after MPPE
encryption and we should free the packet allocated by MPPE encrypter
after calling the PPP low level output function.

Signed-off-by: Sylvain Rochet <gradator@gradator.net>
2016-01-24 17:48:57 +01:00
Sylvain Rochet
53853a25b0 PPP, report full packet size in VJ debug output
Signed-off-by: Sylvain Rochet <gradator@gradator.net>
2016-01-24 02:16:03 +01:00
Sylvain Rochet
858bce7b4e PPP, VJ, code cleaning
Using lwIP types instead of u_ types.
Removed useless register modifier on variable.
Removed trailing spaces.

Signed-off-by: Sylvain Rochet <gradator@gradator.net>
2016-01-24 01:38:26 +01:00
Sylvain Rochet
77d355560f PPP, VJ, fix header offset calculation on LP64/ILP64 systems
long type on LP64/ILP64 systems (such as x86_64 on Linux) is 8 byte
long, this leads to wrong offsets in packets header calculation.

Fixed it by using u32_t lwIP type instead of long type.

Signed-off-by: Sylvain Rochet <gradator@gradator.net>
2016-01-24 01:38:26 +01:00
Sylvain Rochet
733758a909 tcp: fixed TCPH_UNSET_FLAG macro
This macro is only used by VJ support in PPP and was always wrong since
its introduction in commit e4a6d199fe. It's almost only used to clear
the PSH TCP flag when necessary. This flag was probably less common
about a decade ago so that would be the reason why it goes unnoticed for
so long.

Fixes: e4a6d199fe "Merged from DEVEL into main tree."
Signed-off-by: Sylvain Rochet <gradator@gradator.net>
2016-01-24 01:38:26 +01:00
Dirk Ziegelmeier
90df2111b7 SNMP: Add missing closing braces in #ifdef __cplusplus case 2016-01-22 13:28:11 +01:00
Stephan Linz
31732631fc PPP: CCP: add error debug messages for dropped packets due to missing transmit or receive CCP method
It might be difficult to investigate the reason of dropped packets when
there is no debug notification of what is happening, thus, add error
debug messages for dropped packets due to missing transmit or receive
CCP method.

Signed-off-by: Stephan Linz <linz@li-pro.net>
[gradator@gradator.net: improved messages]
Signed-off-by: Sylvain Rochet <gradator@gradator.net>
2016-01-20 21:55:37 +01:00
Sylvain Rochet
c4d78e6422 PPP, PPPoL2TP, fix double free of L2TP pcb in pppol2tp_create error path
ppp_free() calls the low level protocol destroy function, pppol2tp_destroy()
here, which freed the l2tp pcb, followed by pppol2tp_create which also freed
the pcb.

Fixing it by reordering the L2TP init so we don't have to call ppp_free()
anymore.

Signed-off-by: Sylvain Rochet <gradator@gradator.net>
2016-01-20 21:12:37 +01:00
Wayne Uroda
52463fa25b PPP, PPPoS, fix dereference of uninitialised pppos->in_head pointer
When I create a new PPP connection, I am seeing a hardfault (segfault)
coming from pbuf_free.

I traced the problem to an invalid in_head field of the pppos_pcb structure.
The field is invalid because the memory is never cleared to zero after the
pppos_pcb structure is created in pppos_create().

I was able to fix the issue by adding a memset after the memp_malloc call.

Signed-off-by: Sylvain Rochet <gradator@gradator.net>
2016-01-20 20:50:08 +01:00
Joel Cunningham
96373f6959 Define LWIP_CHKSUM_COPY_ALGORITHM when port provides LWIP_CHKSUM_COPY macro
When the port has LWIP_CHECKSUM_ON_COPY enabled and provides
a definition of LWIP_CHKSUM_COPY, the existing logic left
LWIP_CHKSUM_COPY_ALGORITHM undefined

In this case we want it to be defined to 0 since none of the copy
checksum algorithms provided are being used

This commit also introduces indentation matching LWIP_CHKSUM to
improve the readability of the code
2016-01-20 11:34:25 -06:00
Joel Cunningham
0a67c06b51 Fix type on snmp_set_test_ok to be snmp_err_t
This function was returning values from snmp_err_t but wasn't
upgraded to using the typedef after commit babce70

This resulted in compilation failure on MSVC 2013
2016-01-20 11:18:35 -06:00
Dirk Ziegelmeier
babce70c95 SNMP: Convert SNMP error #defines to an enum and fix type mismatches discovered by conversion; Convert SNMP_NEXT_OID_STATUS to an enum 2016-01-20 10:53:59 +01:00
Dirk Ziegelmeier
4cf509989f SNMP: Fix variable naming in snmp_pbuf_stream 2016-01-20 10:53:15 +01:00
Sylvain Rochet
6185bf6f61 PPP: CCP: don't drop output packets if CCP negotiated that we don't compress on our side
CCP might negotiate to not compress if peers cannot agree on a
compressor, therefore if the null compressor is chosen we must pass
packets as is instead of dropping them.

Reported-by: Stephan Linz <linz@li-pro.net>
Fixes: 987f6237c4 "PPP, MPPE, drop input/output packets if we couldn't find the chosen decompressor/compressor"
Signed-off-by: Sylvain Rochet <gradator@gradator.net>
2016-01-19 23:51:47 +01:00
Stephan Linz
2c31beb6e7 IPv4: fix some meaningless debug messages
Signed-off-by: Stephan Linz <linz@li-pro.net>
2016-01-18 21:34:13 +01:00
Stephan Linz
9f3270afaf PPP: fix typo in debug message
Signed-off-by: Stephan Linz <linz@li-pro.net>
2016-01-18 21:33:17 +01:00
Axel Lin
fe2cfe2dba raw: Fix build error
IP6_HLEN is only defined when LWIP_IPV6, IP_HLEN is only defined when LWIP_IPV4.
This fixes build error in !LWIP_IPV4 || !LWIP_IPV6 cases.

Fixes: f2c7e9c939 ("raw: Remove unnecessary #if guard around PCB_ISIPV6() calls")
Reported-by: Erik Ekman
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-01-18 16:02:01 +01:00
Stephan Linz
80375e68dd ip_frag: fix compiler warnings, unused variable
In case of IP_REASS_FREE_OLDEST==0, the argument clen of
ip_reass_enqueue_new_datagram() will not used and leads
the compiler to a warning.

Signed-off-by: Stephan Linz <linz@li-pro.net>
2016-01-18 11:55:54 +01:00
Stephan Linz
289d1dd7f3 slipif: fix several compiler warnings
- include new SNMP header
- add missing pointer type casting
- add missing default cases
- use const for all ip address types
- distinguish between IPv4 and IPv6 address types

Signed-off-by: Stephan Linz <linz@li-pro.net>
2016-01-18 11:55:32 +01:00
Axel Lin
f2c7e9c939 raw: Remove unnecessary #if guard around PCB_ISIPV6() calls
PCB_ISIPV6() macro is well defined for all cases (LWIP_IPV4 && LWIP_IPV6,
LWIP_IPV4 only and LWIP_IPV6 only), thus remove the unnecessary #if guard
around PCB_ISIPV6() calls.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-01-18 11:55:06 +01:00
Dirk Ziegelmeier
dc36dbac27 SNMP MIB2: Add unsupported snmpSilentDrops and snmpProxyDrops objects 2016-01-15 11:46:35 +01:00
Dirk Ziegelmeier
d9534325cf SNTP: Add function to get operating mode 2016-01-15 11:41:12 +01:00
Axel Lin
c221361874 stats: Move memp_names table out of stats_init/stats_display_memp functions
This makes the code simpler with better readability.
Also make memp_names static because it's only referenced by stats.c.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-01-15 11:38:03 +01:00
Axel Lin
70ebeda7ed memp: Simplify implementation of memp_overflow_check_all
We don't really care the order of overflow/underflow checking because if
any checking fails we got assertion.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-01-15 11:38:02 +01:00
Joel Cunningham
11faa8149e Fix blocking close with LWIP_SO_SNDTIMEO
This fixes a bug in close when LWIP_SO_SNDTIMEO is enabled, but
the option is not in use on the socket

A simple mis-typed comparison against zero would cause the close_timeout
to get set to zero if conn->send_timeout was 0

The intended check was to over-ride the default close timeout if a
send timeout had been specified via SO_SNDTIMEO
2016-01-13 22:20:52 +01:00
Dirk Ziegelmeier
70487a43d4 Apply patch #8854: dns: Simplify #ifdef guard around dns_gethostbyname_addrtype from Axel Lin
+ Minor compile fix from me
Patch makes the code a tiny bit less lightweight (add a parameter in dns_gethostbyname which is then not used in dns_gethostbyname_addrtype) but it makes the code more readable.
2016-01-13 19:52:08 +01:00
Axel Lin
a93ae2558f tcp_rexmit_rto: Remove superfluous #if TCP_OVERSIZE guard
TCP_OVERSIZE_DBGCHECK already implies TCP_OVERSIZE is set.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-01-13 19:07:08 +01:00
Dirk Ziegelmeier
c2ba9129ad SNMP: Fix InetAddress octet string encoding (length was missing) 2016-01-13 13:04:37 +01:00
Axel Lin
c2a74b767b udp_bind: Omit checking for the same port if no port specified
No port specified means to use a random port.
udp_new_port() returns a new (free) local UDP port number on success.
So in this case we don't need iterating all lists to test if the port
number is used, udp_new_port() alreay ensures the port is not used.

Move the code checking for double bind and rebind of the same pcb earlier,
as this checking is necessary in all cases.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-01-13 09:05:36 +01:00
Dirk Ziegelmeier
123c8dbd6a Fix bug #46837 Don't send dhcp_release message in dhcp_release function 2016-01-13 08:54:54 +01:00
Dirk Ziegelmeier
40ff62fa60 SNMP MIB Compiler: Update project settings, fix wrong output path in SharpSnmpLib 2016-01-12 08:40:12 +01:00
Dirk Ziegelmeier
84397ef013 SNMP MIB Compiler: Treat read-create nodes as read-only 2016-01-11 20:28:01 +01:00
Dirk Ziegelmeier
a2b7cec17b SNMP MIB Compiler: Add example command line to compile UDP-MIB 2016-01-11 20:15:17 +01:00
Dirk Ziegelmeier
e80e7a10d4 SNMP MIB Compiler: Resolve MIB files in a case-insensitive way 2016-01-11 20:14:54 +01:00
Dirk Ziegelmeier
8c4d1909f4 SNMP MIB Compiler: Deal with multiple OID assignments in a MIB file 2016-01-11 19:45:57 +01:00
Dirk Ziegelmeier
bb8ecd7e08 SNMP: Add some basic MIBs 2016-01-11 19:45:25 +01:00
Axel Lin
9f3aab6a62 tcp_out: Use LWIP_DBG_LEVEL_SERIOUS instead of hard coded number
Trivial clean up to avoid using hard coded number.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-01-11 13:22:51 +01:00
Dirk Ziegelmeier
44256740bd SNMP MIB Viewer: Adapt to changes in SNMP framework that were required to compile UDP-MIB and TCP-MIB 2016-01-11 12:25:47 +01:00
Axel Lin
156ad0dbf5 udp_bind: Fix the logic to check both pcbs have REUSEADDR set
The code for #if SO_REUSE case does not match the comment.
By default, we don't allow to bind to a port that any other udp
PCB is already bound to, unless *all* PCBs with that port have tha
REUSEADDR flag set.

Which means we want to omit checking for the same port if both pcbs
have REUSEADDR set. Fix the logic accordingly.

Fixes: d0348e0c60 ("task #6995: Implement SO_REUSEADDR (correctly)")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-01-11 12:19:13 +01:00
Axel Lin
5056d375f2 tcp_bind/tcp_connect: Omit checking for the same port if no port specified
No port specified means to use a random port.
tcp_new_port() returns a new (free) local TCP port number on success.
So in this case we don't need iterating all lists to test if the port
number is used, tcp_new_port() alreay ensures the port is not used.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-01-11 12:16:27 +01:00
Dirk Ziegelmeier
b68e801975 MIB compiler: Eliminate the need for a cast 2016-01-11 10:32:33 +01:00
Dirk Ziegelmeier
987f0e3016 Update SNMP README - add correct SharpSnmpLib reference 2016-01-11 10:26:37 +01:00
Dirk Ziegelmeier
713deba83f SNMP MIB compiler: Add ability to generate UDP-MIB and TCP-MIB 2016-01-11 10:24:31 +01:00
Dirk Ziegelmeier
b9d0d80946 SNMP: Add more MIB compiler info 2016-01-09 14:35:51 +01:00
Dirk Ziegelmeier
84cd489d24 SNMP: Add MIB compiler (code generator) 2016-01-09 12:39:48 +01:00
Axel Lin
708beb4874 udp_bind: Allocate a random port earlier to correctly detect port conflict
Current code does not correctly detect port conflict if no port specified
because it checks ipcb->local_port == port before udp_new_port().
Fix it by allocating a random port earlier.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-01-09 10:14:09 +01:00
Dirk Ziegelmeier
4e8574bd23 SNMP: Table API cleanup 2016-01-07 09:53:25 +01:00
Dirk Ziegelmeier
fbdfba2509 SNMP: Found the correct cause of a memory leak 2016-01-07 09:52:13 +01:00
Dirk Ziegelmeier
e033866651 Merge branch 'master' of ssh://git.sv.gnu.org:/srv/git/lwip 2016-01-05 10:00:21 +01:00
Dirk Ziegelmeier
76094b8c7e SNMP: SMEMCPY should only be used when size is known at compile time 2016-01-05 09:59:42 +01:00
Dirk Ziegelmeier
e336f877c2 Merge branch 'master' of ssh://git.sv.gnu.org:/srv/git/lwip 2016-01-04 21:27:39 +01:00
Dirk Ziegelmeier
7f699b36ff Update some MIB2 comments 2016-01-04 21:27:24 +01:00
Dirk Ziegelmeier
e041b9a51c SNMP: Fix shadowing warning in another file. Pointed out by Erik Ekman. 2016-01-04 13:30:02 +01:00
Dirk Ziegelmeier
0a222a2ff7 SNMP: Fix shadowing warning pointed out by Erik Ekman 2016-01-04 12:31:09 +01:00
Axel Lin
031de097db Trivial comment fix for lwip_netconn_do_disconnect()
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-01-04 11:54:21 +01:00
Dirk Ziegelmeier
d4361fc7d7 snmp_traps.c: #if 0 ... #endif around C++ style comments does not work - remove the code completely for now 2016-01-04 11:41:17 +01:00
Dirk Ziegelmeier
44617bfa9b Fix compile of SNMP on MSVC 2016-01-04 11:26:36 +01:00
Dirk Ziegelmeier
6352106aaa Fix C++ style comment in snmp_asn1.h 2016-01-04 11:05:44 +01:00
Dirk Ziegelmeier
7412a0e74e SNMP: Move common MIB code into snmp_core.c helper functions 2016-01-02 21:29:01 +01:00
Dirk Ziegelmeier
19d17adcfb SNMP MIB2: Implement tcpConnectionTable 2016-01-02 20:55:14 +01:00
Dirk Ziegelmeier
e1e7a704e1 SNMP MIB2: Implement tcpListenerTable 2016-01-02 20:06:53 +01:00
Dirk Ziegelmeier
19dd6c391f SNMP MIB2: Update UDP endpoint table variable names 2016-01-01 23:09:54 +01:00
Dirk Ziegelmeier
c5cab4e719 SNMP RAW API: Listen on IPV6 UDP port, too 2016-01-01 22:59:00 +01:00
Dirk Ziegelmeier
b48f6d1405 Add comment about udpEnpointTable non-accessible columns 2016-01-01 22:00:39 +01:00
Dirk Ziegelmeier
c466f8824f SNMP: Finish implementing UDP-MIB. Add unsupported udpHCInDatagrams and udpHCOutDatagrams items. 2016-01-01 21:58:51 +01:00
Dirk Ziegelmeier
2b16cd93bf SNMP: Another release_instance call bugfix in SNMP Get/GetNext requests 2016-01-01 20:58:02 +01:00
Dirk Ziegelmeier
0c39165701 SNMP: Two bugfixes in SNMP GET requests 2016-01-01 20:44:16 +01:00
Dirk Ziegelmeier
9d1234d83a Add some comments and OID checks to udpEndpointTable 2015-12-31 16:19:26 +01:00
Dirk Ziegelmeier
dfaa979b99 Start working on udpEndpointTable 2015-12-31 16:13:45 +01:00
Dirk Ziegelmeier
611966de63 SNMP: Cleanup snmp IP helper functions, add IPv6 support 2015-12-29 22:06:23 +01:00
Dirk Ziegelmeier
4341df4094 SNMP: Fix compile when IPV4 is not enabled 2015-12-28 22:28:01 +01:00
Dirk Ziegelmeier
83f8ec1397 Some SNMP MIB2 code layout cleanups 2015-12-28 21:37:17 +01:00
Dirk Ziegelmeier
fdd98879bf C-Style comments only, please 2015-12-26 12:17:07 +01:00
Dirk Ziegelmeier
5e34b8736a Minor SNMP compile and comment fix 2015-12-26 12:02:16 +01:00
Dirk Ziegelmeier
7b946fa9b1 SNMP agent rewrite
- SNMPv2c support
  - Greatly reduced RAM usage, no memory pools any more
  - API cleanup
  - MIB2 is separated from SNMP stack
  - Support for multiple MIBs (snmp_set_mibs call) - e.g. for private MIB
  - Improved MIB2 implementation (tcpConnTable etc.)
  - Redesigned simple and generic API for MIB implementation
  - Comfortable node types for scalar arrays and tables
  - Counter64, bit and truthvalue datatype support
  - Callbacks for SNMP writes
  - Runs on two APIs: RAW and netconn
  - Async API is gone - the stack now supports netconn API instead,
    so blocking operations can be done in MIB calls.
    SNMP runs in a worker thread when netconn API is used.
  - Simplified thread sync support for MIBs - useful when MIBs
    need to access variables shared with other threads without locking
    (used in MIB2 to access lwIP stats from lwIP thread)

Currently in work:
  - Traps rewrite
  - MIB compiler
2015-12-26 11:43:29 +01:00
Dirk Ziegelmeier
0178d1d2ee Add missing comment for MIB2 callbacks in opt.h 2015-12-09 21:06:14 +01:00
Dirk Ziegelmeier
0c06f09d6d makefsdata.c: Adapt to new header include location 2015-12-09 12:48:02 +01:00
Joel Cunningham
a82c6122d5 Correct comment word usage in ip4_frag.c
This corrects word usage in ip4_frag.c:

 * 'On' was used when it should have been 'one'
 * 'Whole' was used when it should have 'hole'
2015-12-08 10:13:56 -06:00
Axel Lin
2e56f2d780 igmp: Optimize the implementation of igmp_start_timer
When LWIP_RAND is defined, calling LWIP_RAND() is not necessary if max_time <= 2
because group->timer will be set to 1 anyway.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2015-12-06 21:47:09 +01:00
Axel Lin
2562d637cd tcp_out: Use LWIP_DBG_LEVEL_SERIOUS instead of magic number
Trivial clean up to avoid using magic number.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2015-12-06 21:38:12 +01:00
Dirk Ziegelmeier
f69b1841e0 Fix compile when netconn api is disabled but socket api is enabled.
Problem is that declaring functions as static in a public header will produce warnings in every file it is included because the static functions are not implemented.
Solution: When socket api is enabled, netconn is simply available, too
(Socket api uses netconn api internally)
2015-12-05 21:58:38 +01:00
Axel Lin
a3bccae173 Catch tcpip_callback call failure
tcpip_callback_with_block() can fail with ERR_MEM or ERR_VAL, and in the
error paths the code does not post the msg to the mailbox thus the
sys_sem_wait() call might wait forever. Fix it by testing return value of
tcpip_callback() and return error immediately.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2015-12-05 21:41:27 +01:00
Axel Lin
a21144b834 memp: Fixup LWIP_HOOK_MEMP_AVAILABLE() hook
I got below build warning if LWIP_HOOK_MEMP_AVAILABLE is defined.

src/core/memp.c: In function 'memp_free_pool':
src/core/memp.c:352:16: warning: variable 'old_first' set but not used [-Wunused-but-set-variable]
   struct memp *old_first;
                ^
src/core/memp.c: In function 'memp_free':
src/core/memp.c:413:6: warning: 'old_first' may be used uninitialized in this function [-Wmaybe-uninitialized]
   if (old_first == NULL) {

The LWIP_HOOK_MEMP_AVAILABLE() hook does not work, fix it.

Fixes: c838e1ed5b ("Implement possibility to declare private memory pools")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2015-12-05 21:32:14 +01:00
Axel Lin
7f92660598 icmp: Fix memory leak in icmp_input() error paths
Ensure the newly allocated packet buffer is freed in error paths.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2015-12-05 21:25:15 +01:00
Axel Lin
3b60c855e1 netbuf: Move #include "lwip/opt.h" out of #if LWIP_NETCONN || LWIP_SOCKET guard
LWIP_NETCONN and LWIP_SOCKET are defined in opt.h,
so move #include "lwip/opt.h" out of #if LWIP_NETCONN || LWIP_SOCKET guard.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2015-12-05 21:22:34 +01:00
Axel Lin
a709041b8b Remove unnecessary p->len checking for pbuf_alloc calls with PBUF_RAM type
pbuf_alloc() for PBUF_RAM type always return big enough memory on success.
So checking p->len is not necessary. Testing if p is NULL or not is enough.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2015-12-05 21:21:59 +01:00
Dirk Ziegelmeier
8bb27ba8c4 Forgot to remove two SNMP options from opt.h that are now in lwip/apps/snmp_opts.h 2015-12-03 13:51:59 +01:00
Axel Lin
bd4c4b5959 Use SYS_ARCH_SET macro at appropriate places
Use SYS_ARCH_SET to simplify the code a bit.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2015-12-02 22:51:08 +01:00
Axel Lin
fb6d0f9006 ipaddr_aton: Avoid duplicate code to handle IPv4 address string conversion
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2015-12-02 22:51:00 +01:00
Axel Lin
6e863ecb50 dns: Remove always true test in dns_alloc_random_port
The only way to exit the do-while loop is err != ERR_USE.
Thus get rid of the always true test.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2015-12-02 22:37:26 +01:00
Axel Lin
764bf251cd igmp: Drop unneeded initialization for *group in igmp_lookup_group()
It's assigned to the return value of igmp_lookfor_group() immediately.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2015-12-02 22:32:50 +01:00
Axel Lin
91586bc6f6 Drop #if TCP_DEBUG guard around tcp_debug_print_state calls
The #if TCP_DEBUG guard can be removed because tcp_debug_print_state()
print nothing if !TCP_DEBUG.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2015-12-02 22:32:42 +01:00
Axel Lin
f971fb921e Simplify testing minimum priority in tcp_kill_prio()
Simplify the code a bit by setting mprio = LWIP_MIN(TCP_PRIO_MAX, prio)
before the for loop.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2015-11-20 21:41:14 +01:00
Axel Lin
c730e45f0c Trivial comment fix about calling tcp_slowtmr
Trivial typo fix.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2015-11-20 21:36:38 +01:00
Axel Lin
5c27429958 memp: Fix if MEMP_OVERFLOW_CHECK guard in memp_free_pool
Current code already checks memp_overflow_check_all() in memp_free() if
MEMP_OVERFLOW_CHECK >= 2. So in memp_free_pool(), it should use
MEMP_OVERFLOW_CHECK == 1 instead.

Fixes: c838e1ed5b ("Implement possibility to declare private memory pools")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2015-11-19 22:06:42 +01:00
goldsimon
8010d6706e fixed bug #46471: lwip_accept() leaks socket descriptors if new netconn was already closed because of peer behavior 2015-11-19 07:33:55 +01:00
Axel Lin
9c6708513a Drop unnecessary NULL test for h->next->next in memp_sanity
The h will point to NULL if h->next->next is NULL anyway.
So remove the unnecessary NULL test for h->next->next in each iteration.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2015-11-19 07:23:55 +01:00
Axel Lin
21b9b5e741 Slightly improve raw_remove()/udp_remove() implementation
There should be no duplicate pcb in raw_pcbs/udp_pcbs list.
So the implementation of raw_remove()/udp_remove() can break from the for
loop once the target pcb is found and removed from the list.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2015-11-19 07:21:00 +01:00