lwIP 2.1.1 Lightweight IP stack

Macros | Functions
nd6.h File Reference
`#include "lwip/opt.h"`
`#include "lwip/ip6_addr.h"`
`#include "lwip/err.h"`

## Macros
#define | ND6_TMR_INTERVAL 1000
#define | ND6_RTR_SOLICITATION_INTERVAL 4000

## Functions
void | nd6_tmr (void)
void | nd6_input (struct pbuf *p, struct netif *inp)
void | nd6_clear_destination_cache (void)
struct netif * | nd6_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)
void | nd6_restart_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

## ◆ ND6_RTR_SOLICITATION_INTERVAL

#define ND6_RTR_SOLICITATION_INTERVAL 4000

Router solicitations are sent in 4 second intervals (see RFC 4861, ch. 6.3.7)

## ◆ 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

  netif | The netif that owns the address.
  addr_idx | The index of the address.
  new_state | The 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

  netif | points 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. This route may be based on an on-link prefix or a default router.

If a suitable route is found, the returned netif is guaranteed to be in a suitable state (up, link up) to be used for packet transmission.

Parameters

  ip6addr | the 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

  ip6addr | the destination address
  netif | the 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

  netif | The lwIP network interface on which the IP packet will be sent.
  q | The pbuf(s) containing the IP packet to be sent.
  ip6addr | The destination IPv6 address of the packet.
  hwaddrp | On 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

  p | the nd packet, p->payload pointing to the icmpv6 header
  inp | the 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

  ip6addr | the destination address which is know to be reachable by an upper layer protocol (TCP)

## ◆ nd6_restart_netif()

void nd6_restart_netif | ( | struct netif * | netif | ) |

Netif was added, set up, or reconnected (link up)

## ◆ 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
- Update lifetimes of our addresses
- Perform duplicate address detection (DAD) for our addresses
- Send router solicitations