* fix LWIP_HOOK_IP4_ROUTE_SRC.

* fix netdev ping select network card.
This commit is contained in:
geniusgogo 2023-03-10 16:16:41 +08:00 committed by GitHub
parent c8b30bf31a
commit e29dfb75ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 15 deletions

View File

@ -637,7 +637,7 @@
#endif
#if RT_USING_LWIP_VER_NUM >= 0x20000 /* >= v2.0.0 */
#define LWIP_HOOK_IP4_ROUTE_SRC(dest, src) lwip_ip4_route_src(dest, src)
#define LWIP_HOOK_IP4_ROUTE_SRC(src, dest) lwip_ip4_route_src(dest, src)
#include "lwip/ip_addr.h"
struct netif *lwip_ip4_route_src(const ip4_addr_t *dest, const ip4_addr_t *src);
#endif /* RT_USING_LWIP_VER_NUM >= 0x20000 */

View File

@ -1130,19 +1130,15 @@ int netdev_cmd_ping(char* target_name, char *netdev_name, rt_uint32_t times, rt_
if (netdev_name != RT_NULL)
{
netdev = netdev_get_by_name(netdev_name);
}
if (netdev == RT_NULL)
{
netdev = netdev_default;
rt_kprintf("ping: not found specified netif, using default netdev %s.\n", netdev->name);
}
}
if (NETDEV_PING_IS_COMMONICABLE(netdev_default))
{
/* using default network interface device for ping */
netdev = netdev_default;
}
else
if (!NETDEV_PING_IS_COMMONICABLE(netdev))
{
/* using first internet up status network interface device */
netdev = netdev_get_first_by_flags(NETDEV_FLAG_LINK_UP);