Commit Graph

2423 Commits

Author SHA1 Message Date
David van Moolenbroek
e0c5e1988f nd6: improve address autoconfiguration support
In summary, this patch aims to resolve bugs #47923 and #48162, by
decoupling address autoconfiguration from the on-link prefix list,
since those are not related. Important necessary changes are needed
to meet this goal, ultimately bringing the lwIP ND6 implementation
closer to compliance with RFC 4862. The main changes are:

  1. support for address lifetimes, and,
  2. addition of a new DUPLICATED address state.

The decoupling implies that the prefix list can no longer be used to
maintain state for address autoconfiguration. Most importantly, the
lifetime of each address, which was previously derived from the
prefix slot's lifetime, must now be associated with the address
itself. This patch implements address lifetime tracking, maintaining
both a valid and a preferred lifetime for each address, along with
the corresponding address state changes (e.g., between PREFERRED and
DEPRECATED), all as required by RFC 4862.

The support for address lifetimes can be enabled with a new
LWIP_IPV6_ADDRESS_LIFETIMES setting in lwipopts.h. It is required for
autoconfiguration and enabled by default if autoconfiguration is
enabled as well, but it may also be enabled separately, so as to allow
application-controlled lifetime management (e.g., if autoconfiguration
is implemented in a separate application). A special valid-lifetime of
zero is used to denote a static address--that is, an address that was
configured manually, that does not have lifetimes, and that should be
left alone by the autoconfiguration functionality. Addresses assigned
without setting a lifetime are deemed static, thus preserving
compatibility with existing lwIP-based applications in this respect.

Similarly, the decoupling implies that the prefix list can no longer
be used to remember cases of address duplication. Previously, the
detection of a duplicated address would simply result in removal of
the address altogether. Instead, this patch introduces a new state
"DUPLICATED", indicating that the address, while technically still
present, has been found to conflict with other node addresses, and no
attempt should be made to produce an autoconfiguration address for
that prefix.

Manually added addresses, including the link-local address, once set
to DUPLICATED, will remain in that state until manual intervention.
Autoconfigured DUPLICATED addresses will expire according to their
valid-lifetime, essentially preserving the current behavior but
without the use of the prefix list. As a first attempt to approach
compliance with RFC 4862 Sec. 5.4.5, if the link-local address is
detected to be duplicated, all derived addresses are marked duplicated
as well, and no new addresses will be autoconfigured. More work is to
be done for full compliance with that section, however.

Together, those two main changes indeed do fully decouple address
autoconfiguration from the on-link prefix list. Changes to the latter
thus no longer affect the former, resolving bug #47923. Moreover, as a
result, autoconfiguration can, and does, now also take place on
advertised prefixes that do not have the on-link flag set, resolving
bug #48162. The routing changes mentioned in the discussion of that
bug are left to a separate patch, though.
2017-01-11 07:54:03 +01:00
David van Moolenbroek
b59472cf63 raw: core support for IP_HDRINCL socket option
This patch adds a new RAW_FLAGS_HDRINCL flag to the raw core
implementation. When this flag is set on a RAW PCB, the raw send
routines expect the caller to supply an IP header for the given
packet, and will use that IP header instead of prepending one to
the packet themselves.

This feature allows the IP_HDRINCL socket option to be implemented
in higher layers with no further effort. Even thoguh that option is
traditionally supported for IPv4 sockets only (e.g., see RFC 3542
Sec. 3), the RAW_FLAGS_HDRINCL flag supports both IPv4 and IPv6, as
much of the lower-level infrastructure was already in place anyway.
2017-01-08 19:26:30 +01:00
David van Moolenbroek
162cc4d343 raw: split off raw_sendto_if_src() from raw_sendto()
Similar to the core UDP API, the new function may be used to implement
IPV6_PKTINFO (RFC 3542 Sec. 4), for example. This patch makes no
further functional changes; it merely moves code around a bit.
2017-01-08 19:26:24 +01:00
David van Moolenbroek
aea7062223 raw: extend support for connected sockets
The support for connecting raw sockets is extended to match the
support for UDP sockets, while keeping the current API unchanged:

- for connected sockets, filter incoming packets on source address;
- use a flag to indicate whether a socket is connected, at no extra
  memory cost; the application may check this flag if needed;
- added raw_disconnect(), which so far existed in documentation only.
2017-01-08 19:26:19 +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
Dirk Ziegelmeier
aae0fc4908 Use new IPv6 init macro in netif.c 2016-12-07 22:19:37 +01:00
goldsimon
b31b0c8148 remove bogus LWIP_MAKE_U16() define and use PP_NTOHS() in ip4.c instead 2016-12-07 12:44:57 +01:00
goldsimon
c87855423c DNS: added compile-time check for some defines to fit into an u8_t (bug #49658) 2016-12-07 09:09:45 +01:00
Dirk Ziegelmeier
1687721600 Fix compile when IPv4 is disabled 2016-12-05 22:01:58 +01:00
Axel Lin
92183bb354 icmp: Increment mib2.icmpintimeexcds counter if got ICMP_TE
Increment mib2.icmpintimeexcds rather than mib2.icmpindestunreachs if got ICMP_TE.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-12-05 12:30:09 +01: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
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
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
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
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
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
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
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
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
Dirk Ziegelmeier
54d76ffd6d Remove superfluous local variable in raw.c 2016-11-05 15:13:57 +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
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
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
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
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
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
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
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
bef7873042 ND6: Always set neighbor_cache.state together with counter value to avoid inconsistency 2016-10-04 13:59:05 +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
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
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
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
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
4144d54642 Fix implementation of lwip_itoa to take more parameters 2016-09-28 22:05:18 +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
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
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
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
ee4cd45c98 Fix bug #49125: Need a way to iterate multicast groups for MAC filtering
-> let list heads be a public symbol
2016-09-19 08:45:57 +02:00
Dirk Ziegelmeier
8cd43a3dd9 Documentation: Add one more note PCB is already freed in tcp_err callback. 2016-09-09 17:36:49 +02:00
Joel Cunningham
b7c2553b46 bug #48964: Make PBUF_POOL sanity checks contingent on PBUF_POOL_SIZE
This commit adds support to the sanity checks in init.c to ensure that
PBUF_POOL is in use

In ports with drivers/netifs that use PBUF_REF for the RX pathway, there
is no need for the PBUF_POOL memory pool.  This allows the port to define
PBUF_POOL_SIZE to 0
2016-09-07 09:11:19 -05:00
Axel Lin
f8a95aa27f dns: Drop unnecessary txid variable in dns_check_entry
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-09-07 14:56:01 +02:00
Dirk Ziegelmeier
d66442ba91 Fix compile when TCP, UDP and RAW are disabled 2016-09-07 08:11:30 +02:00
sg
34682facd1 Remove ip4_frag IP_FRAG_USES_STATIC_BUF code: nearly the same as the other code, but IP_FRAG_USES_STATIC_BUF doesn't work when queuing pbufs 2016-08-31 21:00:10 +02:00
Dirk Ziegelmeier
ac6b64cf66 Implement a more readable fix for pbuf_memcmp than my last fix 2016-08-31 20:24:37 +02:00
Dirk Ziegelmeier
4325aca0f7 Fix pbuf_memcmp() implementation by using pbuf_try_get_at() instead of pbuf_get_at(). Payload out-of-bounds access was not handled correctly. 2016-08-31 10:35:42 +02:00
sg
23147b0e21 added more out of range checks to dns_recv() (see bug #48924) 2016-08-30 22:18:10 +02:00
sg
a08ed9148d added pbuf_try_get_at() (much like pbuf_get_at() but can return out-of-pbuf error) 2016-08-30 21:35:37 +02:00
Dirk Ziegelmeier
8d45162a59 Fix usage of uninitialized data in dhcp.c by checking pbuf_copy_partial() return value 2016-08-30 21:33:43 +02:00
Dirk Ziegelmeier
2137f49d32 Fix usage of uninitialized data in nd6.c because of unchecked pbuf_copy_partial() return value 2016-08-30 21:20:58 +02:00
Dirk Ziegelmeier
aef3d2cb87 Minor coding style fix in pbuf.c 2016-08-30 21:09:24 +02:00
Dirk Ziegelmeier
840d1e60fa Fix bug #48924: Potential out of bound reads in DNS codes of lwip project by adding checks for pbuf_copy_partial() return values.
Add some comments to clarify handling of untrusted network data handling.
2016-08-30 21:09:24 +02:00
Axel Lin
198fa5dbfa Remove duplicated include for lwip/inet_chksum.h
Include it once is enough.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Dirk Ziegelmeier <dirk@ziegelmeier.net>
2016-08-30 09:47:43 +02:00
Axel Lin
db6aa82a10 memp: Fix comment for memp_overflow_check_element_overflow/underflow
These functions now take desc rather than memp_type as second parameter.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-08-28 20:33:57 +02:00
Dirk Ziegelmeier
4b45baee10 Add some dual-stack notes to documentation 2016-08-26 15:58:18 +02:00
Dirk Ziegelmeier
0d510dd66d Add API macros for netif client data handling and update documentation accordingly 2016-08-26 11:21:49 +02:00
Dirk Ziegelmeier
57468b8a30 Minor: Several documentation updates 2016-08-25 22:04:04 +02:00
goldsimon
89aa4e7d79 fixed bug #47921: link-local prefix in router advertisement must not be processes for SLAAC (patch by abhishek ambure) 2016-08-25 14:21:30 +02:00
goldsimon
3e23eb764b fixed compiling TCP_OOSEQ_MAX_BYTES || TCP_OOSEQ_MAX_PBUFS (local variable 'p' was hidden) 2016-08-25 14:21:29 +02:00
Axel Lin
a2ca85a260 tcp: Make tcp_state_str/tcp_backoff/tcp_persist_backoff static
They are only referenced in tcp.c, so make them static.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2016-08-25 11:20:10 +02:00
sg
4c390ad39c update netif address change triggers to tpc & udp to work with IPv6, too 2016-08-24 20:51:05 +02:00
Erik Ekman
a1db05c11e Fix const argument warning in netif_ip6_addr_set
../../../../../lwip/src/netif/ppp/ppp.c:1276:37: error: passing
      'const ip6_addr_t *' (aka 'const struct ip6_addr *') to parameter of type
      'ip6_addr_t *' (aka 'struct ip6_addr *') discards qualifiers
      [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
  netif_ip6_addr_set(pcb->netif, 0, IP6_ADDR_ANY6);
                                    ^~~~~~~~~~~~~
../../../../../lwip/src/include/lwip/ip_addr.h:340:24: note: expanded from macro
      'IP6_ADDR_ANY6'
                       ^~~~~~~~~~~~~~~~~~~~~~~~~
../../../../../lwip/src/include/lwip/netif.h:436:73: note: passing argument to
      parameter 'addr6' here
void netif_ip6_addr_set(struct netif *netif, s8_t addr_idx, ip6_addr_t *addr6);
2016-08-24 14:41:48 +02:00
Axel Lin
bf5866b27d tcp: Prevents a 0 sized (invalid) backlog
commit 44e1a2d8e2 accidently includes below changes in tcp_listen_with_backlog
 -  tcp_backlog_set(lpcb, backlog);
 +  lpcb->backlog = backlog;

Thus pass 0 to the backlog parameter of netconn_listen_with_backlog() fails.

Fixes: 44e1a2d8e2 ("define tcp_backlog_set() as dummy-define when backlog feature is disable")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2016-08-24 12:20:28 +02:00
goldsimon
298ec340e5 set netif IPv6 address & state via function to implement change triggers (task #13517) 2016-08-24 09:19:53 +02:00
Dirk Ziegelmeier
8426dfa14d Remove misleading comments from udp_send() and raw_send(). A pbuf may be added automatically in front of the chain to be able to send PBUF_REFs 2016-08-24 08:45:37 +02:00
Dirk Ziegelmeier
6fc7f84497 Minor: documentation updates 2016-08-24 08:19:51 +02:00
Dirk Ziegelmeier
c719c466b3 Remove SIZEOF_ETHARP_PACKET_TX #define, it is not needed any more after my last cleanups 2016-08-23 20:41:37 +02:00
Dirk Ziegelmeier
31778193da Work on bug #48868: Cleanup etharp.c not to use struct eth_hdr: Cleanup etharp_input() to use ethernet_output() 2016-08-23 17:23:21 +02:00
Dirk Ziegelmeier
6caa7b9927 Cleanup etharp_arp_input() signature to match the sig of other input functions (pbuf, netif). Rename to etharp_input() 2016-08-23 17:03:51 +02:00
Dirk Ziegelmeier
979bee386c Work on bug #48868: Cleanup etharp.c not to use struct eth_hdr: Cleanup etharp_raw() to use ethernet_output() 2016-08-23 16:58:17 +02:00
goldsimon
e4c74109cd fixed bug #47652: there is always a delay to send the first Neighbor Solicitation for the new add INCOMPLETE state neighbor entry 2016-08-23 15:50:48 +02:00
goldsimon
fd5b34ae43 ip4_forward(): fixed compiling IP_FORWARD_ALLOW_TX_ON_RX_NETIF==1 2016-08-23 15:26:05 +02:00
goldsimon
306171c93b DHCP: fixed compiling LWIP_DHCP_BOOTP_FILE==1 2016-08-23 15:25:39 +02:00
goldsimon
d99d91dae9 removed ETHARP_TRUST_IP_MAC since it is insecure and we don't need it any more after implementing unicast ARP renewal towards arp entry timeout 2016-08-23 13:00:15 +02:00
Dirk Ziegelmeier
4456c7d230 Fix regression in etharp.c: Allocate correct pbuf layer 2016-08-23 12:32:57 +02:00
Dirk Ziegelmeier
bae4d6398c Fix some comments to reference ethernet_output now 2016-08-23 10:23:59 +02:00
Dirk Ziegelmeier
18136c047b Work on bug #48824: ethernet.c extensions: Implement ethernet_output();
Fixes bug #48862: ethip6 does not support setting vlan
2016-08-23 10:15:03 +02:00
Axel Lin
1c5c96a50a pbuf: Use SYS_ARCH_INC in pbuf_ref()
Use SYS_ARCH_INC to simplify the code.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2016-08-23 08:59:10 +02:00
Axel Lin
40f2bed5c4 mem: Simplify the code for try bigger pool in mem_malloc
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: sg <goldsimon@gmx.de>
2016-08-20 11:29:57 +02:00
Axel Lin
a032ccafe7 mem: Fix trivial comment typo about using custom pools
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-08-20 09:17:37 +02:00
goldsimon
4f4d16260f minor: fixed typo 2016-08-19 15:40:36 +02:00
goldsimon
6b1e1af3d1 combine MAC filter actions for IGMP and MLD6 (IGMP has compatibility defines for old code, MLD6 filter functions must be adapted) 2016-08-19 13:54:14 +02:00
Axel Lin
b3bae1b44c memp: Fix unused variable build error when MEMP_SANITY_REGION_BEFORE/AFTER is 0
MEMP_SANITY_REGION_BEFORE and MEMP_SANITY_REGION_AFTER can be overridden in
lwipopts.h, if one of it is set to 0 we got build error due to unused variable.

Fix unused variable build error when MEMP_OVERFLOW_CHECK >= 1 &&
(MEMP_SANITY_REGION_BEFORE == 0 || MEMP_SANITY_REGION_AFTER == 0).

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2016-08-19 13:47:37 +02:00
Dirk Ziegelmeier
5e36815867 init.c: Implement check for correct implementation of struct packing in lwip port 2016-08-19 13:05:51 +02:00
Dirk Ziegelmeier
6688033bc4 Move IGMP protocol struct to prot/igmp.h 2016-08-19 12:50:41 +02:00
goldsimon
ed566cceaa minor cleaup in (eth)arp 2016-08-19 12:49:02 +02:00
goldsimon
55d05092ef simplify memp.c code a bit 2016-08-19 12:25:48 +02:00
Axel Lin
0e9ef19cfb memp: Remove memp_overflow_init() function
There is only one caller using memp_overflow_init(), and at that context
calling memp_overflow_init_element() actually simplifes the code.
Thus remove memp_overflow_init() function.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2016-08-19 12:25:47 +02:00
goldsimon
14fb48cd7a minor: whitespace cleanups 2016-08-19 09:41:34 +02:00
goldsimon
9725a496b5 moved 2 enums from 'prot' headers to where they belong (dns, dhcp) 2016-08-19 09:41:33 +02:00
Dirk Ziegelmeier
8eb9db18a2 Reduce usage of netif/ethernet.h header, mostly lwip/prot/ethernet.h is sufficient 2016-08-19 08:36:00 +02:00
sg
43d6812b3e IPv6 addr: clarify tentative count/LWIP_IPV6_DUP_DETECT_ATTEMPTS 2016-08-18 22:02:57 +02:00
Dirk Ziegelmeier
2d503f4433 Work on bug #48728: headers should cleanly separate API vs. implementation
ICMP6
2016-08-18 20:52:00 +02:00
Dirk Ziegelmeier
81c68f529b Work on bug #48728: headers should cleanly separate API vs. implementation
MLD6
2016-08-18 20:36:44 +02:00
Dirk Ziegelmeier
8d68400387 Work on bug #48728: headers should cleanly separate API vs. implementation
ND6
2016-08-18 20:28:03 +02:00
Axel Lin
e24fde05db memp: Fix memp_overflow_check_element_overflow assertion
Use LWIP_MEM_ALIGN() in memp_overflow_init() to get alignment address for memp.
This fixes assertion in memp_overflow_check_element_overflow when
MEMP_OVERFLOW_CHECK is set.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-08-18 19:24:34 +02:00
Axel Lin
ef31afb921 memp: Fix build error when LWIP_HOOK_MEMP_AVAILABLE is defined
Fix below build error.

../../../../../lwip/src/core/memp.c: In function ‘memp_free’:
../../../../../lwip/src/core/memp.c:490:31: error: request for member ‘tab’ in something not a structure or union
   old_first = memp_pools[type].tab;
                               ^
../../Common.mk:94: recipe for target 'memp.o' failed
make: *** [memp.o] Error 1

Fixes: de9054cb7a ("memp: cleaned up MEMP_MEM_MALLOC")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-08-18 19:20:26 +02:00
Dirk Ziegelmeier
97fae7e41b Code cleanup in autoip.c and dhcp.c 2016-08-18 12:49:59 +02:00
Dirk Ziegelmeier
7f60cb3889 Improve netif client data API for lwIP internal clients - these can use a compile-time constant to access their data now 2016-08-18 12:37:21 +02:00
Dirk Ziegelmeier
ebf7959880 Coding style fixes in netif.c 2016-08-18 11:44:19 +02:00
Dirk Ziegelmeier
0c7a59b5db Minor: Documentation fixes 2016-08-18 11:06:50 +02:00
Dirk Ziegelmeier
c9ad58308a Minor documentation fixes 2016-08-18 10:59:18 +02:00
Dirk Ziegelmeier
fa6a2d48cc Fix DHCP unit test after my last changes 2016-08-18 06:09:02 +02:00
Dirk Ziegelmeier
c62bfd8146 Port AUTOIP to new netif client data API 2016-08-17 21:26:08 +02:00
Dirk Ziegelmeier
1db9631e7d Port DHCP to new netif client data API 2016-08-17 21:04:44 +02:00
Dirk Ziegelmeier
c28fb298b7 Introduce an API to store arbitrary data pointers in struct netif
Let MDNS to use the new API
TODO: AutoIP, DHCP
2016-08-17 16:37:15 +02:00
Dirk Ziegelmeier
efb7b3d5f8 Rename LWIP_MDNS to LWIP_MDNS_RESPONDER 2016-08-17 12:07:38 +02:00
Dirk Ziegelmeier
c61c8f3766 Use udp_get_multicast_ttl/udp_set_multicast_ttl accessors where applicable 2016-08-16 08:08:06 +02:00
Erik Ekman
4919932c49 Apply patch #8755: Multicast DNS responder support from Erik Ekman 2016-08-14 15:07:45 +02:00
Dirk Ziegelmeier
5493220c93 Move DNS protocol structs to separate header. Needed for Erik Ekman's MDNS implementation. 2016-08-13 09:05:28 +02:00
Dirk Ziegelmeier
6dcb2b2415 Work on bug #48730: Enums should be used instead of multiple defines (where applicable) 2016-08-12 22:51:43 +02:00
goldsimon
dc7340bbd5 started with bug #48728: move protocol definitions to 'include/prot/*.h' files (started with some IPv4 protocols) 2016-08-11 14:36:09 +02:00
goldsimon
bf3e8e6a48 minor coding style fixes in IPv6 code 2016-08-11 09:23:43 +02:00
Dirk Ziegelmeier
5c0944e01a Don't document tcp_send_empty_ack and tcp_keepalive - users should never need them 2016-08-09 10:17:16 +02:00
Dirk Ziegelmeier
5a09fd3e35 Don't document ip4_route and ip6_route, users should use ip_route instead 2016-08-09 10:16:40 +02:00
Dirk Ziegelmeier
85ab39985a Fix a few incorrect uses of err_t. Found by converting lwip error codes to an enum, but I'm not sure wether I want to commit the actual enum conversion. 2016-08-08 22:15:01 +02:00
Dirk Ziegelmeier
1631307bb3 tcp.c: Partly undo Simon's changes from today (repairs doxygen docs) 2016-08-08 21:42:27 +02:00
goldsimon
eba6ae0122 minor: add a comment about where to define LWIP_RAND() 2016-08-08 09:14:50 +02:00
goldsimon
219438fb24 cleanup: move stdlib.h include to mem.c, where it belongs 2016-08-08 09:11:24 +02:00
goldsimon
08378b7d4b Improve LWIP_EVENT_API compilation 2016-08-08 08:49:14 +02:00
David van Moolenbroek
fc66fb830c Fix compilation for LWIP_EVENT_API
Without LWIP_CALLBACK_API, is no error callback function pointer in
the TCP PCB, nor is it needed, so do not attempt to access it.
2016-08-08 08:48:28 +02:00
Dirk Ziegelmeier
f55c0e7864 Move rawapi.txt description to main page - this doc really should be found and read by users 2016-08-07 20:21:27 +02:00
Axel Lin
0a7db8a9a5 PPP: remove double include for lwip/sys.h
Including it once is enough.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Sylvain Rochet <gradator@gradator.net>
2016-08-07 12:35:50 +02:00
Dirk Ziegelmeier
980a919c9a Don't document IP type specific output functions, users should use IP type independent ones 2016-08-07 10:13:50 +02:00
Dirk Ziegelmeier
8d07629b71 Some documentation cleanups and include more comments that have been already in code into doxygen docs 2016-08-07 10:05:34 +02:00
Dirk Ziegelmeier
b94c8ee76f Add some more functions and macros to documentation 2016-08-06 22:16:49 +02:00
Dirk Ziegelmeier
73131b1677 Fix doxygen warning in ip6.c 2016-08-06 20:29:35 +02:00
Dirk Ziegelmeier
87855b0e0e Update doxgen docs: PBUF layers, IPv4 and IPv6 functions, add some missing tcp raw API functions 2016-08-06 20:28:49 +02:00
Dirk Ziegelmeier
70ee63ef3d Documentation: Add example code for NO_SYS use case 2016-08-05 09:53:50 +02:00
sg
5f774270b6 minor: tabs -> spaces 2016-08-03 21:25:32 +02:00
David van Moolenbroek
02221cf5dc Rename IP_HDRINCL to LWIP_IP_HDRINCL
In the BSD socket API world, IP_HDRINCL is a socket option for "raw"
sockets that indicates whether sent packets already include an IP
header.  Within lwIP, "IP_HDRINCL" is redefined as a special value
that indicates to lwIP-internal functions that an IP header is already
included.  While somewhat related, the two meanings are different and,
on platforms that define the IP_HDRINCL socket option, this results in
a conflict.  This patch renames the lwIP one to "LWIP_IP_HDRINCL",
thus resolving the conflict.
2016-08-03 20:51:21 +02:00
Dirk Ziegelmeier
da83946e75 Add one more documentation sentence in tcp.c 2016-08-03 12:34:16 +02:00
goldsimon
3d379c97ec IPv6 is NOT experimental any more :-) 2016-08-03 12:28:56 +02:00
goldsimon
018294d287 remove doubled include (tcpip.h) 2016-08-01 09:44:18 +02:00
Dirk Ziegelmeier
2f7e6d0661 Remove hard reference from netif.c to tcpip.c - avoids pulling in unnecessary code 2016-08-01 09:32:54 +02:00
Dirk Ziegelmeier
2c2d11fa4d Update documentation of netif_input function 2016-07-30 10:40:36 +02:00
Dirk Ziegelmeier
4cb7e31d2d Add missing #include in netif.c 2016-07-30 10:36:11 +02:00
Dirk Ziegelmeier
0c7d015ec4 Further improvement to netif input function autoselection: Select between netif_input() and tcpip_input() depending on NO_SYS setting 2016-07-30 10:29:14 +02:00
Dirk Ziegelmeier
4b67c582f6 Create netif_input function that decides according to netif flags where to pass an incoming packet.
Allow to pass a NULL pointer to netif_add() input function - if so, use the function mentioned above as input function.
2016-07-30 10:19:16 +02:00
sg
23cf45d252 d'oh! (fixed messed-up timeouts.h) 2016-07-27 21:48:29 +02:00
sg
53dc94d570 added LWIP_TIMERS_CUSTOM to override the default implementation of timeouts 2016-07-27 21:46:16 +02:00
sg
a326b057b3 Fix bug #48568 (timeouts does not support late firing properly) by assuming sys_check_timeouts() jitter can' be too bad 2016-07-27 21:17:15 +02:00
Dirk Ziegelmeier
70927892e1 Fix doxygen warning about debug parameters in memp.c
Remove documentation from them, it is not important
2016-07-27 20:34:23 +02:00
Dirk Ziegelmeier
31f941e172 More documentation updates 2016-07-27 20:34:23 +02:00
Dirk Ziegelmeier
0cb1d1144d Integrate README file into doxygen docs instead of duplicating its content in main_page.h 2016-07-27 19:09:52 +02:00
Dirk Ziegelmeier
eb3261d6e0 Add some more TCP RAW API functions to documentation 2016-07-27 13:46:54 +02:00
Dirk Ziegelmeier
6c7eef7ac0 More documentation updates 2016-07-27 13:14:31 +02:00
Dirk Ziegelmeier
ef5c1b6590 Work on lwIP documentation 2016-07-27 13:09:33 +02:00
Dirk Ziegelmeier
ccc830c99c Work on lwIP documentation 2016-07-27 13:03:36 +02:00
goldsimon
af97f9b239 fixed gcc compiler error in do_memp_free_pool(): obviously, SYS_ARCH_DECL_PROTECT() must be the last declaration... 2016-07-27 08:26:42 +02:00
Dirk Ziegelmeier
6b524367a3 Documentation review with Simon, minor changes 2016-07-27 08:05:38 +02:00
Dirk Ziegelmeier
c7e20150f0 Update and restructure docs of some lwip core functions 2016-07-26 19:42:16 +02:00
Dirk Ziegelmeier
c6831648e2 Document apps in doxygen module style, create more top-level categories to structure documentation 2016-07-26 19:30:05 +02:00
Dirk Ziegelmeier
8a9de94b1f Restructure documentation. Create two top-level sections for thread-safe and callback-style APIs. 2016-07-26 18:39:53 +02:00
Dirk Ziegelmeier
67d674a59c Document IGMP and MLD6 API in doxygen module style 2016-07-26 18:20:30 +02:00
Dirk Ziegelmeier
dc0859b8d1 Document DHCP and AUTOIP API in doxygen module style 2016-07-26 18:10:05 +02:00
Dirk Ziegelmeier
9c10daba93 Document netif API in doxygen module style 2016-07-26 17:53:07 +02:00
Dirk Ziegelmeier
0fea2bc02e Document netconn API in doxygen module style 2016-07-26 17:40:55 +02:00
Dirk Ziegelmeier
ce19c59bb2 Document ip address function in doxygen module style 2016-07-26 17:11:01 +02:00
Dirk Ziegelmeier
8643782e5d Document netif and lwIP in doxygen module style 2016-07-26 16:53:27 +02:00
Dirk Ziegelmeier
bd79f6c055 Document DNS, memory pools and PBUFs as modules 2016-07-26 16:40:13 +02:00
goldsimon
e030118750 moved MEM_LIBC_MALLOC code from mem.h to mem.c:
- it's not worth littering mem.h just to save some bytes to prevent the additional call;
- MEM_STATS now also work when MEM_LIBC_MALLOC is enabled
2016-07-26 15:02:36 +02:00
Dirk Ziegelmeier
59295be4ef Some more RAW API documentation updates
Improve structure of documentation: PPP is now a module, too
2016-07-26 13:53:59 +02:00
Dirk Ziegelmeier
10acd8303d Start to document public RAW API via doxygen 2016-07-26 13:38:43 +02:00
goldsimon
168ad22761 fixed custom pools after last memp cleanup 2016-07-26 12:26:52 +02:00
goldsimon
fb75f48751 Make lwip_cyclic_timers[] const 2016-07-26 09:08:29 +02:00
sg
00598b0b46 fix mem stats for MEM_USE_POOLS==1 2016-07-25 22:08:32 +02:00
Dirk Ziegelmeier
80be1a6bf8 Add links to new documentation pages in the relevant files 2016-07-25 08:20:39 +02:00
sg
de9054cb7a memp: cleaned up MEMP_MEM_MALLOC:
- support memp stats when MEMP_MEM_MALLOC==1 (bug #48442);
- hide MEMP_MEM_MALLOC in memp.c instead of messing up the header file;
- make MEMP_OVERFLOW_CHECK work when MEMP_MEM_MALLOC==1
2016-07-21 22:17:32 +02:00
sg
413eeef5fa minor: moved sanity check from mem.c to init.c 2016-07-21 22:16:05 +02:00
goldsimon
523b11e664 fixed bug #48543 (TCP sent callback may prematurely report sent data when only part of a segment is acked) and don't include SYN/FIN in snd_buf counter (patch by Ambroz Bizjak) 2016-07-21 13:47:52 +02:00
goldsimon
e8ffac852e Fixed bug #48551 (autoip_supplied_address() does not work when address is first assigned); fixed AutoIP timeouts 2016-07-20 08:28:16 +02:00
sg
98d58ffd59 minor: fixed wrong indentation 2016-07-19 22:38:34 +02:00
sg
97b8e88e69 netif_set_addr(): when removing an address (setting address to ANY), we have to remove it *before* changing netmask/gw to ensure that tcp RST segment can be sent correctly 2016-07-19 22:34:22 +02:00
sg
24a339a609 autoip: made private things private, use etharp_* shortcuts instead of etharp_raw() 2016-07-19 22:27:20 +02:00
sg
86e419425b minor: code layout only 2016-07-19 22:06:59 +02:00
sg
d0a79ff085 fixed bug #48477 (ARP input packet might update static entry) 2016-07-19 22:01:42 +02:00
sg
dff46e3816 Fixed bug #48539 (possible crash when packet received in SYN_SENT state) 2016-07-19 21:23:21 +02:00
goldsimon
579fffd2ec fixed task #14084: make dhcp_supplied_address() usable in netif change callbacks triggered by changing the netif address assigned by dhcp 2016-07-19 12:58:21 +02:00
Dirk Ziegelmeier
5d4c1432c2 Fix bug #48436: Naming clash for timers.c (with FreeRTOS)
Rename timers.* to timeouts.*
2016-07-19 12:44:12 +02:00
goldsimon
6adeb706a6 change tcp_pcb->acked to be a global variable: used in one call stack only (idea by Ambroz Bizjak) 2016-07-19 10:38:01 +02:00
Dirk Ziegelmeier
72208cddfa Rename ip_frag.* to ip4_frag.* 2016-07-19 10:12:56 +02:00
Dirk Ziegelmeier
7037b340c1 Move etharp to core/ipv4, which is a more appropriate place for it 2016-07-19 09:29:51 +02:00
Dirk Ziegelmeier
06c7404461 Fix bug #48510, DHCP requires ARP
Use solution 2 proposed by Jens Nielsen
2016-07-19 09:10:21 +02:00
goldsimon
6c0d78caaa Fixed trying to send RST for unconnected (but bound) pcb 2016-07-19 09:05:48 +02:00
Dirk Ziegelmeier
4ec3d29168 Fix bug #48504: tcp_debug_print_pcbs reads nonexisting tcp_pcb fields 2016-07-19 08:54:44 +02:00
Dirk Ziegelmeier
4ea1d62d45 Update some doxygen comments 2016-07-16 17:56:29 +02:00
sg
421dab87e8 fixed bug #48476 (TCP sent callback called wrongly due to picking up old pcb->acked 2016-07-11 21:43:39 +02:00
Dirk Ziegelmeier
01e5d6d819 memp.c: No need to init variables located in BSS section 2016-07-08 11:44:28 +02:00
Ambroz Bizjak
18c332ae51 fixed bug #48402 (Bug in skipping over TCP options)
Signed-off-by: goldsimon <goldsimon@gmx.de>
2016-07-08 11:27:50 +02:00
goldsimon
6293a835e9 fixed compiling: forgot to move one line :-( 2016-07-08 10:16:46 +02:00
goldsimon
2df636fe77 memp: fixed STATS initialization 2016-07-08 10:06:36 +02:00
goldsimon
959042aa88 memp: fixed compiling various combinations of memp stats (display etc.) 2016-07-08 08:21:57 +02:00
Dirk Ziegelmeier
087ecab891 Add some comments to places where we cast through a void* to get rid of alignment warnings 2016-07-07 21:56:43 +02:00
Dirk Ziegelmeier
212eacd9d6 Fix bug #48356: private memp pools have no statistic counters
Implement struct stats_mem instance for each pool, let lwip_stats.mem[] point to these instances
2016-07-07 21:55:51 +02:00
Dirk Ziegelmeier
b91e47b518 Implement portable and overridable allocation of memory buffers
Fixes bug #48300 (Private mempools allocate foreign memory), bug #48354 (Portable alignment defines/include required for static allocation) and bug #47092 (Tag memory buffers like memp_memory_xxx and ram_heap with a macro so that attributes can be attached to their definitions)

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2016-07-07 13:35:13 +02:00
goldsimon
811b237bd7 dns: fixed declaration and usage of DNS_LOOKUP_LOCAL_EXTERN() 2016-07-07 13:02:47 +02:00
goldsimon
14ca418ac0 minor: coding style fixes 2016-07-05 07:36:51 +02:00
goldsimon
2fdea8b79b fixed bug #48398 (dns: entries reused during found-callback could be aborted if ttl==0) 2016-07-04 13:55:20 +02:00
Michael Brown
2e26fc9224 tcp: Avoid 3-second delay for a half-open connection
If lwIP encounters a half-open connection (e.g. due to a restarted
application reusing the same port numbers) it will correctly send a
RST but will not resend the SYN until one retransmission timeout later
(approximately three seconds).  This can increase the time taken by
lpxelinux.0 to fetch its configuration file from a few milliseconds to
around 30 seconds.

Fix by immediately retransmitting the SYN whenever a half-open
connection is detected.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2016-07-04 12:25:22 +02:00
goldsimon
fd83f4fb22 Fix bug #48359 (dns entries are not set to state DONE) 2016-07-04 10:22:20 +02:00
Sylvain Rochet
9d0546839c init: fix NO_SYS targets build
lwip/src/core/init.c:256:32: error: "LWIP_COMPAT_MUTEX" is not defined [-Werror=undef]
 #if LWIP_TCPIP_CORE_LOCKING && LWIP_COMPAT_MUTEX && !defined(LWIP_COMPAT_MUTEX_ALLOWED)
                                ^
Setting LWIP_TCPIP_CORE_LOCKING is meaningless for NO_SYS targets,
therefore checking if LWIP_COMPAT_MUTEX is set does not make sense.

Introduced by 42dfa71f97: Make LWIP_TCPIP_CORE_LOCKING==1 the default
(and warn if LWIP_COMPAT_MUTEX==1 in that case as mutexes are required
to prevent priority inversion on tcpip_thread operations)
2016-07-02 21:53:24 +02:00
sg
42dfa71f97 Make LWIP_TCPIP_CORE_LOCKING==1 the default (and warn if LWIP_COMPAT_MUTEX==1 in that case as mutexes are required to prevent priority inversion on tcpip_thread operations) 2016-06-30 22:37:37 +02:00
goldsimon
e6bc591a1e fixed bug #48170 (Vulnerable to TCP RST spoofing) (original patch by Fabian Koch) 2016-06-30 08:50:42 +02:00
goldsimon
d31d2ee882 Revert "fixed bug #48170 (patch by Fabian Koch)"
This reverts commit 236bc19422.
The fix introduced bug #48328 -> reverted
2016-06-30 08:41:50 +02:00
Erik Ekman
4047702928 Fix clang warning about unreachable code
Do check with preprocessor instead
2016-06-27 22:32:18 +02:00
Dirk Ziegelmeier
5d356c96f5 Minor: cleanup my last commit 2016-06-27 20:57:22 +02:00
Dirk Ziegelmeier
39545d2c6d Fix clang warning about unreachable code 2016-06-27 20:56:21 +02:00
goldsimon
236bc19422 fixed bug #48170 (patch by Fabian Koch) 2016-06-27 10:31:36 +02:00
Dirk Ziegelmeier
38c0255fa2 Fix a few more CLANG format string warnings (from unix check project) 2016-06-25 13:24:48 +02:00
Dirk Ziegelmeier
102f5882d5 Fix several CLANG format string warnings 2016-06-25 13:06:31 +02:00
Dirk Ziegelmeier
8dc77ef558 doxygen updates - include IPv6 in documentation. Exclude include/netif/ppp/polarssl.
Convert TODO -> @todo
2016-06-22 20:18:23 +02:00
Sylvain Rochet
cfe5182380 timers: fix wrong timings for !NO_SYS targets
issue 1:

sys_arch_sem_wait() is supposed to return an elapsed time in ms, what could
happen given a > 1 kHz calling rate for high throughput systems is that it
might always returns 0 ms. This is a problem for systems which compute the
elapsed time from a high precision clock source.

This is what is currently happening in the unix port in sys_arch_sem_wait():

start time -> 1000000000;  // ns
-- less than a ms before an event arrive --
end time   -> 1000xxxxxx;  // ns
return value -> (end time - start time)/1000000 -> 0

The return value is used to reduce the next timer interval, if
sys_arch_sem_wait() always return 0 no more timers are fired anymore

issue 2:

The current timer implementation for !NO_SYS targets only count elapsed
time while -waiting- for semaphore and doesn't count at all the time
spent by the stack to process packets. For CPU bound traffic patterns no
more timers are fired anymore.

Both are serious design issues which cannot be easily fixed without reworking
everything. This patch uses the properly implemented timers for NO_SYS targets
for !NO_SYS targets and merge them both into one single timers implementation.
2016-06-20 16:17:55 +02:00
goldsimon
6d95a34971 icmp ping response: fix invalid checksum (and possible assertion failure) when ip header contains options (is it correct that we mirror back all options) 2016-06-17 10:07:49 +02:00
goldsimon
61e067b98a Check for minimum IPv4 header length in rx packets 2016-06-17 09:36:14 +02:00
goldsimon
fda778f6b6 ip6_reass: don't crash if frag header isn't the first (or not in the first pbuf) 2016-06-16 13:51:38 +02:00
Erik Ekman
d98e25a783 nd6: Handle incorrect ICMP option length in RA
Make sure ICMPv6 options have a valid length before
parsing them.

Found with afl-fuzz.
2016-06-14 15:06:49 +02:00
sg
4e241fbf14 some minor improvements to the tcp options checking code 2016-06-13 20:41:58 +02:00
Henrik Persson
b9a2ee8aaa [PATCH] Drop instead of ASSERT in tcp_input header parsing
Since allowing input validation to trip the ASSERT handler is bad,
let's just drop the packets instead if validation fails.

Signed-off-by: sg <goldsimon@gmx.de>
2016-06-13 20:08:43 +02:00
Dirk Ziegelmeier
5e7b343d52 Fix dns_getserver to return a pointer, not a value 2016-06-13 09:00:46 +02:00
Dirk Ziegelmeier
6be7e221a5 Fix a few doxygen warnings 2016-05-24 22:29:18 +02:00
sg
631c458c55 Fixed invalid DEBUGF level SERIOUS when pbuf_header fails (it returns '1': this is not serious!) 2016-05-23 22:06:02 +02:00
Dirk Ziegelmeier
90a656ed78 Fix several doxygen errors all over the code 2016-05-23 21:18:16 +02:00
Jan Breuer
ebd103775d ipv6_addr: Render last zero in ip6addr_ntoa_r if not in first empty block 2016-05-23 09:54:54 +02:00
goldsimon
bd177ff38f added comment, fixed coding style 2016-05-23 09:47:14 +02:00
Jan Breuer
ac21a5f370 nd6: add cleanup function 2016-05-23 09:44:27 +02:00
Axel Lin
8c0f620d83 dns: Use LWIP_ARRAYSIZE instead of open coded
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-05-11 12:20:15 +02:00
Axel Lin
7e9377a9c7 dhcp: Use LWIP_ARRAYSIZE to get the number of array entries
dhcp_discover_request_options is u8_t array, so the result is the same.
But use LWIP_ARRAYSIZE to get the number of array entries is better
because it works for all types.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-05-11 12:15:12 +02:00
Sylvain Rochet
1dcd5d31d7 pbuf: fix undefined PBUF_POOL_FREE_OOSEQ if TCP_QUEUE_OOSEQ is disabled
lwip/src/core/timers.c: In function ‘sys_check_timeouts’:
lwip/src/core/timers.c:328:5: error: "PBUF_POOL_FREE_OOSEQ" is not defined [-Werror=undef]
 #if PBUF_POOL_FREE_OOSEQ

Fix it by declaring an empty PBUF_CHECK_FREE_OOSEQ() function if feature is
not enabled.
2016-05-08 03:09:51 +02:00
Dirk Ziegelmeier
49badf39a1 Fix bug #47805: dhcp_recv can dereference NULL pointer 2016-04-29 11:16:33 +02:00
Dirk Ziegelmeier
2e05856f90 Fix bug #47641: lwIP would accept IPv6 source addresses from the network that are mapped IPv4 adresses 2016-04-27 21:35:34 +02:00
goldsimon
c981b726f8 fixed bug #47601 (wrong NS request at DAD) 2016-04-27 10:19:13 +02:00
goldsimon
afd9ee9147 fixed bug #47743 (Closing listening tcp pcb is not posible without assert) 2016-04-26 13:27:17 +02:00
Dirk Ziegelmeier
bb908366a5 More PPP cleanups 2016-04-25 20:08:29 +02:00
Dirk Ziegelmeier
73d8f14ebd Fix compile when PPP is not enabled 2016-04-25 20:08:29 +02:00
Dirk Ziegelmeier
ffa340a68c task #13907: PPP cleanups: Move PPP mempools out of lwIP core to PPP code 2016-04-25 20:08:29 +02:00
Dirk Ziegelmeier
4d1a2e6699 Fix projects without PPP do not compile any more 2016-04-22 06:24:01 +02:00
Sylvain Rochet
15fbfb7363 PPP, remove useless ppp_init function
Simon says:

ppp_init() does not seem to be used. The only thing it does is calling
magic_init(), which is not required because it its called again later
from ppp_input().

Also, the time from startup is rather constant, so calling sys_jiffies()
from ppp_init() does not create a random number.
2016-04-21 23:25:48 +02:00
Joel Cunningham
8ac1b4825a udp: use netif addr as src for multicast sockets
Sockets bound to a multicast address could not transmit multicast
packets because the pcb local address did not match the netif address
even if the outgoing netif was resolved correctly.

To correct the issue, pcbs with a multicast local address will use
the outgoing netif address as the source address in IPv4.
2016-04-18 16:36:13 -04:00
Dirk Ziegelmeier
309e072238 Create new IP_IS_V4 macros and use them at instead of !IP_IS_V6 - since we now have an IPADDR_ANY_TYPE, just checking for !V6 does not mean it is V4 2016-04-06 22:31:31 +02:00
sg
ca1b8288de prepare for overriding current timeout implementation: all stack-internal caclic timers are avaliable in the lwip_cyclic_timers array 2016-04-05 23:01:57 +02:00
sg
8c7f513f4d patch #8358: allow more combinations of listening PCB for IPv6 2016-04-05 22:04:19 +02:00
sg
0731eda0b3 make autoip_supplied_address() take a const pointer, too 2016-04-05 20:38:11 +02:00
Dirk Ziegelmeier
12a4cae404 Apply [patch #8969] from Freddie Chopin: Constify netif in dhcp_supplied_address() 2016-04-05 13:18:27 +02:00
sg
27f03798b9 Fixed possible problems with tcp_backlog_delayed/tcp_backlog_accepted 2016-03-25 16:19:39 +01:00
goldsimon
5b0a47ca87 removed unused return values of tcp_listen_input & tcp_timewait_input; fixed unused variable warning 2016-03-24 15:06:31 +01:00
sg
7721b20179 call accept-callback with ERR_MEM when allocating a pcb fails on passive open to inform the application about this error; ATTENTION: applications have to handle NULL pcb in accept callback! 2016-03-23 21:57:38 +01:00
sg
c6b742812d fixed bug #38203: DHCP options are not recorded in all DHCP ack messages (patch by Florent Matignon) 2016-03-23 21:06:52 +01:00
Axel Lin
449fc98a55 tcp_alloc(): Remove superfluous initialization for pcb->keep_cnt_sent
It's already done by memset(0). This was missed in commit 5794ac2340
"tcp_alloc(): remove explicit =0 already done by memset(0)", fix it.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-03-23 14:26:32 +01:00
Dirk Ziegelmeier
f97bf85fd6 udp.c: Allow udp_connect() on a dual-stack UDP PCB (type IPADDR_TYPE_ANY). This may be useful in some applications - no need to keep separate storage for target IP. 2016-03-22 15:12:16 +01:00
sg
dd80759bb9 tcp: changed accept handling to be done internally: the application does not have to call tcp_accepted() any more. Instead, when delaying accept (e.g. sockets do), call tcp_backlog_delayed()/tcp_backlog_accepted() (fixes bug #46696) 2016-03-22 07:30:44 +01:00
sg
a1c78ea7bf ignore dns response parsing errors, only abort resolving for correct responses or error responses from correct server (bug #47459) 2016-03-22 07:22:17 +01:00
sg
5794ac2340 tcp_alloc(): remove explicit =0 already done by memset(0) 2016-03-18 22:05:17 +01:00
sg
44e1a2d8e2 define tcp_backlog_set() as dummy-define when backlog feature is disable 2016-03-18 20:05:04 +01:00
sg
852d5b9c80 Optimize tcp_output runtime by not calling ip_route() for every segment sent 2016-03-16 22:31:33 +01:00
sg
b4d7238eb8 tcp_output_segment: don't count retransmitted segments in mib2.tcpoutsegs by detecting p->payload != tcphdr pointer; don't try to retransmit segments where p->ref != 1 (as it is invalid to mess up p->len/p->payload when we don't have exclusive access to the pbuf) 2016-03-16 22:22:20 +01:00
sg
5f8b5cbb20 reset rto timer on fast retransmission (see task #13757, patch by Joel Cunningham) 2016-03-16 21:49:37 +01:00
sg
8e8571da6a fixed bug #46384 Segment size calculation bug with MSS != TCP_MSS 2016-03-16 16:56:15 +01:00
Dirk Ziegelmeier
f3b7bca3cf Fix bug #47370: Port DNS client to IPv6 2016-03-09 19:25:06 +01:00
Dirk Ziegelmeier
a212210c35 Add missing #include in memp.c 2016-03-08 19:53:01 +01:00
sg
5cf802eda0 dns_gethostbyname: return error code if no valid server is set instead of calling the 'found' callback in this case (fixes bug #46887) 2016-03-07 19:47:39 +01:00
sg
f5fef6eebc fixed bug #45353: IPv6 router / neighbor relationship is not always consistent - patch by Stian Sebastian Skjelstad 2016-03-06 14:48:41 +01:00
sg
b00a17059a fixed icmp_send_response with LWIP_HOOK_IP4_ROUTE_SRC enabled 2016-03-05 15:57:40 +01:00
sg
d2bb569ee4 bug #46094: moved IPv4 routing hook functions down so that they implement actual routing (source-based IPv4 routing is not affected by this change) 2016-03-05 15:52:39 +01:00
sg
e0ab8c581d fixed bug #46093: Move IP6_ROUTE() hook to after LL processing 2016-03-05 14:11:24 +01:00
sg
6b405eccd0 Tried to fix bug #47270 by accepting all ipv4 multicast packets (at IP level) when LWIP_IGMP is disabled 2016-03-04 21:57:47 +01:00
Dirk Ziegelmeier
9a4c66006e Fix compile error in raw.c (possible unused arg) 2016-03-03 22:55:42 +01:00
Dirk Ziegelmeier
1dea649cff Fix comment in tcp.c 2016-03-03 22:48:10 +01:00
Dirk Ziegelmeier
7396d8818b Implement dual-stack in RAW API in the same way as in UDP and TCP 2016-03-03 22:47:27 +01:00
Dirk Ziegelmeier
2d80af1dcb Minor code cleanup in udp.c 2016-03-03 22:44:01 +01:00
Dirk Ziegelmeier
5358380c5f Apply patch from Derek Pravala: Fix segfault in ip6_route when there is no default netif 2016-03-03 16:12:20 +01:00
Dirk Ziegelmeier
e89b48d23f raw.c: Avoid NULL pointer dereference 2016-03-02 23:44:51 +01:00
Dirk Ziegelmeier
f9ce31f98b TCP: Implement dual stack support using new IP_ANY_TYPE introduced at UDP 2016-03-02 23:14:33 +01:00
Dirk Ziegelmeier
f3132c5290 udp: Fix possible NULL pointer dereference, update comments 2016-03-02 23:10:43 +01:00
Dirk Ziegelmeier
9885d5d9f5 Apply patch from Simon to fix buffer overflow handling tcp_in.c which was discovered by Coverity 2016-02-29 23:34:52 +01:00
Dirk Ziegelmeier
8e5663a32f Minor: Avoid ip_input() call indirection for when only IPv4 or IPv6 are enabled 2016-02-29 22:17:42 +01:00
Dirk Ziegelmeier
6aed6e659f Rework DHCP PCB handling: Old code registered one UDP PCB per netif where DHCP was active and there was a special case in udp_input() for this. New implementation uses one PCB for all netifs and removes special case in udp_input().
The old approach called udp_bind() on each of the PCBs, which puts them into udp_pcbs list. The PCBs were iterated on all non-DHCP udp_inputs() with no effect.
My cleanup removes the special handling in udp.c, and uses only one DHCP UDP PCB to catch all DHCP messages from all netifs. The dhcp_recv function then checks whether ip_current_input_netif() has DHCP enabled - if not, the message is ignored. The PCB is only created/registered when one or more PCBs have DHCP enabled.
2016-02-29 19:31:19 +01:00
Dirk Ziegelmeier
70f3e5ed05 Cleanup: Create new file ip.c and move dual-stack code from ipv4 and ipv6 folder in there 2016-02-26 23:04:51 +01:00
Dirk Ziegelmeier
d5778bad2f No need for dual-stack code in ip4.c and icmp.c -> use ip4 only versions 2016-02-26 22:50:20 +01:00
Dirk Ziegelmeier
a5214abd04 udp: udp_send and udp_send_chksum: Check for PCB NULL pointer and PCB must not be the new IP_ANY_TYPE, but a real IPv4 and IPv6 address 2016-02-26 09:20:50 +01:00
goldsimon
bf8bcfafe2 revert accidentally committed comment from a649a3eb50 2016-02-26 08:59:50 +01:00
Joel Cunningham
8cb64698aa Allow backlog to be updated
This commit adds support to the sockets and netconn layer to update the
backlog by calling listen when the netconn is already in the listen state.
When backlog is not enabled, the call returns successfully

This commit also introduces a macro for setting the backlog value that
prevents a 0 sized (invalid) backlog
2016-02-25 15:19:52 -06:00
sg
a649a3eb50 dual-stack fix: moved common definitions/code for ethernet used by etharp and ethip6 to new files ethernet.h/.c 2016-02-25 22:10:28 +01:00
Dirk Ziegelmeier
fd891081c4 minor: Cleanups in raw/tcp/udp code by using macros and reducing #ifdefs 2016-02-24 23:04:25 +01:00
Dirk Ziegelmeier
953b7bdd59 Implement UDP dual-stack PCB support
Create special IP address type "IPADDR_TYPE_ANY" for it.
SNMP uses new feature in non-netconn mode.

TODO: Same for TCP & RAW, adapt NETCONN to use this feature
2016-02-24 22:37:01 +01:00
sg
1dde3d6e56 Fixed bug #46524: "Device as dhcp server does not work after upgrade to lwip-1.4.1" 2016-02-24 22:13:58 +01:00
sg
ec49b68b38 minor: udp_input/local_match: coding style, added comments 2016-02-24 22:04:59 +01:00
Dirk Ziegelmeier
ac4b089b18 udp.c: Further udp_input simplifications
- Move local PCB matching code in a function that can be reused in SO_REUSE && SO_REUSE_RXTOALL case.
- Some checks have been written in the dual-stack version and then repeated with the ipv6-only version. Example:
IPv6 only: ip6_addr_ismulticast(ip6_current_dest_addr())
IPv4 AND IPv6: ip_addr_ismulticast(ip_current_dest_addr())
2016-02-24 19:57:20 +01:00
Dirk Ziegelmeier
005c196ed8 udp.c: Simplify and cleanup input PCB matching 2016-02-24 19:13:30 +01:00
Dirk Ziegelmeier
17fad79f71 Two compile fixes after eliminating isipv6 member in PCBs 2016-02-22 17:07:17 +01:00
Dirk Ziegelmeier
c805843e64 Change signature of ip_output, ip_output_if, ip_output_if_src, ip_output_hinted, ip_route, ip_netif_get_local_ip, ip_route_get_local_ip and tcp_eff_send_mss not to take an isipv6 parameter. Use the IP version of the destination address instead. 2016-02-22 13:38:40 +01:00
Dirk Ziegelmeier
880f1008d6 Together with Simon: Eliminate last instances of isipv6 member in pcbs;
Don't allow NULL pointers (IPv4 ANY) in connect() and sendto() functions as destinations since this does not make sense.
2016-02-22 13:03:51 +01:00
Dirk Ziegelmeier
be9cd800b0 Review with Simon: Init TCP/UDP/RAW PCBs with correct IP types in _new functions to make my changes work correct 2016-02-22 11:16:13 +01:00
Dirk Ziegelmeier
0106cf7ae0 Review with Simon: Remove dead code (since 2003) 2016-02-22 10:18:19 +01:00
Dirk Ziegelmeier
50303eea23 Reduce PCB_ISIPV6 macro usage some more 2016-02-21 19:59:08 +01:00
Dirk Ziegelmeier
339e82d7aa Eliminate IP_PCB_IPVER_EQ macro 2016-02-21 19:45:51 +01:00
Dirk Ziegelmeier
5a25652c21 Eliminate IP_PCB_IPVER_INPUT_MATCH macro 2016-02-21 19:21:36 +01:00
Dirk Ziegelmeier
8f675c37fc Reduce usage of PCB IP version flag in UDP code. Maybe we can figure out a good way for dual-stack UDP when we manage to remove the flag (nearly) entirely from the code. 2016-02-20 20:54:58 +01:00
Dirk Ziegelmeier
5809b01388 Reduce usage of PCB IP version flag in raw and tcp code. Maybe we can figure out a good way for dual-stack UDP when we manage to remove the flag (nearly) entirely from the code. 2016-02-20 20:40:04 +01:00
Dirk Ziegelmeier
10edba936b Fix tcp pcb access after it was freed in tcp.c - found by Coverity 2016-02-19 23:28:09 +01:00
goldsimon
e4cac595c2 Check TCP_SNDLOWAT for too high value (near u16_t overflow) - fixes bug #46948 2016-02-18 09:36:55 +01:00
Dirk Ziegelmeier
24bc77a935 Found some struct instances that can be const 2016-02-16 22:31:59 +01:00
Dirk Ziegelmeier
273d609bac mem.c: Fix unintended sign extension (found by Coverity)
sign_extension: Suspicious implicit sign extension: count with type unsigned short (16 bits, unsigned) is promoted in count * size to type int (32 bits, signed), then sign-extended to type unsigned long (64 bits, unsigned). If count * size is greater than 0x7FFFFFFF, the upper bits of the result will all be 1.
2016-02-10 21:21:08 +01:00
Dirk Ziegelmeier
288b4564e4 DNS: Fix potential array out of bounds access. Variable nanswers may contain bogus values. (found by Coverity) 2016-02-10 20:41:31 +01:00
Dirk Ziegelmeier
1c1587eef6 ICMP: Fix responses were always sent to default netif because of uninitialized source IP (found by Coverity) 2016-02-10 20:35:58 +01:00
Dirk Ziegelmeier
11b810721a ICMP: Fix unused value in icmp_input (found by Coverity) 2016-02-10 20:34:44 +01:00
Dirk Ziegelmeier
222155d7e2 pbuf: Make pbuf_skip function public, so it can be used in SNMP code 2016-02-03 08:37:04 +01:00
Axel Lin
f411a34af5 stats: Add proper #if guard to prevent unused-variable warning for memp_names
The usages of memp_names are under either LWIP_DEBUG in stats_init,
or under LWIP_STATS_DISPLAY in stats_display_memp.

Fix below build warning:
lwip/src/core/stats.c:53:21: error: 'memp_names' defined but not used [-Werror=unused-variable]
static const char * memp_names[] = {
^
cc1: all warnings being treated as errors

Reported-by: David Fernandez
Fixes: 2f2a75a6d9fd ("stats: Move memp_names table out of stats_init/stats_display_memp functions")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-01-31 13:48:38 +01:00
Axel Lin
515a4cad73 Clear addr_hint pointer after calling ip_output_if() in tcp_zero_window_probe()
This was missed in commit aa0e41c389
("task #12178: hardware checksum capabilities can be configured per netif"),
fix it.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-01-29 09:21:58 +01:00
Stephan Linz
2c31beb6e7 IPv4: fix some meaningless debug messages
Signed-off-by: Stephan Linz <linz@li-pro.net>
2016-01-18 21:34:13 +01:00
Axel Lin
fe2cfe2dba raw: Fix build error
IP6_HLEN is only defined when LWIP_IPV6, IP_HLEN is only defined when LWIP_IPV4.
This fixes build error in !LWIP_IPV4 || !LWIP_IPV6 cases.

Fixes: f2c7e9c939 ("raw: Remove unnecessary #if guard around PCB_ISIPV6() calls")
Reported-by: Erik Ekman
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-01-18 16:02:01 +01:00
Stephan Linz
80375e68dd ip_frag: fix compiler warnings, unused variable
In case of IP_REASS_FREE_OLDEST==0, the argument clen of
ip_reass_enqueue_new_datagram() will not used and leads
the compiler to a warning.

Signed-off-by: Stephan Linz <linz@li-pro.net>
2016-01-18 11:55:54 +01:00
Axel Lin
f2c7e9c939 raw: Remove unnecessary #if guard around PCB_ISIPV6() calls
PCB_ISIPV6() macro is well defined for all cases (LWIP_IPV4 && LWIP_IPV6,
LWIP_IPV4 only and LWIP_IPV6 only), thus remove the unnecessary #if guard
around PCB_ISIPV6() calls.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-01-18 11:55:06 +01:00