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

Martine Lenders notifications at github.com
Wed Sep 2 12:41:40 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;

The 10 comes from the fact, that `GNRC_NDP_MIN_RAND` and `GNRC_NDP_MAX_RAND` are bigger by a factor of 10 than in the RFC (because they are fractions). Don't know how to express that, other than already documented here: https://github.com/RIOT-OS/RIOT/blob/master/sys/include/net/gnrc/ipv6/netif.h#L296

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


More information about the notifications mailing list