Commit Graph

325 Commits

Author SHA1 Message Date
David van Moolenbroek
a1130f8c7b nd6: some work on basic RFC 4861 compliance
The current ND implementation does not yet implement the most basic
required ('MUST') checks for message validation and generation.

- implement some of the required checks for message validation;
- document the remaining missing message validation checks;
- hardcode the hop limit of Neighbor Discovery messages rather than
  having it depend on lwIP configuration which, if changed, would
  cause all of ND to cease working.
2017-01-11 07:54:15 +01:00
David van Moolenbroek
0b9d7a386c ip6: improve source address selection
The introduction of address lifetimes also means that lwIP correctly
supports transitions between PREFERRED and DEPRECATED address states,
and that means that the source address selection must be changed to
take this into account. Adding this feature to the previous algorithm
would have resulted in a mess, so this patch rewrites the algorithm to
stay close to the rules described in RFC 6724 (formerly 3484) Sec. 5.
This yields the following changes:

- Rule 2 ("prefer appropriate scope") is now fully implemented, most
  importantly allowing larger-scope addresses to be picked if no
  smaller-scope addresses are available (e.g., a global address may
  now be used to connect to a unique-local address);
- Rule 3 ("avoid deprecated addresses") is now also fully implemented;
- unknown-scope addresses are also supported, with lowest priority;
- the link between the prescribed rules and the actual algorithm is
  made much more explicit, hopefully allowing future improvements to
  be made more easily.

For reasons explained in comments, one previous deviation from the RFC
on Rule 2 is retained for now.
2017-01-11 07:54:14 +01:00
David van Moolenbroek
08de0e9617 ip6/nd6: route using on-link prefixes, not addresses
As laid out in RFC 5942, the assumption that a dynamically assigned
(SLAAC/DHCPv6) address implies an on-link subnet, is wrong. lwIP does
currently make that assumption, routing packets according to local
address subnets rather than the on-link prefix list. The result is
that packets may not make it to their destination due to incorrect
routing decisions.

This patch changes the routing algorithms to be (more) compliant with
RFC 5942, by implementing the following new routing policies:

- all routing decisions check the on-link prefix list first, and
  select a default router for off-link routing only if there is no
  matching entry in the on-link prefix list;
- dynamically assigned addresses (from address autoconfiguration) are
  considered /128 assignments, and thus, no routing decisions are taken
  based on matches against their (/64) subnet anymore;
- more generally, all addresses that have a lifetime are considered
  dynamically assigned and thus of size /128, which is the required
  behavior for externally implemented SLAAC clients and DHCPv6;
- statically assigned (i.e., manually configured) addresses are still
  considered /64 assignments, and thus, their associated subnet is
  considered for routing decisions, in order to behave as generally
  expected by end users and to retain backward compatibility;
- the link-local address in IPv6 address slot #0 is considered static
  and thus has no lifetime and an implied /64 subnet, although link-
  local routing is currently always handled separately anyway.

IPv6 source address selection is kept as is, as the subnet tests in
the algorithm serve as poor man's longest-common-prefix equivalent
there (RFC 6724 Sec. 5, Rule 8).
2017-01-11 07:54:12 +01:00
David van Moolenbroek
22c2fd1b58 nd6: improve router selection
Previously, IPv6 routing could select a next-hop router on a netif
that was down or disconnected, potentially resulting in packets being
dropped unnecessarily. This patch changes router selection to take
into account the state of the router's associated netif, eliminating
such unnecessary packet loss.

Also, this patch fixes the test for router validity, which was
erroneously based on the router's invalidation timer rather than its
neighbor cache entry state. Given that an expired router has no
associated neighbor cache entry, no invalid routers would previously
ever be returned.

Finally, this patch also adds round-robin selection of routers that
are not known to be reachable or probably reachable, as per RFC 4861
Sec. 6.3.6 point (2). Support for this feature was partially present
but not actually functional.
2017-01-11 07:54:10 +01:00
David van Moolenbroek
d99334573b nd6: fix Duplicate Address Detection
Previously, Duplicate Address Detection (DAD) would work only for the
link-local address. For DAD-spawned Neighbor Solicitation requests for
any other address, the request would use the link-local address as the
source, meaning the other side would send a targeted reply (RFC 4861
Sec. 7.2.4). However, the nd6 implementation currently does not
consider targeted replies for DAD--even though technically an RFC 4862
Sec. 5.4.4 violation--supposedly because no real-world scenario could
trigger that case. The combination of these factors resulted in DAD
being entirely ineffective for non-link-local addresses.

This patch forces all DAD-spawned Neighbor Solicitation packets to use
the unspecified ('any') address as source, as per RFC 4862 Sec. 5.4.2.
As a result, other nodes would reply with multicast replies, for which
there is appropriate DAD checking code.

The patch also makes a slight rearrangement of statements such that
MLD join messages are sent before the NS packets, rather than after.
2017-01-11 07:54:07 +01:00
David van Moolenbroek
2ff04a931a nd6: check link status before sending packets
In the cases that nd6 checks whether the interface is up before
sending a packet, also check whether the link is up.  Without this
additional check, temporary link downtime could easily result in
unnecessary false negatives for Duplicate Address Detection.

In addition, use the netif abstraction macros to perform the checks.
2017-01-11 07:54:05 +01:00
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
sg
a2a16d4193 nd6 rdnss: fixed dual-stack compilation 2016-12-31 15:51:59 +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
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
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
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
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
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
26e02e84a6 Fix bug #48963: ip6_frag does not support LWIP_NETIF_TX_SINGLE_PBUF
Implemented.
2016-12-09 21:26:21 +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
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
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
Dirk Ziegelmeier
f5f8ab5acf Fix bug #49328: Crash error in ip6_frag due to Assertion Fail 2016-10-13 08:50:47 +02:00
Dirk Ziegelmeier
e3a9f01fe4 Implement task #14180: IPv6 code should not reuse ip6_current_dest_addr() as temporary storage 2016-10-12 21:41:02 +02:00
Dirk Ziegelmeier
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
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
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
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
Daniel Elstner
22907c7b27 bug #74921: check prefix_length, not length 2016-09-19 18:38:05 +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
d66442ba91 Fix compile when TCP, UDP and RAW are disabled 2016-09-07 08:11:30 +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
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
298ec340e5 set netif IPv6 address & state via function to implement change triggers (task #13517) 2016-08-24 09:19:53 +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
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
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
goldsimon
14fb48cd7a minor: whitespace cleanups 2016-08-19 09:41:34 +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
goldsimon
bf3e8e6a48 minor coding style fixes in IPv6 code 2016-08-11 09:23:43 +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
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
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
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
goldsimon
3d379c97ec IPv6 is NOT experimental any more :-) 2016-08-03 12:28:56 +02:00
Dirk Ziegelmeier
67d674a59c Document IGMP and MLD6 API in doxygen module style 2016-07-26 18:20:30 +02:00
goldsimon
14ca418ac0 minor: coding style fixes 2016-07-05 07:36:51 +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
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
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
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
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
e0ab8c581d fixed bug #46093: Move IP6_ROUTE() hook to after LL processing 2016-03-05 14:11:24 +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
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
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
Axel Lin
a709041b8b Remove unnecessary p->len checking for pbuf_alloc calls with PBUF_RAM type
pbuf_alloc() for PBUF_RAM type always return big enough memory on success.
So checking p->len is not necessary. Testing if p is NULL or not is enough.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2015-12-05 21:21:59 +01:00
Axel Lin
fb6d0f9006 ipaddr_aton: Avoid duplicate code to handle IPv4 address string conversion
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2015-12-02 22:51:00 +01:00
sg
c12fa7b4c4 started to move "private" header files containing implementation details to "lwip/priv/" include directory to seperate the API from the implementation. 2015-10-09 21:58:58 +02:00
goldsimon
b401f42520 minor: fixed coding style (lwip style) 2015-10-07 10:03:12 +02:00
sg
2b971400fa minor: coding style 2015-10-06 21:57:40 +02:00
sg
22df34fc70 minor/coding style: removed spaces before line ending (from file header) 2015-10-06 21:13:15 +02:00
sg
490581a0eb minor/coding style: removed spaces before line ending 2015-10-06 21:08:28 +02:00
Erik Ekman
82fcc307ef mld6: Simplify join/leavegroup()
Use netif_get_ip6_addr_match() helper to shorten the code.
2015-09-30 16:35:15 +02:00
goldsimon
9d28549f32 minor: fixed coding style in mld6.c 2015-09-30 14:48:25 +02:00
Erik Ekman
6cdea62638 Add functions to join/leave v6 multicast group by netif
Existing functions are based on IP address, but the address is used
only to look up which netif to act on. The netif-based core code is
extracted to new exported functions.

If you have a netif handle, this makes it easier to join/leave
groups, without the need to convert to IP address first only for the
mld6 code to convert back to netif.
2015-09-30 14:44:45 +02:00
goldsimon
f950bf4362 ipaddr_aton(): favour ':' over '.' to decide for IPv6 first (since IPv6 mapped IPv4 addresses might contain both ':' and '.') 2015-09-30 14:06:44 +02:00
goldsimon
0621e8d1b1 ip6addr_aton(): fail on three successive colons in an IPv6 address string 2015-09-30 14:05:13 +02:00
goldsimon
5a185a0fbd minor: fixed coding style in ip6addr_aton() 2015-09-30 13:55:09 +02:00
goldsimon
c71723101a Removed ip_2_ip4/6_c const macros again now that ip_2_ip4/6 macros keep the original const'ness 2015-09-24 14:38:52 +02:00
goldsimon
262a641396 eliminate temporary storage when using netif addresses for ip_addr_t* now that they have the correct type (ATTENTION: ip6_select_source_address() and ip4_netif_get_local_ip() now return ip_addr_t*!) 2015-09-24 14:34:24 +02:00
goldsimon
ed4130bd2f Fixed const errors after changing netif_ip4_addr/netif_ip6_addr to return cont pointers 2015-09-24 08:06:50 +02:00
sg
db76671d4d task #13729: Convert netif addresses (IPv4 & IPv6) to ip_addr_t (so they can be used without conversion/temporary storage) 2015-09-23 22:09:37 +02:00
sg
39e32ea7c1 fixed const warning for !IPV6_FRAG_COPYHEADER 2015-09-17 21:59:54 +02:00
Dirk Ziegelmeier
f62022cdf3 Compiler warning fixes (mostly constness in dual-stack configurations) 2015-09-17 13:59:52 +02:00
sg
68a1ec2eb1 Fixed passing ip_input() to netif_add() for single-IP-version NO_SYS configurations 2015-09-16 22:09:54 +02:00
Stian Sebastian Skjelstad
aea87a9a2f Forget addresses set up by SLAAC when prefix expires. 2015-09-02 13:12:52 -06:00
sg
aa0e41c389 task #12178: hardware checksum capabilities can be configured per netif (use NETIF_SET_CHECKSUM_CTRL() in your netif's init function) 2015-09-01 22:04:15 +02:00
goldsimon
dd8feb49aa PBUF_REF with "custom" pbufs is now supported for RX pbufs (see pcapif in contrib for an example, LWIP_SUPPORT_CUSTOM_PBUF is required) 2015-08-31 08:29:23 +02:00
Sylvain Rochet
ddba4b90c3 fixed typo: IP6_FRAG_COPYHEADER -> IPV6_FRAG_COPYHEADER 2015-08-28 14:28:04 +02:00
sg
bc8120c864 Add another sanity check for bug #41009 2015-08-27 21:43:42 +02:00
sg
f649172580 fixed bug bug #41009: IPv6 reassembly broken on 64-bit platforms: define IPV6_FRAG_COPYHEADER==1 on these platforms to copy the IPv6 header instead of referencing it, which gives more room for struct ip6_reass_helper 2015-08-26 22:16:23 +02:00
sg
aad76acb68 IPV6_REASS: fix ip6_reass_remove_oldest_datagram() when the first fragment to enqueue has more pbufs than IP_REASS_MAX_PBUFS 2015-08-26 21:20:13 +02:00
sg
94550682d7 more cleanup prework to fix bug #45029 2015-08-24 22:46:34 +02:00
goldsimon
ee2d01ed88 fix compiler warnings when passing u16_t to pbuf_header() 2015-08-24 08:49:51 +02:00
sg
177c06b1f1 - prework for fixing bug #45029: access IPv4 configuration of struct netif via new API (netif_ip4_addr()/netif_ip4_netmask()/netif_ip4_gw()) instead of accessing the struct member directly. This way, we can change the struct member types from ip4_addr_t to ip_addr_t;
- fixed some bugs in calls to ip4_addr*() where the cast to u8_t* did not reveal the wrong address type
2015-08-20 22:39:48 +02:00
goldsimon
8622af77c1 nd6: adapt to constness of IP6_ADDR_ANY6 for IPv6-only configuration 2015-08-20 16:35:49 +02:00
Ivan Delamer
33a51a1bdc Improved IPv6 address formatting in ip6addr_ntoa_r(). 2015-05-05 14:01:38 -06:00
Ivan Delamer
73660f779b changes to ip6addr_aton() to avoid crash with some ill-formatted
strings.
2015-05-05 13:26:17 -06:00
Ivan Delamer
2c79332de7 Only send RS messages if we have a LL address in some state other than
invalid.
2015-05-05 13:05:41 -06:00
Ivan Delamer
2aec025e16 Bug fix: properly use unspecified source address for router solicitation
if needed.
2015-05-05 13:00:17 -06:00
goldsimon
f01dc8cc34 more "const" fixes 2015-04-23 09:59:15 +02:00
goldsimon
e60bc69515 added more missing casts 2015-04-23 07:24:45 +02:00
sg
69c337b31d Fixed ntoa/aton/ntop/pton definitions after making IPv4 optional 2015-04-13 20:52:42 +02:00
sg
c1c65777b6 worked on task #13480: added LWIP_IPV4 define - IPv4 can be disabled, leaving an IPv6-only stack (SNMP is still missing) 2015-04-12 10:43:46 +02:00
Sylvain Rochet
dcdb360a19 ip6_addr.c: fixed IPv6 ip6_addr_any value
0000:0000:0000:0000:0000:0000:0000:0000 instead of
0000:000a:0000:000b:0000:000c:0000:000d
2015-04-11 20:24:56 +02:00
goldsimon
d31dbc6798 Fixed constant initializer problem in ip_addr_t by having ip6 first 2015-04-10 07:41:40 +02:00
sg
ce7e31cd04 task #12722 (improve IPv4/v6 address handling): renamed ip_addr_t to ip4_addr_t, renamed ipX_addr_t to ip_addr_t and added IP version;
ip_addr_t is used for all generic IP addresses for the API, ip(4/6)_addr_t are only used internally or when initializing netifs or when calling version-related functions
2015-04-09 22:21:15 +02:00
sg
93fa268db1 used ip6_addr_t instead of struct ip6_addr, fix const'ness in ip6_route parameters 2015-03-24 21:30:22 +01:00
sg
521c92764d loopif is not required for loopback traffic any more but passed through any netif (ENABLE_LOOPBACK has to be enabled) (task #13515) 2015-03-24 21:22:19 +01:00
sg
71d121fab2 Added input & route hooks for IPv6 to stay in line with IPv4 2015-03-24 20:33:47 +01:00
Sylvain Rochet
f7a5b71dba nd6: fixed compiler warnings
nd6.c: In function ‘nd6_send_rs’:
nd6.c:997:52: warning: suggest parentheses around ‘+’ inside ‘<<’ [-Wparentheses]
   p = pbuf_alloc(PBUF_IP, sizeof(struct rs_header) + lladdr_opt_len << 3, PBUF_RAM);
                                                    ^
nd6.c:998:58: warning: suggest parentheses around ‘+’ inside ‘<<’ [-Wparentheses]
   if ((p == NULL) || (p->len < (sizeof(struct rs_header) + lladdr_opt_len << 3))) {
2015-03-20 20:11:59 +01:00
Ivan Delamer
a4d14fc987 fix bug #44586: nd6_send_rs() pbuf size error 2015-03-20 09:04:22 -06:00
Ivan Delamer
bc08c1d2b7 fixed bug #43095. Check actual link-layer address option length, versus
maximum length defined in struct. Bug would express itself if we have a
netif with 8-byte addresses and other netifs with 6-byte-or-less
addresses.
2015-03-18 13:21:39 -06:00
Ivan Delamer
8451feaa7a fixed bug #42885 nd6_reachability_hint() accepts an address of an
unknown neighbour
2015-03-18 12:22:49 -06:00
Ivan Delamer
12e3b52f4d fixed bug #39226: Validity of netif IPv6 address is not always checked 2015-03-18 11:56:48 -06:00
Ivan Delamer
291f1382c5 fix ip6 part of bug #43904: ip_route() and ip6_route() must detect
linkup status.
2015-03-18 10:56:02 -06:00
sg
f385193a89 Patch #8207 (Don't Use ND6 Prefix Flags Field When LWIP_IPV6_AUTOCONFIG Is Deasserted) 2015-03-06 21:03:21 +01:00
Philip Gladstone
ff078920bc Patch #8360 (Speed up the acquisition of SLAAC addresses) - adapted to bug #43784 2015-03-06 20:58:30 +01:00
sg
72dcdb7655 fixed bug #43784 (a host should send at least one Router Solicitation) 2015-03-04 21:21:49 +01:00
sg
61e0efa0c7 fixed bug #41094 (Byte-order bug in IPv6 fragmentation header test) 2015-03-04 21:02:52 +01:00
sg
90a0590de1 patch by Zach Smith: fixed bug #38153 (nd6_input() byte order issues) 2015-03-04 20:49:02 +01:00
Sylvain Rochet
b4990b5bb4 Fixed warnings on whole project introduced by const pointers on ip_addr_t 2015-02-22 22:50:06 +01:00
sg
ec5cf8593e Continued chrysn's work: changed nearly all functions taking 'ip(X)_addr_t' pointer to take const pointers (changed user callbacks: raw_recv_fn, udp_recv_fn; changed port callbacks: netif_output_fn, netif_igmp_mac_filter_fn) 2015-02-22 21:46:35 +01:00
sg
80b62df0a9 fixed bug #36403 "ip4_input() and ip6_input() always pass inp to higher layers": now the accepting netif is passed up, but the input netif is available through ip_current_input_netif() if required. 2015-02-12 22:04:10 +01:00
goldsimon
1cbd2121e2 Allow to overrid the check for p->ref==1 in TX packets (there *are* netif drivers that can handle this) 2015-01-16 17:58:07 +01:00
goldsimon
4085a3fad4 task #11472 Support PBUF_REF for RX (IPv6 and IPv4/v6 reassembly might not work yet) 2014-12-08 14:45:36 +01:00
Simon Goldschmidt
33237419c1 Parts of patch #8397 Typos corrected in comments and text outputs 2014-09-18 21:15:13 +02:00
Simon Goldschmidt
142cc8fe2a minor: fixed a comment typo only 2014-09-02 21:26:35 +02:00
goldsimon
b0502d1f3b added optional macros PACK_STRUCT_FLD_8() and PACK_STRUCT_FLD_S() to prevent gcc 4 from warning about struct members that do not need packing 2014-09-02 13:04:36 +02:00
Simon Goldschmidt
c3ac875055 Fixed typo-bug introduced some months ago while fixing bug #41041... 2014-05-19 22:03:19 +02:00
goldsimon
e4ddd6cb6d Multiple fixes found by coverity scan 2014-04-30 12:22:31 +02:00
Simon Goldschmidt
4c3b6814dc Fixed compiling broken ip6.c after last commit 2014-04-06 22:33:27 +02:00