Skip to content

Commit e22fe42

Browse files
committed
sys/shell/gnrc_netif: print v6 addresses based on ipv6 module
To support lwIP better (dont require gnrc_ipv6) Also don't require IPv6 for printing link type With this sc_gnrc_netif can compile and work when using lwIP (with l2util module added): ``` > ifconfig Iface ET1 HWaddr: 24:0A:C4:E6:0E:9C Channel: 6 Link: up L2-PDU:1500 Source address length: 6 Link type: wireless inet6 addr: fe80::260a:c4ff:fee6:e9c scope: link inet6 addr: 2001:db8::260a:c4ff:fee6:e9c scope: global Iface ET0 HWaddr: 24:0A:C4:E6:0E:9F Link: up L2-PDU:1500 Source address length: 6 Link type: wired inet6 addr: fe80::260a:c4ff:fee6:e9f scope: link inet6 addr: 2001:db8::260a:c4ff:fee6:e9f scope: global > ```
1 parent fe71623 commit e22fe42

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

sys/shell/commands/sc_gnrc_netif.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ static unsigned _netif_list_flag(netif_t *iface, netopt_t opt, char *str,
542542
return line_thresh;
543543
}
544544

545-
#ifdef MODULE_GNRC_IPV6
545+
#ifdef MODULE_IPV6
546546
static void _netif_list_ipv6(ipv6_addr_t *addr, uint8_t flags)
547547
{
548548
char addr_str[IPV6_ADDR_MAX_STR_LEN];
@@ -562,6 +562,7 @@ static void _netif_list_ipv6(ipv6_addr_t *addr, uint8_t flags)
562562
else {
563563
printf("unknown");
564564
}
565+
#if MODULE_GNRC_IPV6
565566
if (flags & GNRC_NETIF_IPV6_ADDRS_FLAGS_ANYCAST) {
566567
printf(" [anycast]");
567568
}
@@ -582,6 +583,7 @@ static void _netif_list_ipv6(ipv6_addr_t *addr, uint8_t flags)
582583
break;
583584
}
584585
}
586+
#endif
585587
_newline(0U, _LINE_THRESHOLD);
586588
}
587589

@@ -598,7 +600,7 @@ static void _netif_list_groups(ipv6_addr_t *addr)
598600

599601
static void _netif_list(netif_t *iface)
600602
{
601-
#ifdef MODULE_GNRC_IPV6
603+
#ifdef MODULE_IPV6
602604
ipv6_addr_t ipv6_addrs[CONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF];
603605
ipv6_addr_t ipv6_groups[GNRC_NETIF_IPV6_GROUPS_NUMOF];
604606
#endif
@@ -853,11 +855,11 @@ static void _netif_list(netif_t *iface)
853855
line_thresh++;
854856
}
855857
line_thresh = _newline(0U, line_thresh);
856-
#ifdef MODULE_GNRC_IPV6
857858
printf("Link type: %s",
858859
(netif_get_opt(iface, NETOPT_IS_WIRED, 0, &u16, sizeof(u16)) > 0) ?
859860
"wired" : "wireless");
860861
_newline(0U, ++line_thresh);
862+
#ifdef MODULE_IPV6
861863
res = netif_get_opt(iface, NETOPT_IPV6_ADDR, 0, ipv6_addrs,
862864
sizeof(ipv6_addrs));
863865
if (res >= 0) {

0 commit comments

Comments
 (0)