Fix net (#7034)
* fix LWIP_HOOK_IP4_ROUTE_SRC. * fix netdev ping select network card.
This commit is contained in:
parent
c8b30bf31a
commit
e29dfb75ca
|
@ -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 */
|
||||
|
|
|
@ -1013,7 +1013,7 @@ int netdev_dhcp_open(char* netdev_name)
|
|||
{
|
||||
rt_kprintf("bad network interface device name(%s).\n", netdev_name);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
netdev_dhcp_enabled(netdev,RT_TRUE);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1074,15 +1074,15 @@ int netdev_ifconfig(int argc, char **argv)
|
|||
{
|
||||
netdev_list_if();
|
||||
}
|
||||
#ifdef RT_LWIP_DHCP
|
||||
#ifdef RT_LWIP_DHCP
|
||||
else if(argc == 3)
|
||||
{
|
||||
if (!strcmp(argv[2], "dhcp"))
|
||||
{
|
||||
netdev_dhcp_open(argv[1]);
|
||||
netdev_dhcp_open(argv[1]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
else if (argc == 5)
|
||||
{
|
||||
rt_kprintf("config : %s\n", argv[1]);
|
||||
|
@ -1094,9 +1094,9 @@ int netdev_ifconfig(int argc, char **argv)
|
|||
else
|
||||
{
|
||||
rt_kprintf("bad parameter! e.g: ifconfig e0 192.168.1.30 192.168.1.1 255.255.255.0\n");
|
||||
#ifdef RT_LWIP_DHCP
|
||||
#ifdef RT_LWIP_DHCP
|
||||
rt_kprintf("bad parameter! e.g: ifconfig e0 dhcp\n");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -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))
|
||||
if (netdev == RT_NULL)
|
||||
{
|
||||
/* using default network interface device for ping */
|
||||
netdev = netdev_default;
|
||||
rt_kprintf("ping: not found specified netif, using default netdev %s.\n", netdev->name);
|
||||
}
|
||||
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);
|
||||
|
|
Loading…
Reference in New Issue