提交 adb734ec 编写于 作者: wuyangyong's avatar wuyangyong

update list_if() and set_if()

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1834 bbd45198-f89e-11dd-88c7-29a3b14d5316
上级 dc540968
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes
* 2010-07-07 Bernard fix send mail to mailbox issue. * 2010-07-07 Bernard fix send mail to mailbox issue.
* 2011-12-11 aozima list_if and set_if support multiple interface.
*/ */
/* /*
...@@ -299,15 +300,21 @@ void set_if(char* netif_name, char* ip_addr, char* gw_addr, char* nm_addr) ...@@ -299,15 +300,21 @@ void set_if(char* netif_name, char* ip_addr, char* gw_addr, char* nm_addr)
struct in_addr addr; struct in_addr addr;
struct netif * netif = netif_list; struct netif * netif = netif_list;
if(strlen(netif_name) > sizeof(netif->name))
{
rt_kprintf("network interface name too long!\r\n");
return;
}
while(netif != RT_NULL) while(netif != RT_NULL)
{ {
if(strncmp(netif_name, netif->name, sizeof(netif->name)) == 0) if(strncmp(netif_name, netif->name, sizeof(netif->name)) == 0)
break; break;
netif = netif->next; netif = netif->next;
if( netif == netif_list ) if( netif == RT_NULL )
{ {
rt_kprintf("network interface: %c%c not found!\r\n", netif->name[0], netif->name[1]); rt_kprintf("network interface: %s not found!\r\n", netif_name);
return; return;
} }
} }
...@@ -378,10 +385,6 @@ void list_if(void) ...@@ -378,10 +385,6 @@ void list_if(void)
rt_kprintf("\r\n"); rt_kprintf("\r\n");
netif = netif->next; netif = netif->next;
if( netif == netif_list )
{
break;
}
} }
#if LWIP_DNS #if LWIP_DNS
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册