add list_if() command in lwip

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@72 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
bernard.xiong 2009-10-06 00:24:39 +00:00
parent d5c4a86de8
commit f3b6d80e58
1 changed files with 26 additions and 4 deletions

View File

@ -255,3 +255,25 @@ rt_err_t eth_system_device_init()
return result;
}
#ifdef RT_USING_FINSH
#include <finsh.h>
void list_if()
{
struct _ip_addr
{
rt_uint8_t addr0, addr1, addr2, addr3;
} *addr;
rt_kprintf("Default network interface: %c%c\n", netif_default->name[0], netif_default->name[1]);
addr = (struct _ip_addr*)&netif_default->ip_addr.addr;
rt_kprintf("ip address: %d.%d.%d.%d\n", addr->addr0, addr->addr1, addr->addr2, addr->addr3);
addr = (struct _ip_addr*)&netif_default->gw.addr;
rt_kprintf("gw address: %d.%d.%d.%d\n", addr->addr0, addr->addr1, addr->addr2, addr->addr3);
addr = (struct _ip_addr*)&netif_default->netmask.addr;
rt_kprintf("net mask : %d.%d.%d.%d\n", addr->addr0, addr->addr1, addr->addr2, addr->addr3);
}
FINSH_FUNCTION_EXPORT(list_if, list network interface information);
#endif