Commit Graph

4481 Commits

Author SHA1 Message Date
Joel Cunningham
f28e63b2a3 Add netifapi macros for set link up/down
This commit extends the netifapi macros to support netif_set_link_up
and netif_set_link_down
2016-11-30 08:49:23 -06:00
Joel Cunningham
7f48289fcd Increment ip.drop when dropping due to NULL netif
This commit increments the ip.drop statistic when an IP packet is
dropped due to no matching netif found and forwarding is disabled

This adds parity to the other places where mib2.ipinaddrerrors and
mib2.ipindiscards are incremented which also increment ip.drop
2016-11-30 08:49:22 -06:00
Axel Lin
12e35c4c12 mdns: Fix assertion message in mdns_resp_add_service_txtitem()
So we know which function emits the assertion.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-11-30 11:36:05 +01:00
Dirk Ziegelmeier
182d7c138a Add #include <stddef.h> to a central place (arch.h) instead of #including it in several other files throughout lwip since size_t is needed in many places
See http://lwip.100.n7.nabble.com/Issue-in-arch-h-for-lwIP-2-0-0-td27948.html
2016-11-30 07:43:59 +01:00
Dirk Ziegelmeier
47fd67a35c Remove TODO comments and one check from sockets.c indicating IPV6_V6ONLY socket option handling does not work 2016-11-28 15:56:59 +01:00
goldsimon
b934c3f471 fixed bug #49726: setsockopt() set TCP_NODELAY TCP_KEEPALIVE ... with a listen state TCP will crash 2016-11-28 15:50:59 +01:00
goldsimon
2a882b6387 minor: fixed indent 2016-11-28 12:54:17 +01:00
goldsimon
ca9342c549 fixed bug #49725 (send-timeout: netwonn_write() can return ERR_OK without all bytes being written) 2016-11-28 12:51:45 +01:00
goldsimon
6f1304e03e patch by Ambroz Bizjak: fixed bug #49717 (window size in received SYN and SYN-ACK assumed scaled) 2016-11-28 10:27:21 +01:00
Axel Lin
cac3dc8a46 netif: Trivial indent fix
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-11-28 10:24:23 +01:00
Dirk Ziegelmeier
aea872431c Fix naming of some inet_addr_* macros in inet.h
From inet4_addr_* to inet_addr_* - inet_addr is a "known word", don't change it
2016-11-25 22:13:12 +01:00
Axel Lin
1d4cbe768d netif: Add proper lock protect for accessing netif->loop_first
All the reset part of the code accessing netif->loop_first has lock protection,
the only missing part is "while (netif->loop_first != NULL)".
Fix it by adding lock protect around the while loop.

Also convert the code to use while{} loop instead of do .. while{} loop,
then we can avoid NULL test for in pointer in each loop and reduce a level of indent.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-11-25 13:02:23 +01:00
goldsimon
0e07ed4b13 fixed bug #49676 (Possible endless loop when parsing dhcp options) & added unit test for that 2016-11-25 10:03:43 +01:00
Ambroz Bizjak
8ba7363d11 Optimize passing contiguous nocopy buffers to tcp_write
While TCP_OVERSIZE works only when tcp_write() is used with
TCP_WRITE_FLAG_COPY, this new code achieves
similar benefits for the use case that the caller manages their own
send buffers and passes successive chunks of those to tcp_write()
without TCP_WRITE_FLAG_COPY.

In particular, if a buffer is passed to
tcp_write() that is adjacent in memory to the previously passed
buffer, it will be combined into the previous ROM pbuf reference
whenever possible, thus extending that ROM pbuf rather than allocating
a new ROM pbuf.

For the aforementioned use case, the advantages of this code are
twofold:
1) fewer ROM pbufs need to be allocated to send the same data, and,
2) the MAC layer gets outgoing TCP packets with shorter pbuf chains.

Original patch by Ambroz Bizjak <ambrop7@gmail.com>
Edited by David van Moolenbroek <david@minix3.org>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2016-11-24 11:27:34 +01:00
Joel Cunningham
5030fa81a0 bug #49684, api_msg: treat non-blocking ERR_MEM as ERR_WOULDBLOCK
This corrects a case in lwip_netconn_do_writemore() where if a
non-blocking socket receives ERR_MEM in a call to tcp_write(), it would
return ERR_MEM, which would result in ENOMEM coming out of the socket
layer

This case can be gracefully handled by returning ERR_WOULDBLOCK since the
socket is already marked as no longer writable and sent_tcp/poll_tcp will
mark the socket as writable again based on available buffer space

This is very similiar to how ERR_MEM is resolved for blocking sockets
2016-11-23 15:03:43 -06:00
Dirk Ziegelmeier
09547832ba Fix bug #49662: UDP layer should filter incoming multicast datagrams against the bound IP address
Change lwIP UDP API to match socket behavior. Multicast traffic is now only received on a UDP PCB (and therefore on a UDP socket/netconn) when the PCB is bound to IP_ADDR_ANY.
2016-11-23 12:46:35 +01:00
Sylvain Rochet
8c3c96baf7 PPP, L2TP: fix PPPOL2TP_AUTH_SUPPORT == 0 support
Fix compiler warnings on unused parameters and a function signature
mismatch in PPPAPI.
2016-11-22 22:13:24 +01:00
sg
03a9aac157 dns_enqueue(): minor readability improvement: add local variable "age" to store result of subtraction 2016-11-22 21:34:12 +01:00
David van Moolenbroek
68ec20fffc ipv4/ipv6: restrict loopback-destined traffic
Generally speaking, packets with a loopback destination address -
127.0.0.1 for IPv4 and ::1 for IPv6 - should not be accepted on
non-loopback interfaces.  For IPv4, this is implied by RFC 1122
Sec. 3.2.1.3.  For IPv6, it is mandated by RFC 4291 Sec. 2.5.3.
Failure to perform this filtering may have security implications, as
applications that bind sockets to loopback addresses may not expect
that nodes on the local external network be able to produce traffic
that will arrive at such sockets.

With this patch, lwIP drops packets that are sent to a loopback
address but do not originate from the interface that has the loopback
address assigned to it.  This approach works regardless of whether it
is lwIP or the system using it that implements a loopback netif.  The
only exception that must be made is for configurations that enable
netif packet loopback but disable the lwIP loopback netif: in that
case, loopback packets are routed across non-loopback netifs and would
thus be lost by the new filter as well.

For IPv6, loopback-destined packets are also no longer forwarded; the
IPv4 forwarding code already had a check for that.

As a small performance improvement, the IPv6 link-local/loopback
address check is now performed only once per packet rather than
repeatedly for every candidate netif.
2016-11-22 20:51:36 +01:00
Dirk Ziegelmeier
4076b12ee9 Revert "Apply patch #9165: Allowing udp src port to be 0 in cases when we don't care about outgoing port"
This reverts commit 31b0237c50.
2016-11-22 14:35:45 +01:00
David van Moolenbroek
0034abfa45 Always check whether netif_default is NULL
In general, netif_default may be NULL, and various places in the code
already check for this case before attempting to dereference the
netif_default pointer.  Some places do not perform this check though,
and may cause null pointer dereferences if netif_default is not set.
This patch adds NULL checks to those places as well.
2016-11-21 10:16:28 +01:00
Dirk Ziegelmeier
31b0237c50 Apply patch #9165: Allowing udp src port to be 0 in cases when we don't care about outgoing port 2016-11-18 08:13:15 +01:00
Dirk Ziegelmeier
9366c0eaab I decided to keep the "complexity" of handling IPv6 mapped IPv4 addresses out of netconn API.
Only socket API understands this address type now.
2016-11-17 12:41:00 +01:00
Dirk Ziegelmeier
5d5eeca008 Once more: Try fix compile with clang 2016-11-17 09:23:57 +01:00
Dirk Ziegelmeier
4b7e0f50b7 Fix indent in api_lib.c 2016-11-17 09:14:29 +01:00
Dirk Ziegelmeier
44e430ebc2 Fix compile with MSVC 2010 and remove handling for IP6_ADDR_ANY in netconn_connect() - IP6_ADDR_ANY does not make sense in connect() 2016-11-17 09:12:38 +01:00
Dirk Ziegelmeier
180ba72a06 Dual-stack: Use IPv6 mapped IPv4 addresses in receive() and getaddr() only in socket API, not in netconn API.
It is better to present correct IP types in netconn API.
Netconn API now accepts IPv6 mapped IPv4 addresses as well as IPv6 and IPv4 in send(), bind() and connect(), but does NOT map IPv4 to IPv6 mapped IPv4 in getaddr() and receive() functions.
2016-11-17 08:51:07 +01:00
Dirk Ziegelmeier
792224ead0 Try to fix compile error with clang (found by Erik's Travis-CI) 2016-11-17 08:48:55 +01:00
Dirk Ziegelmeier
e8e853f2cb Move ICMP6 protocol constants to include/lwip/prot/icmp6 2016-11-16 23:49:44 +01:00
Dirk Ziegelmeier
80a24c0399 raw, udp, tcp connect() does NOT need to match exact IP type - when PCB is bound to IPADDR_ANY_TYPE, it is OK to connect to IPv4 or IPv6
This should finally implement task #14187: Dual Stack sendto with socket APIs
2016-11-16 23:39:43 +01:00
Dirk Ziegelmeier
d026a3954a Dual-stack fixes in raw/udp/tcp
bind() may change IP type when previous type is IPADDR_TYPE_ANY
connect() IP type must exactly match bind IP type
Use correct IPADDRx_ANY type when calling ip_route()
2016-11-16 23:30:19 +01:00
Dirk Ziegelmeier
1712b06a64 Work on dual-stack netconn
IPv6 netconns are created as IPADDR_TYPE_ANY raw/udp/tcp PCBs internally
bind, connect and sendto now accept IPv6 mapped IPv4 addresses or IPv4 addresses as argument
getaddr and receive functions now return IPv6 mapped IPv4 addresses instead of IPv4 addresses
This behavior is close to BSD socket API
2016-11-16 22:58:38 +01:00
Dirk Ziegelmeier
010f3550b6 Cleanup macro parameter names 2016-11-16 21:37:41 +01:00
Dirk Ziegelmeier
b70ddf7b54 Cleanup unmap_ipv6_mapped_ipv4() macro 2016-11-16 21:37:41 +01:00
Dirk Ziegelmeier
1dd97e7d53 sockets.c, lwip_sendto(): Remove check whether IP address matches socket type. Is checked in lower layers anyway. 2016-11-16 21:37:41 +01:00
Dirk Ziegelmeier
2f37dc0606 api_msg.c: Partly add support for IPv6 mapped IPv4 addresses
- lwip_netconn_do_getaddr(): Convert IPv4 addresses to IPv6 mapped IPv4 addresses
- lwip_netconn_do_send(): Support IPv6 mapped IPv4 addresses
- Not done: connect(), bind()
2016-11-16 21:37:41 +01:00
Dirk Ziegelmeier
c1eb6d8aa4 Minor: Add macros to map/unmap IPv6 mapped IPv4 addresses 2016-11-16 21:37:41 +01:00
Dirk Ziegelmeier
ad17f345e7 mdns: Use strlen to determine string length of strings contained in a struct - padding seems to be applied to these strings, and sizeof() returns the _padded_ size???
Found by compiling with CLANG with address sanitizer enabled
2016-11-16 21:01:15 +01:00
Dirk Ziegelmeier
ee7a2f346c inet.h: Consistently name some inet <-> ipaddr conversion macros
They operate on ip4_addr_t, not on ip_addr_t
This should be clearly visible in their names
2016-11-16 20:30:13 +01:00
Dirk Ziegelmeier
b99b7577fc memp.c: Only check for overflow/underflow if an element could be allocated
In other words: Don't dereference NULL pointers
2016-11-16 20:15:51 +01:00
Joel Cunningham
f79eabd24b bug #49533: start persist timer when unsent seg can't fit in window
This commit returns LwIP to previous behavior where if the next unsent
segment can't be sent due to the current send window, we start the
persist timer. This is done to engage window probing in the case that
the subsequent window update from the receiver is dropped, thus
preventing connection deadlock

This commit refines the previous logic to only target the following case:
 1) Next unsent segment doesn't fit within the send window (not
    congestion) and there is some room in the window
 2) Unacked queue is empty (otherwise data is inflight and the RTO timer
    will take care of any dropped window updates)

See commit d8f090a759 (which removed this
behavior) to reference the old logic. The old logic falsely started the
persit timer when the RTO timer was already running.
2016-11-16 09:12:47 -06:00
Roberto Barbieri Carrera
81a32e9b06 Fixed bug #49610: Sometimes, autoIP fails to reuse the same address
Signed-off-by: goldsimon <goldsimon@gmx.de>
2016-11-16 12:24:57 +01:00
Joel Cunningham
6dc3a2108a WND_SCALE: duplicate define check & doc cleanup
This commit cleans up a duplicate #if check for LWIP_WND_SCALE in init.c
which was already under #if LWIP_WND_SCALE

This commit also improves documentation for TCP_WND in the window scaling
case to communicate TCP_WND is always the calculated (scaled) window value,
not the value reported in the TCP header

Our developers were confused by having to set both the window and scaling
factor and only after studying the usage of TCP_WND throughout the code, was
it determined to be the calculated (scaled) window
2016-11-11 16:06:54 -06:00
Dirk Ziegelmeier
f965034366 Fix inconsistent return value in udp_sendto_if() - ERR_RTE should always be returned when there is no available route 2016-11-11 11:13:26 +01:00
Dirk Ziegelmeier
fdcd8f6faf Fix bug #49578: lwip_socket_drop_registered_memberships API may not work with LWIP_SOCKET_OFFSET 2016-11-11 11:13:25 +01:00
Erik Ekman
b90682dc8b Update email address
I am leaving Verisure at the end of the month.
2016-11-10 11:19:51 +01:00
Dirk Ziegelmeier
b9dc415178 master: Set version to 2.0.1 2016-11-10 09:59:05 +01:00
Axel Lin
d5dd5241e7 dhcp: Use DHCP_MAX_MSG_LEN_MIN_REQUIRED instead of hard-coded value
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-11-07 12:36:38 +01:00
Sylvain Rochet
c4eb52dcff PPP: set protocol_list[] const
This array is a constant list of protocols, save some ram space by
adding the const modifier it deserves.
2016-11-06 20:00:31 +01:00
Sylvain Rochet
1e6c4ac017 PPP, IPCP: check that the peer is allowed to use the IP address it wants
This is done in the pppd upstream and was disabled because we don't have
the allowed addresses list required for the auth_ip_addr function.

This is mostly necessary for PPP in server mode to prevent the peer to
use the IP address it wants instead of the one we want, which is
currently allowed.

Rewrite auth_ip_addr in a simple way where we forbid PPP peer to use
loopback net, a multicast address or a reserved class address. Added
to that we consider that PPP in server mode with peer required to
authenticate must provide the peer IP address, reject any IP address
wanted by peer different than the one we wanted. This is actually
an allowed addresses "list" of one entry that follows what is done
in the unused auth_ip_addr function.
2016-11-06 17:39:59 +01:00
Sylvain Rochet
b978d17ca0 PPP, IPCP: remove obvious FIXME
No-op. This is now unused code and it is pretty self explanatory what
int_option do; it checks that passed parameter is an unsigned integer.
2016-11-06 12:54:26 +01:00
Sylvain Rochet
dde55c6c0e PPP, IPCP: fix reset state before reconnecting
Commit 7df5496e7b revealed a regression introduced in commit 5a71509353
which broke IPCP reset state.

ask_for_local was set to 0 if ouraddr initial value is 0, if
ask_for_local was false go->ouraddr was cleared in reset callback,
commit 5a71509353 breaks it by removing this clearing. This regression
was silent because the whole ppp pcb runtime data was cleared before
reconnecting until commit 7df5496e7b which removed this giant clearing.

Fix it by reintroducing ask_for_local boolean value, with proper initial
value following what unused function ip_check_options do.

Fixes: 7df5496e7b ("PPP, rework initial/reconnect cleanup")
Fixes: 5a71509353 ("PPP, CORE, IPCP: removed useless ask_for_local boolean")
2016-11-05 22:07:04 +01:00
Dirk Ziegelmeier
5d22679c67 Use API function instead of accessing struct members directly 2016-11-05 16:14:11 +01:00
Dirk Ziegelmeier
132dafa3fc Correct macro parentheses in tcpip_priv.h 2016-11-05 15:15:08 +01:00
Dirk Ziegelmeier
54d76ffd6d Remove superfluous local variable in raw.c 2016-11-05 15:13:57 +01:00
Dirk Ziegelmeier
b6f32caaad Fix inet_addr_to_ipaddr_p() macro 2016-11-05 10:51:06 +01:00
David van Moolenbroek
1c9e603299 netif: fix reset of IPv6 addresses in netif_add()
Previously, only the state of the first IPv6 address would be reset,
thus possibly keeping other addresses valid (even though zeroed).
2016-11-04 20:18:25 +01:00
Axel Lin
1a7ba24d13 memp: Fix memp_overflow_check_all failure
p needs to point to LWIP_MEM_ALIGN(memp_pools[i]->base) otherwise it will cause
assertion in overflow checking.

Fixes: c838e1ed5b ("Implement possibility to declare private memory pools")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-11-04 20:16:24 +01:00
Joel Cunningham
d4384cfac4 Sockets: check external FD_SETSIZE against number of sockets
This commit adds a compiler check to verify an external FD_SETSIZE has
enough space to store the configured number of sockets
2016-11-03 08:59:19 -05:00
Erik Ekman
a82ec4499f memp: Check for null in memp_free
When memp_free_pool was split out from memp_free (c838e1ed5b),
the check for freeing the null pointer was lost.

This resulted in the null value being put back in the list of free
objects, causing all subsequent allocations of that type to fail.
2016-11-03 12:17:01 +01:00
Joel Cunningham
7d8989e3ea TCP documentation: fix tcp_pbuf_prealloc typo
This commit fixes a typo in the tcp_pbuf_prealloc documentation that
used "willo" in place of "will"
2016-11-02 14:10:20 -05:00
Dirk Ziegelmeier
5079e4552c Document non-standard functions in sys abstraction layer 2016-10-23 10:34:52 +02:00
David van Moolenbroek
760281207e mld6: fix conditional checksumming
The mld_group structure no longer has a 'netif' field, as such
structures are now linked from the corresponding netif structure.
For conditional checksumming, use the calling function's netif
reference instead.
2016-10-23 10:00:47 +02:00
Axel Lin
20fde0be6c ip4_frag: Use LWIP_MIN instead of open-coded
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-10-19 08:37:39 +02:00
Dirk Ziegelmeier
67895e7bdd Fixup new IPv4 fragmentation code - thanks to Zach Smith 2016-10-19 08:36:43 +02:00
Dirk Ziegelmeier
801f26ee0c Minor documentation update 2016-10-16 19:07:55 +02:00
Axel Lin
4dffe521a3 api_msg.c: Trivial code cleanup
Slightly improve readability by testing apiflags with NETCONN_DONTBLOCK.
Also remove an empty else clause.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-10-14 09:20:10 +02:00
Dirk Ziegelmeier
f5f8ab5acf Fix bug #49328: Crash error in ip6_frag due to Assertion Fail 2016-10-13 08:50:47 +02:00
Dirk Ziegelmeier
e3a9f01fe4 Implement task #14180: IPv6 code should not reuse ip6_current_dest_addr() as temporary storage 2016-10-12 21:41:02 +02:00
Dirk Ziegelmeier
37d5691b19 Fix bug #49321: error.h missing opening "#ifdef __cplusplus"
Reported by Martin Kortmann
2016-10-12 07:37:39 +02:00
Erik Ekman
725feb0d4a mdns: Use netif_get/set_client_data helpers 2016-10-11 11:34:59 +02:00
goldsimon
6edde498e3 pbuf_copy: try to fix GCC const warning 2016-10-11 09:52:44 +02:00
goldsimon
d5bfec2e52 ip4_frag: restore "lwip_ntohs" after last change 2016-10-11 09:52:20 +02:00
goldsimon
576f49ee2b Fixed bug #46467: ip_frag() shouldn't modify pbuf in case of a retransmission 2016-10-11 09:47:03 +02:00
goldsimon
697be5c2c3 Make some pbuf functions take const pbuf pointers 2016-10-11 09:23:45 +02:00
Axel Lin
c9cfbe27c1 tcp_out: Remove misleading comment in tcp_pbuf_prealloc()
This comment is incorrect since commit 7d0dab9d7d
"partly fixed bug #25882: TCP hangs on MSS > pcb->snd_wnd
(by not creating segments bigger than half the window)".

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-10-11 09:11:47 +02:00
sg
0a343948d9 Fix netconn/socket race condition when receiving RST while waiting on recvmbox 2016-10-10 21:35:07 +02:00
Dirk Ziegelmeier
ed239c4e71 Apply patch #9139: Invalid format string in dhcp.c
by Thomas Mueller
2016-10-10 09:57:07 +02:00
Dirk Ziegelmeier
695c81762c Minor: Fix comment in etharp.c 2016-10-09 12:28:34 +02:00
Dirk Ziegelmeier
f6e27940bd Make lwIP compile with clang -Wdocumentation -> several documentation fixes 2016-10-09 12:21:39 +02:00
Dirk Ziegelmeier
9cd555c51a Minor: documentation typo fix 2016-10-09 10:24:26 +02:00
Dirk Ziegelmeier
4e74ae4bc9 Minor: documentation updates 2016-10-09 10:23:36 +02:00
Dirk Ziegelmeier
5477aa5a42 Minor: Documentation update 2016-10-09 09:41:26 +02:00
Ari Suutari
70ccea9207 Make sys_restart_timeouts public also for !NO_SYS targets 2016-10-07 20:31:15 +02:00
goldsimon
69be49fdc3 Try to fix !defined(LWIP_PROVIDE_ERRNO) 2016-10-07 16:22:33 +02:00
Axel Lin
740182de3c err: Fixup error code range checking in err_to_errno
This also fixes build error in non-debug build because err_strerr is
guarded by LWIP_DEBUG.

Fixes: a1c0a0185b ("bug #48823: posix errors should be removed from arch.h (to new file 'lwip/errno.h'))"
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-10-07 07:41:21 +02:00
Dirk Ziegelmeier
ad3530ee10 One more compile fix in err.c 2016-10-06 20:20:07 +02:00
Dirk Ziegelmeier
86a92543de Try to fix unix build after Simon's errno changes (need sys_arch.h) 2016-10-06 16:01:32 +02:00
goldsimon
2afc2a52d5 Fix comment on sys_mbox_new() (bug #49279) 2016-10-06 13:25:11 +02:00
goldsimon
a1c0a0185b bug #48823: posix errors should be removed from arch.h (to new file 'lwip/errno.h') 2016-10-06 13:21:00 +02:00
Dirk Ziegelmeier
05419912e0 def.h: Provide hton* / ntoh* functions to users by default for compatibility (can be turned off)
Add note to UPGRADING document
2016-10-06 13:13:10 +02:00
Dirk Ziegelmeier
13fb616bb2 Cleanup hton*/ntoh* function handling and platform abstraction
Let lwip use functions/macros prefixed by lwip_ internally to avoid naming clashes with external #includes.
Remove over-complicated #define handling in def.h
Make functions easier to override in cc.h. The following is sufficient now (no more LWIP_PLATFORM_BYTESWAP):
#define lwip_htons(x) <your_htons>
#define lwip_htonl(x) <your_htonl>
2016-10-06 12:55:57 +02:00
Dirk Ziegelmeier
0c06073819 Avoid code duplication in def.c 2016-10-06 09:26:59 +02:00
Dirk Ziegelmeier
fa211096c2 Fix macro name clash with windows headers in TFTP server
Reported by Gisle Vanem
2016-10-05 21:02:46 +02:00
Axel Lin
87172d6d35 mdns: Use NETIF_TO_HOST at appropriate places
Trivial cleanup, use NETIF_TO_HOST macro to get mdns_host from netif.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-10-05 11:23:08 +02:00
Elias Reichart
60a507f88b ETHARP_TABLE_MATCH_NETIF is also used in the etharp_output shortcut 2016-10-04 22:15:59 +02:00
David van Moolenbroek
0d7805a86a tcp: fix FIN ACK handling with unsent data
TCP's snd_nxt represents the next sequence number after sent data, and
as such does not cover any unsent data queued on the connection.  The
current implementation does not take the latter point into account
when processing FIN acknowledgments, mistakenly assuming that an
outgoing FIN is ACK'ed when the acknowledgment covers up to snd_nxt
while there is still unsent data.  This patch adds a check for unsent
data to correct this, effectively preventing that TCP connections are
closed prematurely.
2016-10-04 22:12:13 +02:00
David van Moolenbroek
9ba9dee2aa tcp: advance next seq nr for zero window probes
It is possible that the byte sent as a zero window probe is accepted
and acknowledged by the receiver side without the window being opened.
In that case, the stream has effectively advanced by one byte, and
since lwIP did not take this into account on the sender side, the
result was a desynchronization between the sender and the receiver.
That situation could occur even on a lwIP loopback device, after
filling up the receiver side's receive buffer, and resulted in an ACK
storm. This patch corrects the problem by advancing the sender's next
sequence number by one as needed when sending a zero window probe.
2016-10-04 22:06:05 +02:00
Dirk Ziegelmeier
95754ba95a Another try to fix bug #49264: Crash Error when LWIP_SOCKET_OFFSET is in use 2016-10-04 14:05:56 +02:00
Dirk Ziegelmeier
bef7873042 ND6: Always set neighbor_cache.state together with counter value to avoid inconsistency 2016-10-04 13:59:05 +02:00
Dirk Ziegelmeier
ec236da972 Add comment for my last changes 2016-10-04 13:36:30 +02:00
Dirk Ziegelmeier
ee27daffc4 Fix bug #48876: nd6: timers should be in ticks, not ms
delay_time and stale_time are ticks now.
reachable_time and invalidation_timer are untouched since they may originate from telegram values -> not converting them to ticks avoids an integer division
2016-10-04 13:30:23 +02:00
goldsimon
cdc97d2779 Correctly fix bug #49209: netconn_drain() fails to handle 'netconn_aborted' pointer 2016-10-04 12:35:51 +02:00
goldsimon
d9c6badc55 Revert "Fixed bug #49209: netconn_drain() fails to handle 'netconn_aborted' pointer"
This reverts commit 0e2354e658.
2016-10-04 12:35:50 +02:00
Dirk Ziegelmeier
30251b1404 Fix bug #49264: Crash Error when LWIP_SOCKET_OFFSET is in use
Handle LWIP_SOCKET_OFFSET in lwip_socket_drop_registered_memberships, lwip_socket_unregister_membership and lwip_socket_register_membership.
2016-10-04 12:34:53 +02:00
Dirk Ziegelmeier
d1ed89b2e4 Fix accidental TAB in tftp_server.h 2016-10-04 10:31:43 +02:00
Dirk Ziegelmeier
81549578bf Fix compile of TFTP with MSVC 2016-10-04 08:54:52 +02:00
Dirk Ziegelmeier
f8683499a6 TFTP: Add missing newline at end of file 2016-10-03 14:33:57 +02:00
Dirk Ziegelmeier
1e5efee7cb TFTP server depends on UDP 2016-10-03 09:50:34 +02:00
Dirk Ziegelmeier
b040544628 task #14150: Add TFTP server from Logan Gunthorpe
Originally written by Logan Gunthorpe, modifications/fixes/IPv6 by Dirk Ziegelmeier
2016-10-03 09:47:41 +02:00
Dirk Ziegelmeier
eb77c839fc Minor: comment in pbuf.c 2016-10-03 09:45:59 +02:00
Axel Lin
5e15125b3d igmp: Fix optimized code by always skipping the first entry in the linked groups list
commit 8c52afb6ca ("igmp: Optimize code by always skipping the first entry in the linked groups list - it is always the "allsystems" entry")
accidently changes the code logic. it should check groupref rather than group.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-10-02 19:36:59 +02:00
Dirk Ziegelmeier
8f8f56914b Fix bug #47731: IGMP state transition missing
Set state variable according to RFC 2236 on timeout in delaying member state
2016-10-01 21:27:00 +02:00
Dirk Ziegelmeier
b33070e0cf Add documentation for bug #49139: IGMP "All Systems" vs MLD "All Nodes" inconsistency 2016-10-01 21:13:05 +02:00
Dirk Ziegelmeier
8c52afb6ca igmp: Optimize code by always skipping the first entry in the linked groups list - it is always the "allsystems" entry 2016-10-01 17:28:36 +02:00
Dirk Ziegelmeier
df5a79966d Fix bug #48886: raw pcbs are not handled on netif address change 2016-10-01 17:13:33 +02:00
Dirk Ziegelmeier
149701b347 Fix bug #49218: pbuf_clen() overflow as a result of tcp_write concatenation
Let pbuf_clen() return u16_t
2016-09-30 09:04:36 +02:00
Dirk Ziegelmeier
682b82aad8 Improve documentation: Some words about multiple execution contexts in lwIP 2016-09-29 12:51:45 +02:00
Dirk Ziegelmeier
65796cd827 "Fix" bug #49078: lwip cannot establish ipv6 connection, because of failed to fill ipv6 source address in Neighbor Solicitation Message by adding a note to netif_add not to forget to create a link-local IPv6 address 2016-09-29 12:02:50 +02:00
Dirk Ziegelmeier
40846260b5 Add comment about possible definitions for non-standard functions 2016-09-29 10:44:53 +02:00
Dirk Ziegelmeier
af04864094 Remove non-standard strnlen() call in snmp_msg.c 2016-09-29 08:30:33 +02:00
Dirk Ziegelmeier
5ddd2aef4b Substitute custom itoa implementation mdns by lwip_itoa() and strlen() call 2016-09-29 08:25:57 +02:00
Dirk Ziegelmeier
17e6c9dd02 Add #include <string.h> in def.c since lwip_strnstr uses strlen and strcmp 2016-09-29 08:08:26 +02:00
Dirk Ziegelmeier
0e7f48d81c Fix compile of new functions in def.c - I accidentally put them in a #ifdef section
Thanks to Daniel Elstner
2016-09-28 22:26:55 +02:00
Dirk Ziegelmeier
461b3531c7 httpd.c: add missing default in case statement 2016-09-28 22:05:52 +02:00
Dirk Ziegelmeier
4144d54642 Fix implementation of lwip_itoa to take more parameters 2016-09-28 22:05:18 +02:00
Dirk Ziegelmeier
837b7b3f98 Fix comment in my last commit 2016-09-28 21:55:29 +02:00
Dirk Ziegelmeier
1f68b32485 Cleanup handling of non-standard functions in lwIP
- itoa
- strnicmp, stricmp/strcasecmp
- strnstr
Related to patch #9115: httpd.c: strcasecmp for GCC and stricmp for Windows
2016-09-28 21:52:11 +02:00
Dirk Ziegelmeier
f8d19e28de Minor: Documentation updates 2016-09-28 20:58:02 +02:00
Erik Ekman
f3cec74bd6 mdns: Use macro to get mdns_host from netif v2
Add missing )
2016-09-28 18:15:11 +02:00
Erik Ekman
87e815030c mdns: Use macro to get mdns_host from netif 2016-09-28 18:00:48 +02:00
Erik Ekman
78498981e2 mdns: Update error message after argument type changed
Method argument is no longer netif, but a mdns_host
2016-09-28 18:00:44 +02:00
Dirk Ziegelmeier
633696c153 Implement consistent IPx_ADDR_ANYx macro naming between IPv4 and IPv6
- rename IP4_ADDR_ANY to IP4_ADDR_ANY4
- IP4_ADDR_ANY (= IP_ADDR_ANY) is now IPv4 any address in ip_addr_t format
2016-09-28 12:56:57 +02:00
goldsimon
0e2354e658 Fixed bug #49209: netconn_drain() fails to handle 'netconn_aborted' pointer 2016-09-28 12:53:07 +02:00
Dirk Ziegelmeier
5d811d799c Minor: Documentation updates 2016-09-27 21:18:03 +02:00
Dirk Ziegelmeier
6abcd00f71 Convert IP address type numbers to an enum to improve documentation 2016-09-27 09:46:51 +02:00
Dirk Ziegelmeier
97b774ceb9 Minor: Documentation updates 2016-09-26 21:45:29 +02:00
Daniel Elstner
2f085aa441 ND6: Join/leave groups directly on the netif 2016-09-26 11:44:00 +02:00
Daniel Elstner
354e385453 Fix infinite loop in new MLD6 code 2016-09-26 11:43:59 +02:00
Dirk Ziegelmeier
c7c6b7ce93 Rework IGMP and MLD6 code to store group info per-netif.
Reasoning:
- Makes code in single-netif case perform better and smaller
- IGMP / MLD6 code is a little bit easier to read and understand
- Easier to get multicast groups per netif when implementing drivers

Downside: In multi-netif mode, there are two more pointers on each netif, even if IGMP/MLD6 is not used on it. But these systems should not be so memory-constrained that this will matter.
2016-09-21 13:33:33 +02:00
Dirk Ziegelmeier
c25de8f317 Update comment in MDNS and pbuf.c 2016-09-21 12:37:31 +02:00
Daniel Elstner
c9bae5ea9b Fix bug #49134: Do not announce invalid IPv4 address via mDNS
In a dual stack configuration it is not really feasible to wait
until the IPv4 address is valid before starting the mDNS responder.
If there is no DHCPv4 server in the network, the IPv4 address may
never become valid, which should however not preclude IPv6 mDNS
from working.
2016-09-21 12:31:13 +02:00
Dirk Ziegelmeier
dbd847b70c Fix bugfix for bug #49136: No SNMPv2 SetRequest response when OID does not exist
Last commit broke SNMPv1 answers
2016-09-20 14:28:40 +02:00
Dirk Ziegelmeier
19e2780656 Fix bug #49136: No SNMPv2 SetRequest response when OID does not exist 2016-09-20 14:06:20 +02:00
Dirk Ziegelmeier
eb3a08308d Improve my last docs 2016-09-20 09:14:32 +02:00
Dirk Ziegelmeier
470dae613e Documentation: Add example for zero-copy RX using custom PBUF 2016-09-20 09:03:49 +02:00
Daniel Elstner
22907c7b27 bug #74921: check prefix_length, not length 2016-09-19 18:38:05 +02:00
Dirk Ziegelmeier
623f9ce046 Remove one debug message from Daniel's patch 2016-09-19 12:32:43 +02:00
Daniel Elstner
4d4710dadf Bug #49125 addendum: Remove group from list before callback
When leaving a multicast group, remove the group from the list
before invoking the MAC filter callback. This avoids the need
for the callee to skip over the group that is about to be deleted.
2016-09-19 12:26:51 +02:00
Dirk Ziegelmeier
2facd2d64d Apply modified patch from Daniel Elstner to fix bug #49124: mDNS should not use snprintf() 2016-09-19 12:20:20 +02:00