Merge pull request #471 from hduffddybz/master

The problem of finding ethernet interface
This commit is contained in:
Bernard Xiong 2015-05-09 10:05:35 +08:00
commit 9fa2a04a64
1 changed files with 16 additions and 5 deletions

View File

@ -376,13 +376,24 @@ static void dhcpd_thread_entry(void *parameter)
void dhcpd_start(char* netif_name)
{
rt_thread_t thread;
struct netif *netif = RT_NULL;
struct netif *netif = netif_list;
/* find ethernet interface. */
netif = netif_find(netif_name);
if(strlen(netif_name) > sizeof(netif->name))
{
rt_kprintf("network interface name too long!\r\n");
return;
}
while(netif != RT_NULL)
{
if(strncmp(netif_name, netif->name, sizeof(netif->name)) == 0)
break;
netif = netif->next;
if( netif == RT_NULL )
{
DEBUG_PRINTF("Not found network interface:%s\n", netif_name);
rt_kprintf("network interface: %s not found!\r\n", netif_name);
return;
}
}
thread = rt_thread_create("dhcpd",