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

Submitter:  yanhc <yanhc>
Submitted:  Sat 03 Mar 2018 02:29:21 PM UTC
   
 
Category:  IPv6 Severity:  3 - Normal
Item Group:  Faulty Behaviour Status:  Fixed
Privacy:  Public Assigned to:  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>
Group administrator
Sun 04 Mar 2018 09:51:23 AM UTC, comment #3: 

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

Simon Goldschmidt <goldsimon>
Group administrator
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>
Group administrator
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) {
        addr_index--;
      }
      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>

 

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

    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 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.13-02a9.
    Corresponding source code