1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-30 00:41:17 +01:00

gnrc/ipv6/nib: declutter _handle_pio()

This commit is contained in:
Benjamin Valentin 2025-02-27 15:36:54 +01:00
parent 1aec7f1113
commit 0dc21232b0
2 changed files with 2 additions and 19 deletions

View File

@ -845,6 +845,7 @@ _nib_offl_entry_t *_nib_abr_iter_pfx(const _nib_abr_entry_t *abr,
_nib_abr_entry_t *_nib_abr_iter(const _nib_abr_entry_t *last);
#else
#define _nib_abr_iter(abr) NULL
#define _nib_abr_add_pfx(abr, pfx) (void)abr
#endif
/**

View File

@ -543,14 +543,9 @@ static void _handle_mtuo(gnrc_netif_t *netif, const icmpv6_hdr_t *icmpv6,
static uint32_t _handle_rdnsso(gnrc_netif_t *netif, const icmpv6_hdr_t *icmpv6,
const ndp_opt_rdnss_impl_t *rdnsso);
#endif
#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C)
static uint32_t _handle_pio(gnrc_netif_t *netif, const icmpv6_hdr_t *icmpv6,
const ndp_opt_pi_t *pio,
_nib_abr_entry_t *abr);
#else /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C */
static uint32_t _handle_pio(gnrc_netif_t *netif, const icmpv6_hdr_t *icmpv6,
const ndp_opt_pi_t *pio);
#endif /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C */
static uint32_t _handle_rio(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6,
const ndp_opt_ri_t *pio);
/** @} */
@ -679,8 +674,8 @@ static void _handle_rtr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6,
#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C)
sixlowpan_nd_opt_abr_t *abro = NULL;
_nib_abr_entry_t *abr = NULL;
#endif /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C */
_nib_abr_entry_t *abr = NULL;
uint32_t next_timeout = UINT32_MAX;
assert(netif != NULL);
@ -835,15 +830,9 @@ static void _handle_rtr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6,
break;
case NDP_OPT_PI: {
uint32_t min_pfx_timeout;
#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C)
min_pfx_timeout = _handle_pio(netif,
(const icmpv6_hdr_t *)rtr_adv,
(ndp_opt_pi_t *)opt, abr);
#else /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C */
min_pfx_timeout = _handle_pio(netif,
(const icmpv6_hdr_t *)rtr_adv,
(ndp_opt_pi_t *)opt);
#endif /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C */
next_timeout = _min(next_timeout, min_pfx_timeout);
/* notify optional PIO consumer */
@ -1693,13 +1682,8 @@ static inline bool _multihop_p6c(gnrc_netif_t *netif, _nib_abr_entry_t *abr)
#define _multihop_p6c(netif, abr) (false)
#endif /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C */
#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C)
static uint32_t _handle_pio(gnrc_netif_t *netif, const icmpv6_hdr_t *icmpv6,
const ndp_opt_pi_t *pio, _nib_abr_entry_t *abr)
#else /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C */
static uint32_t _handle_pio(gnrc_netif_t *netif, const icmpv6_hdr_t *icmpv6,
const ndp_opt_pi_t *pio)
#endif /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C */
{
uint32_t valid_ltime;
uint32_t pref_ltime;
@ -1755,11 +1739,9 @@ static uint32_t _handle_pio(gnrc_netif_t *netif, const icmpv6_hdr_t *icmpv6,
}
if ((pfx = _nib_pl_add(netif->pid, &pio->prefix, pio->prefix_len,
valid_ltime, pref_ltime))) {
#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C)
if (abr != NULL) {
_nib_abr_add_pfx(abr, pfx);
}
#endif /* CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C */
if (pio->flags & NDP_OPT_PI_FLAGS_L) {
pfx->flags |= _PFX_ON_LINK;
}