Commit Graph

5519 Commits

Author SHA1 Message Date
goldsimon
558480a5b9 add bug #51937 to CHANGELOG 2017-09-11 21:37:28 +02:00
goldsimon
630c4a3de3 try to fix building unit test on gcc/clang 2017-09-11 11:10:42 +02: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
goldsimon
48c687ea84 tcp_remove_all() (used in tcp test setup/teardown): handle tcp_bound_pcbs, too 2017-09-05 22:20:44 +02:00
goldsimon
cf651e7e0f add test case that shows what's wrong for bug #51937 (Leaking tcp_pcbs on passive close with unacked data) 2017-09-05 22:19:38 +02:00
goldsimon
fca38fda1a remove unnecessary lines from last added test case 2017-09-05 22:18:52 +02:00
goldsimon
8c04009357 add unit test case for passive open & (invalid) bug #51941 2017-09-05 21:47: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
22ee33951b TCP: added a unit test for trimming left side of rx segment 2017-08-21 22:34:01 +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
Dirk Ziegelmeier
47a4be83e4 CHANGELOG/UPGRADING: Also mention that LWIP_HOOK_IP4_ROUTE_SRC has changed, too 2017-08-08 13:13:46 +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