From ed0fbbb2a3da5ecdc7eab71ed7f9503737ff9fd0 Mon Sep 17 00:00:00 2001 From: Martine Lenders Date: Fri, 16 Feb 2018 12:22:15 +0100 Subject: [PATCH] shell: adapt 6ctx command for NIB This somehow was left by the wayside when we moved from the old ND to the NIB. Also piggybacks some fixes. --- sys/shell/commands/Makefile | 2 +- sys/shell/commands/sc_gnrc_6ctx.c | 18 +++++++++--------- sys/shell/commands/shell_commands.c | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/sys/shell/commands/Makefile b/sys/shell/commands/Makefile index 673e583887..42fcf68669 100644 --- a/sys/shell/commands/Makefile +++ b/sys/shell/commands/Makefile @@ -44,7 +44,7 @@ ifneq (,$(filter gnrc_rpl,$(USEMODULE))) SRC += sc_gnrc_rpl.c endif ifneq (,$(filter gnrc_sixlowpan_ctx,$(USEMODULE))) -ifneq (,$(filter gnrc_sixlowpan_nd_border_router,$(USEMODULE))) +ifneq (,$(filter gnrc_ipv6_nib_6lbr,$(USEMODULE))) SRC += sc_gnrc_6ctx.c endif endif diff --git a/sys/shell/commands/sc_gnrc_6ctx.c b/sys/shell/commands/sc_gnrc_6ctx.c index d88c252a53..a1e394c626 100644 --- a/sys/shell/commands/sc_gnrc_6ctx.c +++ b/sys/shell/commands/sc_gnrc_6ctx.c @@ -21,7 +21,7 @@ #include "net/ipv6/addr.h" #include "net/gnrc/sixlowpan/ctx.h" -#include "net/gnrc/sixlowpan/nd.h" +#include "net/sixlowpan/nd.h" #include "timex.h" #include "xtimer.h" @@ -45,13 +45,14 @@ int _gnrc_6ctx_list(void) { puts("cid|prefix |C|ltime"); puts("-----------------------------------------------------------"); - for (uint8_t i = 0; i < GNRC_SIXLOWPAN_CTX_SIZE; i++) { - gnrc_sixlowpan_ctx_t *ctx = gnrc_sixlowpan_ctx_lookup_id(i); + for (uint8_t cid = 0; cid < GNRC_SIXLOWPAN_CTX_SIZE; cid++) { + gnrc_sixlowpan_ctx_t *ctx = gnrc_sixlowpan_ctx_lookup_id(cid); if (ctx != NULL) { char addr_str[IPV6_ADDR_MAX_STR_LEN]; - printf(" %2" PRIu8 "|%39s/%-3" PRIu8 "|%" PRIx8 "|%5" PRIu16 " min\n", i, - ipv6_addr_to_str(addr_str, &ctx->prefix, sizeof(addr_str)), ctx->prefix_len, - (uint8_t) ((ctx->flags_id & 0xf0) >> 4), ctx->ltime); + printf(" %2u|%39s/%-3u|%x|%5umin\n", cid, + ipv6_addr_to_str(addr_str, &ctx->prefix, sizeof(addr_str)), + ctx->prefix_len, (uint8_t) ((ctx->flags_id & 0xf0) >> 4), + ctx->ltime); } } return 0; @@ -112,15 +113,14 @@ int _gnrc_6ctx_del(char *cmd_str, char *ctx_str) ctx->ltime = 0; del_timer[cid].callback = _del_cb; del_timer[cid].arg = ctx; - xtimer_set(&del_timer[cid], GNRC_SIXLOWPAN_ND_RTR_MIN_CTX_DELAY * US_PER_SEC); + xtimer_set(&del_timer[cid], + SIXLOWPAN_ND_MIN_CTX_CHANGE_SEC_DELAY * US_PER_SEC); } } else { printf("Context %u already marked for removal\n", cid); return 1; } - /* advertise updated context */ - _adv_ctx(); return 0; } diff --git a/sys/shell/commands/shell_commands.c b/sys/shell/commands/shell_commands.c index f6e79d64c6..81a25f96f0 100644 --- a/sys/shell/commands/shell_commands.c +++ b/sys/shell/commands/shell_commands.c @@ -113,7 +113,7 @@ extern int _gnrc_rpl(int argc, char **argv); #endif #ifdef MODULE_GNRC_SIXLOWPAN_CTX -#ifdef MODULE_GNRC_SIXLOWPAN_ND_BORDER_ROUTER +#ifdef MODULE_GNRC_IPV6_NIB_6LBR extern int _gnrc_6ctx(int argc, char **argv); #endif #endif @@ -203,7 +203,7 @@ const shell_command_t _shell_command_list[] = { {"rpl", "rpl configuration tool ('rpl help' for more information)", _gnrc_rpl }, #endif #ifdef MODULE_GNRC_SIXLOWPAN_CTX -#ifdef MODULE_GNRC_SIXLOWPAN_ND_BORDER_ROUTER +#ifdef MODULE_GNRC_IPV6_NIB_6LBR {"6ctx", "6LoWPAN context configuration tool", _gnrc_6ctx }, #endif #endif