Provides build and send functions for neighbor discovery packets. More...
Provides build and send functions for neighbor discovery packets.
Files | |
| file | ndp.h |
| GNRC-specific neighbor discovery definitions. | |
Macros | |
| #define | GNRC_NETTYPE_NDP (GNRC_NETTYPE_IPV6) /* usual configuration */ |
| gnrc_nettype: Protocol type to send NDP packets to | |
Functions | |
| gnrc_pktsnip_t * | gnrc_ndp_nbr_sol_build (const ipv6_addr_t *tgt, gnrc_pktsnip_t *options) |
| Builds a neighbor solicitation message for sending. More... | |
| gnrc_pktsnip_t * | gnrc_ndp_nbr_adv_build (const ipv6_addr_t *tgt, uint8_t flags, gnrc_pktsnip_t *options) |
| Builds a neighbor advertisement message for sending. More... | |
| gnrc_pktsnip_t * | gnrc_ndp_rtr_sol_build (gnrc_pktsnip_t *options) |
| Builds a router solicitation message for sending. More... | |
| gnrc_pktsnip_t * | gnrc_ndp_rtr_adv_build (uint8_t cur_hl, uint8_t flags, uint16_t ltime, uint32_t reach_time, uint32_t retrans_timer, gnrc_pktsnip_t *options) |
| Builds a router advertisement message for sending. More... | |
| gnrc_pktsnip_t * | gnrc_ndp_opt_build (uint8_t type, size_t size, gnrc_pktsnip_t *next) |
| Builds a generic NDP option. More... | |
| gnrc_pktsnip_t * | gnrc_ndp_opt_sl2a_build (const uint8_t *l2addr, uint8_t l2addr_len, gnrc_pktsnip_t *next) |
| Builds the source link-layer address option. More... | |
| gnrc_pktsnip_t * | gnrc_ndp_opt_tl2a_build (const uint8_t *l2addr, uint8_t l2addr_len, gnrc_pktsnip_t *next) |
| Builds the target link-layer address option. More... | |
| gnrc_pktsnip_t * | gnrc_ndp_opt_pi_build (const ipv6_addr_t *prefix, uint8_t prefix_len, uint32_t valid_ltime, uint32_t pref_ltime, uint8_t flags, gnrc_pktsnip_t *next) |
| Builds the prefix information option. More... | |
| gnrc_pktsnip_t * | gnrc_ndp_opt_ri_build (const ipv6_addr_t *prefix, uint8_t prefix_len, uint32_t route_ltime, uint8_t flags, gnrc_pktsnip_t *next) |
| Builds the route information option. More... | |
| gnrc_pktsnip_t * | gnrc_ndp_opt_mtu_build (uint32_t mtu, gnrc_pktsnip_t *next) |
| Builds the MTU option. More... | |
| gnrc_pktsnip_t * | gnrc_ndp_opt_rdnss_build (uint32_t lifetime, ipv6_addr_t *addrs, unsigned addrs_num, gnrc_pktsnip_t *next) |
| Builts the recursive DNS server option. More... | |
| void | gnrc_ndp_nbr_sol_send (const ipv6_addr_t *tgt, gnrc_netif_t *netif, const ipv6_addr_t *src, const ipv6_addr_t *dst, gnrc_pktsnip_t *ext_opts) |
| Send pre-compiled neighbor solicitation depending on a given network interface. More... | |
| void | gnrc_ndp_nbr_adv_send (const ipv6_addr_t *tgt, gnrc_netif_t *netif, const ipv6_addr_t *dst, bool supply_tl2a, gnrc_pktsnip_t *ext_opts) |
| Send pre-compiled neighbor advertisement depending on a given network interface. More... | |
| void | gnrc_ndp_rtr_sol_send (gnrc_netif_t *netif, const ipv6_addr_t *dst) |
| Send pre-compiled router solicitation depending on a given network interface. More... | |
| void | gnrc_ndp_rtr_adv_send (gnrc_netif_t *netif, const ipv6_addr_t *src, const ipv6_addr_t *dst, bool fin, gnrc_pktsnip_t *ext_opts) |
| Send pre-compiled router advertisement depending on a given network interface. More... | |
| gnrc_pktsnip_t* gnrc_ndp_nbr_adv_build | ( | const ipv6_addr_t * | tgt, |
| uint8_t | flags, | ||
| gnrc_pktsnip_t * | options | ||
| ) |
Builds a neighbor advertisement message for sending.
(tgt != NULL) && !ipv6_addr_is_multicast(tgt)| [in] | tgt | For solicited advertisements, the Target Address field in the neighbor solicitaton. For and unsolicited advertisement, the address whose link-layer address has changed. Must not be NULL or a multicast address. |
| [in] | flags | Neighbor advertisement flags:
|
| [in] | options | Options to append to the neighbor advertisement. May be NULL for none. |
| void gnrc_ndp_nbr_adv_send | ( | const ipv6_addr_t * | tgt, |
| gnrc_netif_t * | netif, | ||
| const ipv6_addr_t * | dst, | ||
| bool | supply_tl2a, | ||
| gnrc_pktsnip_t * | ext_opts | ||
| ) |
Send pre-compiled neighbor advertisement depending on a given network interface.
(tgt != NULL) && !ipv6_addr_is_multicast(tgt) (netif != NULL) && (dst != NULL)If netif is a forwarding interface and router advertisements are activated the NDP_NBR_ADV_FLAGS_R is set in the neighbor advertisement. If dst is IPV6_ADDR_UNSPECIFIED it will be replaced with IPV6_ADDR_ALL_NODES_LINK_LOCAL and* supply_tl2a is set to true implicitly. Otherwise, the NDP_NBR_ADV_FLAGS_S will be set. If tgt is an anycast address on netif the NDP_NBR_ADV_FLAGS_O flag will be set.
The source address of the IPv6 packet will be left unspecified, so the IPv6 module selects a fitting IPv6 address.
| [in] | tgt | Target address for the neighbor advertisement. May not be NULL and MUST NOT be multicast. |
| [in] | netif | Interface to send over. Must not be NULL. |
| [in] | dst | Destination address for neighbor advertisement. May not be NULL. Is set to IPV6_ADDR_ALL_NODES_LINK_LOCAL when equal to IPV6_ADDR_UNSPECIFIED (to allow for simple reply mechanisms to neighbor solicitations). This also implies that supply_tl2a must be true and the parameter will be reset accordingly. If dst is not IPV6_ADDR_UNSPECIFIED, the NDP_NBR_ADV_FLAGS_S flag will be set implicitly. |
| [in] | supply_tl2a | Add target link-layer address option to neighbor advertisement if link-layer has addresses. If dst is IPV6_ADDR_UNSPECIFIED, it will be set to true. |
| [in] | ext_opts | External options for the neighbor advertisement. Leave NULL for none. Warning: these are not tested if they are suitable for a neighbor advertisement so be sure to check that. Will be released in an error case. |
| gnrc_pktsnip_t* gnrc_ndp_nbr_sol_build | ( | const ipv6_addr_t * | tgt, |
| gnrc_pktsnip_t * | options | ||
| ) |
Builds a neighbor solicitation message for sending.
(tgt != NULL) && !ipv6_addr_is_multicast(tgt)| [in] | tgt | The target address of the neighbor solicitation. Must not be NULL or a multicast address. |
| [in] | options | Options to append to the neighbor solicitation. May be NULL for none. |
| void gnrc_ndp_nbr_sol_send | ( | const ipv6_addr_t * | tgt, |
| gnrc_netif_t * | netif, | ||
| const ipv6_addr_t * | src, | ||
| const ipv6_addr_t * | dst, | ||
| gnrc_pktsnip_t * | ext_opts | ||
| ) |
Send pre-compiled neighbor solicitation depending on a given network interface.
(tgt != NULL) && !ipv6_addr_is_multicast(tgt) (netif != NULL) && (dst != NULL)| [in] | tgt | The target address of the neighbor solicitation. Must not be NULL or a multicast address. |
| [in] | netif | Interface to send over. Must not be NULL. |
| [in] | src | Source address for the neighbor solicitation. Will be chosen from the interface according to dst, if NULL. |
| [in] | dst | Destination address for neighbor solicitation. Must not be NULL. |
| [in] | ext_opts | External options for the neighbor advertisement. Leave NULL for none. Warning: these are not tested if they are suitable for a neighbor solicitation so be sure to check that. Will be released in an error case. |
| gnrc_pktsnip_t* gnrc_ndp_opt_build | ( | uint8_t | type, |
| size_t | size, | ||
| gnrc_pktsnip_t * | next | ||
| ) |
Builds a generic NDP option.
| [in] | type | Type of the option. |
| [in] | size | Size in byte of the option (will be rounded up to the next multiple of 8). |
| [in] | next | More options in the packet. NULL, if there are none. |
| gnrc_pktsnip_t* gnrc_ndp_opt_mtu_build | ( | uint32_t | mtu, |
| gnrc_pktsnip_t * | next | ||
| ) |
Builds the MTU option.
| [in] | mtu | The recommended MTU for the link. |
| [in] | next | More options in the packet. NULL, if there are none. |
| gnrc_pktsnip_t* gnrc_ndp_opt_pi_build | ( | const ipv6_addr_t * | prefix, |
| uint8_t | prefix_len, | ||
| uint32_t | valid_ltime, | ||
| uint32_t | pref_ltime, | ||
| uint8_t | flags, | ||
| gnrc_pktsnip_t * | next | ||
| ) |
Builds the prefix information option.
prefix != NULL !ipv6_addr_is_link_local(prefix) && !ipv6_addr_is_multicast(prefix) prefix_len <= 128| [in] | prefix | An IPv6 address or a prefix of an IPv6 address. Must not be NULL or be a link-local or multicast address. |
| [in] | prefix_len | The length of prefix in bits. Must be between 0 and 128. |
| [in] | valid_ltime | Length of time in seconds that prefix is valid. UINT32_MAX represents infinity. |
| [in] | pref_ltime | Length of time in seconds that addresses using prefix remain preferred. UINT32_MAX represents infinity. |
| [in] | flags | Flags as defined in net/ndp.h.
|
| [in] | next | More options in the packet. NULL, if there are none. |
| gnrc_pktsnip_t* gnrc_ndp_opt_rdnss_build | ( | uint32_t | lifetime, |
| ipv6_addr_t * | addrs, | ||
| unsigned | addrs_num, | ||
| gnrc_pktsnip_t * | next | ||
| ) |
Builts the recursive DNS server option.
addrs != NULL addrs_num > 0| [in] | lifetime | The lifetime of the recursive DNS servers |
| [in] | addrs | The addresses of the recursive DNS servers |
| [in] | addrs_num | The number of addresses in addrs |
| [in] | next | More options in the packet. NULL, if there are none. |
next, if RDNSS is not supported | gnrc_pktsnip_t* gnrc_ndp_opt_ri_build | ( | const ipv6_addr_t * | prefix, |
| uint8_t | prefix_len, | ||
| uint32_t | route_ltime, | ||
| uint8_t | flags, | ||
| gnrc_pktsnip_t * | next | ||
| ) |
Builds the route information option.
prefix != NULL !ipv6_addr_is_link_local(prefix) && !ipv6_addr_is_multicast(prefix) prefix_len <= 128| [in] | prefix | An IPv6 address or a prefix of an IPv6 address. Must not be NULL or be a link-local or multicast address. |
| [in] | prefix_len | The length of prefix in bits. Must be between 0 and 128. |
| [in] | route_ltime | Length of time in seconds that prefix is valid. UINT32_MAX represents infinity. |
| [in] | flags | Flags as defined in net/ndp.h. |
| [in] | next | More options in the packet. NULL, if there are none. |
| gnrc_pktsnip_t* gnrc_ndp_opt_sl2a_build | ( | const uint8_t * | l2addr, |
| uint8_t | l2addr_len, | ||
| gnrc_pktsnip_t * | next | ||
| ) |
Builds the source link-layer address option.
(l2addr != NULL) && (l2addr_len != 0)| [in] | l2addr | A link-layer address of variable length. Must not be NULL. |
| [in] | l2addr_len | Length of l2addr. Must not be 0. |
| [in] | next | More options in the packet. NULL, if there are none. |
| gnrc_pktsnip_t* gnrc_ndp_opt_tl2a_build | ( | const uint8_t * | l2addr, |
| uint8_t | l2addr_len, | ||
| gnrc_pktsnip_t * | next | ||
| ) |
Builds the target link-layer address option.
(l2addr != NULL) && (l2addr_len != 0)| [in] | l2addr | A link-layer address of variable length. Must not be NULL. |
| [in] | l2addr_len | Length of l2addr. Must not be 0. |
| [in] | next | More options in the packet. NULL, if there are none. |
| gnrc_pktsnip_t* gnrc_ndp_rtr_adv_build | ( | uint8_t | cur_hl, |
| uint8_t | flags, | ||
| uint16_t | ltime, | ||
| uint32_t | reach_time, | ||
| uint32_t | retrans_timer, | ||
| gnrc_pktsnip_t * | options | ||
| ) |
Builds a router advertisement message for sending.
| [in] | cur_hl | Default hop limit for outgoing IP packets, 0 if unspecified by this router. |
| [in] | flags | Flags as defined in net/ndp.h.
|
| [in] | ltime | Lifetime of the default router in seconds. |
| [in] | reach_time | Time in milliseconds a node should assume a neighbor reachable. 0 means unspecified by the router. |
| [in] | retrans_timer | Time in milliseconds between retransmitted neighbor solicitations. 0 means unspecified by the router. |
| [in] | options | Options to append to the router advertisement. May be NULL for none. |
| void gnrc_ndp_rtr_adv_send | ( | gnrc_netif_t * | netif, |
| const ipv6_addr_t * | src, | ||
| const ipv6_addr_t * | dst, | ||
| bool | fin, | ||
| gnrc_pktsnip_t * | ext_opts | ||
| ) |
Send pre-compiled router advertisement depending on a given network interface.
(netif != NULL)This function does not add the PIOs to the router, since they are highly dependent on external set-ups (e.g. if multihop prefix distribution is used). Provide them via ext_opts
| [in] | netif | Interface to send over. Must not be NULL. |
| [in] | src | Source address for the router advertisement. May be NULL to be determined by source address selection (:: if netif has no address). |
| [in] | dst | Destination address for router advertisement. ff02::1 if NULL. |
| [in] | fin | This is part of the router's final batch of router advertisements before ceising to be a router (set's router lifetime field to 0). |
| [in] | ext_opts | External options for the neighbor advertisement. Leave NULL for none. Warning: these are not tested if they are suitable for a neighbor advertisement so be sure to check that. Will be released in an error case. |
| gnrc_pktsnip_t* gnrc_ndp_rtr_sol_build | ( | gnrc_pktsnip_t * | options | ) |
Builds a router solicitation message for sending.
| [in] | options | Options to append to the router solicitation. May be NULL for none. |
| void gnrc_ndp_rtr_sol_send | ( | gnrc_netif_t * | netif, |
| const ipv6_addr_t * | dst | ||
| ) |
Send pre-compiled router solicitation depending on a given network interface.
(netif != NULL)| [in] | netif | Interface to send over. Must not be NULL. |
| [in] | dst | Destination for the router solicitation. ff02::2 if NULL. |