lwIP  2.0.2
Lightweight IP stack
nd6.h File Reference
#include "lwip/opt.h"
#include "lwip/ip6_addr.h"
#include "lwip/err.h"

Macros

#define ND6_TMR_INTERVAL   1000
 

Functions

void nd6_tmr (void)
 
void nd6_input (struct pbuf *p, struct netif *inp)
 
void nd6_clear_destination_cache (void)
 
struct netifnd6_find_route (const ip6_addr_t *ip6addr)
 
err_t nd6_get_next_hop_addr_or_queue (struct netif *netif, struct pbuf *q, const ip6_addr_t *ip6addr, const u8_t **hwaddrp)
 
u16_t nd6_get_destination_mtu (const ip6_addr_t *ip6addr, struct netif *netif)
 
void nd6_reachability_hint (const ip6_addr_t *ip6addr)
 
void nd6_cleanup_netif (struct netif *netif)
 
void nd6_adjust_mld_membership (struct netif *netif, s8_t addr_idx, u8_t new_state)
 

Detailed Description

Neighbor discovery and stateless address autoconfiguration for IPv6. Aims to be compliant with RFC 4861 (Neighbor discovery) and RFC 4862 (Address autoconfiguration).

Macro Definition Documentation

◆ ND6_TMR_INTERVAL

#define ND6_TMR_INTERVAL   1000

1 second period

Function Documentation

◆ nd6_adjust_mld_membership()

void nd6_adjust_mld_membership ( struct netif netif,
s8_t  addr_idx,
u8_t  new_state 
)

The state of a local IPv6 address entry is about to change. If needed, join or leave the solicited-node multicast group for the address.

Parameters
netifThe netif that owns the address.
addr_idxThe index of the address.
new_stateThe new (IP6_ADDR_) state for the address.

◆ nd6_cleanup_netif()

void nd6_cleanup_netif ( struct netif netif)

Remove all prefix, neighbor_cache and router entries of the specified netif.

Parameters
netifpoints to a network interface

◆ nd6_clear_destination_cache()

void nd6_clear_destination_cache ( void  )

Clear the destination cache.

This operation may be necessary for consistency in the light of changing local addresses and/or use of the gateway hook.

◆ nd6_find_route()

struct netif* nd6_find_route ( const ip6_addr_t ip6addr)

Find a router-announced route to the given destination.

The caller is responsible for checking whether the returned netif, if any, is in a suitable state (up, link up) to be used for packet transmission.

Parameters
ip6addrthe destination IPv6 address
Returns
the netif to use for the destination, or NULL if none found

◆ nd6_get_destination_mtu()

u16_t nd6_get_destination_mtu ( const ip6_addr_t ip6addr,
struct netif netif 
)

Get the Path MTU for a destination.

Parameters
ip6addrthe destination address
netifthe netif on which the packet will be sent
Returns
the Path MTU, if known, or the netif default MTU

◆ nd6_get_next_hop_addr_or_queue()

err_t nd6_get_next_hop_addr_or_queue ( struct netif netif,
struct pbuf q,
const ip6_addr_t ip6addr,
const u8_t **  hwaddrp 
)

A packet is to be transmitted to a specific IPv6 destination on a specific interface. Check if we can find the hardware address of the next hop to use for the packet. If so, give the hardware address to the caller, which should use it to send the packet right away. Otherwise, enqueue the packet for later transmission while looking up the hardware address, if possible.

As such, this function returns one of three different possible results:

  • ERR_OK with a non-NULL 'hwaddrp': the caller should send the packet now.
  • ERR_OK with a NULL 'hwaddrp': the packet has been enqueued for later.
  • not ERR_OK: something went wrong; forward the error upward in the stack.
Parameters
netifThe lwIP network interface on which the IP packet will be sent.
qThe pbuf(s) containing the IP packet to be sent.
ip6addrThe destination IPv6 address of the packet.
hwaddrpOn success, filled with a pointer to a HW address or NULL (meaning the packet has been queued).
Returns
  • ERR_OK on success, ERR_RTE if no route was found for the packet, or ERR_MEM if low memory conditions prohibit sending the packet at all.

◆ nd6_input()

void nd6_input ( struct pbuf p,
struct netif inp 
)

Process an incoming neighbor discovery message

Parameters
pthe nd packet, p->payload pointing to the icmpv6 header
inpthe netif on which this packet was received

◆ nd6_reachability_hint()

void nd6_reachability_hint ( const ip6_addr_t ip6addr)

Provide the Neighbor discovery process with a hint that a destination is reachable. Called by tcp_receive when ACKs are received or sent (as per RFC). This is useful to avoid sending NS messages every 30 seconds.

Parameters
ip6addrthe destination address which is know to be reachable by an upper layer protocol (TCP)

◆ nd6_tmr()

void nd6_tmr ( void  )

Periodic timer for Neighbor discovery functions:

  • Update neighbor reachability states
  • Update destination cache entries age
  • Update invalidation timers of default routers and on-link prefixes
  • Perform duplicate address detection (DAD) for our addresses
  • Send router solicitations