提交 9fa2a04a 编写于 作者: B Bernard Xiong

Merge pull request #471 from hduffddybz/master

The problem of finding ethernet interface
......@@ -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))
{
rt_kprintf("network interface name too long!\r\n");
return;
}
while(netif != RT_NULL)
{
DEBUG_PRINTF("Not found network interface:%s\n", netif_name);
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",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册