Commit Graph

5187 Commits

Author SHA1 Message Date
goldsimon
b8ecfe640c work on -Wconversion... 2017-07-06 12:38:50 +02:00
goldsimon
2594f1a423 Try to fix the build: ip_globals.current_ip6_header cannot really be const :( 2017-07-06 11:50:02 +02:00
goldsimon
694fc7e472 work on -Wconversion... 2017-07-06 11:22:38 +02:00
goldsimon
9d61e36466 work on -Wconversion, fixed some const bug in ip4 2017-07-06 09:01:03 +02:00
goldsimon
44f7a3cb0d work on -Wconversion... 2017-07-05 22:31:58 +02:00
goldsimon
c5607d3889 Fix compiling ASSERT (broken some commits ago) 2017-07-05 12:22:02 +02:00
goldsimon
ba6b504cc0 work on -Wconversion... 2017-07-05 12:20:26 +02:00
goldsimon
9a40597ced work on -Wconversion... 2017-07-04 21:31:30 +02:00
goldsimon
debf34ff9c work on -Wconversion... 2017-07-04 21:26:30 +02:00
goldsimon
2b2fa0ed71 Ensure SACKs are deleted when pbuf_free_ooseq() frees ooseq pbufs (because of memory shortage) 2017-07-04 20:10:23 +02:00
goldsimon
0b91888eb1 remove invalid TODO comment 2017-07-04 20:09:41 +02:00
goldsimon
1a1c360f1d Fixed LWIP_TCP_SACK_VALID and its usage 2017-07-03 21:41:34 +02:00
goldsimon
6796bcf7ad Cleaned up a bit after merging SACK_OUT support (mostly coding style) 2017-07-03 21:20:56 +02:00
Jakub Schmidtke
b1a3c37c3c Partial SACK (RFC 2018) support
Adds partial support for selective acknowledgements (RFC 2018).
This change makes lwIP negotiate SACK support, and include SACK
data in outgoing empty ACK packets. It does not include it
in outgoing packets with data payload.
It also does not add support for handling incoming SACKs.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-07-03 20:17:30 +02:00
goldsimon
d262132b92 work on -Wconversion... 2017-07-03 20:15:02 +02:00
Dirk Ziegelmeier
94beb4eddf Make inet_chksum.c compile with -Wconversion 2017-06-30 22:17:32 +02:00
goldsimon
41177cfd1c work on -Wconversion... 2017-06-30 22:10:16 +02:00
goldsimon
c636072362 pbuf.c: work on -Wconversion... 2017-06-29 22:49:39 +02:00
Axel Lin
ca9eae26e1 PPP, VJ: Use vj_uncompress_err at appropriate places
Use vj_uncompress_err() instead of duplicating the same code.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Sylvain Rochet <gradator@gradator.net>
2017-06-29 11:44:11 +02:00
Axel Lin
79f2200b27 PPP, PPPoS: Fix update SNMP ifoutoctets counter in pppos_output_last()
Current code does not correctly update ifoutoctets counter because nb->tot_len
is always 0. Fix it by setting nb->tot_len to actual payload length so we can
update ifoutoctets correctly.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Sylvain Rochet <gradator@gradator.net>
2017-06-29 11:44:08 +02:00
goldsimon
5bddbdd914 tcp_output: faster return when nothing is to send (pcb->unsent == NULL) 2017-06-29 08:47:26 +02:00
goldsimon
48e55b1e5d tcp_output: slightly move the jump target 'output_done': when nothing is to send, pcb->unsent cannot be NULL; add a 2017-06-29 08:43:59 +02:00
Joel Cunningham
229c9edad2 tcp: switch tcpflags_t to u16_t for all cases (bug #51326)
This changes tcpflags_t to be a u16_t for all cases.  The TCP Appropriate
Byte Count support added a new flag that used a bit past 8 and since this
flag is now required, tcpflags_t can no longer be a u8_t

This does not increase the size of struct tcp_pcb due to padding that
already existed (see bug #51326 for details)

Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-06-28 21:47:33 +02:00
goldsimon
092c6c1f07 DNS_MAX_SOURCE_PORTS is PP-checked to be <= 255... 2017-06-26 08:48:17 +02:00
goldsimon
5efe26ebd3 Fix the fix for LWIP_LOOPBACK_MAX_PBUFS :-) 2017-06-26 08:21:53 +02:00
goldsimon
5b15234833 work on -Wconversion... 2017-06-25 23:01:57 +02:00
goldsimon
197166d906 LWIP_LOOPBACK_MAX_PBUFS: fix compilation or memory leak for LWIP_LOOPBACK_MAX_PBUFS > 255 2017-06-25 20:31:09 +02:00
goldsimon
af0f4d4020 Start making the source compile correctly with gcc -Wconversion enabled 2017-06-23 21:15:36 +02:00
Matthias Hofmann
c12aa3fb40 Remove double definition of SNTP_SERVER_DNS.
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-06-23 21:05:30 +02:00
Dirk Ziegelmeier
d02a73c285 Replace usages of tcpip_callback_with_block(foo, bar, 0) with tcpip_try_callback() 2017-06-22 08:14:02 +02:00
goldsimon
b4921dc401 Ensure that all parts of an ip_addr are written for the various set commands when setting an ipv4 address in dual-stack configurations (for security & compiler warning reasons :) 2017-06-22 07:48:38 +02:00
goldsimon
c9e7e56389 Fix IPv4-only and IPv6-only after again last commits 2017-06-21 22:01:19 +02:00
goldsimon
c094fcc086 Try to make gcc work without -Wno-address 2017-06-21 16:07:36 +02:00
Dirk Ziegelmeier
10a5afeee7 Revert my last change to tcpip_callback() - it breaks the semantics of the function.
The function previously returned after posting a message, which is a short operation. Now it actually waits until the operation has completed - which may take a long time. This may break user programs. So all that remains is the cleanup separation in tcpip_callback() and tcpip_try_callback() :-(
2017-06-21 15:07:20 +02:00
Dirk Ziegelmeier
68d36f19f0 Implement LWIP core locking support in tcpip_callback_with_block()
Created two new functions for API cleanup:
tcpip_callback() that blocks until message is posted, cannot be called from IRQs.
tcpip_try_callback() that does not block and just tries to post a message. Can be called from IRQs.
Add compatibility #define tcpip_callback_with_block() that maps to these two functions according to "block" parameter.
2017-06-21 13:42:54 +02:00
goldsimon
79d69ce526 Slightly optimize pbuf_alloc: encode 'header offset' in 'enum pbuf_layer' instead of switch/case (which was duplicated in pbuf_alloc and pbuf_alloced_custom) 2017-06-21 13:37:05 +02:00
goldsimon
11da4ef024 Use ip_addr_debug_print_val instead of ip_addr_debug_print where applicable 2017-06-21 13:26:55 +02:00
Axel Lin
aa98747d6f timeouts: Trivial comment fix for cyclic_timer
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-06-21 13:11:48 +02:00
Joel Cunningham
d4c8a1ac78 netconn: switch gethostbyname to use tcpip_send_msg_wait_sem (task #14523)
This switches netconn_gethostbyname to use tcpip_send_msg_wait_sem to
take advantage of core locking support when enabled.

tcpip_send_msg_wait_sem handles blocking for the non-core locking case,
so we can remove the manual blocking in netconn_gethostbyname. For the
core locking case, we need to block if waiting on DNS callback. To
achieve this, we unlock the core and wait in lwip_netconn_do_gethostbyname.
This is the similar approach that netconn_write takes when it needs to
block to continue the write (see lwip_netconn_do_write)

This improves performance in the core locking case and is no change
for the non-core locking case
2017-06-20 17:52:28 -05:00
goldsimon
f13b1340f2 Refine comment changed by last commit 2017-06-20 20:53:39 +02:00
Jakub Schmidtke
112e370457 Sending TCP timestamp option in SYN packets
TCP timestamps were only sent if the remote side
requested it first. This enables the use of timestamps
for outgoing connections as well.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-06-20 20:51:50 +02:00
Axel Lin
faf74b36a4 PPP, VJ: Use pbuf_take instead of duplicate copy code
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-06-20 20:26:01 +02:00
goldsimon
fc23257ca0 Fix unused arg from last patch the *real* lwIP way ;-) 2017-06-20 20:13:31 +02:00
Dirk Ziegelmeier
b92bcc5f02 Fix unused arg from last patch the lwIP way 2017-06-19 14:11:35 +02:00
Our Air Quality
6e62b6090b Silence some unsed variable warnings. 2017-06-19 14:09:07 +02:00
Axel Lin
02aaf12f48 stats: Use proper format modifier in stats_display_mem/stats_display_sys
Use proper format modifier and remove unnecessary cast.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2017-06-19 14:07:31 +02:00
Dirk Ziegelmeier
c923d00340 Fix bug #51238: LWIP_ARRAYSIZE() can't be used on lwip_cyclic_timers
Add const int variable containing number of array elements
2017-06-14 23:07:55 +02:00
goldsimon
7197bf25f0 Add another posix compatibility header 2017-06-14 23:05:30 +02:00
goldsimon
82b9f86b45 Fixed bug #51195 (Calling inet_pton() causes buffer overrun on a struct in6_addr) 2017-06-14 22:22:14 +02:00
Dirk Ziegelmeier
5a27e97baf smtp.c: Fix detecting overlength server names
Thanks to Axel Lin
2017-06-14 22:06:37 +02:00
goldsimon
67d1970059 pbuf_alloced_custom(): less code duplication, please :-) 2017-06-14 21:39:53 +02:00
Dirk Ziegelmeier
3073affaaf Axel Lin correctly pointed out that there is no buffer overflow because smtp_server[SMTP_MAX_SERVERNAME_LEN + 1] - there is always room for terminating 0 byte 2017-06-14 14:11:27 +02:00
Dirk Ziegelmeier
3611b583f5 smtp.c, smtp_set_server_addr: Avoid smtp_server buffer overrun when server name length is SMTP_MAX_SERVERNAME_LEN -> "smtp_server[len] = 0" is an out-of-bound access 2017-06-14 12:40:58 +02:00
Axel Lin
4af438916a apps/smtp: Ensure smtp_server is NULL terminated
Ensure we set correct setting when changing smtp_server setting.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2017-06-14 12:33:57 +02:00
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
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
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
Dirk Ziegelmeier
fe8c62e7b6 Fix bug #50932: LWIP-provided byteorder functions defined in the wrong scope
Apply suggested fix from "Fayek"
2017-05-03 22:28:46 +02:00
goldsimon
72a8db7867 tcp_fasttmr: adapt comment (to delayed FIN implementation) 2017-05-03 21:42:59 +02:00
goldsimon
f00d7db409 backport of "variable assigned but not used" warnings from STM (why don't people report such things?) 2017-05-03 20:31:29 +02:00
goldsimon
eff97c04ef backport of "unreachable code" warnings from STM (why don't people report such things?) 2017-05-03 20:30:38 +02:00
Dirk Ziegelmeier
6c236b047e ip_route() can be called with IP_ANY_TYPE in src parameter, so remove code associated to that 2017-05-03 16:42:30 +02:00
Daniel Elstner
ccf10a5023 SNTP: Avoid warning if debugging is disabled 2017-05-03 16:40:11 +02:00
Joel Cunningham
ddf4e17411 tcp: indentation fix in tcp_receive()
TCP_OVERSIZE block was moved out from inside the while loop and thus
should be on column 7
2017-05-03 09:29:02 -05:00
goldsimon
4cf6f9ed51 tcp_free_acked_segments: fix debug printf parameter errors, fix unused parameters for !LWIP_DEBUG and/or LWIP_NOASSERT 2017-05-03 13:49:24 +02:00
goldsimon
778206798e task #14433: TCP: combine unsent/unacked queue loops in tcp_receive() 2017-05-03 12:32:01 +02:00
goldsimon
39316bb9de httpd: fixed bug #50915 (HTTP_IS_DATA_VOLATILE was wrong for LWIP_HTTPD_DYNAMIC_FILE_READ==1) 2017-05-03 09:57:12 +02:00
goldsimon
b9c47c5089 tcp_route: add comment, fixed whitespace 2017-05-03 09:56:08 +02:00
goldsimon
5c0aab7bd5 udp SO_REUSE_RXTOALL: don't copy IP header in duplicated pbuf 2017-05-03 09:54:46 +02:00
Dirk Ziegelmeier
2b9a132772 Fix compile in tcp_route when IPv4 only is used and source-based routing is disabled 2017-05-03 09:09:37 +02:00
Dirk Ziegelmeier
d32492e953 Make patch 4 of David's Minix3 patches superfluous: Use PBUF_POOL to duplicate incoming packets in UDP
... which would have been the correct way to do it anyway :-)
http://git.minix3.org/index.cgi?p=minix.git;a=blob;f=minix/lib/liblwip/patches/0004-MINIX-3-only-avoid-large-contiguous-allocations.patch;h=f23143c7e8d372b3b35b599a97975d79924f73c1;hb=HEAD
2017-05-03 09:02:56 +02:00
goldsimon
7defe372b9 fixed compiling pbuf.c with LWIP_TCP==0 2017-05-03 09:02:06 +02:00
goldsimon
082fe71c0c fixed compiling sockets.c with LWIP_UDP==0 2017-05-03 09:01:48 +02:00
Dirk Ziegelmeier
676dd74140 Minor cleanup and documentation updates 2017-05-03 08:51:00 +02:00
Dirk Ziegelmeier
e835707814 Cleanup and simplify tcp_connect() code 2017-05-03 08:46:06 +02:00
Dirk Ziegelmeier
5800cf51be Work on task #14494: Implement SO_BINDTODEVICE
TCP needs additional netif handling
2017-05-03 08:00:06 +02:00
Axel Lin
c144e5b1ec pbuf_coalesce: Replace pbuf_alloc+pbuf_copy with pbuf_clone
Avoid duplicate the same implementation.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-05-02 20:36:00 +02:00
Axel Lin
bc0fafdeca udp: Fix compiling for IPv6-only build
Fix below build error when LWIP_IPV6 && !LWIP_IPV4:
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/udp.c
../../../../lwip/src/core/udp.c: In function ‘udp_input_local_match’:
../../../../lwip/src/core/udp.c:130:58: error: unused parameter ‘inp’ [-Werror=unused-parameter]
 udp_input_local_match(struct udp_pcb *pcb, struct netif *inp, u8_t broadcast)
                                                          ^~~

Fixes: 13ffc86aef ("Start working task #14494: Implement SO_BINDTODEVICE")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Dirk Ziegelmeier <dirk@ziegelmeier.net>
2017-05-02 15:55:32 +02:00
Dirk Ziegelmeier
e3289116b9 Fix next build error introduced in my last commit 2017-05-02 15:21:52 +02:00
Dirk Ziegelmeier
6a754325dc Fix build error introduced in my last commit 2017-05-02 14:53:18 +02:00
Dirk Ziegelmeier
c7e3519f46 Start working task #14494: Implement SO_BINDTODEVICE
Implement setsockopt. TODO: getsockopt
2017-05-02 13:18:29 +02:00
Dirk Ziegelmeier
eab2ae5d78 Cleanup netif_name_to_index() implementation 2017-05-02 12:51:25 +02:00
goldsimon
0545eba002 Fixed copy&paste error found by travis-ci... 2017-05-02 10:42:59 +02:00
Dirk Ziegelmeier
13ffc86aef Start working task #14494: Implement SO_BINDTODEVICE
Implement binding TCP, UDP and RAW PCBs to a netif
2017-05-02 09:39:48 +02:00
Dirk Ziegelmeier
20fed63297 Add custom pbuf usage example to pbuf_alloced_custom() docs 2017-04-28 13:19:32 +02:00
Dirk Ziegelmeier
83d0607acf Add PBUF_NEEDS_COPY macro to documentation 2017-04-27 19:25:19 +02:00
goldsimon
1add8c14ca netif: tiny cleanup to last commit 2017-04-27 14:12:13 +02:00
goldsimon
975e29d76e fixed copy&paste error :-) 2017-04-27 12:46:14 +02:00
Dirk Ziegelmeier
1aa24ee21b Add new DHCP hooks to DHCP docs 2017-04-27 12:42:14 +02:00
Dirk Ziegelmeier
a09a8e4a06 Some documentation updates and fixes
Dedicated Zero-copy RX page
Fix doxygen warnings
2017-04-27 12:41:08 +02:00
goldsimon
6aac9377ee Clean up LWIP_NETIF_HWADDRHINT a bit: create a struct holding the hint(s) and pass a pointer to that struct around. That way we are free to add more hints if required (e.g. see task #11620) 2017-04-27 12:39:54 +02:00
Axel Lin
4c9b316e6b pbuf: Fix allocate zero length pbuf
Current code fails to allocate zero length pbuf (e.g. for PBUF_RAW PBUF_POOL),
fix it.

Fixes: eb269e61b5 ("First step to clean up pbuf implementation: add pbuf_alloc_reference() to allocate pbufs referencing external payload; move member initialization to common function; simplify PBUF_POOL chain allocator")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-04-26 20:15:22 +02:00
Joel Cunningham
fc7a68b5af sockets: fix CMSG alignment
This changes the CMSG alignment macros to ensure struct cmsghdr and data
are on a word (double word on 16-bit arch) aligned boundary

We need to ensure at least 32-bit alignment for 16-bit systems because
socklen_t could be 32-bit due to our definition
2017-04-26 08:39:44 -05:00
Dirk Ziegelmeier
c686261e1e Minor whitespace cleanup in ip.h 2017-04-26 12:28:54 +02:00
goldsimon
728aaeb528 Try to fix alignment warnings in CMSG_NXTHDR() 2017-04-26 08:55:07 +02:00
goldsimon
eac45ca284 Try to fix alignment warnings when assigning CMSG_DATA() to some struct pointer 2017-04-26 08:43:56 +02:00
goldsimon
eb269e61b5 First step to clean up pbuf implementation: add pbuf_alloc_reference() to allocate pbufs referencing external payload; move member initialization to common function; simplify PBUF_POOL chain allocator 2017-04-25 23:04:12 +02:00
goldsimon
e57552d401 pbuf_alloc_copy -> pbuf_clone 2017-04-25 22:02:07 +02:00
goldsimon
2fef874494 task #14270: DHCP should support user-defined additional options: added two hooks for adding and parsing user defined DHCP options 2017-04-25 20:18:59 +02:00
Axel Lin
471daba011 tcp_out: Fix LWIP_NETIF_TX_SINGLE_PBUF guard for not executing phase 2
This fixes build error if LWIP_NETIF_TX_SINGLE_PBUF==1.

Fixes: dd811bca06 ("Fix bug #50694 (TX exist more pbufs after enable LWIP_NETIF_TX_SINGLE_PBUF) by not executing phase 2 for LWIP_NETIF_TX_SINGLE_PBUF==1")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2017-04-25 20:17:47 +02:00
Joel Cunningham
2f117add7a sockets: task #14247, add CMSG and IP_PKTINFO
This commit adds CMSG infrastructure (currently used with recvmsg) and
the IP_PKTINFO socket option.

In order to use IP_PKTINFO, set LWIP_NETBUF_RECVINFO to 1

Unit test is added to verify this feature
2017-04-25 09:44:03 -05:00
goldsimon
ca961b9bc2 minor whitespace cleanups only 2017-04-25 12:07:28 +02:00
goldsimon
d02bc6481f Fixed bug #50816 (netif_add() prototype depends on configuration) by adding a new function netif_add_noaddrthat doesn't change 2017-04-25 12:05:05 +02:00
goldsimon
135d506065 minor whitespace fixes only 2017-04-25 12:03:52 +02:00
goldsimon
dd811bca06 Fix bug #50694 (TX exist more pbufs after enable LWIP_NETIF_TX_SINGLE_PBUF) by not executing phase 2 for LWIP_NETIF_TX_SINGLE_PBUF==1 2017-04-25 11:18:36 +02:00
goldsimon
4b68605276 Clarify LWIP_NETIF_TX_SINGLE_PBUF (drivers might still get chained pbufs and have to take care of that, e.g. by using pbuf_alloc_copy) 2017-04-25 10:09:32 +02:00
goldsimon
dcb2cb99a1 Added 'pbuf_alloc_copy' e.g. as a single function for use with non scatter-gather drivers 2017-04-25 10:08:31 +02:00
Dmitry
42eb98c9fc Fix bugs in httpd with "LWIP_HTTPD_CUSTOM_FILES && LWIP_HTTPD_DYNAMIC_FILE_READ" when SSI tags (from '<' to '>' when they span from one read to the next or end at one read buffer) - bugs #50844 aqnd #50845
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-04-24 22:33:17 +02:00
goldsimon
9c6da979ca fixed copy&paste error in last change to lwip_itoa() 2017-04-24 13:33:43 +02:00
goldsimon
16a71473c1 Better fix for bug #50838 (mem.c needs SYS_ARCH_PROTECTION around MEM_STATS): only lock where necessary 2017-04-24 12:23:05 +02:00
goldsimon
bd483fa229 Revert "Fixed bug #50838 (mem.c needs SYS_ARCH_PROTECTION around MEM_STATS)"
This reverts commit 3770adccfd.
2017-04-24 10:29:46 +02:00
Dirk Ziegelmeier
b71878f02e Fix bug #50739: 6lowpan - IPHC de-compression bug
Apply fix provided by Aigner B.
2017-04-21 22:30:23 +02:00
Dirk Ziegelmeier
13f51a0318 Fix bug #50824: Bug in SNTP POLL mode
Ignore all broken packets
Stop timeouts only when correct packet is received
2017-04-21 22:10:52 +02:00
Joel Cunningham
ad779e5c9c doc: clarify RST handling comment
This clarifies the documentation around RST handling to document
the approach follows RFC 5961 and is not a standards violation
2017-04-21 09:27:54 -05:00
goldsimon
f4730e78f8 sntp: use randomized startup delay ([0..5] seconds) by default (if LWIP_RAND is available) 2017-04-21 13:14:48 +02:00
goldsimon
65b8316459 sntp_opts.h: adapt comment to RFC errata 2017-04-21 13:14:03 +02:00
goldsimon
554f5d7f9e sntp: fix SNTP_LI_* bits; fix todo comment 2017-04-21 13:13:56 +02:00
goldsimon
84461e90e2 mqtt: fix shadowing global 'dup' 2017-04-21 07:23:32 +02:00
goldsimon
a50ba9c748 sockets.c: try to fix debug print (again) 2017-04-20 23:03:49 +02:00
Joel Cunningham
de90d03e48 tcp: task #14128 - Appropriate Byte Counting support
This commit adds TCP Appropriate Byte Counting (ABC) support based on
RFC 3465

ABC replaces the previous congestion window growth mechanism and has been
configured with limit of 2 SMSS.  See task #14128 for discussion on
defaults, but the goal is to mitigate the performance impact of delayed
ACKs on congestion window growth

This commit also introduces a mechanism to track when the stack is
undergoing a period following an RTO where data is being retransmitted.

Lastly, this adds a unit test to verify RTO period tracking and some
basic ABC cwnd checking
2017-04-20 15:59:24 -05:00
goldsimon
e1f2c8b30c sockets.c: try to fix debug print 2017-04-20 22:55:56 +02:00
goldsimon
2358a5ac32 lwip_netconn_do_close_internal: 'close' -> 'shut_close': don't override global function names (why is this reported only now?) 2017-04-20 22:52:27 +02:00
goldsimon
2c767a1d60 fix standard conformance: some socket functions should return 'ssize_t', not 'int' 2017-04-20 22:44:23 +02:00
goldsimon
1ada106d61 netconn_tcp_recvd: take size_t, not u32_t 2017-04-20 22:34:12 +02:00
goldsimon
4d6b90727f lwip_recvfrom: use LWIP_MIN instead of self-coded min 2017-04-20 22:07:08 +02:00
goldsimon
dbc969c139 Try to fix the socket API for sizeof(int) <= 2 by checking INT_MAX at 2 places 2017-04-20 22:06:36 +02:00
goldsimon
b93572dca8 Document struct netvector 2017-04-20 22:00:07 +02:00
goldsimon
131d656c23 lwip_itoa: check 'bufsize' instead of ignoring it; ensure code is not stolen from GPL 2017-04-20 21:57:03 +02:00
goldsimon
3770adccfd Fixed bug #50838 (mem.c needs SYS_ARCH_PROTECTION around MEM_STATS) 2017-04-20 21:44:00 +02:00
Dirk Ziegelmeier
d54240bdea One more try to fix compile without TCP 2017-04-19 08:44:05 +02:00
Dirk Ziegelmeier
302d84f5b2 Try to fix compile without TCP (reported by Axel Lin) 2017-04-19 08:18:15 +02:00
Dirk Ziegelmeier
32aa9a41e2 Apply patch from Kudratov Olimjon: Array index used before limits check
while ((q != NULL) && (options[offset] != DHCP_OPTION_END) && (offset < offset_max)) {
should be
while ((q != NULL) && (offset < offset_max) && (options[offset] != DHCP_OPTION_END)) {

See https://jira.reactos.org/browse/CORE-8978 for more info.
2017-04-19 06:35:07 +02:00
Tim Cussins
8e83e206f4 sockets.c: Make sock_inc_used overflow check robust.
Before this patch, it was possible that the overflow check might
miss an overflow event.

e.g. Consider 2 threads, both executing this method. u8_t fd_used is on 255...

Thread A -> atomically increment fd_used (which is now 0)
Thread B -> atomically increment fd_used (which is now 1)
Thread A -> check overflow... sees everything ok
Thread B -> check overflow... sees everything ok

And the overflow is missed :(

Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-04-18 20:50:33 +02:00
Tim Cussins
7ac3056da9 sockets.c: Add missing lwip_select_dec_sockets_used within lwip_select.
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-04-18 20:50:33 +02:00
goldsimon
0952e618bd netconn_drain(): use lwip_netconn_is_err_msg() on acceptmbox, too. 2017-04-18 10:54:40 +02:00
Axel Lin
0b2a652317 api_msg: Use lwip_netconn_is_err_msg instead of NULL test in netconn_drain()
The NULL test no longer work after commit e0a2472706, it needs to test with
lwip_netconn_is_err_msg() instead.

Fixes: e0a2472706 ("netconn/sockets: remove fatal error handling, fix asynchronous error handling, ensure data before RST can be received")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2017-04-18 10:47:42 +02:00
Joel Cunningham
f28c1c851b loopif: set pbuf if_idx during poll
This sets the pbuf's if_idx during the loopif poll function (the
equivalent netif input function).  This was found during IP_PKTINFO
development where p->if_idx is read and was uninitialized
2017-04-15 11:31:38 -05:00
goldsimon
bf01941b23 opt.h: provide LWIP_NUM_SYS_TIMEOUT_INTERNAL as default value for MEMP_NUM_SYS_TIMEOUT that can be extended by local lwipopts.h 2017-04-12 21:52:34 +02:00
goldsimon
dfc57f0289 mqtt: move struct mqtt_client_s and inner structs to new file mqtt_priv.h (to hide it from apps but provide it for tests) 2017-04-12 21:50:58 +02:00
goldsimon
5310d8f13c event_callback: separated ++ from if 2017-04-12 12:40:50 +02:00
goldsimon
e0a2472706 netconn/sockets: remove fatal error handling, fix asynchronous error handling, ensure data before RST can be received 2017-04-12 12:37:16 +02:00
goldsimon
064044eeae sockets: speed up event_callback: don't iterate select_cb_list for NETCONN_EVT_RCVPLUS/SENDPLUS if the socket has been readable/writable before already 2017-04-12 09:12:55 +02:00
goldsimon
58c21eb13c sockets: speed up event_callback: don't iterate select_cb_list for NETCONN_EVT_RCVMINUS/SENDMINUS 2017-04-11 20:59:00 +02:00
goldsimon
b6fdb61654 sockets.c: refactor event_callback() a bit 2017-04-11 20:55:47 +02:00
goldsimon
b0af09ec45 select_cb_ctr no needed any more for LWIP_TCPIP_CORE_LOCKING==1 2017-04-11 12:50:25 +02:00
goldsimon
92997756d1 task #14420 (Remove sys_sem_signal from inside SYS_ARCH_PROTECT crit section) done for LWIP_TCPIP_CORE_LOCKING==1 2017-04-11 12:40:44 +02:00
goldsimon
26d3466f50 Add macro ETH_ADDR() to initialize a struct eth_addr with its 6 bytes and taking care of correct braces 2017-04-11 08:49:15 +02:00
Dirk Ziegelmeier
8695e6e6cb Fixup BRIDGEIF_INITDATA2 macro 2017-04-07 08:59:26 +02:00
Dirk Ziegelmeier
7ba5cc3d52 Improve bridgeif doxygen docs 2017-04-07 08:01:38 +02:00
Joel Cunningham
557a11047d Patch #9307: Replace mem_malloc+memset with mem_calloc
Aside from reducing source code, on systems which use MEM_LIBC_MALLOC,
this has the potential to improve performance depending on the underlying
memory allocator

See http://stackoverflow.com/questions/2688466/why-mallocmemset-is-slower-than-calloc
2017-04-05 14:53:24 -05:00
goldsimon
b34f2d5605 altcp: allocate altcp_pcbs from a pool, not from heap (new option MEMP_NUM_ALTCP_PCB defaults to MEMP_NUM_TCP_PCB) 2017-04-05 12:18:48 +02:00
Dirk Ziegelmeier
0f4ad57033 Fix build error in bridgeif.c 2017-04-05 08:11:37 +02:00
goldsimon
9c78909857 bridgeif: sanity-check init_data->max_ports <= BRIDGEIF_MAX_PORTS 2017-04-04 22:12:38 +02:00
goldsimon
77df9ccd5a bridgeif: fix that max_fdb_static_entries was used to init dynamic FDB 2017-04-04 22:09:31 +02:00
goldsimon
2a30fedbea fix passing NULL to netif_set_gw & netif_set_netmask (or netif_set_addr or netif_add) (broken on 18.03.2017 by 2d9ef2215b) 2017-04-04 22:08:37 +02:00