Skip to content
Snippets Groups Projects
Unverified Commit dbccf06c authored by Martine Lenders's avatar Martine Lenders Committed by GitHub
Browse files

Merge pull request #8575 from miri64/shell/fix/6ctx

shell: adapt 6ctx command for NIB
parents e876bbd0 ed0fbbb2
No related branches found
No related tags found
No related merge requests found
...@@ -44,7 +44,7 @@ ifneq (,$(filter gnrc_rpl,$(USEMODULE))) ...@@ -44,7 +44,7 @@ ifneq (,$(filter gnrc_rpl,$(USEMODULE)))
SRC += sc_gnrc_rpl.c SRC += sc_gnrc_rpl.c
endif endif
ifneq (,$(filter gnrc_sixlowpan_ctx,$(USEMODULE))) 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 SRC += sc_gnrc_6ctx.c
endif endif
endif endif
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include "net/ipv6/addr.h" #include "net/ipv6/addr.h"
#include "net/gnrc/sixlowpan/ctx.h" #include "net/gnrc/sixlowpan/ctx.h"
#include "net/gnrc/sixlowpan/nd.h" #include "net/sixlowpan/nd.h"
#include "timex.h" #include "timex.h"
#include "xtimer.h" #include "xtimer.h"
...@@ -45,13 +45,14 @@ int _gnrc_6ctx_list(void) ...@@ -45,13 +45,14 @@ int _gnrc_6ctx_list(void)
{ {
puts("cid|prefix |C|ltime"); puts("cid|prefix |C|ltime");
puts("-----------------------------------------------------------"); puts("-----------------------------------------------------------");
for (uint8_t i = 0; i < GNRC_SIXLOWPAN_CTX_SIZE; i++) { for (uint8_t cid = 0; cid < GNRC_SIXLOWPAN_CTX_SIZE; cid++) {
gnrc_sixlowpan_ctx_t *ctx = gnrc_sixlowpan_ctx_lookup_id(i); gnrc_sixlowpan_ctx_t *ctx = gnrc_sixlowpan_ctx_lookup_id(cid);
if (ctx != NULL) { if (ctx != NULL) {
char addr_str[IPV6_ADDR_MAX_STR_LEN]; char addr_str[IPV6_ADDR_MAX_STR_LEN];
printf(" %2" PRIu8 "|%39s/%-3" PRIu8 "|%" PRIx8 "|%5" PRIu16 " min\n", i, printf(" %2u|%39s/%-3u|%x|%5umin\n", cid,
ipv6_addr_to_str(addr_str, &ctx->prefix, sizeof(addr_str)), ctx->prefix_len, ipv6_addr_to_str(addr_str, &ctx->prefix, sizeof(addr_str)),
(uint8_t) ((ctx->flags_id & 0xf0) >> 4), ctx->ltime); ctx->prefix_len, (uint8_t) ((ctx->flags_id & 0xf0) >> 4),
ctx->ltime);
} }
} }
return 0; return 0;
...@@ -112,15 +113,14 @@ int _gnrc_6ctx_del(char *cmd_str, char *ctx_str) ...@@ -112,15 +113,14 @@ int _gnrc_6ctx_del(char *cmd_str, char *ctx_str)
ctx->ltime = 0; ctx->ltime = 0;
del_timer[cid].callback = _del_cb; del_timer[cid].callback = _del_cb;
del_timer[cid].arg = ctx; 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 { else {
printf("Context %u already marked for removal\n", cid); printf("Context %u already marked for removal\n", cid);
return 1; return 1;
} }
/* advertise updated context */
_adv_ctx();
return 0; return 0;
} }
......
...@@ -113,7 +113,7 @@ extern int _gnrc_rpl(int argc, char **argv); ...@@ -113,7 +113,7 @@ extern int _gnrc_rpl(int argc, char **argv);
#endif #endif
#ifdef MODULE_GNRC_SIXLOWPAN_CTX #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); extern int _gnrc_6ctx(int argc, char **argv);
#endif #endif
#endif #endif
...@@ -203,7 +203,7 @@ const shell_command_t _shell_command_list[] = { ...@@ -203,7 +203,7 @@ const shell_command_t _shell_command_list[] = {
{"rpl", "rpl configuration tool ('rpl help' for more information)", _gnrc_rpl }, {"rpl", "rpl configuration tool ('rpl help' for more information)", _gnrc_rpl },
#endif #endif
#ifdef MODULE_GNRC_SIXLOWPAN_CTX #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 }, {"6ctx", "6LoWPAN context configuration tool", _gnrc_6ctx },
#endif #endif
#endif #endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment