[net/netdev]Fixed compilation errors when enabling IPv6 and IPv4 dual-stack support.

This commit is contained in:
Rbb666
2025-09-15 11:21:34 +08:00
committed by R b b666
parent ff26c0c4b3
commit 1e81571256
+1 -13
View File
@@ -1415,20 +1415,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)
{