Browse Source

netif: ndp: gnrc_ipv6_netif_t::retrans_timer -> uint32_t

cc430
Cenk Gündoğan 7 years ago
parent
commit
5aaea3879f
  1. 2
      sys/include/net/gnrc/ipv6/netif.h
  2. 10
      sys/net/gnrc/network_layer/ndp/gnrc_ndp.c
  3. 16
      sys/net/gnrc/network_layer/ndp/internal/gnrc_ndp_internal.c
  4. 4
      sys/net/gnrc/network_layer/ndp/node/gnrc_ndp_node.c

2
sys/include/net/gnrc/ipv6/netif.h

@ -338,7 +338,7 @@ typedef struct {
* neighbor.
* The default value is @ref GNRC_NDP_RETRANS_TIMER.
*/
timex_t retrans_timer;
uint32_t retrans_timer;
xtimer_t rtr_sol_timer; /**< Timer for periodic router solicitations */
msg_t rtr_sol_msg; /**< msg_t for gnrc_ipv6_netif_t::rtr_sol_timer */
#if defined (MODULE_GNRC_NDP_ROUTER) || defined (MODULE_GNRC_SIXLOWPAN_ND_ROUTER)

10
sys/net/gnrc/network_layer/ndp/gnrc_ndp.c

@ -540,8 +540,7 @@ void gnrc_ndp_rtr_adv_handle(kernel_pid_t iface, gnrc_pktsnip_t *pkt, ipv6_hdr_t
}
/* set retransmission timer from message */
if (rtr_adv->retrans_timer.u32 != 0) {
if_entry->retrans_timer = timex_set(0, byteorder_ntohl(rtr_adv->retrans_timer));
timex_normalize(&if_entry->retrans_timer);
if_entry->retrans_timer = byteorder_ntohl(rtr_adv->retrans_timer);
}
mutex_unlock(&if_entry->mutex);
sicmpv6_size -= sizeof(ndp_rtr_adv_t);
@ -673,9 +672,7 @@ void gnrc_ndp_retrans_nbr_sol(gnrc_ipv6_nc_t *nc_entry)
gnrc_ndp_internal_send_nbr_sol(nc_entry->iface, NULL, &nc_entry->ipv6_addr, &dst);
mutex_lock(&ipv6_iface->mutex);
gnrc_ndp_internal_reset_nbr_sol_timer(nc_entry, (uint32_t) timex_uint64(
ipv6_iface->retrans_timer
),
gnrc_ndp_internal_reset_nbr_sol_timer(nc_entry, ipv6_iface->retrans_timer,
GNRC_NDP_MSG_NBR_SOL_RETRANS, gnrc_ipv6_pid);
mutex_unlock(&ipv6_iface->mutex);
}
@ -722,8 +719,7 @@ void gnrc_ndp_netif_add(gnrc_ipv6_netif_t *iface)
/* set default values */
mutex_lock(&iface->mutex);
_set_reach_time(iface, GNRC_NDP_REACH_TIME);
iface->retrans_timer = timex_set(0, GNRC_NDP_RETRANS_TIMER);
timex_normalize(&iface->retrans_timer);
iface->retrans_timer = GNRC_NDP_RETRANS_TIMER;
mutex_unlock(&iface->mutex);
}

16
sys/net/gnrc/network_layer/ndp/internal/gnrc_ndp_internal.c

@ -122,18 +122,14 @@ void gnrc_ndp_internal_set_state(gnrc_ipv6_nc_t *nc_entry, uint8_t state)
ipv6_iface = gnrc_ipv6_netif_get(nc_entry->iface);
nc_entry->probes_remaining = GNRC_NDP_MAX_UC_NBR_SOL_NUMOF;
DEBUG("PROBE (probe with %" PRIu8 " unicast NS every %" PRIu32
".%06" PRIu32 " seconds)\n", nc_entry->probes_remaining,
ipv6_iface->retrans_timer.seconds,
ipv6_iface->retrans_timer.microseconds);
DEBUG("PROBE (probe with %" PRIu8 " unicast NS every %" PRIu32 " us)\n",
nc_entry->probes_remaining, ipv6_iface->retrans_timer);
gnrc_ndp_internal_send_nbr_sol(nc_entry->iface, NULL, &nc_entry->ipv6_addr,
&nc_entry->ipv6_addr);
mutex_lock(&ipv6_iface->mutex);
gnrc_ndp_internal_reset_nbr_sol_timer(nc_entry, (uint32_t) timex_uint64(
ipv6_iface->retrans_timer
),
gnrc_ndp_internal_reset_nbr_sol_timer(nc_entry, ipv6_iface->retrans_timer,
GNRC_NDP_MSG_NBR_SOL_RETRANS, gnrc_ipv6_pid);
mutex_unlock(&ipv6_iface->mutex);
break;
@ -557,11 +553,7 @@ void gnrc_ndp_internal_send_rtr_adv(kernel_pid_t iface, ipv6_addr_t *src, ipv6_a
}
}
if (ipv6_iface->flags & GNRC_IPV6_NETIF_FLAGS_ADV_RETRANS_TIMER) {
uint64_t tmp = timex_uint64(ipv6_iface->retrans_timer) / MS_IN_USEC;
if (tmp > UINT32_MAX) {
tmp = UINT32_MAX;
}
retrans_timer = (uint32_t)tmp;
retrans_timer = ipv6_iface->retrans_timer / MS_IN_USEC;
}
if (!fin) {
adv_ltime = ipv6_iface->adv_ltime;

4
sys/net/gnrc/network_layer/ndp/node/gnrc_ndp_node.c

@ -180,9 +180,7 @@ kernel_pid_t gnrc_ndp_node_next_hop_l2addr(uint8_t *l2addr, uint8_t *l2addr_len,
gnrc_ndp_internal_send_nbr_sol(iface, NULL, next_hop_ip, &dst_sol);
mutex_lock(&ipv6_iface->mutex);
gnrc_ndp_internal_reset_nbr_sol_timer(nc_entry, (uint32_t) timex_uint64(
ipv6_iface->retrans_timer
),
gnrc_ndp_internal_reset_nbr_sol_timer(nc_entry, ipv6_iface->retrans_timer,
GNRC_NDP_MSG_NBR_SOL_RETRANS, gnrc_ipv6_pid);
mutex_unlock(&ipv6_iface->mutex);
}

Loading…
Cancel
Save