Commit Graph

5526 Commits

Author SHA1 Message Date
Dirk Ziegelmeier
d5cdb91611 Fix compile of Axel Lin's patch 2017-06-14 12:30:55 +02:00
Axel Lin
6b4cc984ad pbuf: Allow pass flags to pbuf_init_alloced_pbuf()
Then we can reuse pbuf_init_alloced_pbuf() in pbuf_alloced_custom().

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2017-06-14 12:28:29 +02:00
goldsimon
7b45f3fa3f Fix sys_timeouts_init() for LWIP_TCP==0 (see patch #9375) 2017-06-13 22:04:57 +02:00
Axel Lin
e1ce5dc491 mem: Move LWIP_DEBUGF out of critical section in mem_malloc
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2017-06-13 22:02:17 +02:00
goldsimon
bab7a32eec Remove smtp_server when passing NULL to smtp_set_server_addr() (see patch #9373 for discussion) 2017-06-13 22:00:48 +02:00
Axel Lin
117d3abdf8 apps/smtp: Make smtp_state_str/smtp_result_strs/base64_table static
These tables are only referenced in smtp.c, so make them static.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2017-06-13 21:57:03 +02:00
goldsimon
07cc25a9df httpd: remove unnecessary "\0" suffix for CRLF string constant (see bug #51232) 2017-06-13 21:53:35 +02:00
goldsimon
ef5e44b2d3 Fix bug #51230 (Fix comment line) - change tcp_pcb to altcp_pcb 2017-06-13 21:14:16 +02:00
goldsimon
a92e838687 httpd: include hooks header file so that redefined defines/functions can be defined there 2017-06-13 21:13:45 +02:00
goldsimon
35ba3a877d Moved NUM_SOCKETS and struct lwip_sock to sockets_priv.h; added test case for fd_use count with select 2017-06-13 21:07:34 +02:00
goldsimon
85a85906d9 Fix bug #51122 (Mismatched socket->fd_used accounting when using lwip_select) 2017-06-13 20:58:45 +02:00
Joel Cunningham
3eaf976152 tcp: fix cwnd rollover introduced by ABC
Changes for TCP Appropriate Byte Counting introduce a potential cwnd
rollover by not taking into account integer promotion on tcpwnd_size_t
during inequality comparisions

This fixes the issue by introducing a macro TCP_WND_INC which detects
the rollover correctly and now holds the tcpwnd_size_t at the maximum
value rather than not incrementing the window.  This provides a slight
performance improvement by allowing full use of the tcpwnd_size_t number
space for the congestion window
2017-06-01 12:34:57 -05:00
Dirk Ziegelmeier
0df2c4f2be Map {tcp, udp, raw}_bind_netif() functions to netconn API 2017-05-31 20:16:21 +02:00
David Girault
dc2bdc2a21 memp: allow initialization of pool memory if not in standard section 2017-05-31 19:11:33 +02:00
Axel Lin
3aca7885a7 pbuf: Init pbuf if_idx to NETIF_NO_INDEX in pbuf_alloced_custom
Otherwise the p->pbuf.if_idx is uninitialized.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2017-05-31 19:10:00 +02:00
goldsimon
ba1cf2fa44 memp malloc: move LWIP_DEBUGF out of critical section (bug #51142) 2017-05-30 11:39:42 +02:00
Tim Cussins
84502e5ae0 etharp.c: Ensure etharp_query() allocates adequate pbuf if copying/consolidating.
etharp_query() queues packets, instead of sending, if a relevant arp-request is
pending.

Code walks the packet (a pbuf chain) to determine whether any pbufs are marked
'volatile': If so, we cannot simply enqueue the packet, and instead allocate a
new pbuf from RAM, copying the original packet, and enqueueing this new pbuf.

The bug here is that the allocation refers to the tot_len field of a temp pbuf*,
'p', instead of the head, 'q'.

In the case where the first pbuf of the chain is non-volatile but the second pbuf
*is* volatile, then we'll request an allocation that uses the tot_len field of
the second pbuf. If the first pbuf is non-zero length, the allocated pbuf (chain)
will be too small to allow the copy.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-05-29 21:48:51 +02:00
Our Air Quality
fb9fabb87c Initialize the tcp listen pcb netif_idx to NETIF_NO_INDEX.
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-05-29 21:48:51 +02:00
Axel Lin
cbbfb1356c pbuf: Make pbuf_init_alloced_pbuf take pbuf_type instead of u8_t for type parameter
All callers pass pbuf_type to pbuf_init_alloced_pbuf(), so make it take
pbuf_type instead of u8_t.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-05-24 12:19:32 +02:00
goldsimon
356da76cc8 Work on bug #3031/task #7896: change pbuf->type/enum pbuf_type to be more generic (see UPGRADING) 2017-05-22 22:30:55 +02:00
goldsimon
5c65402fd6 minor: whitespace change only to make the next diff smaller :-) 2017-05-22 22:30:19 +02:00
Axel Lin
10abb6b5ec ethernetif: Add #if LWIP_IPV4 guard around netif->output
netif->output and etharp_output are only available when LWIP_IPV4=1.
Fix the skeleton file.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-05-22 20:42:19 +02:00
goldsimon
8db0001e32 Adjust pbuf reuse documentation a bit: pbufs should never be reused after transmit 2017-05-18 09:19:08 +02:00
Axel Lin
5dd037ea49 debug: Remove superfluous #ifudef checking for LWIP_PLATFORM_ASSERT/LWIP_PLATFORM_DIAG
The lwip/arch.h already provides a default implentation of LWIP_PLATFORM_ASSERT
and LWIP_PLATFORM_DIAG.
So both LWIP_PLATFORM_ASSERT and LWIP_PLATFORM_DIAG are never undefined here.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2017-05-15 21:04:21 +02:00
goldsimon
0bbf6490f5 setsockopt: allow SO_BROADCAST for UDP sockets only 2017-05-12 20:34:16 +02:00
goldsimon
8345e9035f gesockopt: fall-through in switch/case only if a case contains no code at all 2017-05-12 20:33:57 +02:00
goldsimon
5c35bab26c getsockopt: invalid type used to check for UDP 2017-05-12 20:31:11 +02:00
goldsimon
e80b2eb4cf Fix mdns_resp_del_service 2017-05-12 13:21:42 +02:00
David Girault
c8b7759e10 mdns: added support for removing service in mdns responder
New function `mdns_resp_del_service()` added.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-05-12 13:12:22 +02:00
goldsimon
20fd844935 fixed typo in docs 2017-05-11 21:26:34 +02:00
Adrey Vinogradov
46f2e25ce0 Fixed bug #51002
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-05-11 20:51:41 +02:00
goldsimon
79bd47736c SO_BROADCAST is valid for SOCK_DGRAM only 2017-05-11 20:48:57 +02:00
Axel Lin
9dee346000 apps/smtp: Fix memory leak in smtp_send_mail_alloced error paths
Call smtp_free_struct(s) in all smtp_send_mail_alloced error paths to ensure
no memory leak.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Dirk Ziegelmeier <dirk@ziegelmeier.net>
2017-05-11 10:47:20 +02:00
goldsimon
ec9096be40 fixed typo in httpd debug message 2017-05-10 13:41:26 +02:00
goldsimon
035bf4dcb0 Fixed bug #50992: window updated too often 2017-05-10 13:40:17 +02:00
Axel Lin
ae210967f2 apps/smtp: Fix memory leak if SMTP_BODYDH_MALLOC fails
Need to free s before return error.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Dirk Ziegelmeier <dirk@ziegelmeier.net>
2017-05-10 11:25:34 +02:00
Axel Lin
5bbe190b3b apps/smtp: Make smtp_send_bodyh_data takes "const char **from" parameter
Fixes below build error:
cc -g -Wall -DLWIP_DEBUG -pedantic -Werror -Wparentheses -Wsequence-point -Wswitch-default -Wextra -Wundef -Wshadow -Wpointer-arith -Wcast-qual -Wc++-compat -Wwrite-strings -Wold-style-definition -Wcast-align -Wmissing-prototypes -Wredundant-decls -Wnested-externs -Wno-address -Wunreachable-code -Wuninitialized -Wlogical-op -I. -I../../.. -I../../../../lwip/src/include -I../../../ports/unix/port/include -I../../../../mbedtls/include -Wno-redundant-decls -DLWIP_HAVE_MBEDTLS=1 -c ../../../../lwip/src/apps/smtp/smtp.c
../../../../lwip/src/apps/smtp/smtp.c: In function ‘smtp_send_body_data_handler’:
../../../../lwip/src/apps/smtp/smtp.c:1487:41: error: cast discards ‘const’ qualifier from pointer target type [-Werror=cast-qual]
     if((res = smtp_send_bodyh_data(pcb, (char **)&s->body, &s->body_len))
                                         ^
../../../../lwip/src/apps/smtp/smtp.c:1507:47: error: cast discards ‘const’ qualifier from pointer target type [-Werror=cast-qual]
             ((res = smtp_send_bodyh_data(pcb, (char **)&s->body, &s->body_len)) == BDHALLDATASENT)
                                               ^
cc1: all warnings being treated as errors
../../Common.allports.mk:94: recipe for target 'smtp.o' failed
make: *** [smtp.o] Error 1

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2017-05-10 08:43:07 +02:00
Axel Lin
f5f34f138c apps/smtp: Fix missing altcp conversion in smtp_send_bodyh_data
The pcb is "struct altcp_pcb *" so we cannot call tcp_sndbuf/tcp_write here.
Use altcp_sndbuf/altcp_write instead.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Dirk Ziegelmeier <dirk@ziegelmeier.net>
2017-05-10 08:18:00 +02:00
Axel Lin
b9d5399ec1 apps/smtp: Trivial typo fixes
s/smpt/smtp/g

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Dirk Ziegelmeier <dirk@ziegelmeier.net>
2017-05-10 08:06:49 +02:00
Joel Cunningham
c03fef9a3c bug #50837: add zero-window probe timeout
This commit adds a timeout to the zero-window probing (persist timer)
mechanism. LwIP has not historically had a timeout for the persist
timer, leading to unbounded blocking if connection drops during the
zero-window condition

This commit also adds two units test, one to check the RTO timeout
and a second to check the zero-window probe timeout
2017-05-09 09:01:03 -05:00
Axel Lin
d87b11e8f9 sockets: Remove unreachable break statements in event_callback
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Dirk Ziegelmeier <dirk@ziegelmeier.net>
2017-05-09 11:25:59 +02:00
Sylvain Rochet
4171f39a72 PPP: remove ppp_singlebuf
We don't have to keep a helper function just for the sake of a PBUF_RAW
constant. Inline ppp_singlebuf function.

Signed-off-by: Sylvain Rochet <gradator@gradator.net>
2017-05-05 15:42:15 +02:00
Axel Lin
3e909bafa8 PPP: use pbuf_coalesce() instead of private ppp_singlebuf()
pbuf_coalesce() creates a single pbuf out of a chain of pbufs, which is
exactly what ppp_singlebuf() need.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Sylvain Rochet <gradator@gradator.net>
2017-05-05 15:36:26 +02:00
Dirk Ziegelmeier
a942582b4b Minor #ifdef cleanup in netif.c 2017-05-05 11:11:19 +02:00
Axel Lin
89d825f603 netif: Fix IPv6-only build
Fix below build error if LWIP_IPV4 == 0.
cc -g -Wall -DLWIP_DEBUG -pedantic -Werror -Wparentheses -Wsequence-point -Wswitch-default -Wextra -Wundef -Wshadow -Wpointer-arith -Wcast-qual -Wc++-compat -Wwrite-strings -Wold-style-definition -Wcast-align -Wmissing-prototypes -Wredundant-decls -Wnested-externs -Wno-address -Wunreachable-code -Wuninitialized -Wlogical-op -I. -I../../.. -I../../../../lwip/src/include -I../../../ports/unix/port/include -I../../../../mbedtls/include -Wno-redundant-decls -DLWIP_HAVE_MBEDTLS=1 -c ../../../../lwip/src/core/netif.c
../../../../lwip/src/core/netif.c: In function ‘netif_add’:
../../../../lwip/src/core/netif.c:284:7: error: ‘ipaddr’ undeclared (first use in this function)
   if (ipaddr == NULL) {
       ^~~~~~
../../../../lwip/src/core/netif.c:284:7: note: each undeclared identifier is reported only once for each function it appears in
../../../../lwip/src/core/netif.c:285:14: error: implicit declaration of function ‘ip_2_ip4’ [-Werror=implicit-function-declaration]
     ipaddr = ip_2_ip4(IP4_ADDR_ANY);
              ^~~~~~~~
../../../../lwip/src/core/netif.c:285:5: error: nested extern declaration of ‘ip_2_ip4’ [-Werror=nested-externs]
     ipaddr = ip_2_ip4(IP4_ADDR_ANY);
     ^~~~~~
../../../../lwip/src/core/netif.c:285:23: error: ‘IP4_ADDR_ANY’ undeclared (first use in this function)
     ipaddr = ip_2_ip4(IP4_ADDR_ANY);
                       ^~~~~~~~~~~~
../../../../lwip/src/core/netif.c:287:7: error: ‘netmask’ undeclared (first use in this function)
   if (netmask == NULL) {
       ^~~~~~~
../../../../lwip/src/core/netif.c:290:7: error: ‘gw’ undeclared (first use in this function)
   if (gw == NULL) {
       ^~
cc1: all warnings being treated as errors
../../Common.allports.mk:94: recipe for target 'netif.o' failed
make: *** [netif.o] Error 1

Fixes: 5967380c20 ("netif_add: avoid passing NULL pointers to subsequent functions")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Dirk Ziegelmeier <dirk@ziegelmeier.net>
2017-05-05 10:39:15 +02:00
goldsimon
749e078d36 6lowpan: fix compiling with !LWIP_UDP 2017-05-05 09:19:02 +02:00
Dirk Ziegelmeier
5967380c20 netif_add: avoid passing NULL pointers to subsequent functions (reported by Axel Lin) 2017-05-05 09:07:40 +02:00
Axel Lin
9bbb741247 tcp: Remove unreachable code in tcp_close_shutdown_fin
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Dirk Ziegelmeier <dirk@ziegelmeier.net>
2017-05-05 08:58:09 +02:00
goldsimon
d36306e30b sntp_process: fixed unused variable if sub-second time info is not used 2017-05-04 15:49:12 +02:00
Axel Lin
bf510fee51 SNMP: Cleanup unreachable code
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Dirk Ziegelmeier <dirk@ziegelmeier.net>
2017-05-04 09:15:29 +02:00