From 0fc7898b348c4b058a770eccf2bfd1aca5ee1f1d Mon Sep 17 00:00:00 2001 From: Erik Ekman Date: Wed, 11 Oct 2023 20:46:55 +0200 Subject: [PATCH] sys/shell/gnrc_netif: Show interface up/down state --- sys/shell/cmds/gnrc_netif.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/sys/shell/cmds/gnrc_netif.c b/sys/shell/cmds/gnrc_netif.c index 938480e89f..47a2f33acf 100644 --- a/sys/shell/cmds/gnrc_netif.c +++ b/sys/shell/cmds/gnrc_netif.c @@ -776,11 +776,17 @@ static void _netif_list(netif_t *iface) } } #endif /* MODULE_NETDEV_IEEE802154 */ - netopt_enable_t link; - res = netif_get_opt(iface, NETOPT_LINK, 0, &link, sizeof(netopt_enable_t)); + netopt_enable_t enabled; + res = netif_get_opt(iface, NETOPT_LINK, 0, &enabled, sizeof(enabled)); if (res >= 0) { - printf(" Link: %s ", (link == NETOPT_ENABLE) ? "up" : "down" ); + printf(" Link: %s ", (enabled == NETOPT_ENABLE) ? "up" : "down" ); } +#if IS_USED(MODULE_LWIP_NETIF) /* only supported on lwIP for now */ + res = netif_get_opt(iface, NETOPT_ACTIVE, 0, &enabled, sizeof(enabled)); + if (res >= 0) { + printf(" State: %s ", (enabled == NETOPT_ENABLE) ? "up" : "down" ); + } +#endif /* MODULE_LWIP_NETIF */ line_thresh = _newline(0U, line_thresh); res = netif_get_opt(iface, NETOPT_ADDRESS_LONG, 0, hwaddr, sizeof(hwaddr)); if (res >= 0) { @@ -806,9 +812,9 @@ static void _netif_list(netif_t *iface) } res = netif_get_opt(iface, NETOPT_CSMA_RETRIES, 0, &u8, sizeof(u8)); if (res >= 0) { - netopt_enable_t enable = NETOPT_DISABLE; - res = netif_get_opt(iface, NETOPT_CSMA, 0, &enable, sizeof(enable)); - if ((res >= 0) && (enable == NETOPT_ENABLE)) { + enabled = NETOPT_DISABLE; + res = netif_get_opt(iface, NETOPT_CSMA, 0, &enabled, sizeof(enabled)); + if ((res >= 0) && (enabled == NETOPT_ENABLE)) { printf(" CSMA Retries: %u ", (unsigned)u8); } line_thresh++;