File tree Expand file tree Collapse file tree 1 file changed +16
-5
lines changed
components/net/lwip_dhcpd Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -376,13 +376,24 @@ static void dhcpd_thread_entry(void *parameter)
376376void dhcpd_start (char * netif_name )
377377{
378378 rt_thread_t thread ;
379- struct netif * netif = RT_NULL ;
379+ struct netif * netif = netif_list ;
380380
381- /* find ethernet interface. */
382- netif = netif_find (netif_name );
383- if (netif == RT_NULL )
381+ if (strlen (netif_name ) > sizeof (netif -> name ))
382+ {
383+ rt_kprintf ("network interface name too long!\r\n" );
384+ return ;
385+ }
386+ while (netif != RT_NULL )
384387 {
385- DEBUG_PRINTF ("Not found network interface:%s\n" , netif_name );
388+ if (strncmp (netif_name , netif -> name , sizeof (netif -> name )) == 0 )
389+ break ;
390+
391+ netif = netif -> next ;
392+ if ( netif == RT_NULL )
393+ {
394+ rt_kprintf ("network interface: %s not found!\r\n" , netif_name );
395+ return ;
396+ }
386397 }
387398
388399 thread = rt_thread_create ("dhcpd" ,
You can’t perform that action at this time.
0 commit comments