6LoWPAN neighbor discovery

Neighbor Discovery Optimization for 6LoWPAN. More...

Detailed Description

See also
RFC 6775

Modules

 Border router part of 6LoWPAN-ND
 Border router part of 6LoWPAN-ND.
 
 Router-part of 6LoWPAN-ND
 Router-part of 6LoWPAN-ND.
 

Files

file  gnrc/sixlowpan/nd.h
 General 6LoWPAN ND definitions.
 

Macros

#define GNRC_SIXLOWPAN_ND_MSG_MC_RTR_SOL   (0x0220)
 Message type for next multicast router solicitation.
 
#define GNRC_SIXLOWPAN_ND_MSG_UC_RTR_SOL   (0x0221)
 Message type for next unicast router solicitation.
 
#define GNRC_SIXLOWPAN_ND_MSG_DELETE_CTX   (0x0222)
 Message type for removing 6LoWPAN contexts.
 
#define GNRC_SIXLOWPAN_ND_MSG_ABR_TIMEOUT   (0x0223)
 Message type for authoritative border router timeout.
 
#define GNRC_SIXLOWPAN_ND_MSG_AR_TIMEOUT   (0x0224)
 Message type for address registration timeout.
 
#define GNRC_SIXLOWPAN_ND_AR_LTIME   (15U)
 Registration lifetime in minutes for the address registration option. More...
 

Functions

void gnrc_sixlowpan_nd_init (gnrc_ipv6_netif_t *iface)
 Initializes 6LoWPAN neighbor discovery for the interface. More...
 
void gnrc_sixlowpan_nd_mc_rtr_sol (gnrc_ipv6_netif_t *iface)
 Multicasts a router solicitation over iface. More...
 
void gnrc_sixlowpan_nd_uc_rtr_sol (gnrc_ipv6_nc_t *nce)
 Unicasts a router solicitation to the neighbor represented by nce. More...
 
kernel_pid_t gnrc_sixlowpan_nd_next_hop_l2addr (uint8_t *l2addr, uint8_t *l2addr_len, kernel_pid_t iface, ipv6_addr_t *dst)
 Get link-layer address and interface for next hop to destination IPv6 address. More...
 
void gnrc_sixlowpan_nd_rtr_sol_reschedule (gnrc_ipv6_nc_t *nce, uint32_t sec_delay)
 Reschedules the next router advertisement for a neighboring router. More...
 
gnrc_pktsnip_tgnrc_sixlowpan_nd_opt_ar_build (uint8_t status, uint16_t ltime, eui64_t *eui64, gnrc_pktsnip_t *next)
 Builds the address registration option. More...
 
uint8_t gnrc_sixlowpan_nd_opt_ar_handle (kernel_pid_t iface, ipv6_hdr_t *ipv6, uint8_t icmpv6_type, ipv6_addr_t *addr, sixlowpan_nd_opt_ar_t *ar_opt, uint8_t *sl2a, size_t sl2a_len)
 Handles address registration option. More...
 
bool gnrc_sixlowpan_nd_opt_6ctx_handle (uint8_t icmpv6_type, sixlowpan_nd_opt_6ctx_t *ctx_opt)
 Handles 6LoWPAN context option. More...
 
void gnrc_sixlowpan_nd_wakeup (void)
 Handles registration calls after node-wakeup. More...
 
void gnrc_sixlowpan_nd_opt_abr_handle (kernel_pid_t iface, ndp_rtr_adv_t *rtr_adv, int icmpv6_size, sixlowpan_nd_opt_abr_t *abr_opt)
 Handles authoritative border router option. More...
 
gnrc_pktsnip_tgnrc_sixlowpan_nd_opt_6ctx_build (uint8_t prefix_len, uint8_t flags, uint16_t ltime, ipv6_addr_t *prefix, gnrc_pktsnip_t *next)
 Builds the 6LoWPAN context option. More...
 
gnrc_pktsnip_tgnrc_sixlowpan_nd_opt_abr_build (uint32_t version, uint16_t ltime, ipv6_addr_t *braddr, gnrc_pktsnip_t *next)
 Builds the authoritative border router option. More...
 

Border router constants

See also
RFC 6775, section 9
#define GNRC_SIXLOWPAN_ND_RTR_MIN_CTX_DELAY   (300U)
 minimum delay between context change and stop of C=0 dissimination in seconds
 

Host constants

See also
RFC 6775, section 9
#define GNRC_SIXLOWPAN_ND_RTR_SOL_INT   (10U)
 replacement value (in seconds) for GNRC_NDP_MAX_RTR_SOL_INT
 
#define GNRC_SIXLOWPAN_ND_MAX_RTR_SOL_INT   (60U)
 retransmission increment for exponential backoff of subsequent RS
 

Router constants

See also
RFC 6775, section 9
#define GNRC_SIXLOWPAN_ND_MIN_RTR_ADV_DELAY   (10U)
 replacement value (in seconds) for GNRC_NDP_MIN_RTR_ADV_DELAY
 
#define GNRC_SIXLOWPAN_ND_MAX_RTR_ADV_DELAY   (2U * US_PER_SEC)
 replacement value (in microseconds) for GNRC_NDP_MAX_RTR_ADV_DELAY
 
#define GNRC_SIXLOWPAN_ND_TENTATIVE_NCE_LIFETIME   (20U)
 Lifetime of a tentative address entry in seconds.
 
#define GNRC_SIXLOWPAN_ND_MULTIHOP_HOPLIMIT   (64U)
 6LoWPAN Multihop Hoplimit
 

Macro Definition Documentation

#define GNRC_SIXLOWPAN_ND_AR_LTIME   (15U)

This value should be adapted to the devices power-lifecycle so that it is greater than the time the device spends sleeping.

See also
RFC 6775, section 5.8.1

Definition at line 79 of file gnrc/sixlowpan/nd.h.

Function Documentation

void gnrc_sixlowpan_nd_init ( gnrc_ipv6_netif_t iface)
Precondition
iface->flags & GNRC_IPV6_NETIF_FLAGS_SIXLOWPAN
Parameters
[in]ifaceAn IPv6 interface.
void gnrc_sixlowpan_nd_mc_rtr_sol ( gnrc_ipv6_netif_t iface)
Precondition
iface->flags & GNRC_IPV6_NETIF_FLAGS_SIXLOWPAN
Parameters
[in]ifaceAn IPv6 interface.
kernel_pid_t gnrc_sixlowpan_nd_next_hop_l2addr ( uint8_t *  l2addr,
uint8_t *  l2addr_len,
kernel_pid_t  iface,
ipv6_addr_t dst 
)
Parameters
[out]l2addrThe link-layer for the next hop to dst.
[out]l2addr_lenLength of l2addr.
[in]ifaceThe interface to search the next hop on. May be KERNEL_PID_UNDEF if not specified.
[in]dstAn IPv6 address to search the next hop for.
Returns
The PID of the interface, on success.
-EHOSTUNREACH, if dst is not reachable.
-ENOBUFS, if l2addr_len was smaller than the resulting l2addr would be long.
gnrc_pktsnip_t* gnrc_sixlowpan_nd_opt_6ctx_build ( uint8_t  prefix_len,
uint8_t  flags,
uint16_t  ltime,
ipv6_addr_t prefix,
gnrc_pktsnip_t next 
)
Parameters
[in]prefix_lenThe length of the context's prefix.
[in]flagsFlags + CID for the context.
[in]ltimeLifetime of the context.
[in]prefixThe context's prefix
[in]nextMore options in the packet. NULL, if there are none.
Returns
The pkt snip list of options, on success
NULL, if packet buffer is full or on error
bool gnrc_sixlowpan_nd_opt_6ctx_handle ( uint8_t  icmpv6_type,
sixlowpan_nd_opt_6ctx_t ctx_opt 
)
Parameters
[in]icmpv6_typeMessage type of the ICMPv6 message that contained. this message.
[in]ctx_optThe 6LoWPAN context option.
Returns
true, when 6LoWPAN context option was correct.
false, when it was incorrect.
gnrc_pktsnip_t* gnrc_sixlowpan_nd_opt_abr_build ( uint32_t  version,
uint16_t  ltime,
ipv6_addr_t braddr,
gnrc_pktsnip_t next 
)
Parameters
[in]versionVersion of the border router information.
[in]ltimeRegistration lifetime for the border router.
[in]braddrThe IPv6 address of the border router.
[in]nextMore options in the packet. NULL, if there are none.
Returns
The pkt snip list of options, on success
NULL, if packet buffer is full or on error
void gnrc_sixlowpan_nd_opt_abr_handle ( kernel_pid_t  iface,
ndp_rtr_adv_t rtr_adv,
int  icmpv6_size,
sixlowpan_nd_opt_abr_t abr_opt 
)
Parameters
[in]ifaceInterface the source link-layer option was received on.
[in]rtr_advThe router advertisement containing the ABRO.
[in]icmpv6_sizeThe size of the rtr_adv.
[in]abr_optThe ABRO.
Note
Erroneous ABROs are always ignored silently.
gnrc_pktsnip_t* gnrc_sixlowpan_nd_opt_ar_build ( uint8_t  status,
uint16_t  ltime,
eui64_t eui64,
gnrc_pktsnip_t next 
)
Parameters
[in]statusStatus for the ARO.
[in]ltimeRegistration lifetime for the ARO.
[in]eui64The EUI-64 for the ARO
[in]nextMore options in the packet. NULL, if there are none.
Returns
The pkt snip list of options, on success
NULL, if packet buffer is full
uint8_t gnrc_sixlowpan_nd_opt_ar_handle ( kernel_pid_t  iface,
ipv6_hdr_t ipv6,
uint8_t  icmpv6_type,
ipv6_addr_t addr,
sixlowpan_nd_opt_ar_t ar_opt,
uint8_t *  sl2a,
size_t  sl2a_len 
)
Parameters
[in]ifaceThe interface the ARO was received on.
[in]ipv6The IPv6 header the ARO was received in.
[in]icmpv6_typeMessage type of the ICMPv6 message that contained. this message.
[in]addrThe IPv6 address to register.
[in]ar_optThe address registration option.
[in]sl2aThe link-layer source address contained in SL2A accompanying this option. May be NULL for icmpv6_type == ICMPV6_NBR_ADV.
[in]sl2a_lenLength of sl2a. May be 0 if sl2a == NULL.
Returns
Status for the ARO in the replying NA (always 0 if icmpv6_type == ICMPV6_NBR_ADV).
void gnrc_sixlowpan_nd_rtr_sol_reschedule ( gnrc_ipv6_nc_t nce,
uint32_t  sec_delay 
)
Precondition
nce != NULL && sec_delay != 0U
Parameters
[in]nceNeighbor cache entry representing the neighboring router.
[in]sec_delayThe delay for the next router solicitation in seconds.
void gnrc_sixlowpan_nd_uc_rtr_sol ( gnrc_ipv6_nc_t nce)
Precondition
nce->iface is an IPv6 interface and GNRC_IPV6_NETIF_FLAGS_SIXLOWPAN is set in its flags.
Parameters
[in]nceThe neighbor to send the router solicitation to.
void gnrc_sixlowpan_nd_wakeup ( void  )