Merge pull request #12528 from benpicco/ifconfig_scope

shell_commands: gnrc_netif: print correct scope for IPv6 address
This commit is contained in:
Martine Lenders 2019-10-21 15:16:47 +02:00 committed by GitHub
commit 42968ccc6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 5 deletions

View File

@ -352,11 +352,17 @@ static void _netif_list_ipv6(ipv6_addr_t *addr, uint8_t flags)
printf("inet6 addr: "); printf("inet6 addr: ");
ipv6_addr_to_str(addr_str, addr, sizeof(addr_str)); ipv6_addr_to_str(addr_str, addr, sizeof(addr_str));
printf("%s scope: ", addr_str); printf("%s scope: ", addr_str);
if ((ipv6_addr_is_link_local(addr))) { if (ipv6_addr_is_link_local(addr)) {
printf("local"); printf("link");
}
else if (ipv6_addr_is_site_local(addr)) {
printf("site");
}
else if (ipv6_addr_is_global(addr)) {
printf("global");
} }
else { else {
printf("global"); printf("unknown");
} }
if (flags & GNRC_NETIF_IPV6_ADDRS_FLAGS_ANYCAST) { if (flags & GNRC_NETIF_IPV6_ADDRS_FLAGS_ANYCAST) {
printf(" [anycast]"); printf(" [anycast]");

View File

@ -371,7 +371,7 @@ def testfunc(child):
child.expect("HWaddr: (?P<hwaddr>[A-Fa-f:0-9]+)") child.expect("HWaddr: (?P<hwaddr>[A-Fa-f:0-9]+)")
hwaddr_dst = child.match.group("hwaddr").lower() hwaddr_dst = child.match.group("hwaddr").lower()
res = child.expect([ res = child.expect([
r"(?P<lladdr>fe80::[A-Fa-f:0-9]+)\s+scope:\s+local\s+VAL", r"(?P<lladdr>fe80::[A-Fa-f:0-9]+)\s+scope:\s+link\s+VAL",
pexpect.TIMEOUT pexpect.TIMEOUT
]) ])
count += 1 count += 1

View File

@ -50,7 +50,7 @@ static void _print_addr(ipv6_addr_t *addr, uint8_t flags)
ipv6_addr_to_str(addr_str, addr, sizeof(addr_str)); ipv6_addr_to_str(addr_str, addr, sizeof(addr_str));
printf("%s scope: ", addr_str); printf("%s scope: ", addr_str);
if ((ipv6_addr_is_link_local(addr))) { if ((ipv6_addr_is_link_local(addr))) {
printf("local"); printf("link");
} }
else { else {
printf("global"); printf("global");