Commit Graph

2077 Commits

Author SHA1 Message Date
Dirk Ziegelmeier
4fc3770278 Remove special ARP reply optimization from etharp.c
- Code duplication with etharp_raw()
- No great effect on perfomance
- May make reworking PBUF handling code more complicated (see bug #49914)
- The check for p->type == PBUF_REF is a strange special case, too
- Simon also voted to remove it

(cherry picked from commit 47bac3c11f)
2017-02-27 12:17:40 +01:00
Dirk Ziegelmeier
e53c84654e Fix bug #50064: Zero-copy RX: ARP reply fails with PBUF_REF
Kept the optimized version intact, see discussion in savannah bug tracker

(cherry picked from commit 199c38de29)
2017-02-27 12:17:40 +01:00
Axel Lin
90d68b41df tcp_out: Use LWIP_MIN instead of open-coded for better readability
Make the intention of code more clear by using LWIP_MIN instead of open-coded.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
(cherry picked from commit 141b5def46)
2017-02-27 12:16:17 +01:00
Axel Lin
e6756387b0 tcp_out: Fix comment for last_unsent->oversize_left and tcp_pcb.unsent_oversize
Both last_unsent->unsent_oversize and tcp_pcb.unsent_oversized fields are not
exist, fix the comments.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
(cherry picked from commit 30aedfc3f7)
2017-02-27 12:16:17 +01:00
Dirk Ziegelmeier
4fe1436904 Add some parentheses for better code readability in tcp_in.c
(cherry picked from commit df8e404abd)
2017-02-27 12:16:16 +01:00
Dirk Ziegelmeier
1fdbda9700 Fix bug #50040: pbuf_alloc(..., 65534, PBUF_RAM) succeeds
Check for integer overflow when calculating memory allocation size
(cherry picked from commit 9898d406bc)
2017-02-27 12:16:16 +01:00
Dirk Ziegelmeier
fed15778dd Minor typo fix in tcp_out.c
(cherry picked from commit 0043bf78b6)
2017-02-27 12:16:16 +01:00
Axel Lin
bbe91e356f tcp_out: Fix oversize vs. space assertion test
oversize_used is always 0 at this point, should test oversize instead.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
(cherry picked from commit e1598b0b11)
2017-02-27 12:16:15 +01:00
Dirk Ziegelmeier
e94c9ffa70 Fix warning about bad cast in pbuf_skip() 2017-01-05 08:14:39 +01:00
Dirk Ziegelmeier
72316bdb5b Move macros to access DHCP and AUTOIP data to headers, users may want to access the members 2017-01-05 08:09:00 +01:00
Dirk Ziegelmeier
803a711e6a Fix warning that local variable may be used uninitialized in mem.c 2017-01-05 08:07:41 +01:00
Axel Lin
1f3c18fcbe tcp: Make tcp_listen_with_backlog_and_err return NULL if the address/port is already used
The caller of tcp_listen_with_backlog_and_err() usually check if the return
pcb is NULL before checking the err reason. I think the commit adding
tcp_listen_with_backlog_and_err() accidently change the behavior, Fix it.

Fixes: 98fc82fa71 ("added function tcp_listen_with_backlog_and_err() to get the error reason when listening fails")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2017-01-01 19:53:51 +01:00
sg
a2a16d4193 nd6 rdnss: fixed dual-stack compilation 2016-12-31 15:51:59 +01:00
sg
98fc82fa71 added function tcp_listen_with_backlog_and_err() to get the error reason when listening fails (bug #49861) 2016-12-31 15:36:31 +01:00
Dirk Ziegelmeier
748e2e925b Create documentation section "porting" and move it under lwIP section (instead of infrastructure) 2016-12-29 09:29:24 +01:00
Dirk Ziegelmeier
1fd69ddee9 Minor documentation update in def.c 2016-12-29 09:28:45 +01:00
David van Moolenbroek
71810d0415 ipv6: adjust MLD membership on address state changes
If MLD support is enabled, each locally assigned IPv6 address in the
appropriate state must be a member of the solicited-node multicast
group corresponding to that address.  Ensure that this is always the
case by (re-)deciding on the membership upon every address state
change.  By doing so, this patch enforces that user-initiated state
changes to addresses (e.g., deletion) never cause a desynchronization
with the corresponding solicited-node multicast group membership,
thereby making such user-initiated state changes simpler and safer.
2016-12-20 22:28:02 +01:00
Dirk Ziegelmeier
dd96c71253 Fix a few -Wconversion warnings (there are many more to do) 2016-12-20 14:22:51 +01:00
Dirk Ziegelmeier
e0c0ba7e1b Fix compile with LWIP_NOASSERT
Pointed out by Nirav Desai
2016-12-19 10:11:23 +01:00
Axel Lin
f488c5b7bc igmp: Fix optimized code for igmp_remove_group
The code in the for loop checks tmp_group->next == group, so current code
actually checks from the 3rd entry in the linked groups list. Fix it.

Fixes: 5c1dd6a4c6 ("Optimization in igmp_remove_group() pointed out by Axel Lin")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-12-17 22:01:30 +01:00
Dirk Ziegelmeier
5c1dd6a4c6 Optimization in igmp_remove_group() pointed out by Axel Lin
No need to handle special case "first in list" since this is always the allsystems group that shall not be removed
2016-12-17 15:06:33 +01:00
Dirk Ziegelmeier
102a50fa96 Fix bug #39145: IGMP membership report for 224.0.0.1
Ensure allsystems group is always first in linked list
2016-12-17 13:36:24 +01:00
Joel Cunningham
cceea73c3f bug #49631: handle zero-window probe and refused_data
This commit adds support for responding to a zero-window probe when
the refused_data pointer is set

A zero-window probe is a data segment received when rcv_ann_wnd
is 0. This corrects a standards violation where LwIP would not
respond to a zero-window probe with its current ACK value (RCV.NXT)
when it has refused data, thus leading to the probing TCP closing
out the connection
2016-12-16 09:37:54 -06:00
Dirk Ziegelmeier
b5f51dbd0c ND6: Don't misuse ip6_current_dest_addr() to create an aligned copy of an IPv6 address
We never know what side effect in application code this could trigger...
2016-12-16 08:51:06 +01:00
David van Moolenbroek
a8b986bbb6 Add hook for TCP Initial Sequence Number generation
lwIP produces a TCP Initial Sequence Number (ISN) for each new TCP
connection. The current algorithm is simple and predictable however.
The result is that lwIP TCP connections may be the target of TCP
spoofing attacks.  The problem of such attacks is well known, and a
recommended ISN generation algorithm is standardized in RFC 6528.
This algorithm requires a high-resolution timer and cryptographic
hashing function, though.  The implementation (or best-effort
approximation) of both of these aspects is well beyond the scope of
lwIP itself.

For that reason, this patch adds LWIP_HOOK_TCP_ISN, a hook that
allows each platform to implement its own ISN generation using
locally available means.  The hook provides full flexibility, in
that the hook may generate anything from a simple random number
(by being set to LWIP_RAND()) to a full RFC 6528 implementation.

Implementation note:

Users of the hook would typically declare the function prototype of
the hook function in arch/cc.h, as this is the last place where such
prototypes can be supplied.  However, at that point, the ip_addr_t
type has not yet been defined.  For that reason, this patch removes
the leading underscore from "struct _ip_addr", so that a prototype
of the hook function can use "struct ip_addr" instead of "ip_addr_t".

Signed-off-by: sg <goldsimon@gmx.de>
2016-12-15 20:18:08 +01:00
goldsimon
da15132aa0 Make nd6_new_router() handle already existing routers (this is a special case for 2 netifs on the same subnet - e.g. wifi and cable) see bug #46506 2016-12-15 09:25:44 +01:00
Axel Lin
e3925cc359 nd6: Fix build error if LWIP_ND6_RDNSS_MAX_DNS_SERVERS == 0
Fix below build error when LWIP_ND6_RDNSS_MAX_DNS_SERVERS == 0
../../../../lwip/src/core/ipv6/nd6.c: In function ‘nd6_input’:
../../../../lwip/src/core/ipv6/nd6.c:400:10: error: unused variable ‘rdnss_server_idx’ [-Werror=unused-variable]
     u8_t rdnss_server_idx = 0;
          ^~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
../Common.mk:93: recipe for target 'nd6.o' failed
make: *** [nd6.o] Error 1

Fixes: 6b1950ec24 ("nd6: add support for RDNSS option (as per RFC 6106)")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-12-15 08:11:34 +01:00
sg
6b1950ec24 nd6: add support for RDNSS option (as per RFC 6106) 2016-12-14 22:12:14 +01:00
sg
4e3cf61571 opt.h: added LWIP_DHCP_MAX_DNS_SERVERS to configure the maximum number of DNS servers configured from dhcp.c(v4) (if any; guarded with LWIP_DNS) 2016-12-14 22:04:08 +01:00
sg
53b9f2a5bd dhcp: covert DHCP_OPTION_IDX_* from defines to enum (mainly to ease offset calculation) 2016-12-14 21:56:39 +01:00
David van Moolenbroek
cd5dfa2bc5 nd6: minor 'static' consistency fix 2016-12-14 21:25:55 +01:00
sg
60cd25c6a1 Moved nd6 implementation details to new file nd6_priv.h (possible after David's cleanups) 2016-12-14 21:04:53 +01:00
sg
4c16ea920c Minor: nd6_packet_send_check() -> nd6_get_next_hop_addr_or_queue() (too long, but a little more self-explaining); cosmetics... 2016-12-14 20:52:44 +01:00
David van Moolenbroek
69a7039f75 nd6: centralize link-local packet send decision
Previously, ethip6 and lowpan6 each had their own copy of code that
used internal nd6 data structures to decide whether to send a packet
on the local link right away, or queue it while nd6 performed local
address resolution.  This patch moves that code into nd6, thereby
eliminating all remaining cases of external access to internal nd6
data structures, as well as the need to expose two specific nd6
functions.

As a side effect, the patch effectively fixes two bugs in the lowpan6
code that were already fixed in the ethip6 code.
2016-12-14 20:19:50 +01:00
David van Moolenbroek
06ff89cbe4 nd6: use default_router_list internally only
This patch rearranges the code division between nd6.c and ip6.c such
that the latter does not need to access ND6-internal data structures
(specifically, "default_router_list") directly anymore.
2016-12-14 20:16:38 +01:00
David van Moolenbroek
cee59ba8cd nd6: add nd6_clear_destination_cache() function
The new function, while currently not used internally, allows external
code to clear the ND destination cache in the case that it may have
become inconsistent with the current situation, for example as the
result of a change of locally assigned addresses, or a change in
routing tables implemented through the LWIP_HOOK_ND6_GET_GW hook.
2016-12-14 20:12:40 +01:00
goldsimon
d4fad5929c nd6_input(): allow using NA without lladdr_opt for DAD 2016-12-14 13:11:13 +01:00
David van Moolenbroek
7d119fd86b nd6: add LWIP_HOOK_ND6_GET_GW hook 2016-12-14 08:36:57 +01:00
goldsimon
74a5537e15 Revert "Added LWIP_HOOK_ETHIP6_GET_GW()"
This reverts commit 86b01e4f29.
2016-12-14 08:36:47 +01:00
goldsimon
afb21603dc Add a check for correct implementation of LWIP_CONST_CAST() to lwip_init() 2016-12-14 08:31:09 +01:00
David van Moolenbroek
002e077dbd ethip6: forward correct error code
On failure, nd6_get_next_hop_entry() returns an ERR_ type negative
error code.  ethip6_output() erroneously assumed that that error would
always be ERR_MEM, even though it may also be ERR_RTE in practice.
With this patch, ethip6_output() simply forwards the returned error.
2016-12-14 08:29:36 +01:00
sg
9d199a6d72 netif_create_ip6_linklocal_address(): use macros to assign address state to ensure callbacks are triggered; netif_add_ip6_address(): only overwrite invalid addresses, not tentative addresses 2016-12-13 21:54:49 +01:00
Pradip De
86b01e4f29 Added LWIP_HOOK_ETHIP6_GET_GW()
Signed-off-by: sg <goldsimon@gmx.de>
2016-12-13 21:53:07 +01:00
Dirk Ziegelmeier
e5f9f187ad Continue to fix incorrect casts via size_t for some platforms
Now also for casts:
- to remove alignment warnings
- casts between pointers and ints
2016-12-12 10:17:33 +01:00
Dirk Ziegelmeier
f2a5aa2866 Fix bug #49827: wrong cast to size_t on 16-bit x86 architecture
I hope I caught all of them.
TODO: Same for casts to get rid of alignment warnings, these are also casts via size_t
2016-12-12 10:07:00 +01:00
Dirk Ziegelmeier
7a1b38db6e Minor: Save an #ifdef in ip4_frag.c 2016-12-09 21:26:53 +01:00
Dirk Ziegelmeier
26e02e84a6 Fix bug #48963: ip6_frag does not support LWIP_NETIF_TX_SINGLE_PBUF
Implemented.
2016-12-09 21:26:21 +01:00
goldsimon
5774fdfe75 dns: added one-shot multicast DNS queries 2016-12-09 09:20:46 +01:00
Dirk Ziegelmeier
89cb7b7aa1 Try to remove #include <stdlib.h> from many files. Does not seem necessary any more and might cause problems when porting lwIP. 2016-12-08 11:05:01 +01:00
goldsimon
9c3bbcf4e6 removed old disabled code 2016-12-08 10:24:56 +01:00