mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-02-12 01:59:08 +08:00
netif find error
This commit is contained in:
parent
2d1edc94a3
commit
877a679b26
@ -376,13 +376,24 @@ static void dhcpd_thread_entry(void *parameter)
|
|||||||
void dhcpd_start(char* netif_name)
|
void dhcpd_start(char* netif_name)
|
||||||
{
|
{
|
||||||
rt_thread_t thread;
|
rt_thread_t thread;
|
||||||
struct netif *netif = RT_NULL;
|
struct netif *netif = netif_list;
|
||||||
|
|
||||||
/* find ethernet interface. */
|
if(strlen(netif_name) > sizeof(netif->name))
|
||||||
netif = netif_find(netif_name);
|
|
||||||
if (netif == RT_NULL)
|
|
||||||
{
|
{
|
||||||
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",
|
thread = rt_thread_create("dhcpd",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user