-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gnrc_ndp_internal: add capability to add external options to NAs #3747
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shouldn't There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the other hand: the releases of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm, then I would opt for a good documentation for now, stating that |
||
return; | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so this
in
might need to be anin,out
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't change it really, so no. But I'll document, that it will be released in an error case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for the record: will
ext_ops
beNULL
if it gets released due to an error? If not, I would also want you to add a return value tognrc_ndp_internal_send_nbr_adv
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No it will not. To be honest: this functionality is just used at one part in the 6LoWPAN-ND (on handling NSs) and it's at the very end of the function. I just throw it in there and don't care for the result (because I don't use it afterwards). If you see a real use-case where we need a return value, I will a return value, otherwise I see it as a waste of resources (RAM, ROM and my time ;-P)