Commit Graph

5354 Commits

Author SHA1 Message Date
goldsimon
68d75a58df sockets: adapt poll to LWIP_MPU_COMPATIBLE; make LWIP_SOCKET_POLL and LWIP_SOCKET_SELECT independent options 2017-09-21 22:18:55 +02:00
Kalle Olavi Niemitalo
1152fd02c0 New sockets function: lwip_poll
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-09-21 21:50:36 +02:00
goldsimon
333f1bf2bd Fix compiling with LWIP_SOCKET_SELECT==0 2017-09-21 21:49:31 +02:00
Kalle Olavi Niemitalo
983eb8ebb4 Move select_cb list handling to functions (prepare for adding "poll")
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-09-21 21:10:08 +02:00
goldsimon
61e0a42cce Guard LWIP_COMPAT_SOCKETS definitions of lwip_socket with LWIP_SOCKET_SELECT 2017-09-21 21:05:50 +02:00
goldsimon
60356514c7 Guard struct lwip_select_cb definition with LWIP_SOCKET_SELECT 2017-09-21 20:20:23 +02:00
Our Air Quality
dbd726959c [PATCH] Replace the OOSEQ max bytes and pbufs constants with functions.
Some systems need to take into account an RX buffer pool size when
advising an appropriate number of RX pbufs to queue on the ooseq
list. For some systems there is a practical hard limit beyond which
the rx pool becomes exhausted blocking reception of further buffers
until some are freed.

It also helps to be able to consider the available dynamic memory when
advising an appropriate maximum number of bytes to buffer on the ooseq
list.

These decisions can also benefit from knowing the number already
allocated on a particular pcb, so the ooseq tcp segement is passed to
these functions. For example, if the system only wants to allow the
total number of rx pbufs queued on all the ooseq lists to grow by one
and a pcb already has two then it can return three for this call, but
might return one for another call - supporting a greedy allocation
strategy.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-09-21 10:36:21 +02:00
goldsimon
7dcc407c53 tcp_in: favour local variables over ifdef blocks 2017-09-21 10:12:36 +02:00
goldsimon
8f459cc242 Make TCP_OOSEQ_MAX_BYTES and TCP_OOSEQ_MAX_PBUFS work independently 2017-09-21 09:52:51 +02:00
goldsimon
6d2b181cc0 tcp_in: favour code block over #ifdef blocks for local variables only used in TCP_OOSEQ_MAX_BYTES || TCP_OOSEQ_MAX_PBUFS configs 2017-09-21 09:50:47 +02:00
David Girault
f48c71e17f altcp_tcp: free altcp_pcb struct in altcp_tcp_close()
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-09-20 20:50:03 +02:00
Dirk Ziegelmeier
8faf765632 Fix bug #52059: httpd/makefsdata assumes UNICODE
Patch by Gisle Vanem
And fixup one variable name (currName -> curName)
2017-09-20 12:41:31 +02:00
Jisu Kim
6447a583e2 ipv6 ready: When there are more fragments(Mbit is not zero), payload_length field in IPV6 header must be the multiple of 8 (see patch #9455)
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-09-19 14:29:27 +02:00
Jisu Kim
fa11461f84 ipv6 ready: Added exception handling to parse a routing header (see patch #9455)
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-09-19 14:21:10 +02:00
Jisu Kim
675c6e4428 ipv6 ready: Hop-by-Hop and destination option header must be checked more detailed (see patch #9455)
Hop-by-Hop, Destination option header structures consist of 2 unsigned char; next option type and header length field.
And TLV(Type-Length-Value) option headers come by the number in header length field.
If the option type in TLV option header is not recognized and 2 MSB is not 0, it is handled as an exception.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-09-19 14:18:38 +02:00
Jisu Kim
72171c12b5 ipv6 ready: Hop-by-Hop and destination option header must be checked more detailed (see patch #9455)
Hop-by-Hop, Destination option header structures consist of 2 unsigned char; next option type and header length field.
And TLV(Type-Length-Value) option headers come by the number in header length field.
If the option type in TLV option header is not recognized and 2 MSB is not 0, it is handled as an exception.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-09-19 14:12:10 +02:00
Jisu Kim
acb4b60517 ipv6 ready: icmp6_param_problem() should send an exact offset to point to the error (see patch #9455)
For this, convert 'u8_t nexth' to a pointer and change 'icmp6_param_problem()' to take a pointer, not an offset number

Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-09-19 14:11:30 +02:00
Jisu Kim
7b27df1b83 ipv6 ready: clean up ipv6 header structs and add more header types & defines (see patch #9455)
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-09-19 14:08:16 +02:00
goldsimon
6d1c067719 tabs -> spaces 2017-09-19 09:20:40 +02:00
Dirk Ziegelmeier
931b5e643c Reformat core code using astylerc 2017-09-17 20:38:38 +02:00
Dirk Ziegelmeier
8c59be74c1 Reformat IPv4 code using astylerc 2017-09-17 20:33:27 +02:00
Dirk Ziegelmeier
3ed24085fa Reformat SNMP code using astylerc 2017-09-17 20:29:18 +02:00
Dirk Ziegelmeier
6e7fe4520a Reformat tftp_server.c using astylerc 2017-09-17 18:08:43 +02:00
Dirk Ziegelmeier
2ab73ad572 Reformat sntp.c using astylerc 2017-09-17 18:07:26 +02:00
Dirk Ziegelmeier
52d65ed1d0 Reformat netbiosns.c using astylerc 2017-09-17 18:05:07 +02:00
Dirk Ziegelmeier
be5bcc172d Reformat mqtt.c using astylerc 2017-09-17 18:04:29 +02:00
Dirk Ziegelmeier
914a20728e Reformat mdns.c using astylerc 2017-09-17 18:00:33 +02:00
Dirk Ziegelmeier
014420bfa0 Reformat lwiperf.c using astylerc 2017-09-17 18:00:23 +02:00
Dirk Ziegelmeier
6164f0cd34 Reformat httpd* using astylerc 2017-09-17 17:58:36 +02:00
Dirk Ziegelmeier
c35b1099a4 Reformat altcp_tls_mbedtls* using astylerc 2017-09-17 17:52:44 +02:00
Dirk Ziegelmeier
438cfd3f14 Reformat sockets.c using astylerc 2017-09-17 17:50:24 +02:00
Dirk Ziegelmeier
fa33db1448 Reformat tcpip.c using astylerc 2017-09-17 17:50:24 +02:00
Dirk Ziegelmeier
dc9115334e Reformat netifapi.c using astylerc 2017-09-17 17:50:24 +02:00
Dirk Ziegelmeier
771ac7ac44 Reformat netdb.c using astylerc 2017-09-17 17:50:24 +02:00
Dirk Ziegelmeier
bfae233e3e Reformat netbuf.c using astylerc 2017-09-17 17:50:24 +02:00
Dirk Ziegelmeier
3d60024f9b Reformat if_api.c using astylerc 2017-09-17 17:50:24 +02:00
Dirk Ziegelmeier
75847c8b4d Reformat err.c using astylerc 2017-09-17 17:50:24 +02:00
Dirk Ziegelmeier
2b977a4a6a Reformat api_msg.c using astylerc 2017-09-17 17:50:24 +02:00
Dirk Ziegelmeier
30152cea78 Reformat api_lib.c using astylerc 2017-09-17 17:50:24 +02:00
Jisu Kim
bd94297115 icmp6_send_response() sends the pointer in network byte order (see patch #9455: IPv6 ready test on RFC2460)
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-09-16 22:46:42 +02:00
goldsimon
ab1c9548e0 Increase IPv4 reassembly timeout according to RFC 791 2017-09-16 22:43:12 +02:00
Jisu Kim
27b7ed17fc First step to passing IPV6 Ready test: time out IPv6 fragments after 60 seconds
(added IPV6_REASS_MAXAGE as an option that is independent of the IPv4 setting)

Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-09-16 22:41:35 +02:00
goldsimon
14919e34a1 icmp_input: fix possibly unused variable (used for debug output only) 2017-09-15 11:44:22 +02:00
Joel Cunningham
5c0054d8ee Remove double free on select_cb (bug #51990)
This was left over after the refactoring in 92b6f83eb2
2017-09-13 16:51:03 -05:00
goldsimon
7ba479e482 Try to fix clang runtime errors during unit tests (see bug #51652) 2017-09-12 21:51:50 +02:00
goldsimon
92b6f83eb2 Slightly rework the fix for bug #51990: allocate select_cb only if we actually need to wait 2017-09-12 21:37:48 +02:00
David Lockyer
72a00ca79c Fixed bug #51990: Calling select() from different threads with MPU enabled triggers memory protection fault
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-09-12 21:19:54 +02:00
Joel Cunningham
445eef2b0e sockets: add readv() implementation (task #14610)
Adds an implementation of readv() that calls recvmsg()

See http://pubs.opengroup.org/onlinepubs/009695399/functions/readv.html
2017-09-11 14:48:33 -05:00
Jakub Schmidtke
b7e5de389e Fixed removing unneeded TCP SACKs
TCP SACKs were removed after some changes in the ooseq queue,
but before all unneeded packets were removed from it.
Because of that, we would sometimes include SACKs
for data already delivered in-order.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-09-09 21:51:13 +02:00
goldsimon
86abfbe087 Fix bug #51937 by checking TF_CLOSED at the end of all pcb callbacks in tcp_input() 2017-09-09 21:46:41 +02:00
goldsimon
a8ac37f419 refactor tcp_input a bit in preparation of a fix for bug #51937 2017-09-09 21:41:06 +02:00
Our Air Quality
dc7a9c8c37 tcp_in: correct some loops continuing without maintaining a prev pointer.
This problem would appear to have only affected systems with multiple
interfaces. It was noted causing tcp resets when the pcb was lost, and there
might have been other associated problems.

Signed-off-by: Dirk Ziegelmeier <dirk@ziegelmeier.net>
2017-09-04 07:48:37 +02:00
Joel Cunningham
28e519b72d tcp_output: move useg assignment to right before segment while loop
There were a couple cases in-between that could cause an exit from
tcp_output which don't use useg. With large send buffers, pcb->unacked
may be large and calculating useg is wasted in these exit cases

Some compilers may be re-ordering this already, but it doesn't hurt to
correctly arrange the code
2017-08-29 16:59:39 -05:00
goldsimon
1d4ca0bff6 Fix bug #51687 (tcp_close(): is it OK to return ERR_MEM if TF_CLOSEPEND is set?) 2017-08-28 21:59:05 +02:00
goldsimon
e749678eed Fix function signature of fcntl() for LWIP_COMPAT_SOCKETS == 2 && LWIP_POSIX_SOCKETS_IO_NAMES (see bug #51701) 2017-08-25 22:07:14 +02:00
goldsimon
c7edfdf987 Fix bug #51765 and fix commit 90873d6: call tcp_rexmit_fast() more than once on dupacks since the actual transmission is guarded by TF_INFR, not by pcb->dupacks 2017-08-25 21:16:59 +02:00
Joel Cunningham
f582c88339 tcp: persist timer re-work (bug #50837)
This re-works the persist timer to have the following behavior:

  1) Only start persist timer when a buffered segment doesn't fit within
     the current window and there is no in-fligh data.  Previously, the
     persist timer was always started when the window went to zero even
     if there was no buffered data (since timer was managed in receive
     pathway rather than transmit pathway)
  2) Upon first fire of persist timer, fill the remaining window if
     non-zero by splitting the unsent segment.  If split segment is sent,
     persist timer is stopped, RTO timer is now ensuring reliable window
     updates
  3) If window is already zero when persist timer fires, send 1 byte probe
  4) Persist timer and zero window probe should only be active when the
     following are true:
       * no in-flight data (pcb->unacked == NULL)
       * when there is buffered data (pcb->unsent != NULL)
       * when pcb->unsent->len > pcb->snd_wnd
2017-08-25 09:35:10 -05:00
Axel Lin
2e4867fcde api_msg: Remove superfluous NETIF_NO_INDEX checking
netif_get_by_index() returns NULL if idx is NETIF_NO_INDEX.
So remove the superfluous NETIF_NO_INDEX checking for msg->msg.jl.if_idx
before calling netif_get_by_index().

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Dirk Ziegelmeier <dirk@ziegelmeier.net>
2017-08-24 08:59:49 +02:00
goldsimon
1ed1cfe83a TCP: simplify trimming left edge & use pbuf_remove_header() instead of pbuf_header() 2017-08-21 22:34:44 +02:00
goldsimon
bd8709bc82 Simplify pbuf_remove_header() a bit 2017-08-21 22:33:01 +02:00
goldsimon
3c5398403d fix pbuf_split_64k() for zero-length pbufs 2017-08-21 22:08:53 +02:00
Dirk Ziegelmeier
b9d3812ee8 Add assertion that netif index is within sane range in sockets.h.
We can assert here since lwIP only supports <= 255 netifs due to netif index being an u8_t.
2017-08-21 21:27:12 +02:00
Dirk Ziegelmeier
fa51a7225a lwip_socket_drop_registered_mld6_memberships: Fix if_idx got lost :-( 2017-08-21 09:46:08 +02:00
Dirk Ziegelmeier
6082251854 Use netconn_join_leave_group_netif() in sockets.c, lwip_socket_drop_registered_mld6_memberships to avoid threading issues (reported by Joel Cunningham) 2017-08-21 09:43:34 +02:00
Dirk Ziegelmeier
f457769fe8 Add netconn_join_leave_group_netif() that takes netif index as argument 2017-08-21 09:42:57 +02:00
Dirk Ziegelmeier
d0e0afb46a sockets.c, lwip_socket_drop_registered_mld6_memberships: Remove membership from socket_ipv6_multicast_memberships even if netif cannot be found 2017-08-21 09:30:23 +02:00
Joel Cunningham
3bdb34886c sockets IPv6: cast interface index to u8_t
Interface indexes are u8_t internally so cast from sockets int representation to u8_t

This was found with MSVC 2013:

 1>lwip\src\api\sockets.c(3190): warning C4242: 'function' : conversion from 'const unsigned int' to 'u8_t', possible loss of data
 1>lwip\src\api\sockets.c(3698): warning C4242: 'function' : conversion from 'unsigned int' to 'u8_t', possible loss of data
2017-08-17 08:54:50 -05:00
Dirk Ziegelmeier
339ec17cf0 Fixup my last commit 2017-08-16 17:41:46 +02:00
Dirk Ziegelmeier
e58e398267 Implement IPv6 IPV6_JOIN_GROUP/IPV6_LEAVE_GROUP socket options 2017-08-16 17:41:46 +02:00
Dirk Ziegelmeier
9d74883491 Moving eth_type to iana.h was incorrect - these are assigned by IEEE. IANA published a document containing these numbers, but does not assign them. I didn't see that in the first place :-(
Now we have ieee.h, too.
2017-08-15 13:50:12 +02:00
Dirk Ziegelmeier
c6fac10b62 Rename eth_type enum in iana.h to be prefixed with lwip_iana_ 2017-08-15 13:42:39 +02:00
Dirk Ziegelmeier
aaee7ed1e7 Improve documentation in iana.h 2017-08-15 13:40:37 +02:00
Dirk Ziegelmeier
2013f4cbd4 Move eth_type definition to iana.h 2017-08-15 13:35:30 +02:00
Dirk Ziegelmeier
772bf96752 Fix makefsdata.c on Win32 after moving to tinydir.h 2017-08-14 09:13:36 +02:00
Dirk Ziegelmeier
01bbbdb19f More makefsdata fixes:
- fix lwip_itoa usage was totally messed up
- fix size_t format string was missing % prefix
2017-08-11 22:50:08 +02:00
Dirk Ziegelmeier
8878a042dc Apply patch #9399: makefsdata for linux
+ some more fixes in compiling under Linux by Dirk Ziegelmeier
2017-08-11 22:50:08 +02:00
Joel Cunningham
9844049cb1 lwip_itoa: fix converting 0 (bug #51729)
lwip_itoa would output the number 0 as \0.  This fixes the issue by
adding a special check before the normal conversion loop

This was found via shell cmd idxtoname and win32 port.  "lo0" should
be returned for index 1
2017-08-11 13:38:51 -05:00
Dirk Ziegelmeier
0cf405e24f Fix that the socket option IPV6ONLY can only be set on TCP sockets
Reported by Andrej Butok
2017-08-10 09:14:31 +02:00
Joel Cunningham
3d82155d29 tcp: use TCP_WND_INC for dupack > 3 case
TCP_WND_INC abstracts the rollover handling and allows the window to
reach it's maximum value
2017-08-09 16:28:55 -05:00
Joel Cunningham
b8a3cf3a4a tcp: use tcp_set_flags() rather than manually setting flag 2017-08-09 12:15:52 -05:00
Joel Cunningham
ba7a3204cb tcp: use tcp_ack_now rather than manually setting TF_ACK_NOW 2017-08-09 10:13:41 -05:00
goldsimon
90873d6c71 Continue fixing the spirit of bug #51663: don't change pcb state if retransmission can't be done because segments are still queued for transmission
- add a better-documented static function tcp_output_segment_busy
- try to reduce the number of checks
- tcp_rexmit_rto: iterate pcb->unacked only once
- no need to check for ref==1 in tcp_rexmit_fast when tcp_rexmit does
- call tcp_rexmit_fast if dupacks >= 3 (not == 3) and use TF_INFR flag to guard the fast-rexmit case (that way, it's triggered again on the next dupack)
2017-08-08 23:02:14 +02:00
Our Air Quality
6a01607004 tcp_out rto: delay re-transmission earlier if link writes are deferred.
There is already a guard in tcp_output_segment() for a pbuf still being
referenced by the netif driver due to deferred transmission, however the callers
are modifying state even when this gives up.

It seems cleaner to have the callers guard this case and avoid modifying their
state.

tcp_rexmit_rto() might better avoid re-transmission of any segments if any of
the unacked segments are deferred, to avoid loading the link further if it is
struggling to flush its buffered writes. Link level queues can be limited on
some devices and need spares for link management.
2017-08-08 22:20:02 +02:00
Joel Cunningham
902d393aef tcp: map tcp_ack_now() directly to tcp_set_flags()
Also remove extra set of parenthesis in tcp_ack()
2017-08-08 14:56:00 -05:00
goldsimon
fed916b852 tiny doc change to LWIP_HOOK_IP4_ROUTE_SRC 2017-08-08 21:03:41 +02:00
goldsimon
991f751305 Even more pbuf_header -> pbuf_add/remove_header replacements (also in strings) 2017-08-08 20:51:57 +02:00
goldsimon
07434aa73a More pbuf_header -> pbuf_add/remove_header replacements 2017-08-08 20:40:26 +02:00
goldsimon
6d28e9de79 Some cleanups after applying David Girault's altcp patches 2017-08-08 12:59:49 +02:00
David Girault
bc3edfb4d7 altcp_tls_mbedtls: remove "rx pbufs left at end of handshake" assert
There is case where a close notify come right after the handshake and is in the same pbuf!
So just handle these data like any other data.
2017-08-08 12:59:48 +02:00
David Girault
0486100a2b altcp_tls: some fixes
- added `altcp_tls_free_config()`.
- added `altcp_tls_context()` function to allow mbedtls parameter tweak.

  Since state structure isn't exported, this allow application to get
  internal context (port dependent) to tweak it.

- free altcp_pcb when lower error callback called.
2017-08-08 12:59:47 +02:00
David Girault
ee89d906ec altcp_tcp: some fixes
- expose `altcp_tcp_setup()` so we can wrap altcp over existing tcp pcb.
- avoid calling tcp_close() with NULL pcb.
- free altcp_pcb struct when error callback called.

According to `mqtt_tcp_err_cb()` in src/apps/mqtt/mqtt.c, altcp socket should
work the same way than raw tcp socket. So freeing altcp_pcb ensure this.
2017-08-08 12:59:46 +02:00
David Girault
9d120c59ea altcp: fix altcp_free
call dealloc function in altcp_free() so it can be propagate it to inner_conn.
2017-08-08 12:59:45 +02:00
David Girault
8b1a4ef711 altcp_tls_mbedtls: fix log messages by include a \n 2017-08-08 12:59:44 +02:00
Dirk Ziegelmeier
60dd518887 Implement task #14594: Improve consistency of ip route API parameters
reverse parameters of ip4_route_src to be consistent with other ip*_route* functions
This commit will break applications using this function!
2017-08-08 12:41:19 +02:00
goldsimon
ae7c76c773 Rework pbuf_add_header_impl to only modify the pbuf after all checks passed 2017-08-08 12:19:06 +02:00
Dirk Ziegelmeier
6209c8d347 Fix bug #51686: pbuf_remove_header: silence unused variable warning
but in another way than the provided patch
2017-08-08 12:13:45 +02:00
Dirk Ziegelmeier
e65a388c1f ip4.c does not need to #include prot/dhcp.h any more 2017-08-08 11:49:00 +02:00
Dirk Ziegelmeier
1c91118f4a Add DHCP ports to iana.h 2017-08-08 11:46:15 +02:00
Dirk Ziegelmeier
0eb8d19e82 Move several port number #defines to iana.h 2017-08-08 11:37:08 +02:00
Dirk Ziegelmeier
5193844ac4 iana.h: Prefix #defines with LWIP_ 2017-08-08 11:21:11 +02:00
Dirk Ziegelmeier
79a08c9fee tcp.c: Remove side-effects from boolean expressions 2017-08-08 11:05:23 +02:00
goldsimon
51c4bc55a0 iana.h: added RFC 2017-08-07 22:07:09 +02:00
Dirk Ziegelmeier
629ec98dd8 Work on task #14587: Create common header for IANA assigned numbers
Create include/lwip/prot/iana.h
Move DHCP and ARP #define in there
2017-08-07 21:06:19 +02:00
Dirk Ziegelmeier
42fd01547d Fix bug #51681: mqtt: cannot free client
Add free function
2017-08-07 20:43:25 +02:00
goldsimon
4fb7fab850 Fix docs on dhcp_option_trailer() 2017-08-07 08:08:24 +02:00
Our Air Quality
ff588fc771 dhcp: quieten a compile unused variable warning 2017-08-06 21:21:10 +02:00
goldsimon
a1c7924cb6 task #14597: cleanup pbuf_header usages (use pbuf_add_header/pbuf_remove_header instead) 2017-08-04 22:38:11 +02:00
goldsimon
1981cf39d1 opt.h: improved hooks documentation by adding function signatures for all hooks 2017-08-04 21:55:10 +02:00
goldsimon
a681f6b04f Fix using LWIP_HOOK_DHCP_PARSE_OPTION after recent dhcp changes 2017-08-04 21:53:24 +02:00
goldsimon
cd80e38db8 Clean up DHCP a bit: no need keep msg_out and msg_in as members in struct dhcp
They are used in a call stack only (p_out and options_out_len as well)
2017-08-04 21:26:29 +02:00
goldsimon
65ac160e99 Wconversion-related cleanup: split pbuf_header(s16_t) into pbuf_add_header(size_t) and pbuf_remove_header(size_t)
The new functions both take size_t as increment/decrement argument instead of s16_t (which needed to be range-checked before conversion everywhere) - in most places, the direction (increment or decrement) is known anyway, so no need to encode it in a sign bit
2017-08-04 13:16:18 +02:00
goldsimon
47f55b02bf Finally fix bug #50088 (socket/netconn: data before RST should be readable) and added a unit test for it 2017-08-03 22:28:50 +02:00
Joel Cunningham
6fa5d02435 tcp: remove extra seg == NULL checks
In tcp_output() there were a number of blocks of code performing
duplicate checks of 'if (seg == NULL)'.  This combines them together
to reduce duplicate checks

TCP_OUTPUT_DEBUG and TCP_CWND_DEBUG also don't need to be guarded
by #if/#endif since the LWIP_DEBUGF infrastructure already compiles them
out when LWIP_DEBUG is not defined
2017-08-03 10:37:16 -05:00
goldsimon
5ea7f507c3 Fixed bugs #51606 and #51535: IPv4 reassembly could be finished although there are holes 2017-08-02 21:11:53 +02:00
Axel Lin
2781d7abd7 ip6_reass: Move update ip6_frag.drop stats to nullreturn
The ip6_frag.drop counter is updated before all the code paths calling
goto nullreturn, so let's move updating ip6_frag.drop stats to nullreturn.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2017-08-01 20:48:08 +02:00
Joel Cunningham
5d2be3460f docs: update remaining api_msg_msg references
This updates some remaining references to the old struct api_msg_msg
(renamed to struct api_msg) in comment blocks
2017-08-01 11:56:54 -05:00
goldsimon
a81b19aa62 Fixed bug #51623: DHCP request XID should probably be regenerated for INIT-REBOOT 2017-07-31 20:20:31 +02:00
Joel Cunningham
2b2ea50cb1 ip4: fix swapped src/dst params with ip4_route_src
This fixes a couple of occurrences where the src and dst parameters to
ip4_route_src() were swapped. This was most likely due to confusion between
ip_route(src, dst) and ip4_route_src(dst, src)

This was found in a system where LWIP_IPV4_SRC_ROUTING is 0

The UDP case was an application socket bound to INADDR_ANY with
IP_MULTICAST_IF set. Transmits would result in calling ip4_route(dst) where
dst was pcb->local_addr (which was INADDR_ANY) instead of pcb->mcast_ip4.
This resulted in a routing failure

The ICMP issue was found through code analysis only
2017-07-31 08:57:11 -05:00
Dirk Ziegelmeier
006bb84368 Fix bug #50883: struct eth_addr alignment does not fit with ETHADDR16_COPY
... by simply removing ETHADDR16_COPY since noone advocated to keep it
2017-07-30 17:48:16 +02:00
goldsimon
500598658d ip4_reass: fixed bug #51596 (Insufficient overlap check) 2017-07-28 10:11:45 +02:00
goldsimon
3dedfa3d1f ip4_reass: fixed bug #51597 (Last fragment is assumed to have arrived even if it was discarded) 2017-07-28 09:46:56 +02:00
goldsimon
f1072fee8a ip4_reass: fixed bug #51595 (ip_reass_pbufcount may be updated incorectly) 2017-07-28 09:41:00 +02:00
Dirk Ziegelmeier
ca76c302f1 Probably fix bug #51602: MQTT Ring buffer 'get'
Rollover of get index was wrong
2017-07-28 08:01:30 +02:00
Our Air Quality
ff03ae6f55 dhcp: restart dhcp after releasing.
There were uses of dhcp_release() followed immediately by dhcp_discover() but
dhcp_release() now stops dhcp so discovery would fail, so call dhcp_start()
after release which restarts discovery.

Signed-off-by: Dirk Ziegelmeier <dirk@ziegelmeier.net>
2017-07-28 07:57:50 +02:00
Axel Lin
925f3944d3 init: Correct minimal MEMP_NUM_SYS_TIMEOUT setting check
According to commit 1f780e86d5 ("PPP timeouts required depend on the number of allowed PPP sessions"):
Per PPP needs 6 timeouts (AUTH + PAP|CHAP|EAP + LCP + IPCP + IP6CP + PPPoE).

So update the minimal MEMP_NUM_SYS_TIMEOUT setting check accordingly.
Since we have LWIP_NUM_SYS_TIMEOUT_INTERNAL so just switch to use it.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-07-27 20:51:11 +02:00
goldsimon
a6432c46aa Clarify LWIP_NUM_SYS_TIMEOUT_INTERNAL regarding PPP and make the number of required timeouts per ppp_pcb configurable as we don't really know it right now ;-) 2017-07-27 20:50:40 +02:00
goldsimon
45fb7d7220 Give struct fs_file::pextension its own type & improve its documentation (see also task #14567) 2017-07-26 22:16:26 +02:00
Axel Lin
a92a281455 PPP, VJ: Use pbuf_clone to replace pbuf_alloc+pbuf_copy
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-07-26 21:18:33 +02:00
Dirk Ziegelmeier
ecd6c7ceae Fix bug #51525: MQTT_OUTPUT_RINGBUF_SIZE validation
Ringbuf now supports sizes that are not a power of two
2017-07-26 18:53:12 +02:00
Dirk Ziegelmeier
0d23d686eb snmp_asn1.c: Fix handling of u64 values 2017-07-26 12:48:19 +02:00
Dirk Ziegelmeier
0dabc8df9b snmp_asn1: Surround u64_t handling functions with #if LWIP_HAVE_INT64 2017-07-26 09:42:41 +02:00
Dirk Ziegelmeier
b5fe13d818 Don't declare SNMP_ASN1_TYPE_COUNTER64 on systems that do not have uint64_t to avoid runtime problems 2017-07-26 09:33:15 +02:00
Dirk Ziegelmeier
b7e24fdc58 Accidentally removed a break statement in my last commit 2017-07-26 09:32:40 +02:00
Dirk Ziegelmeier
aa4d978448 Fix [bug #51520] Big endian bug in apps/snmp/snmp_asn1.c
Apply patch from Art Heers that does not need endianess checks
2017-07-26 09:28:07 +02:00
Dirk Ziegelmeier
f5d7535323 Work on [bug #51577] snmp/asn1: 64 bit encoding/decoding seems broken for big endian
We should support COUNTER64 data type only when we have u64_t on the system
2017-07-26 09:27:11 +02:00
Dirk Ziegelmeier
3ec8b22f14 snmp_core.h: Add room for u64 values in union snmp_variant_value 2017-07-26 09:06:13 +02:00
goldsimon
4c13c32473 fix bug #51578 (SNMP failed to decode some values on non 32bit platforms) 2017-07-26 08:41:13 +02:00
Joel Cunningham
c5db278746 sockets: Refactor event_callback()
This refactors event_callback() to separate updating socket event
state from processing the select list (to apply socket event change)

Refactoring changes:

1) select_list_cb processing has been moved to a new local function called
select_check_waiters()
2) goto no_select_wakeup has been removed and now we use a flag
to track whether to call select_check_waiters()
3) There is a small functional change for !LWIP_TCPIP_CORE_LOCKING.
We call SYS_ARCH_UNPROTECT after saving events but before calling
select_check_waiters() (which now calls PROTECT before starting the loop).
Before the code held the PROTECT across saving the events and the first
loop iteration, but this didn't protect against anything because each loop
iteration we do an UNPROTECT/PROTECT
4) Better documentation for both LWIP_TCPIP_CORE_LOCKING and
!LWIP_TCPIP_CORE_LOCKING
2017-07-25 15:06:26 -05:00
goldsimon
0ee6ad0a3a Removed LWIP_SOCKET_SET_ERRNO - errno is always set - if it doesn't exist, it must be provided by the port 2017-07-25 21:54:10 +02:00
goldsimon
a2e4dd2de7 Minor whitespace cleanups 2017-07-25 21:48:17 +02:00
Matthias Hofmann
9b06d71aeb Fix using DHCP IP configuration after lease time is expired.
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-07-25 21:46:57 +02:00
goldsimon
9b5d8f14a9 tcp_getoptbyte() -> tcp_get_next_optbyte() (to make it clearer that this function modifies something - not only a getter) 2017-07-25 21:38:06 +02:00
Matthias Hofmann
64bceabc03 Increase SNTP_RECV_TIMEOUT to be conform with RFC.
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-07-25 20:52:25 +02:00
Pascal Quantin
2e78b6dcae Fixed bug #51528 (Bug when parsing WND_SCALE option)
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-07-24 21:38:47 +02:00
goldsimon
6d51b3ff37 Restructure compatibility headers to fix bug #51463 2017-07-20 22:11:55 +02:00
Our Air Quality
f934ca7a03 [PATCH] Deprecate sys_arch_sem_wait and sys_arch_mbox_fetch returning the time waited
These are now defined to return != SYS_ARCH_TIMEOUT on success rather than the time
waiting. The returned times were unused by lwip and this simplifies at
least some implementations.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-07-20 22:04:34 +02:00
goldsimon
d01b3177fd Fix bug #51507 (Keep uses of SYS_ARCH_PROTECT/UNPROTECT in alloc_socket nested) 2017-07-20 21:18:40 +02:00
Joel Cunningham
99e1f37b82 IP_PKTINFO: set msg_controllen upon output
This fixes a bug where when writing IP_PKTINFO to msg_control, the
msg_controllen field was not updated with the length written

This bug is exposed by applications that provide a msg_control buffer large
enough for multiple control messages.  Then when calling CMSG_NXTHDR, it
returned a next cmsg pointer even though was no additional message
2017-07-20 12:29:56 -05:00
Joel Cunningham
5cd475d91b docs: remove 'unimplemented' tag from exceptset
The exceptset FDs in select() are implemented and record pending socket
errors.  This removes the 'unimplemented' tag in documentation
2017-07-18 16:56:02 -05:00
goldsimon
26771d0800 Add @todo: scope ip6addr? 2017-07-18 19:17:17 +02:00
Our Air Quality
5eff45cac0 Correct a few uses of sizeof(ip6_addr_t) to sizeof(ip6_addr_p_t)
The ip6_addr_t structure may have an addition slot so is not necessarily
the size of an ipv6 address, so some uses of sizeof(ip6_addr_t) were not
correct.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-07-18 19:17:17 +02:00
Joel Cunningham
7b13fae833 docs: update references to global igmp_group_list
This updates documentation to refer to netif specific igmp group list rather
than the old global igmp_group_list
2017-07-17 14:25:14 -05:00
Dirk Ziegelmeier
328134fdba Fix two -Wconversion warnings 2017-07-15 10:25:45 +02:00
goldsimon
3c371e4d52 Fixed bug #51379: (Sockets: prevent select_waiting overflow) 2017-07-14 20:16:11 +02:00
Dirk Ziegelmeier
aa317dcb18 Fix dhcp documentation 2017-07-12 11:09:36 +02:00
Dirk Ziegelmeier
d62d3edc08 Update tcpip.c/.h documentation 2017-07-12 11:08:35 +02:00
Dirk Ziegelmeier
30a2283993 Move netifapi private definitions to priv/api_msg.h 2017-07-12 10:56:42 +02:00
Dirk Ziegelmeier
c08459490d Update netifapi documentation 2017-07-12 10:48:43 +02:00
Dirk Ziegelmeier
66df84a5b5 Map dhcp_release_and_stop() to netifapi, mark old functions as deprecated 2017-07-12 10:43:40 +02:00
Dirk Ziegelmeier
d021972785 Fix "no previous prototype" warning when TCP_QUEUE_OOSEQ is disabled 2017-07-11 09:59:11 +02:00
Dirk Ziegelmeier
449eb64fcb Fix my last commit - break is missing 2017-07-10 09:52:48 +02:00
Dirk Ziegelmeier
57b1471254 Avoid return in case statement, makes function control flow equal to other case statement paths 2017-07-10 09:40:21 +02:00
Dirk Ziegelmeier
9130d37df7 Add "fall through" statement to Axel's patch 2017-07-10 09:37:59 +02:00
Axel Lin
6f28a874b8 pbuf: Simplify pbuf_alloc a bit
No need to have additional if statement for PBUF_REF/PBUF_ROM.
It can be merged to the existing swtich(type) cases.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2017-07-10 09:37:07 +02:00
goldsimon
f3c860958f -Wconversion (still far from finished) and other minor compilation fixes... 2017-07-06 22:47:11 +02:00
goldsimon
866d6c8637 Make PBUF_LINK_ENCAPSULATION_HLEN default signed (unsigned would be OK, but too many defines are signed already and mixing them gets bad) 2017-07-06 20:26:24 +02:00
goldsimon
c730a404d4 Make ioctl(FIONBIO) take an int*, not a u32_t* to got the *nix way 2017-07-06 20:25:41 +02:00
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