buglwIP - A Lightweight TCP/IP stack - Bugs: bug #53125, netif_find(const char *name)...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #53125: netif_find(const char *name) cannot return correct netif

Submitter:  luocheng <luoc>
Submitted:  Mon 12 Feb 2018 08:33:09 AM UTC
   
 
Category:  IPv4 Severity:  3 - Normal
Item Group:  Faulty Behaviour Status:  Invalid
Privacy:  Public Assigned to:  None
Open/Closed:  Closed Planned Release:  None
lwIP version:  2.0.2

Mon 12 Feb 2018 09:24:51 AM UTC, comment #2: 

After calling netif_add() to register a new netif, netif->num is increased every time.

According your way, it doesn't return correct netif due to the following logic:
netif_find(const char *name)
{
...
if (num == netif->num &&
...
}

luocheng <luoc>
Mon 12 Feb 2018 08:37:18 AM UTC, comment #1: 

Read the docs: you don't pass 'netif->name' to 'netif_find()'. If 'netif->name' is 'en', you pass 'en0' to get the first netif of all the 'en' netifs.

Simon Goldschmidt <goldsimon>
Group administrator
Mon 12 Feb 2018 08:33:09 AM UTC, original submission:  

1) Note the member of "char name[2];" in "struct netif", maybe there is a bug in following code of  netif_find():
netif_find(const char *name)
{
...
  num = (u8_t)(name[2] - '0');
...
if (num == netif->num &&
...
}

2) Realizing the logic of checking netif->num in netif_find(), what's the rule of setting netif->name in network driver before calling netif_add()

luocheng <luoc>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by goldsimon (Posted a comment)
  • -email is unavailable- added by luoc (Submitted the item)
  • -email is unavailable- added by luoc
  • -email is unavailable- added by luoc
  • -email is unavailable- added by luoc
  • -email is unavailable- added by luoc
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-02-12 goldsimon StatusNone Invalid
        Open/ClosedOpen Closed
    2018-02-12 luoc Carbon-Copy- Added -email is unavailable-
        Carbon-Copy- Added -email is unavailable-
        Carbon-Copy- Added -email is unavailable-
        Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code