Skip to content

Commit

Permalink
gnrc: adapt for gnrc_sixlowpan_nd_border_router
Browse files Browse the repository at this point in the history
  • Loading branch information
miri64 committed Aug 31, 2015
1 parent 9582c1b commit 5e347e6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
21 changes: 21 additions & 0 deletions sys/net/gnrc/network_layer/ipv6/netif/gnrc_ipv6_netif.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ static ipv6_addr_t *_add_addr_to_entry(gnrc_ipv6_netif_t *entry, const ipv6_addr
entry->rtr_adv_count = GNRC_NDP_MAX_INIT_RTR_ADV_NUMOF;
gnrc_ndp_router_retrans_rtr_adv(entry);
}
#endif
#ifdef MODULE_GNRC_SIXLOWPAN_ND_BORDER_ROUTER
gnrc_sixlowpan_nd_router_abr_t *abr = gnrc_sixlowpan_nd_router_abr_get();
if (gnrc_sixlowpan_nd_router_abr_add_prf(abr, entry, tmp_addr) < 0) {
DEBUG("ipv6_netif: error adding prefix to 6LoWPAN-ND management\n");
}
#endif
}
else {
Expand Down Expand Up @@ -306,6 +312,10 @@ static void _remove_addr_from_entry(gnrc_ipv6_netif_t *entry, ipv6_addr_t *addr)
gnrc_ndp_router_retrans_rtr_adv(entry);
}
#endif
#ifdef MODULE_GNRC_SIXLOWPAN_ND_BORDER_ROUTER
gnrc_sixlowpan_nd_router_abr_t *abr = gnrc_sixlowpan_nd_router_abr_get();
gnrc_sixlowpan_nd_router_abr_rem_prf(abr, entry, &entry->addrs[i]);
#endif

mutex_unlock(&entry->mutex);
return;
Expand Down Expand Up @@ -755,6 +765,9 @@ void gnrc_ipv6_netif_init_by_dev(void)
{
kernel_pid_t ifs[GNRC_NETIF_NUMOF];
size_t ifnum = gnrc_netif_get(ifs);
#ifdef MODULE_GNRC_SIXLOWPAN_ND_BORDER_ROUTER
bool abr_init = false;
#endif

for (size_t i = 0; i < ifnum; i++) {
ipv6_addr_t addr;
Expand Down Expand Up @@ -822,6 +835,14 @@ void gnrc_ipv6_netif_init_by_dev(void)
#endif
#ifdef MODULE_GNRC_SIXLOWPAN_ND
if (ipv6_if->flags & GNRC_IPV6_NETIF_FLAGS_SIXLOWPAN) {
#ifdef MODULE_GNRC_SIXLOWPAN_ND_BORDER_ROUTER
/* first interface wins */
if (!abr_init) {
gnrc_sixlowpan_nd_router_abr_create(&addr, 0);
gnrc_ipv6_netif_set_rtr_adv(ipv6_if, true);
abr_init = true;
}
#endif
gnrc_sixlowpan_nd_init(ipv6_if);
continue; /* skip gnrc_ndp_host_init() */
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ gnrc_sixlowpan_ctx_t *gnrc_sixlowpan_ctx_update(uint8_t id, const ipv6_addr_t *p
_ctx_inval_times[id] = ltime + _current_minute();

mutex_unlock(&_ctx_mutex);

return &(_ctxs[id]);
}

Expand Down

0 comments on commit 5e347e6

Please sign in to comment.