diff --git a/tests/lwip/main.c b/tests/lwip/main.c index e229f11296..2184166a00 100644 --- a/tests/lwip/main.c +++ b/tests/lwip/main.c @@ -32,43 +32,6 @@ #endif #include "shell.h" -#define IFCONFIG_FILLER " " - -static int ifconfig(int argc, char **argv) -{ - (void)argc; - (void)argv; - for (struct netif *iface = netif_list; iface != NULL; iface = iface->next) { - printf("%s_%02u: ", iface->name, iface->num); -#if IS_USED(MODULE_LWIP_IPV6) - char addrstr[IPV6_ADDR_MAX_STR_LEN]; -#elif IS_USED(MODULE_LWIP_IPV4) - char addrstr[IPV4_ADDR_MAX_STR_LEN]; -#endif -#ifdef MODULE_LWIP_IPV6 - for (int i = 0; i < LWIP_IPV6_NUM_ADDRESSES; i++) { - if (!ipv6_addr_is_unspecified((ipv6_addr_t *)&iface->ip6_addr[i])) { - printf("%s inet6 %s\n", (i == 0) ? "" : IFCONFIG_FILLER, - ipv6_addr_to_str(addrstr, - (ipv6_addr_t *)&iface->ip6_addr[i], - sizeof(addrstr))); - } - } -#endif -#ifdef MODULE_LWIP_IPV4 - if (IS_USED(MODULE_LWIP_IPV6)) { - /* insert spaces to be aligned with inet6 */ - printf(IFCONFIG_FILLER); - } - printf(" inet %s\n", ipv4_addr_to_str(addrstr, - (ipv4_addr_t *)&iface->ip_addr, - sizeof(addrstr))); -#endif - puts(""); - } - return 0; -} - static const shell_command_t shell_commands[] = { #ifdef MODULE_SOCK_IP { "ip", "Send IP packets and listen for packets of certain type", ip_cmd }, @@ -79,7 +42,6 @@ static const shell_command_t shell_commands[] = { #ifdef MODULE_SOCK_UDP { "udp", "Send UDP messages and listen for messages on UDP port", udp_cmd }, #endif - { "ifconfig", "Shows assigned IP addresses", ifconfig }, { NULL, NULL, NULL } }; diff --git a/tests/lwip/tests/01-run.py b/tests/lwip/tests/01-run.py index 68770891e1..0f96dc6593 100755 --- a/tests/lwip/tests/01-run.py +++ b/tests/lwip/tests/01-run.py @@ -15,6 +15,7 @@ import time import types import pexpect import socket +import ipaddress DEFAULT_TIMEOUT = 5 @@ -190,8 +191,9 @@ class TestStrategy(ApplicationStrategy): def get_ipv6_address(spawn): spawn.sendline(u"ifconfig") - spawn.expect(r"[A-Za-z0-9]{2}_[0-9]+: inet6 (fe80::[0-9a-f:]+)\s") - return spawn.match.group(1) + spawn.expect(r" inet6 addr: (fe80:[0-9a-f:]+)\s") + # pack v6 address to minimal form (lwIP returns fe80:0:0:..) + return str(ipaddress.ip_address(spawn.match.group(1))) def test_ipv6_send(board_group, application, env=None):