Merge pull request #471 from hduffddybz/master
The problem of finding ethernet interface
This commit is contained in:
commit
9fa2a04a64
|
@ -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 (netif == RT_NULL)
|
||||
if(strlen(netif_name) > sizeof(netif->name))
|
||||
{
|
||||
DEBUG_PRINTF("Not found network interface:%s\n", 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 )
|
||||
{
|
||||
rt_kprintf("network interface: %s not found!\r\n", netif_name);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
thread = rt_thread_create("dhcpd",
|
||||
|
|
Loading…
Reference in New Issue