Merge pull request #258 from aozima/pulls

update MSH ifconfig and add MSH netstat.
This commit is contained in:
Bernard Xiong 2014-04-09 16:08:25 +08:00
commit f91f22b31f
1 changed files with 31 additions and 4 deletions

View File

@ -182,14 +182,41 @@ FINSH_FUNCTION_EXPORT_ALIAS(cmd_mkdir, __cmd_mkdir, Create the DIRECTORY.);
#ifdef RT_USING_LWIP
int cmd_ifconfig(int argc, char** argv)
{
extern void list_if(void);
extern void list_if(void);
extern void set_if(char* netif_name, char* ip_addr, char* gw_addr, char* nm_addr);
list_if();
return 0;
if(argc == 1)
{
list_if();
}
else if(argc == 5)
{
rt_kprintf("config : %s\n", argv[1]);
rt_kprintf("IP addr: %s\n", argv[2]);
rt_kprintf("Gateway: %s\n", argv[3]);
rt_kprintf("netmask: %s\n", argv[4]);
set_if(argv[1], argv[2], argv[3], argv[4]);
}
else
{
rt_kprintf("bad parameter! e.g: ifconfig e0 192.168.1.30 192.168.1.1 255.255.255.0\n");
}
return 0;
}
FINSH_FUNCTION_EXPORT_ALIAS(cmd_ifconfig, __cmd_ifconfig, list the information of network interfaces);
#endif
int cmd_netstat(int argc, char** argv)
{
extern void list_tcps(void);
list_tcps();
return 0;
}
FINSH_FUNCTION_EXPORT_ALIAS(cmd_netstat, __cmd_netstat, list the information of TCP/IP);
#endif /* RT_USING_LWIP */
int cmd_ps(int argc, char** argv)
{