diff --git a/components/finsh/msh_cmd.c b/components/finsh/msh_cmd.c index c11873dc912ccdae8731205df2407f8a618492c5..83b3930213306ed52ef6aac4ce30ca656ced1e0c 100644 --- a/components/finsh/msh_cmd.c +++ b/components/finsh/msh_cmd.c @@ -182,14 +182,32 @@ 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 +#endif /* RT_USING_LWIP */ int cmd_ps(int argc, char** argv) {