Skip to content
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

ipv6/nib: bugfix handle SLLAO on 6LR if ARO is not present #17814

Merged
merged 1 commit into from
Apr 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 17 additions & 19 deletions sys/net/gnrc/network_layer/ipv6/nib/_nib-6lr.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,28 +136,26 @@ gnrc_pktsnip_t *_copy_and_handle_aro(gnrc_netif_t *netif,
const ndp_opt_t *sl2ao)
{
gnrc_pktsnip_t *reply_aro = NULL;

if (aro != NULL) {
uint8_t status = _handle_aro(netif, ipv6, (icmpv6_hdr_t *)nbr_sol, aro,
sl2ao, NULL);

if ((status != _ADDR_REG_STATUS_TENTATIVE) &&
(status != _ADDR_REG_STATUS_IGNORE)) {
reply_aro = gnrc_sixlowpan_nd_opt_ar_build(status,
byteorder_ntohs(aro->ltime),
(eui64_t *)&aro->eui64,
NULL);
if (reply_aro == NULL) {
DEBUG("nib: No space left in packet buffer. Not replying NS");
}
assert(aro);
uint8_t status = _handle_aro(netif, ipv6, (icmpv6_hdr_t *)nbr_sol, aro,
sl2ao, NULL);

if ((status != _ADDR_REG_STATUS_TENTATIVE) &&
(status != _ADDR_REG_STATUS_IGNORE)) {
reply_aro = gnrc_sixlowpan_nd_opt_ar_build(status,
byteorder_ntohs(aro->ltime),
(eui64_t *)&aro->eui64,
NULL);
if (reply_aro == NULL) {
DEBUG("nib: No space left in packet buffer. Not replying NS");
}
}
#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_DAD)
else if (status != _ADDR_REG_STATUS_IGNORE) {
DEBUG("nib: Address was marked TENTATIVE => not replying NS, "
"waiting for DAC\n");
}
#endif /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_DAD */
else if (status != _ADDR_REG_STATUS_IGNORE) {
DEBUG("nib: Address was marked TENTATIVE => not replying NS, "
"waiting for DAC\n");
}
#endif /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_DAD */
return reply_aro;
}
#else /* CONFIG_GNRC_IPV6_NIB_6LR */
Expand Down
2 changes: 1 addition & 1 deletion sys/net/gnrc/network_layer/ipv6/nib/_nib-6lr.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ uint8_t _reg_addr_upstream(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6,
* @param[in] nbr_sol The neighbor solicitation carrying the original ARO
* (handed over as @ref icmpv6_hdr_t, since it is just
* handed to @ref _handle_aro()).
* @param[in] aro The original ARO
* @param[in] aro The original ARO, must not be NULL
* @param[in] sl2ao SL2AO associated with the ARO.
*
* @return registration status of the address (including
Expand Down
16 changes: 13 additions & 3 deletions sys/net/gnrc/network_layer/ipv6/nib/nib.c
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,6 @@ static void _handle_nbr_sol(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6,
gnrc_ndp_nbr_adv_send(&nbr_sol->tgt, netif, &ipv6->src, false, NULL);
}
else {
gnrc_pktsnip_t *reply_aro = NULL;
#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LR)
ndp_opt_t *sl2ao = NULL;
sixlowpan_nd_opt_ar_t *aro = NULL;
Expand All @@ -1027,7 +1026,7 @@ static void _handle_nbr_sol(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6,
if (gnrc_netif_is_6lr(netif)) {
DEBUG("nib: Storing SL2AO for later handling\n");
sl2ao = opt;
break;
break; /* SL2AO is handled below together with an ARO */
}
#endif /* CONFIG_GNRC_IPV6_NIB_6LR */
_handle_sl2ao(netif, ipv6, (const icmpv6_hdr_t *)nbr_sol,
Expand All @@ -1045,7 +1044,18 @@ static void _handle_nbr_sol(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6,
break;
}
}
reply_aro = _copy_and_handle_aro(netif, ipv6, nbr_sol, aro, sl2ao);
gnrc_pktsnip_t *reply_aro = NULL;
if (aro && sl2ao) {
/* If no SLLAO is included, then any included ARO is ignored. */
if (!(reply_aro = _copy_and_handle_aro(netif, ipv6, nbr_sol, aro, sl2ao))) {
/* If the Length field is not two, or if the Status field is not zero,
then the NS is silently ignored.*/
return;
}
}
else if (sl2ao) {
_handle_sl2ao(netif, ipv6, (const icmpv6_hdr_t *)nbr_sol, sl2ao);
}
/* check if target address is anycast */
if (netif->ipv6.addrs_flags[tgt_idx] & GNRC_NETIF_IPV6_ADDRS_FLAGS_ANYCAST) {
_send_delayed_nbr_adv(netif, &nbr_sol->tgt, ipv6, reply_aro);
Expand Down