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

gnrc/ipv6_auto_subnets: unicast RA if upstream is 6lo

This commit is contained in:
Benjamin Valentin 2024-12-11 19:23:53 +01:00
parent 24a1417b31
commit c5c8482b4d
2 changed files with 13 additions and 7 deletions

View File

@ -849,8 +849,9 @@ static void _handle_rtr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6,
/* notify optional PIO consumer */
if (IS_USED(MODULE_GNRC_IPV6_NIB_RTR_ADV_PIO_CB)) {
extern void gnrc_ipv6_nib_rtr_adv_pio_cb(gnrc_netif_t *netif,
const ndp_opt_pi_t *pio);
gnrc_ipv6_nib_rtr_adv_pio_cb(netif, (ndp_opt_pi_t *)opt);
const ndp_opt_pi_t *pio,
const ipv6_addr_t *src);
gnrc_ipv6_nib_rtr_adv_pio_cb(netif, (ndp_opt_pi_t *)opt, &ipv6->src);
}
break;
}

View File

@ -404,7 +404,7 @@ static bool _remove_old_prefix(gnrc_netif_t *netif,
}
static void _configure_subnets(uint8_t subnets, uint8_t start_idx, gnrc_netif_t *upstream,
const ndp_opt_pi_t *pio)
const ndp_opt_pi_t *pio, const ipv6_addr_t *src)
{
gnrc_netif_t *downstream = NULL;
gnrc_pktsnip_t *ext_opts = NULL;
@ -490,13 +490,14 @@ static void _configure_subnets(uint8_t subnets, uint8_t start_idx, gnrc_netif_t
/* immediately send an RA with RIO */
if (ext_opts) {
gnrc_ndp_rtr_adv_send(upstream, NULL, NULL, true, ext_opts);
gnrc_ndp_rtr_adv_send(upstream, NULL, src, true, ext_opts);
} else {
DEBUG("auto_subnets: Options empty, not sending RA\n");
}
}
void gnrc_ipv6_nib_rtr_adv_pio_cb(gnrc_netif_t *upstream, const ndp_opt_pi_t *pio)
void gnrc_ipv6_nib_rtr_adv_pio_cb(gnrc_netif_t *upstream, const ndp_opt_pi_t *pio,
const ipv6_addr_t *src)
{
/* create a subnet for each downstream interface */
unsigned subnets = gnrc_netif_numof() - 1;
@ -515,8 +516,12 @@ void gnrc_ipv6_nib_rtr_adv_pio_cb(gnrc_netif_t *upstream, const ndp_opt_pi_t *pi
}
#if IS_USED(MODULE_GNRC_IPV6_AUTO_SUBNETS_SIMPLE)
/* 'don't broadcast RA if we are a 6lo node - unicast allows l2 retransmissions */
if (!gnrc_netif_is_6ln(upstream)) {
src = NULL;
}
/* if we are the only router on this bus, we can directly choose a prefix */
_configure_subnets(subnets, 0, upstream, pio);
_configure_subnets(subnets, 0, upstream, pio, src);
#else
/* store PIO information for later use */
@ -689,7 +694,7 @@ static void _process_pio_cache(uint8_t subnets, uint8_t idx_start, gnrc_netif_t
}
/* use PIO for prefix configuration */
_configure_subnets(subnets, idx_start, upstream, &_pio_cache[i]);
_configure_subnets(subnets, idx_start, upstream, &_pio_cache[i], NULL);
/* invalidate entry */
_pio_cache[i].len = 0;