From 83ef4a37e9bb65c90a0b4b5b50fc90898ad6d8b7 Mon Sep 17 00:00:00 2001 From: Rbb666 Date: Sat, 13 Sep 2025 11:29:35 +0800 Subject: [PATCH] [net/netdev]Fixed compilation errors when enabling IPv6 and IPv4 dual-stack support. --- components/net/netdev/src/netdev.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/components/net/netdev/src/netdev.c b/components/net/netdev/src/netdev.c index 73919fe4e88..33fb5c79af8 100644 --- a/components/net/netdev/src/netdev.c +++ b/components/net/netdev/src/netdev.c @@ -1414,20 +1414,8 @@ int netdev_cmd_ping(char* target_name, char *netdev_name, rt_uint32_t times, rt_ /* print ping statistics */ loss = (uint32_t)((1 - ((float)received) / index) * 100); avg_time = (uint32_t)(avg_time / received); -#if NETDEV_IPV4 && NETDEV_IPV6 - if (IP_IS_V4_VAL(&ping_resp.ip_addr)) - { - rt_kprintf("\n--- %s ping statistics ---\n", inet_ntoa(*ip_2_ip4(&ping_resp.ip_addr))); - } - else - { - rt_kprintf("\n--- %s ping statistics ---\n", inet6_ntoa(*ip_2_ip6(&ping_resp.ip_addr))); - } -#elif NETDEV_IPV4 + rt_kprintf("\n--- %s ping statistics ---\n", inet_ntoa(ping_resp.ip_addr)); -#elif NETDEV_IPV6 - rt_kprintf("\n--- %s ping statistics ---\n", inet6_ntoa(ping_resp.ip_addr)); -#endif rt_kprintf("%d packets transmitted, %d received, %d%% packet loss\n", index, received, loss); if (received > 0) {