lwIP 2.0.0  lwIP 2.0.0
LightweightIPstack
nd6.c File Reference
#include "lwip/opt.h"
#include "lwip/nd6.h"
#include "lwip/prot/nd6.h"
#include "lwip/prot/icmp6.h"
#include "lwip/pbuf.h"
#include "lwip/mem.h"
#include "lwip/memp.h"
#include "lwip/ip6.h"
#include "lwip/ip6_addr.h"
#include "lwip/inet_chksum.h"
#include "lwip/netif.h"
#include "lwip/icmp6.h"
#include "lwip/mld6.h"
#include "lwip/ip.h"
#include "lwip/stats.h"
#include <string.h>

Functions

void nd6_input (struct pbuf *p, struct netif *inp)
 
void nd6_tmr (void)
 
s8_t nd6_select_router (const ip6_addr_t *ip6addr, struct netif *netif)
 
s8_t nd6_get_next_hop_entry (const ip6_addr_t *ip6addr, struct netif *netif)
 
err_t nd6_queue_packet (s8_t neighbor_index, struct pbuf *q)
 
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)
 

Detailed Description

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

Function Documentation

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
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
s8_t nd6_get_next_hop_entry ( const ip6_addr_t ip6addr,
struct netif netif 
)

Determine the next hop for a destination. Will determine if the destination is on-link, else a suitable on-link router is selected.

The last entry index is cached for fast entry search.

Parameters
ip6addrthe destination address
netifthe netif on which the packet will be sent
Returns
the neighbor cache entry for the next hop, ERR_RTE if no suitable next hop was found, ERR_MEM if no cache entry could be created
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
err_t nd6_queue_packet ( s8_t  neighbor_index,
struct pbuf q 
)

Queue a packet for a neighbor.

Parameters
neighbor_indexthe index in the neighbor cache table
qpacket to be queued
Returns
ERR_OK if succeeded, ERR_MEM if out of memory
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)
s8_t nd6_select_router ( const ip6_addr_t ip6addr,
struct netif netif 
)

Select a default router for a destination.

Parameters
ip6addrthe destination address
netifthe netif for the outgoing packet, if known
Returns
the default router entry index, or -1 if no suitable router is found
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