Commit Graph

6001 Commits

Author SHA1 Message Date
Simon Goldschmidt
2d65251c6c mdns: add config option to use netif ext callback
e.g. if the calling stack should not invoke the mdns functions due
to high stack usage, disable the option and trigger it yourself.

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-07-03 21:09:33 +02:00
Simon Goldschmidt
b398a2a394 fix implicit cast warnings in IAR and others
See bug #54190

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-07-03 20:53:32 +02:00
Axel Lin
9b638e7c05 apps/netbiosns: Convert to use lwip_isupper instead of open-coded
Also remove additonal (cname == '\0' || cname == '.') check because
it's covered by !lwip_isupper(cname) test.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-07-03 22:55:59 +08:00
Axel Lin
58be2b1573 Add define for lwip_isupper when LWIP_NO_CTYPE_H=0
lwip_isupper is not defined when LWIP_NO_CTYPE_H=0, add it.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-07-03 22:55:07 +08:00
Dirk Ziegelmeier
e942818940 Filelists.cmake: Remove old documentation before generating new one to avoid orphaned files 2018-07-03 13:26:59 +02:00
Dirk Ziegelmeier
88ef663334 Add CMakeLists.txt to generate source distribution file 2018-07-03 12:54:17 +02:00
Simon Goldschmidt
fd0af07d2d tcp/udp bind: small code restructuring for IPv6-only
See bug #54229
2018-07-02 20:31:38 +02:00
Simon Goldschmidt
1e24f9c9cd dhcp: 2 small code improvements
See bugs #54226 and #54228
2018-07-02 20:27:12 +02:00
Simon Goldschmidt
19a929f5fb dhcp: fix parse error with chained pbfus
If a chained pbuf starts with DHCP_OPTION_PAD, an overflow check
triggers and the packet is ignored.

Fix this by changing the way the offset is increased for PAD.
Also ignore a packet that is missing the END option.

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-07-02 20:25:42 +02:00
Simon Goldschmidt
cc8995823a mdns: implement random time for initial probing 2018-06-28 22:10:45 +02:00
Simon Goldschmidt
af2cbad64a mdns: add 2 RFC constants 2018-06-28 22:07:23 +02:00
Simon Goldschmidt
8090afa4f9 mdns: minor coding style cleanup 2018-06-28 22:04:57 +02:00
Simon Goldschmidt
4506db4331 mdns: fix implicit cast warnings (size_t to u8_t) 2018-06-28 21:58:15 +02:00
Simon Goldschmidt
814341a6ed mdns: use an u8_t instead of an enum for mdns_hos::probing_state
This saves some bytes only, but it is actually more common in lwip code
2018-06-28 21:56:59 +02:00
Simon Goldschmidt
6067edfed3 mdns: add defines for mdns_name_result_cb_t result parameter 2018-06-28 21:52:58 +02:00
Jens Nielsen
9f1196fb53 MDNS send probes to verify domain before use
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-28 21:41:10 +02:00
Simon Goldschmidt
b1487e6480 ip4_reass: fixed duplicat NULL check
See bug #54197

Rerported-by: Andrey Vinogradov <andrey.vinogradov@teplomonitor.ru>
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-27 20:56:05 +02:00
Simon Goldschmidt
0610b34372 httpd: fixed duplicate NULL check
See bug #54196.

Reported-by: Andrey Vinogradov <andrey.vinogradov@teplomonitor.ru>
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-27 20:53:30 +02:00
Simon Goldschmidt
0c209dba4b ethernet_input: fixed duplicate check for p->len
See bug #54195.

Reported-by: Andrey Vinogradov <andrey.vinogradov@teplomonitor.ru>
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-27 20:51:10 +02:00
Simon Goldschmidt
f3e14585ad tcp_out: fix duplicate check of tcp snd_queuelen
Can be combined into a single check using LWIP_MIN.
See bug #54194

Reported-by: Andrey Vinogradov <andrey.vinogradov@teplomonitor.ru>
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-27 20:44:01 +02:00
Simon Goldschmidt
8435fbb048 doc: IP_REASS_MAX_PBUFS is used for ipv6, too
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-27 20:44:01 +02:00
Axel Lin
4027a2ae58 Introduce lwip_toupper and use it in netbiosns.c
This fixes build error when LWIP_NO_CTYPE_H=1.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-27 23:16:03 +08:00
Axel Lin
a56e61c942 Fix compiling with LWIP_NOASSERT defined
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-06-24 18:18:35 +08:00
Simon Goldschmidt
d80e84864e httpd deduplicate code in http_send_data_ssi
Keep lead-in/lead-out tag in an array
2018-06-22 22:23:26 +02:00
Lucas Vinicius Hartmann
0acf37fd75 Added JavaScript-friendly ssi /*#tag*/. 2018-06-22 22:06:14 +02:00
Simon Goldschmidt
58f928a181 lwiperf: remove the comments that this is IPv4 only
IPv6 works (tested against iperf version 2.0.9 on linux)

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-22 06:39:04 +02:00
Simon Goldschmidt
b9b74b2d92 lwiperf: make tradeoff client mode work 2018-06-21 22:06:36 +02:00
Axel Lin
fb21bc1609 tcp_priv.h: LWIP_TCP_OPT_LENGTH: Enclosing macro argument in parentheses
Fix below build error:
In file included from
../../../../lwip/src/../test/unit/tcp/test_tcp.c:3:0:
../../../../lwip/src/../test/unit/tcp/test_tcp.c: In function
‘test_tcp_rto_timeout_syn_sent_impl’:
../../../../lwip/src/../test/unit/tcp/test_tcp.c:1246:113: error: suggest parentheses around arithmetic in operand of ‘|’ [-Werror=parentheses]
   const u16_t tcp_syn_opts_len = LWIP_TCP_OPT_LENGTH(TF_SEG_OPTS_MSS|TF_SEG_OPTS_WND_SCALE|TF_SEG_OPTS_SACK_PERM|TF_SEG_OPTS_TS);
                                                                                                                 ^
../../../../lwip/src/include/lwip/priv/tcp_priv.h:305:4: note: in definition of macro ‘LWIP_TCP_OPT_LENGTH’
   (flags & TF_SEG_OPTS_MSS       ? LWIP_TCP_OPT_LEN_MSS           : 0) + \
    ^~~~~

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-06-21 09:11:14 +08:00
Simon Goldschmidt
9992b48e90 fix compiling with LWIP_NOASSERT defined
See bug #54157
2018-06-20 20:56:20 +02:00
Simon Goldschmidt
824ebbe0e9 tcp: fix RTO timer not working if link is down
... and added some test cases for this situation
See bug #54139

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-19 22:48:06 +02:00
Simon Goldschmidt
3cdfc67dd8 ip4_frag: fix assertion on wrong pbuf
see bug #54117

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-19 21:29:16 +02:00
Simon Goldschmidt
7577e587be lwip_itoa: fix implicit conversion warning 2018-06-18 12:15:37 +02:00
Sylvain Rochet
ce16f8c498 PPP: remove unknown define references to PPP_NUM_TIMEOUTS when PPP_SUPPORT is disabled
Fail to build if PPP_SUPPORT is disabled because PPP_NUM_TIMEOUTS
references defines that are unknown if PPP_SUPPORT == 0. Move
PPP_NUM_TIMEOUTS to PPP_SUPPORT block and set a default value to 0
if PPP_NUM_TIMEOUTS is still not defined at the end of ppp_opts.h.

Fixes: e4e0fc4193 ("PPP: set PPP_NUM_TIMEOUTS_PER_PCB value to computed number of simultaneous timers")
Signed-off-by: Sylvain Rochet <gradator@gradator.net>
2018-06-18 10:17:58 +02:00
Simon Goldschmidt
871f27628b lwiperf: fix unused function warning/error 2018-06-18 07:24:42 +02:00
Sylvain Rochet
e4e0fc4193 PPP: set PPP_NUM_TIMEOUTS_PER_PCB value to computed number of simultaneous timers
A deep analysis of simultaneously running timers showed we can use a
slightly smaller value for PPP_NUM_TIMEOUTS_PER_PCB, value which was
arbitrarily chosen to a safe value based on the number of enabled PPP
features. Add the boring and long analysis to the end of our internal
header file and use the result in ppp_opts.h.

Signed-off-by: Sylvain Rochet <gradator@gradator.net>
2018-06-18 01:15:35 +02:00
Simon Goldschmidt
58b5a5fc5a lwiperf: implemented "dual" client mode 2018-06-17 21:04:57 +02:00
Simon Goldschmidt
a057caee45 lwiperf: start implementing iperf client
Only the transmission side works for now (todo: dual and tradeoff mode).
Also, only a 10 second timeout mode is implemented for now.

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-15 22:26:32 +02:00
Simon Goldschmidt
dbc16e6765 minor whitespace cleanup 2018-06-15 21:19:19 +02:00
Sylvain Rochet
f31160a6cb PPP, PPPoL2TP: properly ack receipt of duplicate packets
Managed to find the spirit behind the RFC. Looks like we need to send
a ZLB packet with counters as is to the packet (ZLB or not) we
previously sent to ack the message. Luckily we don't need more than
received NS/NR counters to forge the resent ack.

Signed-off-by: Sylvain Rochet <gradator@gradator.net>
2018-06-15 17:29:50 +02:00
Sylvain Rochet
738a2fe846 PPP, PPPoL2TP: stop ICCN timeout when receiving ICCN ack
Remove spurious and hitless timeout function call once L2TP reach "data"
state.

Signed-off-by: Sylvain Rochet <gradator@gradator.net>
2018-06-15 15:45:15 +02:00
Sylvain Rochet
5278202f66 PPP: remove now unnecessary null PPP IP4 output handler
netif_null_output_ip4 dummy handler appeared in netif core, remove our
own from PPP stack.

Signed-off-by: Sylvain Rochet <gradator@gradator.net>
2018-06-15 14:41:19 +02:00
Sylvain Rochet
98008cb1ab PPP, PPPoL2TP: use expected peer NS instead of current peer NS
We never use the current peer NS value but always the next expected peer
NS value (current value plus one).

Signed-off-by: Sylvain Rochet <gradator@gradator.net>
2018-06-15 14:08:03 +02:00
Sylvain Rochet
a56519032e PPP, PPPoL2TP: drop unexpected packets from peer
Conform a little bit more to the RFC by dropping duplicate received
packets. It might help discover Ns sequence issues.

Signed-off-by: Sylvain Rochet <gradator@gradator.net>
2018-06-15 14:02:58 +02:00
Sylvain Rochet
047c3c6528 PPP, PPPoL2TP: take care of Ns/Nr wraparounds
It can't be an issue since we only send and receive a few L2TP control
packets and we don't care about anything received next other than
sending Ack packet. For the sake of correctness properly handle Ns/Nr
counters wraparounds, it doesn't add more code anyway.

Signed-off-by: Sylvain Rochet <gradator@gradator.net>
2018-06-15 01:33:07 +02:00
Sylvain Rochet
5b8760601b PPP, PPPoL2TP: wait for ICCN ack before starting PPP
L2TP tunnel is really UP only once we received the ICCN Ack packet,
generally with a ZLB packet. We actually drop all data packets until
we reach the "data" L2TP state, which is a sane thing to do, therefore
it makes no sense at all to start the PPP session a bit earlier.

Signed-off-by: Sylvain Rochet <gradator@gradator.net>
2018-06-15 00:47:29 +02:00
Sylvain Rochet
b9fe13c105 PPP, PPPoL2TP: fix ZLB packets Ns value
Our Ns counter is the current slot rather than the next to ease packet
retransmission. Therefore we increment the Ns counter before using the
next slot instead of after. The RFC is written with post-increment in
mind rather than pre-increment, thus when the RFC says that Ns in not
incremented for ZLB packets it actually means that ZLB packets are sent
with the next Ns without post-incrementing the Ns value, meaning the
ZLB packet does not take a slot. Since we are using a pre-incremented
value for real slots we need to send ZLB packets with our current Ns
value plus one.

Signed-off-by: Sylvain Rochet <gradator@gradator.net>
2018-06-14 23:42:29 +02:00
Sylvain Rochet
a48ff4aaf2 PPP, PPPoE: fix trivial build error
lwip/src/netif/ppp/pppoe.c: In function ‘pppoe_send_padt’:
lwip/src/netif/ppp/pppoe.c:1048:108: error: ‘sc’ undeclared (first use in this function)

sc is not passed to ‘pppoe_send_padt’ function because it might be
called to terminate unknown sessions.

Fixes: d4047ea1d1 ("Try to fix issues reported by coverity")
Signed-off-by: Sylvain Rochet <gradator@gradator.net>
2018-06-14 19:58:41 +02:00
Axel Lin
a51c92b617 tcp_out: Fix trivial build error
Fixes: 6ac21515ca ("Add missing null checks")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-06-14 22:47:28 +08:00
Matthias Hofmann
6ac21515ca Add missing null checks.
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-14 16:20:47 +02:00
Simon Goldschmidt
e61b925709 try to fix compiling with gcc & clang 2018-06-14 15:01:57 +02:00
Simon Goldschmidt
944f286d87 fix bug in RA MTU validation
Also fix that RA could change IPv4 MTU.
See bug #53696

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-14 12:55:18 +02:00
Simon Goldschmidt
313664c59c ip6addr_ntoa_r: correctly generate ipv4 mapped addresses 2018-06-14 12:29:40 +02:00
Axel Lin
7c03f4cf46 Silence lwip_tolower compiler warning
Fix gcc build warning: array subscript has type 'char' [-Wchar-subscripts].

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-06-14 09:47:19 +08:00
Simon Goldschmidt
b0e5eeb7d2 udp: prefer correctly bound pcbs when receiving broadcast
See bug #53301

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-13 22:01:18 +02:00
Simon Goldschmidt
1bdc669b45 udp: restructure udp_input uncon_pcb selection in preparation for fixing bug #53301 2018-06-13 21:59:04 +02:00
Simon Goldschmidt
47ebb2b267 dns: add a comment about case insensitivity 2018-06-13 15:10:47 +02:00
Simon Goldschmidt
a9d6ea5953 introduce 'lwip_tolower' and use it in dns.c
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-13 15:08:11 +02:00
armink
66f7f06601 fix DNS resolution to not case insensitivity
See patch #9654

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-13 15:04:46 +02:00
Matthias Hofmann
8e23b8d903 Correct UDP rebind check.
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-13 15:00:21 +02:00
Simon Goldschmidt
a75332a407 ip4_frag: correctly refragment packets that already have MF set
see patch #9645

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-13 14:56:18 +02:00
Simon Goldschmidt
25497bb387 bridgeif/slipif/zepif: check that input callback is not NULL 2018-06-13 10:53:50 +02:00
Axel Lin
61e3f49f69 netif: Don't return error if pass NULL netif_input_fn to netif_add
The new NULL checking against netif_input_fn make ppp stop working
because in ppp_new() it calls netif_add with NULL netif_input_fn.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-13 10:39:38 +02:00
Simon Goldschmidt
3f2227f04c Fix pppos after changing PBUF_POOL to PBUF_RAM
This partly reverts 31bc2f9b which broke pppos tx as 'pppos_output_append'
implements a custom scheme of checking available pbuf size.
Added a comment why PBUF_POOL is ok for tx in this special case.
See bug #51908

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-13 09:38:04 +02:00
Simon Goldschmidt
392c676ef5 fix bug #53273: IPv6 link-local address generation for non-ethernet type netif does not convert byte order 2018-06-13 08:57:17 +02:00
Simon Goldschmidt
0c5133d7cf fix ip6addr_aton for non-shortened ipv4 mapped addresses 2018-06-12 21:48:32 +02:00
Simon Goldschmidt
eb91fdd861 httpd: fix missing null termination when searching for a default file in file system folder 2018-06-12 20:14:04 +02:00
Simon Goldschmidt
1bf323e12f remove 2 NULL checks which are wrong 2018-06-12 13:46:44 +02:00
Simon Goldschmidt
e7c0619189 fix NULL checks (compiler error, tcp_rst allows pcb==NULL) 2018-06-12 13:32:12 +02:00
Simon Goldschmidt
31bc2f9b20 fixed bug #51908: PPPOS uses PBUF_POOL in transmit pathway
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-12 10:39:46 +02:00
Matthias Hofmann
342d0eadfb Add null pointer checks for TCP, UDP and netif
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-12 10:24:08 +02:00
Simon Goldschmidt
6ea2483546 ip4_canforward(): don't route multicast packets
Added LWIP_HOOK_IP4_CANFORWARD to still implement multicast routing.
See bug #52914

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-12 06:45:30 +02:00
Axel Lin
1fd145fbc9 Fix trivial copy-n-paste mistake in ip4_debug_print
Fixes: 288d3c2802 ("fixed bug #54006: Two compiler warnings on IAR when debug is enabled")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-06-12 11:36:05 +08:00
Simon Goldschmidt
2837bb310c fix ip6addr_aton handling IPv4-mapped addresses
... and added a unit test for it

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-11 22:21:31 +02:00
Simon Goldschmidt
288d3c2802 fixed bug #54006: Two compiler warnings on IAR when debug is enabled 2018-06-11 20:11:47 +02:00
Simon Goldschmidt
31e07f90bd send router solicitations every 4 seconds
See bug #53973

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-08 23:09:13 +02:00
Simon Goldschmidt
4fa33c17bc add reference to the RFC for the last commit... 2018-06-08 22:54:02 +02:00
Simon Goldschmidt
1a294622d0 ipv6 router solicitation: "ensure at least one solicitation is sent"
Fix the case where nd6_send_rs() fails: send one solicitation here,
not LWIP_ND6_MAX_MULTICAST_SOLICIT.

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-08 22:45:55 +02:00
Simon Goldschmidt
fd050b8a97 fix bug #53971 Lwip sends Router Solicitation on address changes
... and add a unit test for it.

Moved resetting netif->rs_count from all reports to link-up and netif-up only.
While at it, clean up the interface a bit so that netif->rs_count is touched
from nd6.c only.

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-08 22:18:50 +02:00
Simon Goldschmidt
b1ffb3a8d3 Try to fix bug #53952 (ip4_addr_debug_print_val unaligned structure reference compiler warning) 2018-05-24 23:13:27 +02:00
Dirk Ziegelmeier
d996d0f486 Apply patch #9629: tftp_cleanup() should clean up more
By Jens Nielsen
2018-05-21 09:27:31 +02:00
Simon Goldschmidt
11c294e973 fix type conversion errors introduced with last commit 2018-05-17 22:35:12 +02:00
Simon Goldschmidt
0c2fdfcf42 Fix bug #53667: ARP table max size is to small
arp table functions, nd6 destination cache and struct netif_hint
can now be u16_t or u8_t depending on table size, so up to 32K
entries can be used in these tables (s16_t)

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-05-17 21:52:01 +02:00
Simon Goldschmidt
0f165ff136 etharp: use generic types in external access to ARP table
This should hide the internal type used for access to the ARP table
which currently is s8_t or u8_t, depending on the use case.

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-05-17 21:16:06 +02:00
goldsimon
8f3df7c862 tcp: fix const warning for LWIP_NETIF_HWADDRHINT==1 2018-05-17 20:57:02 +02:00
Axel Lin
ec8c764fcb apps/smtp: Fix build warning when !(SMTP_SUPPORT_AUTH_PLAIN || SMTP_SUPPORT_AUTH_LOGIN)
Fix build warning: ‘smtp_base64_encode’ declared ‘static’ but never defined.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-05-17 19:50:17 +08:00
Axel Lin
795f05c5d3 apps/smtp: Fix build warning when SMTP_CHECK_DATA==0
Fix build warning: 'smtp_verify' declared 'static' but never defined.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-05-17 17:06:31 +08:00
Joel Cunningham
ffaee59f3e loopif: only schedule poll when first packet is enqueued
This optimizes the netif_loop_output to only schedule a call to poll when
the first packet is enqueued. This ensures netif_poll is ran once per
burst of packets that are sent (which is typical in a TCP transfer)

The old behavior scheduled a call to poll for every packet that was
enqueued and this lead to exhaustion of the MEMP_TCPIP_MSG_API memory pool
and tcpip_mbox (if port is using static mbox size). The extra callbacks are
wasted work because netif_poll drains the entire queue when ran

This issue presented itself when large TCP transfer go across the loopback
netif
2018-05-02 09:16:01 -05:00
Joel Cunningham
070e449690 loopif: disable checksums
This disable checksum generation and checking for the loopback netif
when LWIP_CHECKSUM_CTRL_PER_NETIF is enabled

Checksums are not needed for the loopback adapter and this will increase
performance for loopback communication
2018-05-02 09:16:01 -05:00
goldsimon
a445172661 makefsdata: fix hiding local variable 'i' 2018-05-02 10:05:24 +02:00
Dirk Ziegelmeier
059bc952f6 Revert Filelists.mk to original state - it is not really useful to generate it from Filelists.cmake 2018-05-02 09:40:36 +02:00
Dirk Ziegelmeier
f116bc37d1 Cleanups in CMake files 2018-04-30 22:29:07 +02:00
Dirk Ziegelmeier
9672b4c3af Work on CMake build system - restructure to use included cmake files, this is more flexible 2018-04-30 21:35:12 +02:00
Dirk Ziegelmeier
d40c3251d7 Work on CMake build system
Always configure files, doesn't hurt and makes CMakeLists.txt more readable
2018-04-26 23:31:31 +02:00
Dirk Ziegelmeier
ad8e08a08b Continue workin on CMake build system
Split lwip lib into lwIP core and lwIP apps
Compile makefsdata only when NOT cross-compiling
2018-04-26 22:33:53 +02:00
Dirk Ziegelmeier
c61a0570b1 Work on CMake build system 2018-04-25 22:44:30 +02:00
goldsimon
2291f9a8fa tftp: decrease TFTP_TIMER_MSECS
This timeout is used to measure TFTP_TIMEOUT_MSECS fine enough.
Calling tftp_tmr at a 50ms interval to handle a 1 seconds timeout
produces way too much cpu load (and prevents sleep).

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-04-25 21:27:58 +02:00
goldsimon
e05a96550f etharp: fix bogus ifdef regions
(after separating etharp and ethernet)
2018-04-25 21:17:47 +02:00
goldsimon
b2ef9d9046 netbiosns: fix bug #53747 (need to verify received packet length) 2018-04-25 20:56:34 +02:00
Our Air Quality
373bf8c36d Quieten a toupper() compiler warning.
Gcc complains that an array index is a 'char' when passing a 'char' to
toupper(). Quieten this by coercing to an 'unsigned char'.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-04-25 20:39:25 +02:00
Jens Nielsen
c34120e855 TFTP server handle retransmit Data packets
Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-04-25 20:29:31 +02:00
Dirk Ziegelmeier
91bc7a02c9 Fix indent in CMakeLists.txt (Tabs -> Spaces) 2018-04-24 08:06:27 +02:00
Dirk Ziegelmeier
4355a23ad2 Cleanups in CMake build files 2018-04-23 23:30:01 +02:00
Dirk Ziegelmeier
b60df2df20 Start working on a CMAKE build system 2018-04-23 22:56:35 +02:00
Dirk Ziegelmeier
b2948c08f7 Merge branch 'master' of ssh://git.sv.gnu.org:/srv/git/lwip 2018-04-22 06:57:28 +02:00
Dirk Ziegelmeier
d4ee483280 Enable IPv6 fragmentation by default 2018-04-22 06:57:05 +02:00
Axel Lin
9fd8222479 etharp: Cast the return value of etharp_find_entry to s8_t instead of err_t
etharp_find_entry() returns s8_t rather than err_t.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-04-21 08:22:51 +08:00
Dirk Ziegelmeier
9980d09bc8 Add note about NETIF_FLAG_MLD6 netif flag 2018-04-20 08:59:36 +02:00
Dirk Ziegelmeier
4b3e996617 Add note to MLD6 that allnodes group multicasts must be received 2018-04-20 08:57:01 +02:00
Ben Wijen
7d1c6ba549 dhcp: Fix BOOTP_FILE bug
The comment in dhcp_handle_ack for 'offered_si_addr' states:
'boot file name copied in dhcp_parse_reply if not overloaded'
However this code was never reached if the packed was not 'overloaded'

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-04-19 22:18:56 +02:00
goldsimon
d320b27a5f fix compiling sockets.c for SYS_LIGHTWEIGHT_PROT==0 2018-04-19 08:23:10 +02:00
goldsimon
ef3073aaf9 LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT: 'lfree' mus be volatile 2018-04-18 22:12:46 +02:00
goldsimon
3abc8ae161 LWIP_NETCONN_FULLDUPLEX: unblock rx threads on close
Threads blocked on the rx mbox are counted and on close,
one "netconn closed" message per thread is posted to the mbox
to ensure all threads are woken.

The netconn can then be safely deleted. In socket API, "fd_used"
and "fd_free_pending" help with auto-deleting the netconn.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-04-18 21:51:34 +02:00
goldsimon
41fea4ad7d sockets: change closing: netconn is freed when socket is closed, not before
This is necessary to implement fullduplex sockets that are closed asynchronously:
the netconn in the socket must not be freed before all threads have given up
using it.

We now call the first part of 'netconn_delete()' (moved to 'netconn_prepare_delete()')
from lwip_close() and only actually end up calling 'netconn_free()' from
'free_socket()', which might be called later if LWIP_NETCONN_FULLDUPLEX is enabled.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-04-18 20:55:49 +02:00
goldsimon
1090e9cdec LWIP_NETCONN_FULLDUPLEX: prevent taking recursive sys arch lock
Calling SYS_ARCH_PROTECT() could happen twice in 'free_socket()' if
that free was executed delayed (e.g. in 'done_socket_locked()').

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-04-18 20:55:49 +02:00
goldsimon
b1fe8cf4b8 netbiosns: check question type before generating an answer 2018-04-18 08:17:10 +02:00
goldsimon
f65911a84b netbios: fix response length of node status response 2018-04-18 07:28:41 +02:00
Dirk Ziegelmeier
66800925cf Fix indent in netbiosns.c 2018-04-17 14:08:59 +02:00
Dirk Ziegelmeier
533c97f0c3 Fix bug #53626: NetBIOS Responder generates malformed packet responding to "*" name
Implement corrected answer packet
2018-04-16 10:40:05 +02:00
Axel Lin
e935faf2bc tcp_priv.h: Fix compile warnings when TCP_DEBUG_PCB_LISTS is set
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-04-10 17:48:47 +08:00
goldsimon
fa55458c42 netconn_accept: reduce number of ifdefs 2018-04-06 22:37:20 +02:00
goldsimon
4cc953d0e3 httpd: fixed compiling makefsdata.c 2018-04-04 21:45:47 +02:00
Dirk Ziegelmeier
ffdd44ec74 Fix bug #53559: IPv4 to IPv6 filtering not freeing PBUFs
Add missing pbuf_free() call
2018-04-04 21:04:14 +02:00
Ray Abram
b0ae967660 NetBIOS Responder should respond to "*" names
See bug #53325

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-04-03 22:19:18 +02:00
Tom Ferrin
82d8f08451 Add "server reachability" register to SNTP
Guarded with SNTP_MONITOR_SERVER_REACHABILITY (sntp_opts.h).
See patch 9581

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-04-03 21:56:33 +02:00
Tom Ferrin
e46b9ad4ac sntp: store server IP address after DNS lookup
See patch #9612

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-04-03 21:16:05 +02:00
Giuseppe Modugno
2d4da92eeb makefsdata: added options to skip and avoid compressing some extensions
See patch #9605

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-04-03 21:08:25 +02:00
Axel Lin
81acaf0ff1 tcp_out: Fix updating remainder_flags in tcp_split_unsent_seg
The code to migrate flags from original segment updating wrong variable
so both remainder and remainder_flags may be incorrect. Fix it.

Fixes: f582c88339 ("tcp: persist timer re-work (bug #50837)")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Joel Cunningham <joel.cunningham@me.com>
2018-03-31 11:20:03 +08:00
goldsimon
b693056bb6 lowpan6_ble: local address is required for compression/decompression, too 2018-03-27 21:20:01 +02:00
goldsimon
97a9fe1b10 Fix compiling lowpan6_ble.c on travis 2018-03-22 08:48:53 +01:00
Axel Lin
e9ee3c4b58 add lowpan6_common.c to Filelists.mk
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-03-22 08:39:20 +08:00
goldsimon
8adfc730ec lowpan6_ble.c: use common functions from lowpan6_common.c 2018-03-21 22:57:45 +01:00
goldsimon
ac03107036 lowpan6_common.c: add comments from ble version 2018-03-21 22:53:08 +01:00
goldsimon
a4b9beef04 Move common 6LoWPAN code to new file lopwan6_common.c
This is mainly IPHC (de)compression.

TODO: adapt the 6LoWPAN-over-BLE netif to this.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-03-21 20:55:05 +01:00
goldsimon
c974fc9d43 http_client: fix compiling if mem_size_t is smaller than size_t 2018-03-21 09:33:00 +01:00
goldsimon
c881c48eed netif_add: check that the new netif is not already added 2018-03-21 09:32:39 +01:00
Axel Lin
600527dde7 apps/http: httpd: Fix unused parameter warning if !LWIP_HTTPD_SUPPORT_V09
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-03-21 15:05:33 +08:00
Axel Lin
e19d908f0e apps/http: Fix httpd_structs.h build error
Fixes: bug #53382: HTTPD_ADDITIONAL_CONTENT_TYPES doesn't compile
Reported-by: Giuseppe Modugno <giuseppe.modugno.loqed@gmail.com>
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-03-19 21:08:17 +08:00
Dirk Ziegelmeier
104a629a51 zepif: Convert to dual-stack 2018-03-15 09:21:32 +01:00
goldsimon
d79416eee6 lowpan6: move a function to delete one prototype 2018-03-14 16:59:20 +01:00
Axel Lin
6070a7ef6a netif: Add netif_do_ip_addr_changed function to reduce duplicated code
As the common code to call tcp/udp/raw_netif_ip_addr_changed is called
by multiple places, add netif_do_ip_addr_changed() to call them.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-03-14 22:59:17 +08:00
goldsimon
08bcfa2b29 netif: initialize netif->output with a dummy function for IPv6 only netifs 2018-03-13 20:29:37 +01:00
goldsimon
0074022bb5 minor: fix typos and spaces 2018-03-13 20:28:59 +01:00
Axel Lin
10ae311a93 lowpan6: Rework to speed up dequeue datagram process
Current implementation iterates the lowpan6_data.reass_list every time
dequeue_datagram() is called.
We can get previous lrh in all the context calling dequeue_datagram().
By adding a prev arguemnt to dequeue_datagram(), we can speed up the
dequeue datagram process.

All the callers never check return value of dequeue_datagram() as it
always return ERR_OR, thus make it return void instead.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-03-13 08:16:35 +08:00
Axel Lin
909037c2ca api_lib: Remove superfluous #if LWIP_TCP in netconn_recv_data_tcp
netconn_recv_data_tcp() will be built only when LWIP_TCP=1.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-03-11 16:47:14 +08:00
goldsimon
16afe566ff lowpan6: fix doc warning in clang 2018-03-09 13:40:15 +01:00
goldsimon
253fcc8dcd http_client: call tcp_recved for header bytes
Without this, closing the connection after successful transfer resulted
in a RST being sent because the window was not fully marked as 'recved'.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-03-09 11:30:23 +01:00
goldsimon
8d8572354b lowpan6: fix bug #47291 (wrong datagram size for fragmentation)
Fragment datagram_size and datagram_offset should be calculated from the uncompressed datagram.
We did this on the compressed size and thus were not compatible to other implementations.
Now my test setup communicates with contiki sicslowpan.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-03-09 11:28:35 +01:00
goldsimon
b86f9b97e0 lowpan6: refactor decompression to not allocate a pbuf 2018-03-09 06:37:59 +01:00
goldsimon
61a1b98cc9 various IPv6-only compile fixes 2018-03-07 20:55:00 +01:00
goldsimon
972f32dd47 zepif: fix compiling with IPv4 disabled 2018-03-07 19:58:09 +01:00
Axel Lin
971404ff90 http_client.h: Include lwip/pbuf.h
struct pbuf is used by httpc_headers_done_fn, thus need to include
lwip/pbuf.h.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-03-07 15:24:14 +08:00
Axel Lin
0411332856 api_msg.h: Fix build error when LWIP_NETIF_API && !LWIP_SOCKET && !LWIP_NETCONN
netifapi related lwIP internal definitions should be guarded
by #if LWIP_NETIF_API rather than #if LWIP_NETCONN || LWIP_SOCKET.

Fix below build errors:
cc -g -DLWIP_DEBUG -Wall -pedantic -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 -Wunreachable-code -Wuninitialized -Wmissing-prototypes -Wredundant-decls -Waggregate-return -Wlogical-not-parentheses -Wlogical-op -Wc90-c99-compat -Wtrampolines -I. -I../../..  -I../../../../lwip/src/include -I../../../ports/unix/port/include -I../../../../mbedtls/include -Wno-redundant-decls -DLWIP_HAVE_MBEDTLS=1 -c ../../../../lwip/src/api/netifapi.c In file included from ../../../../lwip/src/api/netifapi.c:46:0:
../../../../lwip/src/include/lwip/netifapi.h:76:50: error: unknown type name 'netifapi_void_fn'; did you mean 'netif_init_fn'?
 err_t netifapi_netif_common(struct netif *netif, netifapi_void_fn voidfunc,
                                                  ^~~~~~~~~~~~~~~~
                                                  netif_init_fn
../../../../lwip/src/include/lwip/netifapi.h:77:29: error: unknown type name 'netifapi_errt_fn'; did you mean 'netif_input_fn'?
                             netifapi_errt_fn errtfunc);
                             ^~~~~~~~~~~~~~~~
                             netif_input_fn
../../../../lwip/src/api/netifapi.c: In function 'netifapi_do_netif_add':
../../../../lwip/src/api/netifapi.c:67:22: error: dereferencing pointer to incomplete type 'struct netifapi_msg'
   if (!netif_add( msg->netif,
                      ^~

Fixes: 30a2283993 ("Move netifapi private definitions to priv/api_msg.h")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-03-07 07:58:10 +08:00
goldsimon
b6d9bb6b2a http_client: check current state when receiving FIN 2018-03-06 21:51:13 +01:00
goldsimon
91a2d9e237 zepif: fix comment for calling netif->input() 2018-03-05 08:40:51 +01:00
goldsimon
5474498f7e zepif: call netif->input instead of tcpip_6lowpan_input for rx packets
This allows reusing zepif e.g. with contiki 6LoWPAN code for testing.
2018-03-05 06:43:57 +01:00
Axel Lin
53ddb9244b apps/sntp: Trivial build warning fix
Fix below build warning:
../../../../lwip/src/apps/sntp/sntp.c: In function ‘sntp_servermode_dhcp’:
../../../../lwip/src/apps/sntp/sntp.c:726:3: warning: ISO C90 forbids mixed declarations and code [-Wc90-c99-compat]
   u8_t new_mode = set_servers_from_dhcp ? 1 : 0;
   ^~~~

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-03-04 19:18:26 +08:00
Dirk Ziegelmeier
91038e4979 Improve 6LoWPAN documentation 2018-03-03 11:09:57 +01:00
Dirk Ziegelmeier
08bf8b7121 Improve documentation for 6LOWPAN BLE and ZEPIF 2018-03-03 11:00:04 +01:00
goldsimon
282e1601ef finally got zepif running 2018-03-02 13:01:05 +01:00
goldsimon
ab0e457066 lowpan6: change the name of 2 members to indicate usage for tx 2018-03-01 22:17:12 +01:00
goldsimon
a137e16ff8 lowpan6.c: fix referenced RFCs 2018-03-01 12:44:18 +01:00
goldsimon
6e62baaa6c sockets.h: include <string.h> for memcpy in FD_ZERO 2018-03-01 09:05:29 +01:00
goldsimon
cb746a1aea zepif: fix destination IP (default should be broadcast, not 0.0.0.0) 2018-03-01 07:08:03 +01:00
goldsimon
fcccc47be4 lowpan6.c: fix clang doc warnings 2018-03-01 07:00:32 +01:00
goldsimon
002ba1a66b zeoif: ZEPIF_LOOPBACK should be 0 default, not 1 2018-03-01 06:15:55 +01:00
goldsimon
43778e5334 add zepif.c to Filelists.mk 2018-02-28 23:00:08 +01:00
goldsimon
43a55003da Added a netif encapsulating 6LowPAN in ZEP (ZigBee Enxapsulation Protocol)
This protocol is sent over a 2nd netif via UDP/IP and can used to analyze
6LoWPAN with a Wireshark dissector.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-02-28 22:58:48 +01:00
goldsimon
d9770d2c5f tcpip_thread: TCPIP_MSG_INPKT: free input pbufs if the input function returns an error
This simply wasn't the case until 6LoWPAN. However, since tcpip_input is like this, we
should stay with that pattern.

Adapted documentation in netif.h

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-02-28 22:48:56 +01:00
goldsimon
3a8af612b3 lowpan6.c: handle 6-byte MAC addresses on netif, too 2018-02-28 22:46:55 +01:00
goldsimon
2a5b66c9b1 lowpan6.c: tiny whitespace fix 2018-02-28 22:32:58 +01:00
goldsimon
3a93029e92 lowpan6.c: implement software CRC (e.g. required for use with ZEP) 2018-02-28 21:39:38 +01:00
goldsimon
fe68fa49f7 lowpan6.c: refactor parsing and writing the ieee 802.15.4 header to separate function 2018-02-28 21:38:49 +01:00
goldsimon
5e91cd47c9 lowpan6.c: ensure netif->hwaddr_len == 8 (to not create invalid frames) 2018-02-28 21:09:55 +01:00
goldsimon
4f059fea76 fix some IEEE_802154_FC_ bit definitions 2018-02-28 21:03:40 +01:00
goldsimon
569464ffd3 lowpan6.c: move static variables declared inside lowpan6_frag into lowpan6_data 2018-02-28 20:42:31 +01:00
Axel Lin
6e6eb620df tftp_opts.h: Make TFTP_DEBUG default OFF
TFTP_DEBUG should be enabled only when it's necessary to debug tftp,
make it default OFF.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-02-28 13:49:44 +08:00
Axel Lin
3c71e3fc77 lowpan6_ble_opts.h: Make LWIP_RFC7668_DEBUG default OFF
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-02-27 18:04:36 +08:00
Axel Lin
2e2c607727 lowpan6.c: Fix ‘lowpan6_context_lookup’ defined but not used build warning
Fix build warning with LWIP_6LOWPAN_NUM_CONTEXTS==0.
lowpan6_context_lookup() is only used when LWIP_6LOWPAN_IPHC &&
LWIP_6LOWPAN_NUM_CONTEXTS > 0.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-02-27 18:01:18 +08:00
goldsimon
49acdae8d0 lowpan6.c: fix building with LWIP_6LOWPAN_NUM_CONTEXTS==0 2018-02-27 10:07:15 +01:00
goldsimon
7db978ca03 lowpan6.c: rework lowpan6_input processing of the ieee 802.15.4 header
This should fix bug #48825 (lowpan6: source PAN ID is skipped without
checking PAN ID compression flag)
2018-02-26 21:47:24 +01:00
goldsimon
731b83ac5f lowpan6.c: a netif input function must return ERR_OK only if the input pbuf was freed 2018-02-26 20:51:13 +01:00
goldsimon
fb5bbca1d9 lowpan6.c: move IEEE 802.15.4 definitions to their own header file
This is mainly a preparation to merge the two 6LoWPAN netifs
2018-02-26 20:38:41 +01:00
goldsimon
a022590f40 lowpan6.c: move netif-specific data to a common struct 2018-02-26 20:32:39 +01:00
Axel Lin
c28aa02820 lowpan6_ble: Convert to use pbuf_remove_header instead of pbuf_header
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-02-26 10:20:05 +08:00
goldsimon
e7766297de dhcp6_disable: need to set pcb_allocated to zero
See bug #53224: dhcp6_disable() pcb_allocated need set to zero.
2018-02-25 13:20:28 +01:00
Axel Lin
265f6f5047 lowpan6_ble: Fix build warning if LWIP_RFC7668_LINUX_WORKAROUND_PUBLIC_ADDRESS==0
Fix unused parameter ‘public_addr’ build warning if
LWIP_RFC7668_LINUX_WORKAROUND_PUBLIC_ADDRESS==0.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-02-25 12:05:24 +08:00
Axel Lin
7697a45405 lowpan6_ble_opts.h: Add #ifndef guard for LWIP_RFC7668_LINUX_WORKAROUND_PUBLIC_ADDRESS
Avoid "LWIP_RFC7668_LINUX_WORKAROUND_PUBLIC_ADDRESS" redefined build
warning if it's set to 0 by lwipopts.h.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-02-25 12:01:01 +08:00
Our Air Quality
59e98ccb19 tcp_output_fill_options: account for the SACKS length in assertion. 2018-02-24 14:46:44 +01:00
goldsimon
56124bf53b Add check in init.c: altcp does not work with LWIP_EVENT_API 2018-02-24 14:43:51 +01:00
goldsimon
a3034a442b lowpan6_ble: fix compiling with LWIP_RFC7668_NUM_CONTEXTS==0 2018-02-24 11:39:31 +01:00
goldsimon
2ce3c79ec5 lowpan6_ble.c: travis complains... 2018-02-23 14:00:56 +01:00
goldsimon
a8d789e7b3 add lowpan6_ble.c to Filelists.mk 2018-02-23 13:19:27 +01:00
goldsimon
c510e92cf4 get lowpan6_ble.c to compile 2018-02-23 13:16:14 +01:00
goldsimon
69eaafecca lowpan6_ble.c: fixed whitespace & indentation 2018-02-23 13:08:00 +01:00
Benjamin Aigner
10209ee788 Added a RFC7668 netif.
Works as expected, but some features are not implemented yet.

(See patch #9364: RFC7668 - 6lowpan over Bluetooth Low Energy -- a new netif)
(I've change the file names only; sg)

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-02-23 13:07:31 +01:00
Dirk Ziegelmeier
f595445ec0 Some fixes to DHCPv6 documentation 2018-02-23 12:54:51 +01:00
Dirk Ziegelmeier
aa04944ae0 Add DHCPv6 to documentation 2018-02-23 12:35:45 +01:00
goldsimon
d2ee10977f dhcp6: try to fix docs (clang complains) 2018-02-23 10:26:19 +01:00
goldsimon
7ad680c2bf Try to fix dhcp6.c on travis 2018-02-23 09:54:04 +01:00
goldsimon
7d007cfee5 DHCPv6: make LWIP_IPV6_DHCP6_STATELESS==LWIP_IPV6_DHCP6 by default 2018-02-23 09:26:46 +01:00
goldsimon
8600259a78 tiny cleanup in dhcp.c 2018-02-22 22:33:48 +01:00
goldsimon
76a13054ee add initial support for stateless DHCPv6
Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-02-22 22:33:16 +01:00
goldsimon
37b4494921 http_client: fix function documentation 2018-02-22 09:55:32 +01:00
goldsimon
0ee0393936 fix compiling http_client and altcp_proxyconnect with gcc 2018-02-22 09:12:51 +01:00
Axel Lin
fe3bb8bb78 etharp: Remove superfluous assert checking in free_etharp_q
The same checking is done while iterating the list in the while loop.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-02-22 11:27:29 +08:00
Axel Lin
e93cecf527 Fix build error for http files
The HTTPDFILES is renamed to HTTPFILES now.

Fixes: 1f0867299d ("add new http files to Filelists.mk")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-02-22 09:21:33 +08:00
goldsimon
1f0867299d add new http files to Filelists.mk 2018-02-21 22:17:51 +01:00
goldsimon
7b9e145fc5 http_client: change user-agent and make it overridable 2018-02-21 20:18:29 +01:00
goldsimon
2753eb1fb1 add an altcp layer for http proxy connect (e.g. to tunnel TLS through a http proxy)
Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-02-21 20:18:05 +01:00
goldsimon
a0e900dd02 makefsdata: update usage output to code 2018-02-21 14:42:47 +01:00
goldsimon
325cdf3c0b altcp_tls_mbedtls: restructure upper callbacks to prevent double-free
This fixes bug #53192: use-after-free in altcp_mbedtls

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-02-21 14:20:34 +01:00
goldsimon
a7b43dae49 altcp: default shutdown for both sides is close 2018-02-21 12:50:42 +01:00
goldsimon
d66c0e3381 altcp: mbedtls: move freeing state->rx from close to dealloc (catch-all) 2018-02-20 22:12:11 +01:00
goldsimon
bcff67b00e altcp_tls_alloc: need to close inner conn instead of freeing it 2018-02-20 17:08:00 +01:00
goldsimon
3bd87e3815 doc: altcp: keep altcp_alloc/altcp_free out of the docs
Those functions are for implementing altcp layers, not for applications
2018-02-20 14:08:04 +01:00
Dirk Ziegelmeier
333fff3e66 Improve altcp allocator documentation 2018-02-20 13:31:27 +01:00
Dirk Ziegelmeier
fc3c186289 Improve altcp allocator documentation 2018-02-20 13:25:50 +01:00
goldsimon
3a41f4fe8a altcp_alloc: add to Filelists.mk 2018-02-20 11:21:32 +01:00
Axel Lin
e9bd31b190 icmp6: Fix "LWIP_ICMP6_DATASIZE" redefined build warning if it was set to 0
Need to undefine LWIP_ICMP6_DATASIZE before change the setting.
While at it, also remove the unneeded #ifndef LWIP_ICMP6_DATASIZE
checking because it is set in lwip/opt.h.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-02-20 17:54:49 +08:00
Axel Lin
a894140bb0 igmp: Use angle brackets for including string.h
Use angle brackets(<>) for including system header files.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-02-20 15:20:14 +08:00
goldsimon
842b9f4429 altcp: simplify creating different types by adding an allocator concept
This is done with an example in the http_client

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-02-19 21:41:48 +01:00
Dirk Ziegelmeier
5b33d33e34 Add HTTP client to documentation 2018-02-19 09:01:44 +01:00
Dirk Ziegelmeier
2501913cde Move ethernetif.c from lwIP main rep to contrib examples directory where it has a chance to be actually found by users 2018-02-19 07:46:56 +01:00
Dirk Ziegelmeier
47c55c3d96 Improve documentation for 6LOWPAN and SLIPIF 2018-02-18 17:49:54 +01:00
goldsimon
ef29f2d401 http_client: httpc_tcp_recv did not return inner_conn's recv return value
Signed-off-by: goldsimon <goldsimon@gmx.de>
Reported-by: Our Air Quality <info@ourairquality.org>
2018-02-18 09:02:00 +01:00
goldsimon
b5448a86fd ip4_reass: free datagram entry if p == NULL 2018-02-18 08:55:11 +01:00
Dirk Ziegelmeier
5b459c1282 dns.h depends on err.h 2018-02-17 16:53:03 +01:00
goldsimon
2b09c18c4e altcp_tls.h: minor whitespace cleanup 2018-02-16 13:59:00 +01:00
goldsimon
2648d30843 altcp_tls_mbedtls.c: tiny function rename 2018-02-16 13:57:38 +01:00
goldsimon
bd656efd64 http client: add https support, fix parsing header with chained pbufs 2018-02-16 12:29:40 +01:00
goldsimon
e87392cc85 http client: fix proxy support 2018-02-16 09:18:35 +01:00
goldsimon
3dafa72ec8 apps: add http client
Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-02-15 22:10:29 +01:00
goldsimon
d4c4b0eec5 rename folder 'src/apps/httpd' to 'http'
Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-02-15 20:13:25 +01:00
goldsimon
cd1516e2e4 mqtt: rewrote check for topc_len so that coverity is happy... 2018-02-15 09:15:40 +01:00
goldsimon
216f21dcd1 simple whitespace cleanup 2018-02-15 06:41:16 +01:00
Axel Lin
5d5b8fbb46 Fix trivial copy & paste mistake for comment in header files
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-02-14 22:49:12 +08:00
goldsimon
133bf70ab5 mqtt: slightly change some overflow checks 2018-02-14 12:37:35 +01:00
goldsimon
eea95459c9 mqtt: add more length validity checks in mqtt_message_received
This also (but not only) fixes bug #52345 ("MQTT buffer length check seems wrong")
2018-02-14 12:08:15 +01:00
goldsimon
546a8c4860 Revert "vj_compress_tcp: help coverity to see we're not accessing out of bounds (this is a union)"
This reverts commit 2390eb6826.
I've already marked other issues like this as 'invalid', so do this here, too.
Although I don't like the code, there's not much use in fixing this in one place only.
2018-02-14 07:34:05 +01:00
goldsimon
e926779510 netif_alloc_client_data_id: only present if LWIP_NUM_NETIF_CLIENT_DATA
In contrast to netif_get_client_data, netif_alloc_client_data_id() is only
available if LWIP_NUM_NETIF_CLIENT_DATA > 0, not for DHCP etc.

This is correct in netif.c but wrong in netif.h
2018-02-14 07:19:46 +01:00
goldsimon
731336223f mqtt: add comments in mqtt_parse_incoming 2018-02-14 06:54:56 +01:00
Joel Cunningham
618a28fc53 memp: remove include of sockets.h
Socket memory pool types have been migrated to sockets_priv.h so we
no longer need to include sockets.h
2018-02-13 14:04:01 -06:00
goldsimon
2390eb6826 vj_compress_tcp: help coverity to see we're not accessing out of bounds (this is a union) 2018-02-13 12:47:00 +01:00
goldsimon
5ee77262bc mem plug_holes: fix copy& paste error 2018-02-13 12:24:10 +01:00
goldsimon
bcb6819715 dns_compare_name: change check for u16_t overflow
check upper border (0xFFFF) instead of checking for 0 after overflow
2018-02-13 12:23:50 +01:00
goldsimon
d4047ea1d1 Try to fix issues reported by coverity 2018-02-13 12:10:19 +01:00
goldsimon
e20e9bc3d4 Try to fix issues reported by coverity 2018-02-13 12:09:18 +01:00
Dirk Ziegelmeier
d5d635cdce Minor DNS documentation improvement 2018-02-13 10:58:32 +01:00
Axel Lin
47946a29e9 memp: Remove include of lwip/netifapi.h from memp.c
struct netifapi_msg is defined in lwip/priv/api_msg.h rather than
lwip/netifapi.h. Thus remove include of lwip/netifapi.h from memp.c.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-02-13 16:52:18 +08:00
goldsimon
b5e67f142a tcp: LWIP_CHECKSUM_ON_COPY: fix adding data to retx segment
See bug #50914( TCP_CHECKSUM_ON_COPY when adding data to
retransmission): when adding data to an already transmitted segment
that has an uneven length, the checksum was wrong.

To fix this, tcp_output_segment has to restore seg->chksum_swapped
before returning.
2018-02-12 12:38:17 +01:00
Dirk Ziegelmeier
093adf8322 Fix typo in MQTT port #define 2018-02-11 11:57:22 +01:00
goldsimon
8fa55e32d2 add MEM_OVERFLOW_CHECK and combine code with MEMP_OVERFLOW_CHECK
This moves untouched memory check and defines from memp.c and memp_priv.h
to mem.c and mem_priv.h (which is new).
2018-02-09 13:44:10 +01:00
goldsimon
010b0210ba netif: ext_callback: make LWIP_NSC_ defines, not an enum; fix mdns accordingly
Re-applied after reverting d6e58d02a6
2018-02-08 12:36:26 +01:00
goldsimon
f201d261b2 Revert "MDNS send probes to verify domain before use"
This reverts commit d6e58d02a6.
Erik seems to have commit this by accident. Let's discuss this first
(see patch #9555)
2018-02-08 12:28:04 +01:00
goldsimon
3cf906e073 Revert "netif: ext_callback: make LWIP_NSC_ defines, not an enum; fix mdns accordingly"
This reverts commit 6934bb4428.
Need to revert commit d6e58d02a6 first, and that one produced merge conflicts.
2018-02-08 12:26:16 +01:00
Joel Cunningham
d785561eae tcpip: guard tcpip_msg enum/struct member with !CORE_LOCKING
enum tcpip_msg_type and struct tcpip_msg have members which are only
used when core locking and/or core locking input are disabled. Remove
these from the union to reduce the size. Remove from enum to prevent
usage when these are options are disabled

A quick sizeof test with MSVC 2013 showed a 4 byte size reduction for
struct tcpip_msg (16 bytes -> 12bytes) for the following configuration:
  LWIP_TCPIP_CORE_LOCKING        1
  LWIP_TCPIP_CORE_LOCKING_INPUT  1
  LWIP_TCPIP_TIMEOUT             0
2018-02-07 16:03:41 -06:00
goldsimon
f7be3d10ae httpd: create "connection" and "content-length" headers when file is ready
see patch #9500
2018-02-07 21:27:42 +01:00
goldsimon
e8d7e82c8c httpd: fix simple typo 2018-02-07 21:19:07 +01:00
goldsimon
f9300c1fb0 netif: ext_callback: clean up netif_set_addr after last change 2018-02-07 20:37:29 +01:00
goldsimon
6934bb4428 netif: ext_callback: make LWIP_NSC_ defines, not an enum; fix mdns accordingly 2018-02-07 20:35:49 +01:00
Joel Cunningham
030ffdee82 sockets: remove ERR_CLSD case after data receive
With the changes introduced in b1b6275110
it's no longer possible to get ERR_CLSD from netconn_recv_tcp_pbuf_flags
after we've received data because of the NETCONN_NOFIN flag, so remove
handling for this case. Further the NETCONN_EVT_RCVPLUS stays active in
netconn_recv_data_tcp when the NETCONN_NOFIN flag is used
2018-02-05 13:50:16 -06:00
goldsimon
b1b6275110 socket/netconn recv: FIN should only be reported once
FIN should only be reported once (as '0' for sockets, as 'ERR_CLSD' for
netconns). Before this change, ERR_CLSD was returned forever...

This is the 2nd try. First try (commit ebcae98ae6)
was buggy in that it could drop the FIN if it was read together with data
(reverted in commit ebcae98ae6).

This version fixes this by adding an apiflag and a netconn flag to keep
track of this.
2018-02-04 20:16:53 +01:00
goldsimon
dc882801bb tcp: document TCP_EVENT_ERR exception for SYN_RCVD 2018-02-04 14:19:39 +01:00
goldsimon
2a4dd0dc7b altcp: priority-based pcb/conn allocation required
altcp_tcp_new_ip_type: allocate the tcp pcb first to invoke the
priority handling code if we're out of pcbs
2018-02-04 14:00:23 +01:00
goldsimon
f9bc3cae5d docs: make hook documentation a little nicer 2018-02-04 13:36:41 +01:00
goldsimon
c6b5527710 Improve LWIP_ASSERT_CORE_LOCKED documentation a bit 2018-02-04 13:20:55 +01:00
goldsimon
9d087ad2d2 Add LWIP_ASSERT_CORE_LOCKED() to ppp (see task #14780)
Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-02-03 22:13:32 +01:00
goldsimon
ea2e628ac3 httpd: get_http_headers: refactor decision for add_content_len 2018-02-03 21:58:45 +01:00
goldsimon
1a75112b47 httpd: ensure hs->keepalive is 0 if content length is not sent
Connections for custom files without the persistent flag were not
closed without this change.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-02-03 21:53:44 +01:00
goldsimon
053a5e6e13 httpd: get_http_headers: fix content length check for custom files
Headers are never included here or else get_http_headers would not
have been called.

As a result, custom files need to set FS_FILE_FLAGS_HEADER_PERSISTENT
in file->flags if file->len is the correct length of the file.

See also patch #9500

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-02-03 21:51:33 +01:00
goldsimon
d5d30d49f2 httpd: check that file data is present when dynamic read is disabled
Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-02-02 21:31:36 +01:00
Erik Ekman
23c933fd16 Fix annotation in function documentation
clang failed to build:

../../../../lwip/src/include/lwip/tcp.h:180:11: error: parameter 'ERR_OK' not found in the function declaration [-Werror,-Wdocumentation]
 * @param ERR_OK if OK, any error if connection should be dropped
          ^~~~~~
2018-02-02 11:13:35 +01:00
Jens Nielsen
d6e58d02a6 MDNS send probes to verify domain before use 2018-02-02 11:10:09 +01:00
goldsimon
6706b3778e httpd: add "struct file*" parameter to httpd_cgi_handler() callback 2018-02-02 09:29:52 +01:00
Giuseppe Modugno
ab281cb750 httpd: move httpd_cgi_handler() call
This patch moves in advance httpd_cgi_handler() call, before assigning
variables like hs->file and hs->left.

In this way, CGI handler could prepare the reply data and set the
"file properties", like file->data and file->len. At the exit, hs->file
and hs->left is correctly assigned.

The handler prototype says it can't access file pointer, however it is
simple to obtain it after setting LWIP_HTTPD_FILE_STATE that enables a
"file state" pointer. It is sufficient to assign file->state to file
itself in fs_open_custom().

For example, I have the request GET /login.cgi?user=admin&pwd=admin and
I have to reply with some JSON data. The answer depends on parameters
user and pwd passed in the query string.
2018-02-02 09:12:42 +01:00
goldsimon
7edbd95b50 tcp_out: fix unused parameter when all options are off 2018-02-02 09:01:21 +01:00
goldsimon
fa9082116f tcp: add 2 hooks to add custom options to outgoing tcp segments
Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-02-01 09:31:15 +01:00
goldsimon
77d0ee0961 tcp: add LWIP_HOOK_TCP_INPACKET_PCB
This hook is called from tcp_input() for all kinds of input pcbs when
selected to receive a pbuf (LISTEN, TIME_WAIT, rest). I can parse or
drop an rx pbuf.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-02-01 09:19:16 +01:00
goldsimon
0e85582bc0 tcp: introduce ext_args per pcb
This introduces the concept of ext (external/extended) arguments per
tcp_pcb (also for listening pcbs) to store more data than just one
"void *arg" per pcb. The "arg" is for use to applications, whereas
the ext_args may be used by frameworks and leave "arg" untouched.

In addition to a void pointer, callbacks are added to help frameworks
migrate arguments from listen pcb to connection pcb and to free args
when the pcb is freed.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-02-01 09:19:16 +01:00
goldsimon
ebe782ba16 tcp: centralize freeing tcp pcbs to memp_free
This should make it easier to add debugging messages or other hooks
to the point where tcp pcbs are deallocated.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-02-01 09:19:15 +01:00
goldsimon
ce79811bce sockets: add hooks to implement additional socket options
LWIP_HOOK_SOCKETS_SETSOCKOPT() and LWIP_HOOK_SOCKETS_GETSOCKOPT()
are introduced to implement additional socket options. The hooks
are always called first and report back if they handled the option
or not.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-02-01 09:19:15 +01:00
goldsimon
61671d6df0 tcp_out: make some more pointers const 2018-02-01 09:18:24 +01:00
goldsimon
9fb86f6e4b tcp: add a define for maximum option bytes 2018-02-01 09:14:22 +01:00
Axel Lin
2c3c578475 apps/smtp: Fix wrong sizeof for memset s->bodydh
Use sizeof(struct smtp_bodydh_state) to zero all fields of s->bodydh.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-01-31 09:07:48 +08:00
Joel Cunningham
64a351cbe0 tcp_out: remove CHECKSUM_GEN_TCP case from tcp_send_empty_ack
CHECKSUM_GEN_TCP support was moved to tcp_output_control_segment
so we can remove usage of tcphdr and the extra set of #if/#endif

This fixes https://travis-ci.org/yarrick/lwip-merged/builds/335348098
2018-01-30 17:35:40 -06:00
goldsimon
0ee7a39594 tcp: add comments about usage of options 2018-01-30 22:01:54 +01:00
goldsimon
424c33bcb7 tcp_out: combine the tx path of the 4 direct tx functions
tcp_rst, tcp_send_empty_ack, tcp_keepalive and tcp_zero_window_probe
all execute the same instructions to send a segment pbuf.
Combined into tcp_output_control_segment().
2018-01-30 21:50:41 +01:00
goldsimon
9128a51944 tcp_out: make tcp_output_alloc_header generic enough for tcp_rst 2018-01-30 21:46:48 +01:00
goldsimon
1570dd8ad1 tcp_abandon: no need to buffer pcb->local_port 2018-01-30 21:43:18 +01:00
goldsimon
fdbc9f9b32 tcp_out: move around functions to group them together
This file has been a mess regarding the order of the functions.
By moving them around, they can be grouped into functions taking
part in normal data transmission (via unsent/unacked) and control
segments (which are allocated, directly sent and freed).

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-01-30 21:06:44 +01:00
goldsimon
dd6c43ecbd tcp_out: documentation update 2018-01-30 20:49:47 +01:00
goldsimon
ad3937df58 tcp: tiny doc update (mention tcp_output) 2018-01-30 20:20:22 +01:00
goldsimon
c597cfd6ca tcp_create_segment: rename arg 'flags' to 'hdrflags'
The argument name 'flags' is too unspecific because there is another
argument named 'optflags'.
2018-01-30 12:26:13 +01:00
Dirk Ziegelmeier
40997c4a08 Apply (modified) patch #9552: tftp_cleanup() for cleanup and filename buffer zeroing to prevent filename bugs
... without the memset to zero out the filename
2018-01-29 06:59:47 +01:00
goldsimon
83ff2014ae tcp_enqueue_flags: no need to check pcb->snd_queuelen
We only allow SYN or FIN in this functions and FIN shall always come
through, so no need to check pcb->snd_queuelen
2018-01-28 20:57:53 +01:00
goldsimon
d6cf8a3e38 tcp_out: improved some comments 2018-01-28 20:56:52 +01:00
goldsimon
93f9c56c32 fix bug #52976: lwip_ioctl() FIONREAD crash 2018-01-27 14:45:17 +01:00
goldsimon
05ba509e33 mdns: clarify usage of ip_addr_cmp_zoneless() 2018-01-26 06:32:35 +01:00
goldsimon
de68c5bed6 altcp_mbedtls_sndbuf: use mbedtls_ssl_get_record_expansion() 2018-01-25 13:15:49 +01:00
goldsimon
6606c4013f bug #52893: Add 'old_stat' save in LWIP_NSC_IPV6_ADDR_STATE_CHANGED callback message 2018-01-25 13:05:33 +01:00
goldsimon
fe2c249fb7 bug #52937: raw_input() must tell ip4/6_input() if protocol has been received
This also moves "raw_input" and "raw_netif_ip_addr_changed" to a new file
raw_priv.h
2018-01-25 12:51:46 +01:00
goldsimon
ebda5cb04e ip_addr.h: add IP_ADDR_RAW_SIZE() to know the memcpy size of an IP 2018-01-23 06:53:45 +01:00
goldsimon
5b75ad9019 Fix bug #52949: udp_input() checksum error for LWIP_CHECKSUM_CTRL_PER_NETIF 2018-01-22 19:51:45 +01:00
Mike Kleshov
84fcd6290e [patch #9548] Add .json to list of SSI file extensions
Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-01-22 19:49:10 +01:00
Mike Kleshov
76826c1622 [patch #9547] Bring some comments in httpd.h up to date
Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-01-22 19:47:16 +01:00
goldsimon
9dbfa9ca0a lwiperf: enable TCP over IPv6 connections
tested against iperf 2.0.10
redefine LWIPERF_SERVER_IP_TYPE if you don't want both IP versions
2018-01-19 21:08:51 +01:00
goldsimon
a696b2b515 lwiperf: fix testing against iperf 2.0.10 (bug #52901) 2018-01-17 20:54:16 +01:00
goldsimon
9cf6bbf573 memp_std.h: make MEMP_PBUF a normal pool
No need to use LWIP_PBUF_MEMPOOL here since this pool never contains
pbufs with payload included.
2018-01-17 12:54:00 +01:00
goldsimon
2fd2b6810e memp_std.h: fix LWIP_PBUF_MEMPOOL element size for MEMP_OVERFLOW_CHECK
The LWIP_PBUF_MEMPOOL define used MEMP_ALIGN_SIZE instead of
LWIP_MEM_ALIGN_SIZE to calculate the element size of PBUF_POOL pbufs.
This is wrong for MEMP_OVERFLOW_CHECK, since MEMP_ALIGN_SIZE adds
MEMP_SANITY_REGION_AFTER_ALIGNED. This should be only added during
pool_base buffer allocation but for PBUF_POOL, it changed the size
of the pool elements.
2018-01-17 12:51:49 +01:00
goldsimon
d12d6abae8 minor whitespace/indentation cleanup 2018-01-17 12:27:17 +01:00
Joel Cunningham
f3c289d966 sockets: add core lock assert to select_check_waiters
Assert the requirement that the core is locked in select_check_waiters
2018-01-16 18:52:45 -06:00
goldsimon
8a27408eb2 altcp_tls_mbedtls: hide allocation strategy in altcp_tls_create_config() 2018-01-16 21:41:44 +01:00
David Girault
42f14a96fb altcp_tls: avoid use of static in altcp_tls_config
cert and pkey are allocated with the altcp_tls_config structure.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-01-16 21:03:43 +01:00
David Girault
c7106cc57f altcp_tls: fix pbuf leaked when handshake failed
Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-01-16 20:56:15 +01:00
goldsimon
30ddfe1a98 Make LWIP_VERSION work with the preprocessor again. 2018-01-16 20:37:10 +01:00
Dirk Ziegelmeier
51369854b5 Fix bug #52911: SNMPv3 time window check is not the same as RFC3414 2018-01-16 13:30:31 +01:00
goldsimon
2fd83c9d2e lwiperf: fix double-free of pbufs on recv error 2018-01-16 06:54:28 +01:00
Dirk Ziegelmeier
330793d94d Fix bug #52880: ethernet_output() Compile error. 2018-01-14 09:24:41 +01:00
goldsimon
28c8693683 mqtt: fix documentation error (remove ':' after param name) 2018-01-13 16:09:17 +01:00
goldsimon
4a99721751 netif: try to fix gcc error (-Werror=c++-compat) 2018-01-13 09:38:18 +01:00
goldsimon
734b6ab57a netif: ensure netif_set_addr() only results in one "ext_status_callback"
This can be used e.g. in mdns to create one, not multiple "changed" triggers
if IP address and netmask change at the same time.
2018-01-12 23:11:38 +01:00
goldsimon
452c6a5378 netif: add netif_remove_ext_callback() (counterpart to netif_add_ext_callback()) 2018-01-12 22:25:34 +01:00
goldsimon
d115b28057 netif: change netif_nsc_reason_t to flags (preparation only) 2018-01-12 22:24:45 +01:00
goldsimon
0b2b22338a tcpip_thread_poll_one: remove invalid comment in this function 2018-01-12 20:41:11 +01:00
goldsimon
eb51b683ed fix copy & paste error in comment 2018-01-12 20:29:12 +01:00
Dirk Ziegelmeier
46cb0a796b Forgot to add LWIP_ASSERT_CORE_LOCKED() to http_continue function 2018-01-12 13:35:20 +01:00
Dirk Ziegelmeier
653313cb37 Work on task #14780: Add debug helper asserts to ensure threading/locking requirements are met
Add LWIP_ASSERT_CORE_LOCKED() to several more places
2018-01-12 13:15:36 +01:00
Dirk Ziegelmeier
67ad6e45db Add assertion that checks for a maximum msecs value for sys_timeout() 2018-01-12 12:38:25 +01:00
Dirk Ziegelmeier
990c25d4f3 Add unit test for a long running timer 2018-01-12 12:37:16 +01:00
David Girault
6ccd12b97c altcp_mbedtls: added altcp_mbedtls_sndbuf implementation
Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-01-11 10:34:55 +01:00
goldsimon
eab1b45cba tcpip: give the tcpip_thread mbox a better name
This also fixes shadowing 'mbox' in tcpip_timeouts_mbox_fetch()
2018-01-11 09:56:43 +01:00
Dirk Ziegelmeier
b6b14438b7 Rename lwip_sys_timers_get_next_timout() to sys_timeouts_get_next_timeout() 2018-01-11 09:53:07 +01:00
goldsimon
c257b56a39 move sys_timeouts_mbox_fetch() to tcpip_timeouts_mbox_fetch()
This cleans up the code: sys_timeouts_mbox_fetch() was only used from
tcpip.c anyway, so let's move it there.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-01-11 09:39:36 +01:00
Axel Lin
39ada6ec0e ip_addr: Define ip_addr_cmp_zoneless for LWIP_IPV6 only
This fixes build error when LWIP_IPV4=0 && LWIP_IPV6=1:
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 -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/mdns/mdns.c
../../../../lwip/src/apps/mdns/mdns.c: In function ‘mdns_recv’:
../../../../lwip/src/apps/mdns/mdns.c:1817:10: error: implicit declaration of function ‘ip_addr_cmp_zoneless’; did you mean ‘ip6_addr_cmp_zoneless’? [-Werror=implicit-function-declaration]
     if (!ip_addr_cmp_zoneless(ip_current_dest_addr(), &v6group)) {
          ^~~~~~~~~~~~~~~~~~~~
          ip6_addr_cmp_zoneless
../../../../lwip/src/apps/mdns/mdns.c:1817:10: error: nested extern declaration of ‘ip_addr_cmp_zoneless’ [-Werror=nested-externs]
cc1: all warnings being treated as errors

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-01-09 21:24:12 +01:00
goldsimon
2d06483d8e ip4_frag: don't use LWIP_ERROR where we might depend in input data
fuzz test revealed that an ip header with options might land in ip4_frag() via ICMP. In this case, we can't use LWIP_ERROR() to check for not having ip options as that might be defined to assert
2018-01-09 10:25:41 +01:00
Axel Lin
deab51c36d netif: Remove unnecessary NULL checking in netif_do_set_{ipaddr|netmask|gw}
The callers already ensure the ipaddr/netmask/gw won't be NULL, so remove
the duplicated NULL checking in these static functions.
While at it, also move the code saving old_address for netmask/gw as
it's only used when address is actually being changed.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Dirk Ziegelmeier <dirk@ziegelmeier.net>
2018-01-09 08:45:37 +01:00
goldsimon
0795e289eb ip4_reass: fix double-free of pbuf and wrong ip_reass_pbufcount
This was broken by commit f1072fee8a on 07/28/17 when trying to fix bug #51595
2018-01-09 08:19:43 +01:00
Axel Lin
efa90d4294 netif: Add LWIP_ASSERT_CORE_LOCKED() to netif_set_remove_callback
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Dirk Ziegelmeier <dirk@ziegelmeier.net>
2018-01-09 07:51:18 +01:00
Dirk Ziegelmeier
05ded5516d Apply patch #9536: netif: Prevent possible NULL pointer dereference in netif_set_addr in a modified version
Replace NULL pointers by IP4_ADDR_ANY4 - at sometime in the future, we make the NULL pointer handling obsolete and we can remove all the NULL pointer checks in the code
2018-01-09 07:51:09 +01:00
David Girault
8801cbdb30 core: fix lwip_itoa()
See discussion in bug #51729

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-01-08 21:37:31 +01:00
Dirk Ziegelmeier
bb0ba64fb0 Work on bug #52748: the bug in timeouts.c - apply Douglas' patch for absolute timeouts with modification to avoid cyclic timer overload situation 2018-01-08 12:48:48 +01:00
Dirk Ziegelmeier
5eced48869 Apply timeouts.c simplification from Douglas
Use TIME_LESS_THAN() macro instead of TIME_LESS_OR_EQUAL_THAN, it is more readable and results equivalent
2018-01-08 11:16:51 +01:00
Dirk Ziegelmeier
b6c0c52d66 Fix that one of Douglas' optimizations broke the timers
The unit tests failed and I didn't notice it :-(
2018-01-08 09:19:57 +01:00
Dirk Ziegelmeier
bbb2e50327 Fix variable shadowing warning in my last commit 2018-01-08 08:12:33 +01:00
Dirk Ziegelmeier
a31f8837b5 Partly apply patch from "Douglas" provided in bug #52748: the bug in timeouts.c
- Fix sys_untimeout implementation should not modify timer values since we are now using absolute timeouts.c
- Cleanup and simplify sys_check_timeouts() implementation
- Implement sys_restart_timeouts to rebase all timeouts based on next timer to expire

Changes by me:
- Rename TIME_LESS_THAN to TIME_LESS_OR_EQUAL_THAN
2018-01-08 07:33:40 +01:00
Dirk Ziegelmeier
eaca067c7d Make _cyclic_ timers interval more deterministic - next timeout is calculated from last due time instead of relative to current time
This eliminates the cyclic timer jitter
2018-01-08 07:16:49 +01:00
Dirk Ziegelmeier
2b4dde84e3 Apply modified patch #9533: sys_check_timeouts: recalculate the time diff after each handler call
Adapted to new timer implementation
2018-01-08 07:16:48 +01:00
Dirk Ziegelmeier
dd3861720f Fix bug #52748: the bug in timeouts.c by reimplementing timer logic to use absolute instead of relative timeout values 2018-01-08 07:16:47 +01:00
Axel Lin
da2478b761 netif: Enclosing macro argument in parentheses for NETIF_FOREACH
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-01-05 21:35:25 +01:00
goldsimon
8fc20142f7 Added sys_mbox_trypost_fromisr() and tcpip_callbackmsg_trycallback_fromisr()
This can be used to post preallocated messages from an ISR to the tcpip thread
when using FreeRTOS, where where calls differ between task level and ISR level.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-01-05 21:08:27 +01:00