Commit Graph

5354 Commits

Author SHA1 Message Date
Dirk Ziegelmeier
7eb462867b Fix follow-up to [bug #52315] Minor typo in output of MIB compiler
LWIP_SNMP_OBJ_ID_LEN -> SNMP_MAX_OBJ_ID_LEN
2017-11-05 11:51:23 +01:00
Dirk Ziegelmeier
849dfb17c7 The macros in ip6_addr.c are duplicated from ip4_addr.c, so move them to lwIPs portability layer
...didn't see that in the first place...
2017-11-05 10:27:46 +01:00
Dirk Ziegelmeier
93f4245e89 ip6_addr.c: Convert several macros to private #defines
The macros are functions from ctype.h, but ctype.h declares them as functions, not as #defines
It makes no sense to abstract them in lwIPs portability layer, the functions are of low complexity and they are only used in this file.
2017-11-05 10:13:24 +01:00
Dirk Ziegelmeier
a9a3d473ac Make xchar() a private #define of ip6_addr.c, it is not standardized in any C header 2017-11-05 10:06:25 +01:00
Dirk Ziegelmeier
de991b1158 Apply patch #9478: MQTT.c printf warning in debug messages
in a modified version that uses lwIP's format string #defines
2017-11-05 09:51:26 +01:00
Joel Cunningham
472f7985b5 Introduce LWIP_PACKED_CAST to fix error issue with ARMCC
ARMCC when using __packed structures will not implicitly convert a
pointer to a member of a packed structure to something which does not
have __packed. This results in a compiler error and was found with calls
to icmp6_param_problem

While there is a #pragma pack mode in ARMCC that disables this error, it
does require existing ports to switch over their packing mode and
perform integration
2017-11-01 09:05:06 -05:00
Joel Cunningham
d39e8cd827 docs: replace old reference to TCPIP_APIMSG with netconn_apimsg 2017-10-29 16:52:03 -05:00
Dirk Ziegelmeier
08ec234127 Related to patch #9471: pbuf: Drop casting to u8_t for increment the reference count
Cast to correct type: Needed to avoid warnings about integer cast (-Wconversion)
SYS_ARCH_SET cannot be used here
2017-10-28 15:41:15 +02:00
Dirk Ziegelmeier
4a9e845a53 Fix bug #52300: Minor type in snmp_opts.h
The comments for MIN and MAX need to be swapped
2017-10-28 15:37:22 +02:00
Joel Cunningham
b953bd0393 docs: fix minor mis-spelling in sys.c 2017-10-27 15:33:18 -05:00
goldsimon
283fec0a36 fixed copy&paste bug introduced in last commit 2017-10-26 11:30:26 +02:00
goldsimon
0f685e4fb5 Fixed bug #52279: httpd.c http_init_file() miss uri 2017-10-25 21:58:53 +02:00
Joel Cunningham
b296d2c7bb docs: update tcp_kill_prio same priority comments
tcp_kill_prio will kill the oldest active connection of same/lower
priority. Update all comments so that it's clear the same priority
can be killed
2017-10-25 09:08:23 -05:00
Joel Cunningham
b18e6a8734 sockets: fix missing break regression in event_callback
During the refactoring in c5db278746, the
previous gotos were removed, but the lack of break statements in
NETCONN_EVNT_RCVMINUS and NETCONN_EVT_SENDMINUS was overlooked, leading
to incorrect fall through behavior
2017-10-23 09:05:57 -05:00
Joel Cunningham
22dacc38c0 Revert "Fix two bad "fall-through" code"
This reverts commit a7f2ef4aec.

The fall through is actually a regression
2017-10-23 08:59:43 -05:00
Dirk Ziegelmeier
98d5e06dba Silence gcc 7 warning about fall-through in case statement by adding a comment 2017-10-22 21:27:32 +02:00
Dirk Ziegelmeier
a7f2ef4aec Fix two bad "fall-through" code 2017-10-22 21:26:57 +02:00
Dirk Ziegelmeier
ddcf9cc764 Move all rawapi.txt to appropriate doxygen docs 2017-10-20 21:40:23 +02:00
Dirk Ziegelmeier
33ce04019d Move API description text from rawapi.txt to doxygen docs 2017-10-20 18:44:58 +02:00
Dirk Ziegelmeier
a8edee8268 Move all text from sys_arch.txt to appropriate doxygen places 2017-10-20 18:23:06 +02:00
Joel Cunningham
9c175835d5 sockets: poll Open Group clean ups
1) Define remaining Open Group poll constants (values in hex)
2) Switch nfds_t to unsigned int

http://pubs.opengroup.org/onlinepubs/007908799/xsh/poll.h.html
2017-10-19 14:03:56 -05:00
Nate Karstens
1960937df3 Enable support for MSG_DONTWAIT in lwip_recvmsg()
Enables support for MSG_DONTWAIT in lwip_recvmsg(). Support already
exists in lwip_recv_tcp() and lwip_recvfrom_udp_raw(); these are both
accessible from lwip_recvfrom(), which already supports MSG_DONTWAIT.

Signed-off-by: Nate Karstens <nate.karstens@garmin.com>
Signed-off-by: Joel Cunningham <joel.cunningham@me.com>
2017-10-19 13:55:25 -05:00
Dirk Ziegelmeier
f41b5b84b1 Try to fix build of bridgeif_fdb.c 2017-10-19 12:16:11 +02:00
goldsimon
cf07fddf96 lwip_poll_dec_sockets_used: remove unused SYS_ARCH_DECL_PROTECT(lev); 2017-10-19 06:52:33 +02:00
Joel Cunningham
8d04f3d622 docs: correct LWIP_IPV6_MLD reference on #endif comment 2017-10-18 11:48:00 -05:00
Dirk Ziegelmeier
4f2dc05c7c Improve documentation on bridgeif_fdb 2017-10-18 18:31:38 +02:00
Dirk Ziegelmeier
b3a379c239 BridgeIF: Move FDB implementation into a separate file, implementation is easier to understand like this. 2017-10-18 18:27:35 +02:00
Dirk Ziegelmeier
8a46a853d2 Improve system abstraction layer doxygen docs by moving documentation from sys_arch.txt to sys.c 2017-10-17 22:38:18 +02:00
Dirk Ziegelmeier
26b2628f01 Improve system abstraction layer doxygen docs by moving documentation from sys_arch.txt to the corresponding functions 2017-10-17 22:30:51 +02:00
Dirk Ziegelmeier
84b2a0f55b Remove raw API TCP/UDP function documentation from rawapi.txt - it is now integrated in doxygen docs.
This avoid having a second description for the same stuff that is "bit-rotting" because noone remembers to update this file.
Also remove outdated and misleading zero-copy TX information.
2017-10-17 21:59:34 +02:00
Dirk Ziegelmeier
d020bfc0df Improve UDP documentation using rawapi.txt texts 2017-10-17 21:50:18 +02:00
Dirk Ziegelmeier
001e1f1127 Improve lwIP doxygen documentation by copying several passages from rawapi.txt to the corresponding doxygen places 2017-10-16 23:24:52 +02:00
Dirk Ziegelmeier
921f601b5d Improve lwIP doxygen documentation by copying several passages from rawapi.txt to the corresponding function documentation 2017-10-16 23:14:28 +02:00
Our Air Quality
4d21d8da23 Allow LWIP_SOCKET_OFFSET with an external FD_SET
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-10-16 17:07:17 +02:00
Joel Cunningham
0882e0ba89 sockets: poll clean ups
This makes the following poll cleanups:

 1) Add LWIP_ERROR in lwip_poll to check for invalid fds/nfds combinations.
    This fixes a possible a NULL fds dereference in lwip_poll_scan()
 2) Use has_ copies of the socket events in lwip_poll_should_wake() rather
    passing the sock pointer and accessing socket after leaving the critical
    section
2017-10-16 08:06:31 -05:00
Dirk Ziegelmeier
ada6a84785 Fix documentation on relocating memory pools 2017-10-15 22:37:41 +02:00
Joel Cunningham
de531131c5 Fix compiler warnings seen with clang 8.1.0 on MacOS
This fixes the following warnings:

test_tcp.c:266:5: error: code will never be executed [-Werror,-Wunreachable-code]
    pbuf_free(p);
    ^~~~~~~~~
 - The check API 'fail' aborts the test, thus pbuf_free(p) will never be executed

pbuf.c:783:111: error: format specifies type 'unsigned short' but the argument has type 'u8_t' (aka 'unsigned char') [-Werror,-Wformat]
      LWIP_DEBUGF( PBUF_DEBUG | LWIP_DBG_TRACE, ("pbuf_free: %p has ref %"U16_F", ending here.\n", (void *)p, ref));
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
 - LWIP_PBUF_REF_T is u8_t by default and doesn't match U16_F, so cast to u16_t. The cast and formatter will need to be changed
   if ref is larger than 16 bits

ethernet.c:105:16: error: format specifies type 'unsigned char' but the argument has type 'unsigned int' [-Werror,-Wformat]
               (unsigned)ethhdr->dest.addr[0], (unsigned)ethhdr->dest.addr[1], (unsigned)ethhdr->dest.addr[2],
~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 - addr[] is type u8_t, formatter is X8_F which should be 8 bits. 'unsigned' is an int, so cast to unsighed char instead
2017-10-13 07:52:34 -05:00
Our Air Quality
0794d88f09 If undefined then define O_NDELAY in terms of O_NONBLOCK.
Current newlib does not define O_NDELAY, but it needs to be the same
as O_NONBLOCK rather than using the lwip value of 1.

Signed-off-by: Dirk Ziegelmeier <dirk@ziegelmeier.net>
2017-10-09 12:31:23 +02:00
Dirk Ziegelmeier
856b0c3260 Fix bug #52189: list add and remove bug in <lwiperf.c>
Apply patch from xuyao hong
2017-10-09 12:30:12 +02:00
goldsimon
8fc69c9858 Revert changes of 07434aa73a (accidentally committed local changes) 2017-10-06 11:45:10 +02:00
Dirk Ziegelmeier
de5b693e7d Reformat netif subdir using astylerc 2017-10-03 21:22:04 +02:00
Dirk Ziegelmeier
47138f92d0 Fix a few doxygen comment issues 2017-10-02 10:08:48 +02:00
goldsimon
ad4358592a add MEM_SANITY_CHECK (behaves like MEMP_SANITY_CHECK) and ensure 'ram_end->prev' does not get changed 2017-09-26 22:30:18 +02:00
goldsimon
a61aee337b mem.c: beautify converting between struct mem and heap index (add ptr_to_mem/mem_to_ptr) 2017-09-26 22:13:44 +02:00
goldsimon
1710fc1a89 Fix a corner case of double-free in the heap 2017-09-25 22:29:02 +02:00
goldsimon
f058364d7f Added two simple unit tests for illegal calls to mem_free() 2017-09-25 21:38:00 +02:00
goldsimon
5e187bb8bc Tiny typo fix 2017-09-25 20:24:47 +02:00
Jens Nielsen
7115384b15 Clear seg->oversize_left after sending OK
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-09-25 20:21:17 +02:00
Joel Cunningham
6cdfae1245 sockets: cleanup ioctlsocket for LWIP_COMPAT_SOCKETS == 2 (patch #9456)
This makes two cleanups that follows the same organization as close/closesocket:

 1) There is no lwip_ioctlsocket. Instead lwip_ioctl should redirect to ioctlsocket
 2) With LWIP_POSIX_SOCKETS_IO_NAMES enabled, lwip_ioctl/ioctlsocket should redirect to ioctl
2017-09-22 08:51:48 -05:00
goldsimon
0c2d94a283 sntp: allow SNTP_UPDATE_DELAY to be a function 2017-09-22 06:26:53 +02:00
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