Loading...
Searching...
No Matches
Neighbor Information Base for IPv6

Neighbor Information Base (NIB) for IPv6. More...

Detailed Description

Neighbor Information Base (NIB) for IPv6.

Todo:

Add detailed description

Implement multihop DAD

Implement classic SLAAC

Implement MLD

Modules

 Authoritative border router list
 Authoritative border router list component of neighbor information base.
 
 Forwarding table
 
 GNRC IPv6 NIB compile configurations
 Configuration macros for neighbor information base.
 
 Neighbor Cache
 Neighbor cache component of neighbor information base.
 
 Prefix list
 Prefix list component of neighbor information base.
 

Files

file  nib.h
 NIB definitions.
 
file  _nib-6ln.h
 Definitions related to 6Lo node (6LN) functionality of the NIB.
 
file  _nib-6lr.h
 Definitions related to 6Lo router (6LR) functionality of the NIB.
 
file  _nib-slaac.h
 Definions related to SLAAC functionality of the NIB.
 

Enumerations

enum  { GNRC_IPV6_NIB_ROUTE_INFO_TYPE_UNDEF = 0 , GNRC_IPV6_NIB_ROUTE_INFO_TYPE_RRQ , GNRC_IPV6_NIB_ROUTE_INFO_TYPE_RN , GNRC_IPV6_NIB_ROUTE_INFO_TYPE_NSC }
 Types for gnrc_netif_ipv6_t::route_info_cb . More...
 

Functions

void gnrc_ipv6_nib_init (void)
 Initialize NIB.
 
void gnrc_ipv6_nib_init_iface (gnrc_netif_t *netif)
 Adds an interface to be managed by the NIB.
 
void gnrc_ipv6_nib_iface_up (gnrc_netif_t *netif)
 Call bring-up functions when the interface comes online.
 
void gnrc_ipv6_nib_iface_down (gnrc_netif_t *netif, bool send_final_ra)
 Clean up when the interface goes offline.
 
int gnrc_ipv6_nib_get_next_hop_l2addr (const ipv6_addr_t *dst, gnrc_netif_t *netif, gnrc_pktsnip_t *pkt, gnrc_ipv6_nib_nc_t *nce)
 Gets link-layer address of next hop to a destination address.
 
void gnrc_ipv6_nib_handle_pkt (gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, const icmpv6_hdr_t *icmpv6, size_t icmpv6_len)
 Handles a received ICMPv6 packet.
 
void gnrc_ipv6_nib_handle_timer_event (void *ctx, uint16_t type)
 Handles a timer event.
 
void gnrc_ipv6_nib_change_rtr_adv_iface (gnrc_netif_t *netif, bool enable)
 Changes the state if an interface advertises itself as a router or not.
 
void _snd_ns (const ipv6_addr_t *tgt, gnrc_netif_t *netif, const ipv6_addr_t *src, const ipv6_addr_t *dst)
 Sends neighbor solicitation (including ARO if required)
 
static void _init_iface_router (gnrc_netif_t *netif)
 Initializes interface for router behavior.
 

Timer event message types

#define GNRC_IPV6_NIB_SND_UC_NS   (0x4fc0U)
 (Re-)transmit unicast Neighbor Solicitation event.
 
#define GNRC_IPV6_NIB_SND_MC_NS   (0x4fc1U)
 (Re-)transmit multicast Neighbor Solicitation event.
 
#define GNRC_IPV6_NIB_SND_NA   (0x4fc2U)
 Send delayed Neighbor Advertisement event.
 
#define GNRC_IPV6_NIB_SEARCH_RTR   (0x4fc3U)
 Search router event.
 
#define GNRC_IPV6_NIB_REPLY_RS   (0x4fc5U)
 Reply Router Solicitation event.
 
#define GNRC_IPV6_NIB_SND_MC_RA   (0x4fc6U)
 (Re-)transmit multicast Router Advertisement event.
 
#define GNRC_IPV6_NIB_REACH_TIMEOUT   (0x4fc7U)
 Reachability timeout event.
 
#define GNRC_IPV6_NIB_DELAY_TIMEOUT   (0x4fc8U)
 Delay timeout event.
 
#define GNRC_IPV6_NIB_ADDR_REG_TIMEOUT   (0x4fc9U)
 Address registration timeout event.
 
#define GNRC_IPV6_NIB_ABR_TIMEOUT   (0x4fcbU)
 Authoritative border router timeout event.
 
#define GNRC_IPV6_NIB_PFX_TIMEOUT   (0x4fccU)
 Prefix timeout event.
 
#define GNRC_IPV6_NIB_RTR_TIMEOUT   (0x4fcdU)
 Router timeout event.
 
#define GNRC_IPV6_NIB_RECALC_REACH_TIME   (0x4fceU)
 Recalculate reachability timeout time.
 
#define GNRC_IPV6_NIB_REREG_ADDRESS   (0x4fcfU)
 Reregister address.
 
#define GNRC_IPV6_NIB_ROUTE_TIMEOUT   (0x4fd0U)
 Route timeout event.
 
#define GNRC_IPV6_NIB_DAD   (0x4fd1U)
 Perform DAD event.
 
#define GNRC_IPV6_NIB_VALID_ADDR   (0x4fd2U)
 Validate a tentative address event.
 
#define GNRC_IPV6_NIB_RDNSS_TIMEOUT   (0x4fd3U)
 Recursive DNS server timeout.
 
#define GNRC_IPV6_NIB_IFACE_UP   (0x4fd4U)
 Interface up event.
 
#define GNRC_IPV6_NIB_IFACE_DOWN   (0x4fd5U)
 Interface down event.
 

Macro Definition Documentation

◆ GNRC_IPV6_NIB_ABR_TIMEOUT

#define GNRC_IPV6_NIB_ABR_TIMEOUT   (0x4fcbU)

Authoritative border router timeout event.

This message type is for the event of an Authoritative border router timeout. The expected message context is the NIB-internal state of the authoritative border router.

Note
Only handled with CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C != 0

Definition at line 156 of file nib.h.

◆ GNRC_IPV6_NIB_ADDR_REG_TIMEOUT

#define GNRC_IPV6_NIB_ADDR_REG_TIMEOUT   (0x4fc9U)

Address registration timeout event.

This message type is for the event of a 6LoWPAN address registration state timeout. The expected message context is a pointer to a valid on-link entry representing the neighbor which faces a timeout of its address registration.

Note
Only handled with CONFIG_GNRC_IPV6_NIB_6LR != 0

Definition at line 145 of file nib.h.

◆ GNRC_IPV6_NIB_DAD

#define GNRC_IPV6_NIB_DAD   (0x4fd1U)

Perform DAD event.

This message type is for performing DAD for a given address. The expected message context is a TENTATIVE IPv6 address.

Note
Only handled with CONFIG_GNRC_IPV6_NIB_SLAAC != 0

Definition at line 214 of file nib.h.

◆ GNRC_IPV6_NIB_DELAY_TIMEOUT

#define GNRC_IPV6_NIB_DELAY_TIMEOUT   (0x4fc8U)

Delay timeout event.

This message type is for the event of the DELAY state timeout. The expected message context is a pointer to a valid on-link entry representing the neighbor cache entry that faces a state change.

Note
Only handled with CONFIG_GNRC_IPV6_NIB_ARSM != 0

Definition at line 134 of file nib.h.

◆ GNRC_IPV6_NIB_IFACE_DOWN

#define GNRC_IPV6_NIB_IFACE_DOWN   (0x4fd5U)

Interface down event.

Definition at line 245 of file nib.h.

◆ GNRC_IPV6_NIB_IFACE_UP

#define GNRC_IPV6_NIB_IFACE_UP   (0x4fd4U)

Interface up event.

Definition at line 240 of file nib.h.

◆ GNRC_IPV6_NIB_PFX_TIMEOUT

#define GNRC_IPV6_NIB_PFX_TIMEOUT   (0x4fccU)

Prefix timeout event.

This message type is for the event of a prefix timeout. The expected message context is a valid off-link entry representing the prefix.

Definition at line 164 of file nib.h.

◆ GNRC_IPV6_NIB_RDNSS_TIMEOUT

#define GNRC_IPV6_NIB_RDNSS_TIMEOUT   (0x4fd3U)

Recursive DNS server timeout.

This message type is for the event of a recursive DNS server timeout. The expected message context is the UDP end point representing the DNS server.

Note
Only handled with CONFIG_GNRC_IPV6_NIB_DNS != 0

Definition at line 235 of file nib.h.

◆ GNRC_IPV6_NIB_REACH_TIMEOUT

#define GNRC_IPV6_NIB_REACH_TIMEOUT   (0x4fc7U)

Reachability timeout event.

This message type is for the event of a REACHABLE state timeout. The expected message context is a pointer to a valid on-link entry representing the neighbor cache entry that faces a state change.

Note
Only handled with CONFIG_GNRC_IPV6_NIB_ARSM != 0

Definition at line 123 of file nib.h.

◆ GNRC_IPV6_NIB_RECALC_REACH_TIME

#define GNRC_IPV6_NIB_RECALC_REACH_TIME   (0x4fceU)

Recalculate reachability timeout time.

This message type is for the event of recalculating the reachability timeout time. The expected message context is a valid interface.

Note
Only handled with CONFIG_GNRC_IPV6_NIB_ARSM != 0

Definition at line 183 of file nib.h.

◆ GNRC_IPV6_NIB_REPLY_RS

#define GNRC_IPV6_NIB_REPLY_RS   (0x4fc5U)

Reply Router Solicitation event.

This message type is for the event of the delayed reply to a Router Solicitaion with a Router Advertisement. The expected message context is a pointer to a valid on-link entry representing the neighbor that sent the Router Solicitation.

Note
Only handled with CONFIG_GNRC_IPV6_NIB_ROUTER != 0

Definition at line 100 of file nib.h.

◆ GNRC_IPV6_NIB_REREG_ADDRESS

#define GNRC_IPV6_NIB_REREG_ADDRESS   (0x4fcfU)

Reregister address.

This message type is for the event of reregistering an IPv6 address to the upstream router. The expected message context is an IPv6 address assigned to one of the nodes interfaces.

Note
Only handled with CONFIG_GNRC_IPV6_NIB_6LN != 0

Definition at line 194 of file nib.h.

◆ GNRC_IPV6_NIB_ROUTE_TIMEOUT

#define GNRC_IPV6_NIB_ROUTE_TIMEOUT   (0x4fd0U)

Route timeout event.

This message type is for the event of a route timeout. The expected message context is a valid off-link entry representing the route.

Note
Only handled with CONFIG_GNRC_IPV6_NIB_ROUTER != 0

Definition at line 204 of file nib.h.

◆ GNRC_IPV6_NIB_RTR_TIMEOUT

#define GNRC_IPV6_NIB_RTR_TIMEOUT   (0x4fcdU)

Router timeout event.

This message type is for the event of a router timeout. The expected message context is a valid default router entry representing the router.

Definition at line 172 of file nib.h.

◆ GNRC_IPV6_NIB_SEARCH_RTR

#define GNRC_IPV6_NIB_SEARCH_RTR   (0x4fc3U)

Search router event.

This message type is for the event of searching a (new) router (which implies sending a multicast Router Solicitation). The expected message context is a pointer to a valid interface behind which the router is searched.

Definition at line 88 of file nib.h.

◆ GNRC_IPV6_NIB_SND_MC_NS

#define GNRC_IPV6_NIB_SND_MC_NS   (0x4fc1U)

(Re-)transmit multicast Neighbor Solicitation event.

This message type is for the event of (re-)transmitting of multicast Neighbor Solicitation. The expected message context is a pointer to a valid on-link entry representing the neighbor to which solicited nodes group the Neighbor Solicitation is supposed to be sent.

Definition at line 68 of file nib.h.

◆ GNRC_IPV6_NIB_SND_MC_RA

#define GNRC_IPV6_NIB_SND_MC_RA   (0x4fc6U)

(Re-)transmit multicast Router Advertisement event.

This message type is for the event of (Re)transmit Advertisements event. The expected message context is a pointer to a valid interface over which the Router Advertisement will be sent and by which parameters it will be configured.

Note
Only handled with CONFIG_GNRC_IPV6_NIB_ROUTER != 0

Definition at line 112 of file nib.h.

◆ GNRC_IPV6_NIB_SND_NA

#define GNRC_IPV6_NIB_SND_NA   (0x4fc2U)

Send delayed Neighbor Advertisement event.

This message type is for the event of sending delayed Neighbor Advertisements. The expected message context is a pointer to a valid packet snip in sending order, representing the Neighbor Advertisement.

Definition at line 78 of file nib.h.

◆ GNRC_IPV6_NIB_SND_UC_NS

#define GNRC_IPV6_NIB_SND_UC_NS   (0x4fc0U)

(Re-)transmit unicast Neighbor Solicitation event.

This message type is for the event of (re-)transmitting of unicast Neighbor Solicitation. The expected message context is a pointer to a valid on-link entry representing the neighbor to which the Neighbor Solicitation is supposed to be sent.

Definition at line 57 of file nib.h.

◆ GNRC_IPV6_NIB_VALID_ADDR

#define GNRC_IPV6_NIB_VALID_ADDR   (0x4fd2U)

Validate a tentative address event.

Moves a TENTATIVE address to VALID state. The expected message context is a TENTATIVE IPv6 address.

Note
Only handled with CONFIG_GNRC_IPV6_NIB_SLAAC != 0

Definition at line 224 of file nib.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Types for gnrc_netif_ipv6_t::route_info_cb .

Enumerator
GNRC_IPV6_NIB_ROUTE_INFO_TYPE_UNDEF 

undefined

GNRC_IPV6_NIB_ROUTE_INFO_TYPE_RRQ 

reactive routing query

A reactive routing query is issued when a route is unknown to the NIB. A reactive routing protocol can use this call to search for a route in a reactive manner.

The ctx_addr will be the destination address of the unknown route, ctx a pointer to the packet as gnrc_pktsnip_t that caused the route look-up (to possibly queue it for later sending).

GNRC_IPV6_NIB_ROUTE_INFO_TYPE_RN 

route notification

A route notification is issued when an already established route is taken. A routing protocol can use this call to update its information on the route.

The ctx_addr is the prefix of the route, ctx is set to a value equal to the length of the prefix in bits.

GNRC_IPV6_NIB_ROUTE_INFO_TYPE_NSC 

neighbor state change

A neighbor state change is issued when ever the NUD state of a neighbor changes. A routing protocol can use this call to update its information on routes via this neighbor.

The ctx_addr is the address of the neighbor, ctx is a value equal to the new NUD state as defined in the NC info flags. If the entry is deleted, ctx will be set to GNRC_IPV6_NIB_NC_INFO_NUD_STATE_UNREACHABLE (except if it was already in the UNREACHABLE state). This does not include cache-outs, since they give no information about the neighbor's reachability (you might however get an INCOMPLETE or STALE notification due to that, as soon as the neighbor enters the neighbor cache again).

Be advised to only use ctx_addr in the context of the callback, since it might be overwritten, after the callback was left.

Definition at line 252 of file nib.h.

Function Documentation

◆ _init_iface_router()

static void _init_iface_router ( gnrc_netif_t netif)
inlinestatic

Initializes interface for router behavior.

Parameters
[in]netifAn interface.

Definition at line 42 of file _nib-router.h.

◆ _snd_ns()

void _snd_ns ( const ipv6_addr_t tgt,
gnrc_netif_t netif,
const ipv6_addr_t src,
const ipv6_addr_t dst 
)

Sends neighbor solicitation (including ARO if required)

Precondition
(tgt != NULL) && !ipv6_addr_is_multicast(tgt)
(netif != NULL) && (dst != NULL)
Parameters
[in]tgtThe target address of the neighbor solicitation. Must not be NULL or a multicast address.
[in]netifInterface to send over. Must not be NULL.
[in]srcSource address for the neighbor solicitation. Will be chosen from the interface according to dst, if NULL.
[in]dstDestination address for neighbor solicitation. Must not be NULL.

◆ gnrc_ipv6_nib_change_rtr_adv_iface()

void gnrc_ipv6_nib_change_rtr_adv_iface ( gnrc_netif_t netif,
bool  enable 
)

Changes the state if an interface advertises itself as a router or not.

Parameters
[in]netifThe interface for which the state should be changed.
[in]enabletrue, to enable advertising the interface as a router. false, to disable advertising the interface as a router.

◆ gnrc_ipv6_nib_get_next_hop_l2addr()

int gnrc_ipv6_nib_get_next_hop_l2addr ( const ipv6_addr_t dst,
gnrc_netif_t netif,
gnrc_pktsnip_t pkt,
gnrc_ipv6_nib_nc_t nce 
)

Gets link-layer address of next hop to a destination address.

Precondition
(dst != NULL) && (nce != NULL)
Parameters
[in]dstDestination address of a packet.
[in]netifRestrict search to this interface. May be NULL for any interface.
[in]pktThe IPv6 packet in sending order for which the next hop is searched. Needed for queuing for with reactive routing or address resolution. May be NULL. Will be released properly on error.
[out]nceThe neighbor cache entry of the next hop to dst.
Returns
0, on success.
-ENETUNREACH if there is no route to host.
-EHOSTUNREACH if the next hop is not reachable or if dst was link-local, but iface was KERNEL_PID_UNDEF (no neighbor cache entry will be created in this case and no neighbor solicitation sent).

◆ gnrc_ipv6_nib_handle_pkt()

void gnrc_ipv6_nib_handle_pkt ( gnrc_netif_t netif,
const ipv6_hdr_t ipv6,
const icmpv6_hdr_t icmpv6,
size_t  icmpv6_len 
)

Handles a received ICMPv6 packet.

Precondition
netif != NULL
ipv6 != NULL
icmpv6 != NULL
icmpv6_len > sizeof(icmpv6_hdr_t)
Attention
The ICMPv6 checksum is supposed to be checked externally!
Note
ipv6 is just used for the addresses and hop limit. The next header field will not be checked for correctness (but should be PROTNUM_ICMPV6)
See also
RFC 4861, section 6.1
RFC 4861, section 6.2.6
RFC 4861, section 6.3.4
RFC 4861, section 7.1
RFC 4861, section 7.2.3
RFC 4861, section 7.2.5
RFC 4861, section 8.1
RFC 4861, section 8.3
RFC 4862, section 5.4.3
RFC 4862, section 5.4.4
RFC 4862, section 5.5.3
RFC 6775, section 5.5.2
RFC 6775, section 5.4
RFC 6775, section 6.3
RFC 6775, section 6.5
RFC 6775, section 8.1.3
RFC 6775, section 8.2.1
RFC 6775, section 8.2.4
RFC 6775, section 8.2.5
Parameters
[in]netifThe interface the packet came over.
[in]ipv6The IPv6 header of the received packet.
[in]icmpv6The ICMPv6 header and payload of the received packet.
[in]icmpv6_lenThe number of bytes at icmpv6.

◆ gnrc_ipv6_nib_handle_timer_event()

void gnrc_ipv6_nib_handle_timer_event ( void *  ctx,
uint16_t  type 
)

Handles a timer event.

Parameters
[in]ctxContext of the timer event.
[in]typeType of the timer event (see timer event types")

◆ gnrc_ipv6_nib_iface_down()

void gnrc_ipv6_nib_iface_down ( gnrc_netif_t netif,
bool  send_final_ra 
)

Clean up when the interface goes offline.

Precondition
netif != NULL
Parameters
[in,out]netifThe interface that has just got offline
[in]send_final_raWhether to advertise router disappearance in a final router advertisement

◆ gnrc_ipv6_nib_iface_up()

void gnrc_ipv6_nib_iface_up ( gnrc_netif_t netif)

Call bring-up functions when the interface comes online.

Precondition
netif != NULL
Parameters
[in,out]netifThe interface that just got online

◆ gnrc_ipv6_nib_init_iface()

void gnrc_ipv6_nib_init_iface ( gnrc_netif_t netif)

Adds an interface to be managed by the NIB.

Precondition
netif != NULL
Parameters
[in,out]netifThe interface to be managed by the NIB