[riot-notifications] [RIOT] gnrc_ndp_host: Initial import of host behavior of router discovery (#3746)

Oleg Hahm notifications at github.com
Wed Sep 2 16:52:13 CEST 2015


> +    }
> +    /* set current hop limit from message if available */
> +    if (rtr_adv->cur_hl != 0) {
> +        if_entry->cur_hl = rtr_adv->cur_hl;
> +    }
> +    /* set flags from message */
> +    if_entry->flags &= 0x3f;
> +    if_entry->flags |= (rtr_adv->flags & (0xc0));
> +    /* set reachable time from message if it is not the same as the random base
> +     * value */
> +    if ((rtr_adv->reach_time.u32 != 0) &&
> +        (if_entry->reach_time_base != byteorder_ntohl(rtr_adv->reach_time))) {
> +        /* calculate new random reachable time */
> +        uint32_t reach_time = genrand_uint32_range(GNRC_NDP_MIN_RAND, GNRC_NDP_MAX_RAND);
> +        if_entry->reach_time_base = byteorder_ntohl(rtr_adv->reach_time);
> +        reach_time = (reach_time * if_entry->reach_time_base) / 10;

Ok, so, how about a comment here saying something like "to avoid floating point number computations, the boundaries for the random values are multiplied by 10"?

---
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/3746/files#r38540936
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20150902/9197d944/attachment.html>


More information about the notifications mailing list