Skip to content

Commit

Permalink
Merge pull request #3747 from authmillenon/gnrc_ndp_internal/api/ext-…
Browse files Browse the repository at this point in the history
…opts

gnrc_ndp_internal: add capability to add external options to NAs
  • Loading branch information
cgundogan committed Aug 31, 2015
2 parents 27148ed + 82924c6 commit d1a0247
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
8 changes: 6 additions & 2 deletions sys/include/net/gnrc/ndp/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions sys/net/gnrc/network_layer/ndp/gnrc_ndp.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ void gnrc_ndp_nbr_sol_handle(kernel_pid_t iface, gnrc_pktsnip_t *pkt,
sicmpv6_size -= (opt->len * 8);
}

gnrc_ndp_internal_send_nbr_adv(iface, tgt, &ipv6->src,
ipv6_addr_is_multicast(&ipv6->dst));
gnrc_ndp_internal_send_nbr_adv(iface, tgt, &ipv6->src, ipv6_addr_is_multicast(&ipv6->dst),
NULL);

return;
}
Expand Down
10 changes: 5 additions & 5 deletions sys/net/gnrc/network_layer/ndp/internal/gnrc_ndp_internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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, ",
Expand All @@ -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;
}
}
Expand Down

0 comments on commit d1a0247

Please sign in to comment.