buglwIP - A Lightweight TCP/IP stack - Bugs: bug #53273, IPv6 link-local address generation...


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

bug #53273: IPv6 link-local address generation for non-ethernet type netif does not convert byte order

Submitted by:  yanhc <yanhc>
Submitted on:  Sat 03 Mar 2018 02:29:21 PM UTC  
Category:  IPv6 Severity:  3 - Normal
Item Group:  Faulty Behaviour Status:  Fixed
Privacy:  Public Assigned to:  Simon Goldschmidt <goldsimon>
Open/Closed:  Closed Planned Release:  2.1.0
lwIP version:  2.0.2

Tue 12 Jun 2018 08:29:51 AM UTC, comment #4: 

Also, it seems like link-local address generation should call netif_ip6_addr_set() or something like that to trigger callbacks.

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Sun 04 Mar 2018 09:51:23 AM UTC, comment #3: 

Ok, now I know which part you mean, thanks.

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Sun 04 Mar 2018 04:39:03 AM UTC, comment #2: 

For example, I use slipif and set the hardware address 48 bits which is same as ethernet mac.

When the hardware address of slipif is 0x123456789abc, the orginal code will generate the link local address as
fe80:0000:0000:0000 : 3412:0000:bc9a:7856
However, the expected output, as the comment "Use hwaddr directly as interface ID" says, should be
fe80:0000:0000:0000 : 0000:1234:5678:9abc

Apparently, this is caused by endianness, since I am using an platform which is little endian.

yanhc <yanhc>
Sat 03 Mar 2018 09:04:17 PM UTC, comment #1: 

Could you elaborat a bit more on what this fixes instead of what you change in the code? I'm really to lazy to think about that myself ;-)

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Sat 03 Mar 2018 02:29:21 PM UTC, original submission:  

netif_create_ip6_linklocal_address in netif.c does not convert byte order for non-ethernet type netif. I found this problem in x86 platform which is little endian.
I add the lwip_htonl conversion in the following codes.

addr_index = 3;
    for (i = 0; (i < 8) && (i < netif->hwaddr_len); i++) {
      if (i == 4) {
      ip_2_ip6(&netif->ip6_addr[0])->addr[addr_index] |= lwip_htonl( ((u32_t)(netif->hwaddr[netif->hwaddr_len - i - 1])) << (8 * (i & 0x03)) );

I have checked the latest 2.0.3. This problem is still there.

yanhc <yanhc>


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 yanhc (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-06-13 goldsimon StatusNone => Fixed
        Assigned toNone => goldsimon
        Open/ClosedOpen => Closed
    2018-06-12 goldsimon Planned ReleaseNone => 2.1.0

    Back to the top

    Powered by Savane 3.5