lwIP 2.0.0  lwIP 2.0.0
LightweightIPstack
nd6.h File Reference
#include "lwip/opt.h"
#include "lwip/pbuf.h"
#include "lwip/ip6.h"
#include "lwip/ip6_addr.h"
#include "lwip/netif.h"

Data Structures

struct  nd6_neighbor_cache_entry
 
struct  nd6_q_entry
 
struct  ns_header
 
struct  na_header
 
struct  rs_header
 
struct  redirect_header
 

Macros

#define ND6_RA_FLAG_MANAGED_ADDR_CONFIG   (0x80)
 
#define ND6_OPTION_TYPE_SOURCE_LLADDR   (0x01)
 
#define ND6_OPTION_TYPE_PREFIX_INFO   (0x03)
 
#define ND6_OPTION_TYPE_REDIR_HDR   (0x04)
 
#define ND6_OPTION_TYPE_MTU   (0x05)
 
#define ND6_OPTION_TYPE_ROUTE_INFO   (24)
 
#define ND6_TMR_INTERVAL   1000
 

Functions

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

Macro Definition Documentation

#define ND6_OPTION_TYPE_MTU   (0x05)

MTU option.

#define ND6_OPTION_TYPE_PREFIX_INFO   (0x03)

Prefix information option.

#define ND6_OPTION_TYPE_REDIR_HDR   (0x04)

Redirected header option.

#define ND6_OPTION_TYPE_ROUTE_INFO   (24)

Route information option.

#define ND6_OPTION_TYPE_SOURCE_LLADDR   (0x01)

Link-layer address option.

#define ND6_RA_FLAG_MANAGED_ADDR_CONFIG   (0x80)

Router advertisement message header.

#define ND6_TMR_INTERVAL   1000

1 second period

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