1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-24 22:13:52 +01:00

gnrc_ndp_internal: add capability to add external options to NAs

This commit is contained in:
Martine Lenders 2015-08-30 22:39:11 +02:00 committed by Martine Lenders
parent 27148ed0b3
commit a913c01e99
2 changed files with 11 additions and 7 deletions

View File

@ -80,9 +80,13 @@ void gnrc_ndp_internal_send_nbr_sol(kernel_pid_t iface, ipv6_addr_t *tgt,
* not be NULL.
* @param[in] supply_tl2a Add target link-layer address option to neighbor
* advertisement if link-layer has addresses.
* @param[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.
*/
void gnrc_ndp_internal_send_nbr_adv(kernel_pid_t iface, ipv6_addr_t *tgt,
ipv6_addr_t *dst, bool supply_tl2a);
void gnrc_ndp_internal_send_nbr_adv(kernel_pid_t iface, ipv6_addr_t *tgt, ipv6_addr_t *dst,
bool supply_tl2a, gnrc_pktsnip_t *ext_opts);
/**
* @brief Handles a SL2A option.

View File

@ -149,10 +149,10 @@ void gnrc_ndp_internal_set_state(gnrc_ipv6_nc_t *nc_entry, uint8_t state)
}
}
void gnrc_ndp_internal_send_nbr_adv(kernel_pid_t iface, ipv6_addr_t *tgt,
ipv6_addr_t *dst, bool supply_tl2a)
void gnrc_ndp_internal_send_nbr_adv(kernel_pid_t iface, ipv6_addr_t *tgt, ipv6_addr_t *dst,
bool supply_tl2a, gnrc_pktsnip_t *ext_opts)
{
gnrc_pktsnip_t *hdr, *pkt = NULL;
gnrc_pktsnip_t *hdr, *pkt = ext_opts;
uint8_t adv_flags = 0;
DEBUG("ndp internal: send neighbor advertisement (iface: %" PRIkernel_pid ", tgt: %s, ",
@ -179,11 +179,11 @@ void gnrc_ndp_internal_send_nbr_adv(kernel_pid_t iface, ipv6_addr_t *tgt,
if (l2src_len > 0) {
/* add target address link-layer address option */
pkt = gnrc_ndp_opt_tl2a_build(l2src, l2src_len, NULL);
pkt = gnrc_ndp_opt_tl2a_build(l2src, l2src_len, pkt);
if (pkt == NULL) {
DEBUG("ndp internal: error allocating Target Link-layer address option.\n");
gnrc_pktbuf_release(pkt);
gnrc_pktbuf_release(ext_opts);
return;
}
}