mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-25 22:43:50 +01:00
Merge pull request #21256 from benpicco/sys/net/gnrc-fixes
gnrc/ipv6/nib: improve debug output, declutter code
This commit is contained in:
commit
7e7af30de9
@ -1078,11 +1078,13 @@ static int _create_candidate_set(const gnrc_netif_t *netif,
|
||||
* (so don't consider tentative addresses for source address
|
||||
* selection) */
|
||||
gnrc_netif_ipv6_addr_dad_trans(netif, i)) {
|
||||
DEBUG(" -> skip tentative address\n");
|
||||
continue;
|
||||
}
|
||||
/* Check if we only want link local addresses */
|
||||
if (ll_only && !ipv6_addr_is_link_local(tmp)) {
|
||||
continue;
|
||||
DEBUG(" -> skip non link-local address\n");
|
||||
continue;
|
||||
}
|
||||
/* "For all multicast and link-local destination addresses, the set of
|
||||
* candidate source addresses MUST only include addresses assigned to
|
||||
@ -1743,12 +1745,10 @@ static void _process_events_await_msg(gnrc_netif_t *netif, msg_t *msg)
|
||||
|
||||
/* First drain the queues before blocking the thread */
|
||||
/* Events will be handled before messages */
|
||||
DEBUG("gnrc_netif: handling events\n");
|
||||
event_t *evp;
|
||||
/* We can not use event_loop() or event_wait() because then we would not
|
||||
* wake up when a message arrives */
|
||||
while ((evp = _gnrc_netif_fetch_event(netif))) {
|
||||
DEBUG("gnrc_netif: event %p\n", (void *)evp);
|
||||
if (evp->handler) {
|
||||
evp->handler(evp);
|
||||
}
|
||||
@ -1758,7 +1758,6 @@ static void _process_events_await_msg(gnrc_netif_t *netif, msg_t *msg)
|
||||
if (msg_waiting > 0) {
|
||||
return;
|
||||
}
|
||||
DEBUG("gnrc_netif: waiting for events\n");
|
||||
/* Block the thread until something interesting happens */
|
||||
thread_flags_wait_any(THREAD_FLAG_MSG_WAITING | THREAD_FLAG_EVENT);
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
/**
|
||||
|
||||
@ -202,7 +202,9 @@ static gnrc_pktsnip_t *_add_rio(gnrc_netif_t *netif, gnrc_pktsnip_t *ext_opts, b
|
||||
|
||||
if (local_pfx || (offl && routed_pfx)) {
|
||||
|
||||
DEBUG("nib: adding downstream subnet to RA\n");
|
||||
DEBUG("nib: adding downstream subnet %s/%u to RA on %u\n",
|
||||
ipv6_addr_to_str(addr_str, &entry->pfx, sizeof(addr_str)),
|
||||
entry->pfx_len, netif->pid);
|
||||
uint32_t valid_ltime = (entry->valid_until == UINT32_MAX) ? UINT32_MAX :
|
||||
((entry->valid_until - now) / MS_PER_SEC);
|
||||
gnrc_pktsnip_t *snip = gnrc_ndp_opt_ri_build(&entry->pfx,
|
||||
|
||||
@ -552,14 +552,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);
|
||||
/** @} */
|
||||
@ -688,8 +683,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);
|
||||
@ -789,9 +784,8 @@ static void _handle_rtr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6,
|
||||
}
|
||||
else {
|
||||
dr = _nib_drl_get(&ipv6->src, netif->pid);
|
||||
|
||||
DEBUG("nib: router lifetime was 0. Removing router and routes via it.");
|
||||
if (dr != NULL) {
|
||||
DEBUG("nib: router lifetime was 0. Removing router and routes via it.\n");
|
||||
_handle_rtr_timeout(dr);
|
||||
}
|
||||
dr = NULL;
|
||||
@ -844,15 +838,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 */
|
||||
@ -1702,13 +1690,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;
|
||||
@ -1764,11 +1747,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;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user