Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
lwip_nd6.c File Reference
Neighbor discovery and stateless address autoconfiguration for IPv6. More...
Go to the source code of this file.
Functions | |
static s8_t | nd6_find_neighbor_cache_entry (const ip6_addr_t *ip6addr) |
Search for a neighbor cache entry. | |
static s8_t | nd6_new_neighbor_cache_entry (void) |
Create a new neighbor cache entry. | |
static void | nd6_free_neighbor_cache_entry (s8_t i) |
Will free any resources associated with a neighbor cache entry, and will mark it as unused. | |
static s8_t | nd6_find_destination_cache_entry (const ip6_addr_t *ip6addr) |
Search for a destination cache entry. | |
static s8_t | nd6_new_destination_cache_entry (void) |
Create a new destination cache entry. | |
static s8_t | nd6_is_prefix_in_netif (const ip6_addr_t *ip6addr, struct netif *netif) |
Determine whether an address matches an on-link prefix. | |
static s8_t | nd6_get_router (const ip6_addr_t *router_addr, struct netif *netif) |
Find an entry for a default router. | |
static s8_t | nd6_new_router (const ip6_addr_t *router_addr, struct netif *netif) |
Create a new entry for a default router. | |
static s8_t | nd6_get_onlink_prefix (ip6_addr_t *prefix, struct netif *netif) |
Find the cached entry for an on-link prefix. | |
static s8_t | nd6_new_onlink_prefix (ip6_addr_t *prefix, struct netif *netif) |
Creates a new entry for an on-link prefix. | |
static void | nd6_send_ns (struct netif *netif, const ip6_addr_t *target_addr, u8_t flags) |
Send a neighbor solicitation message. | |
static void | nd6_send_na (struct netif *netif, const ip6_addr_t *target_addr, u8_t flags) |
Send a neighbor advertisement message. | |
static err_t | nd6_send_rs (struct netif *netif) |
Send a router solicitation message. | |
static void | nd6_free_q (struct nd6_q_entry *q) |
Free a complete queue of nd6 q entries. | |
static void | nd6_send_q (s8_t i) |
Send queued packets for a neighbor. | |
void | nd6_input (struct pbuf *p, struct netif *inp) |
Process an incoming neighbor discovery message. | |
void | nd6_tmr (void) |
Periodic timer for Neighbor discovery functions: | |
s8_t | nd6_select_router (const ip6_addr_t *ip6addr, struct netif *netif) |
Select a default router for a destination. | |
s8_t | nd6_get_next_hop_entry (const ip6_addr_t *ip6addr, struct netif *netif) |
Determine the next hop for a destination. | |
err_t | nd6_queue_packet (s8_t neighbor_index, struct pbuf *q) |
Queue a packet for a neighbor. | |
u16_t | nd6_get_destination_mtu (const ip6_addr_t *ip6addr, struct netif *netif) |
Get the Path MTU for a destination. | |
void | nd6_reachability_hint (const ip6_addr_t *ip6addr) |
Provide the Neighbor discovery process with a hint that a destination is reachable. | |
void | nd6_cleanup_netif (struct netif *netif) |
Remove all prefix, neighbor_cache and router entries of the specified 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).
Definition in file lwip_nd6.c.
Function Documentation
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
Definition at line 1861 of file lwip_nd6.c.
static s8_t nd6_find_destination_cache_entry | ( | const ip6_addr_t * | ip6addr ) | [static] |
Search for a destination cache entry.
- Parameters:
-
ip6addr the IPv6 address of the destination
- Returns:
- The destination cache entry index that matched, -1 if no entry is found
Definition at line 1221 of file lwip_nd6.c.
static s8_t nd6_find_neighbor_cache_entry | ( | const ip6_addr_t * | ip6addr ) | [static] |
Search for a neighbor cache entry.
- Parameters:
-
ip6addr the IPv6 address of the neighbor
- Returns:
- The neighbor cache entry index that matched, -1 if no entry is found
Definition at line 1062 of file lwip_nd6.c.
static void nd6_free_neighbor_cache_entry | ( | s8_t | i ) | [static] |
Will free any resources associated with a neighbor cache entry, and will mark it as unused.
- Parameters:
-
i the neighbor cache entry index to free
Definition at line 1190 of file lwip_nd6.c.
static void nd6_free_q | ( | struct nd6_q_entry * | q ) | [static] |
Free a complete queue of nd6 q entries.
- Parameters:
-
q a queue of nd6_q_entry to free
Definition at line 1715 of file lwip_nd6.c.
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
Definition at line 1788 of file lwip_nd6.c.
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:
-
ip6addr the destination address netif the 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
Definition at line 1492 of file lwip_nd6.c.
static s8_t nd6_get_onlink_prefix | ( | ip6_addr_t * | prefix, |
struct netif * | netif | ||
) | [static] |
Find the cached entry for an on-link prefix.
- Parameters:
-
prefix the IPv6 prefix that is on-link netif the netif on which the prefix is on-link
- Returns:
- the index on the prefix table, or -1 if not found
Definition at line 1433 of file lwip_nd6.c.
static s8_t nd6_get_router | ( | const ip6_addr_t * | router_addr, |
struct netif * | netif | ||
) | [static] |
Find an entry for a default router.
- Parameters:
-
router_addr the IPv6 address of the router netif the netif on which the router is found, if known
- Returns:
- the index of the router entry, or -1 if not found
Definition at line 1359 of file lwip_nd6.c.
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
Definition at line 119 of file lwip_nd6.c.
static s8_t nd6_is_prefix_in_netif | ( | const ip6_addr_t * | ip6addr, |
struct netif * | netif | ||
) | [static] |
Determine whether an address matches an on-link prefix.
- Parameters:
-
ip6addr the IPv6 address to match
- Returns:
- 1 if the address is on-link, 0 otherwise
Definition at line 1271 of file lwip_nd6.c.
static s8_t nd6_new_destination_cache_entry | ( | void | ) | [static] |
Create a new destination cache entry.
If no unused entry is found, will recycle oldest entry.
- Returns:
- The destination cache entry index that was created, -1 if no entry was created
Definition at line 1240 of file lwip_nd6.c.
static s8_t nd6_new_neighbor_cache_entry | ( | void | ) | [static] |
Create a new neighbor cache entry.
If no unused entry is found, will try to recycle an old entry according to ad-hoc "age" heuristic.
- Returns:
- The neighbor cache entry index that was created, -1 if no entry could be created
Definition at line 1083 of file lwip_nd6.c.
static s8_t nd6_new_onlink_prefix | ( | ip6_addr_t * | prefix, |
struct netif * | netif | ||
) | [static] |
Creates a new entry for an on-link prefix.
- Parameters:
-
prefix the IPv6 prefix that is on-link netif the netif on which the prefix is on-link
- Returns:
- the index on the prefix table, or -1 if not created
Definition at line 1457 of file lwip_nd6.c.
static s8_t nd6_new_router | ( | const ip6_addr_t * | router_addr, |
struct netif * | netif | ||
) | [static] |
Create a new entry for a default router.
- Parameters:
-
router_addr the IPv6 address of the router netif the netif on which the router is connected, if known
- Returns:
- the index on the router table, or -1 if could not be created
Definition at line 1384 of file lwip_nd6.c.
Queue a packet for a neighbor.
- Parameters:
-
neighbor_index the index in the neighbor cache table q packet to be queued
- Returns:
- ERR_OK if succeeded, ERR_MEM if out of memory
Definition at line 1604 of file lwip_nd6.c.
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)
Definition at line 1818 of file lwip_nd6.c.
s8_t nd6_select_router | ( | const ip6_addr_t * | ip6addr, |
struct netif * | netif | ||
) |
Select a default router for a destination.
- Parameters:
-
ip6addr the destination address netif the netif for the outgoing packet, if known
- Returns:
- the default router entry index, or -1 if no suitable router is found
Definition at line 1300 of file lwip_nd6.c.
static void nd6_send_na | ( | struct netif * | netif, |
const ip6_addr_t * | target_addr, | ||
u8_t | flags | ||
) | [static] |
Send a neighbor advertisement message.
- Parameters:
-
netif the netif on which to send the message target_addr the IPv6 target address for the ND message flags one of ND6_SEND_FLAG_*
Definition at line 920 of file lwip_nd6.c.
static void nd6_send_ns | ( | struct netif * | netif, |
const ip6_addr_t * | target_addr, | ||
u8_t | flags | ||
) | [static] |
Send a neighbor solicitation message.
- Parameters:
-
netif the netif on which to send the message target_addr the IPv6 target address for the ND message flags one of ND6_SEND_FLAG_*
Definition at line 851 of file lwip_nd6.c.
static void nd6_send_q | ( | s8_t | i ) | [static] |
Send queued packets for a neighbor.
- Parameters:
-
i the neighbor to send packets to
Definition at line 1736 of file lwip_nd6.c.
Send a router solicitation message.
- Parameters:
-
netif the netif on which to send the message
Definition at line 991 of file lwip_nd6.c.
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
Definition at line 655 of file lwip_nd6.c.
Generated on Tue Jul 12 2022 17:35:02 by
