1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #17814 from fabian18/bugfix_nib_sllao_in_NS_6LR

ipv6/nib: bugfix handle SLLAO on 6LR if ARO is not present
This commit is contained in:
fabian18 2022-04-18 17:54:04 +02:00 committed by GitHub
commit 5643b52879
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 23 deletions

View File

@ -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;
assert(aro);
uint8_t status = _handle_aro(netif, ipv6, (icmpv6_hdr_t *)nbr_sol, aro,
sl2ao, 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");
}
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 */
}
#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 */
return reply_aro;
}
#else /* CONFIG_GNRC_IPV6_NIB_6LR */

View File

@ -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

View File

@ -1007,7 +1007,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;
@ -1029,7 +1028,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,
@ -1047,7 +1046,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);