diff --git a/sys/include/net/gnrc/ipv6/netif.h b/sys/include/net/gnrc/ipv6/netif.h index fd6eb8c3983f5..d1b756f888fd0 100644 --- a/sys/include/net/gnrc/ipv6/netif.h +++ b/sys/include/net/gnrc/ipv6/netif.h @@ -183,6 +183,18 @@ extern "C" { */ #define GNRC_IPV6_NETIF_FLAGS_IS_WIRED (0x2000) +/** + * @brief Offset of the router advertisement flags compared to the position in router + * advertisements. + */ +#define GNRC_IPV6_NETIF_FLAGS_RTR_ADV_POS (8U) + +/** + * @brief Mask for flags intended for router advertisements. + * @note Please expand if more router advertisement flags are introduced. + */ +#define GNRC_IPV6_NETIF_FLAGS_RTR_ADV_MASK (0xc000) + /** * @brief Flag to indicate that the interface has other address * configuration. diff --git a/sys/net/gnrc/network_layer/ndp/gnrc_ndp.c b/sys/net/gnrc/network_layer/ndp/gnrc_ndp.c index f31cb7c2c403f..145d2e021071a 100644 --- a/sys/net/gnrc/network_layer/ndp/gnrc_ndp.c +++ b/sys/net/gnrc/network_layer/ndp/gnrc_ndp.c @@ -322,8 +322,9 @@ void gnrc_ndp_rtr_adv_handle(kernel_pid_t iface, gnrc_pktsnip_t *pkt, ipv6_hdr_t if_entry->cur_hl = rtr_adv->cur_hl; } /* set flags from message */ - if_entry->flags &= 0x3f; - if_entry->flags |= (rtr_adv->flags & (0xc0)); + if_entry->flags &= ~GNRC_IPV6_NETIF_FLAGS_RTR_ADV_MASK; + if_entry->flags |= ((rtr_adv->flags << GNRC_IPV6_NETIF_FLAGS_RTR_ADV_POS) & + (GNRC_IPV6_NETIF_FLAGS_RTR_ADV_MASK)); /* set reachable time from message if it is not the same as the random base * value */ if ((rtr_adv->reach_time.u32 != 0) &&