From 59366022ca8842a19b205f0a612b567b6d91eec9 Mon Sep 17 00:00:00 2001 From: Martine Lenders Date: Thu, 27 Dec 2018 20:29:13 +0100 Subject: [PATCH 1/3] netopt: provide option to (de-)activate 6Lo --- sys/include/net/netopt.h | 7 +++++++ sys/net/crosslayer/netopt/netopt.c | 1 + 2 files changed, 8 insertions(+) diff --git a/sys/include/net/netopt.h b/sys/include/net/netopt.h index 3809898235..d5fb9273c1 100644 --- a/sys/include/net/netopt.h +++ b/sys/include/net/netopt.h @@ -519,6 +519,13 @@ typedef enum { */ NETOPT_IQ_INVERT, + /** + * @brief (@ref netopt_enable_t) 6Lo support + * + * @see [RFC 4944](https://tools.ietf.org/html/rfc4944) + */ + NETOPT_6LO, + /** * @brief (@ref netopt_enable_t) header compression * diff --git a/sys/net/crosslayer/netopt/netopt.c b/sys/net/crosslayer/netopt/netopt.c index ac04811054..177ab6ef10 100644 --- a/sys/net/crosslayer/netopt/netopt.c +++ b/sys/net/crosslayer/netopt/netopt.c @@ -88,6 +88,7 @@ static const char *_netopt_strmap[] = { [NETOPT_FIXED_HEADER] = "NETOPT_FIXED_HEADER", [NETOPT_IQ_INVERT] = "NETOPT_IQ_INVERT", [NETOPT_TX_RETRIES_NEEDED] = "NETOPT_TX_RETRIES_NEEDED", + [NETOPT_6LO] = "NETOPT_6LO", [NETOPT_6LO_IPHC] = "NETOPT_6LO_IPHC", [NETOPT_BLE_CTX] = "NETOPT_BLE_CTX", [NETOPT_CHECKSUM] = "NETOPT_CHECKSUM", From 45b9dd6f50f78570261a757b8ebc9f39d0f4b795 Mon Sep 17 00:00:00 2001 From: Martine Lenders Date: Thu, 27 Dec 2018 20:53:19 +0100 Subject: [PATCH 2/3] gnrc_netif: implement get NETOPT_6LO --- sys/net/gnrc/netif/gnrc_netif.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/net/gnrc/netif/gnrc_netif.c b/sys/net/gnrc/netif/gnrc_netif.c index 5a27de43fb..47a355e2a2 100644 --- a/sys/net/gnrc/netif/gnrc_netif.c +++ b/sys/net/gnrc/netif/gnrc_netif.c @@ -106,6 +106,12 @@ int gnrc_netif_get_from_netdev(gnrc_netif_t *netif, gnrc_netapi_opt_t *opt) gnrc_netif_acquire(netif); switch (opt->opt) { + case NETOPT_6LO: + assert(opt->data_len == sizeof(netopt_enable_t)); + *((netopt_enable_t *)opt->data) = + (netopt_enable_t)gnrc_netif_is_6ln(netif); + res = sizeof(netopt_enable_t); + break; case NETOPT_HOP_LIMIT: assert(opt->data_len == sizeof(uint8_t)); *((uint8_t *)opt->data) = netif->cur_hl; From e88abc49b8c4d5a9570b55d4546298d1bf0e6e36 Mon Sep 17 00:00:00 2001 From: Martine Lenders Date: Thu, 27 Dec 2018 20:56:54 +0100 Subject: [PATCH 3/3] shell_commands/sc_gnrc_netif: get 6Lo flag --- sys/shell/commands/sc_gnrc_netif.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/shell/commands/sc_gnrc_netif.c b/sys/shell/commands/sc_gnrc_netif.c index 304b869e3f..a124f9ca36 100644 --- a/sys/shell/commands/sc_gnrc_netif.c +++ b/sys/shell/commands/sc_gnrc_netif.c @@ -523,6 +523,9 @@ static void _netif_list(kernel_pid_t iface) #endif line_thresh = _netif_list_flag(iface, NETOPT_IPV6_SND_RTR_ADV, "RTR_ADV ", line_thresh); +#ifdef MODULE_GNRC_SIXLOWPAN + line_thresh = _netif_list_flag(iface, NETOPT_6LO, "6LO ", line_thresh); +#endif #ifdef MODULE_GNRC_SIXLOWPAN_IPHC line_thresh += _LINE_THRESHOLD + 1; /* enforce linebreak after this option */ line_thresh = _netif_list_flag(iface, NETOPT_6LO_IPHC, "IPHC ",