Skip to content
Snippets Groups Projects
Commit e6dbd3d9 authored by Saehie ParK's avatar Saehie ParK Committed by Gregory Nutt
Browse files

Networking: Fix network device name assignment logic for the case of the...

Networking:  Fix network device name assignment logic for the case of the local loopback device.  There is only one local loopback network device and it is unnumbered
parent fb53c292
No related branches found
No related tags found
No related merge requests found
......@@ -257,16 +257,35 @@ int netdev_register(FAR struct net_driver_s *dev, enum net_lltype_e lltype)
dev->d_conncb = NULL;
dev->d_devcb = NULL;
/* Get the next available device number and sssign a device name to
/* Get the next available device number and assign a device name to
* the interface
*/
save = net_lock();
#ifdef CONFIG_NET_MULTILINK
devnum = find_devnum(devfmt);
# ifdef CONFIG_NET_LOOPBACK
/* The local loopback device is a special case: There can be only one
* local loopback device so it is unnumbered.
*/
if (lltype == NET_LL_LOOPBACK)
{
devnum = 0;
}
else
# endif
{
devnum = find_devnum(devfmt);
}
#else
/* There is only a single link type. Finding the next network device
* number is simple.
*/
devnum = g_next_devnum++;
#endif
#ifdef CONFIG_NET_USER_DEVFMT
if (*dev->d_ifname)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment