buglwIP - A Lightweight TCP/IP stack - Bugs: bug #49078, lwip cannot establish ipv6...

 
 

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

bug #49078: lwip cannot establish ipv6 connection, because of failed to fill ipv6 source address in Neighbor Solicitation Message

Submitter:  lishen <lishen5>
Submitted:  Tue 13 Sep 2016 03:47:45 AM UTC
   
 
Category:  IPv6 Severity:  3 - Normal
Item Group:  Faulty Behaviour Status:  Invalid
Privacy:  Public Assigned to:  None
Open/Closed:  Closed Planned Release:  None
lwIP version:  git head

Tue 20 Sep 2016 07:58:15 AM UTC, comment #4: 

Current behavior is acceptable, it was my mistake that not set a LL  address. But add these lines to use any address available is not very complex, and not violate RFC, and make the code a little bit more robust. ^_^

880a881

>   u8_t i;

882,890c883,898
<   if (ip6_addr_isvalid(netif_ip6_addr_state(netif,0))) {
<     /* Use link-local address as source address. */
<     src_addr = netif_ip6_addr(netif, 0);
<     /* calculate option length (in 8-byte-blocks) */
<     lladdr_opt_len = ((netif->hwaddr_len + 2) + 7) >> 3;
<   } else {
<     src_addr = IP6_ADDR_ANY6;
<     /* Option "MUST NOT be included when the source IP address is the unspecified address." */
<     lladdr_opt_len = 0;
---

>   src_addr = NULL;
>   /* Use any address available. */
>   for (i = 0; i < LWIP_IPV6_NUM_ADDRESSES; i++) {
>     if (ip6_addr_isvalid(netif_ip6_addr_state(netif, i))) {
>         src_addr = netif_ip6_addr(netif, i);
>         /* calculate option length (in 8-byte-blocks) */
>         lladdr_opt_len = ((netif->hwaddr_len + 2) + 7) >> 3;
>         break;
>     }
>   }
>
>   /* No address available */
>   if (NULL == src_addr){
>       src_addr = IP6_ADDR_ANY6;
>       /* Option "MUST NOT be included when the source IP address is the unspecified address." */
>       lladdr_opt_len = 0;


lishen <lishen5>
Mon 19 Sep 2016 03:45:30 PM UTC, comment #3: 

When I coded this I remember it was required to set up the LL address at index 0. It was a requirement and documented (somewhere... I think the Wikia page...).

I don't know that it was a RFC requirement, but it helped keep things "light". That for me is important, otherwise we can't call it LwIP any more...

Ivan Delamer <idelamer>
Group Member
Mon 19 Sep 2016 10:43:56 AM UTC, comment #2: 

RFC 4291, 2.1: "All interfaces are required to have at least one Link-Local unicast address"

-> IMHO, this is not a bug.

Comments from anyone else?

Dirk Ziegelmeier <dziegel>
Group administrator
Mon 19 Sep 2016 02:05:57 AM UTC, comment #1: 

I find that add a local-link address to the interface will solve this problem. However, with further reading the RFC (RFC4861 7.2.2), I find that RFC recommended to set Neighbor Solicitation Message's source address to the messages that triggers the NS message. I also read lwip's code (function 'nd6_send_ns'), it set the NS message's source address to an empty address if local-link address is not valid at slot 0. I think lwip should at least select a valid address when local-link address dose not exist, instead of using empty address.

lishen <lishen5>
Tue 13 Sep 2016 03:47:45 AM UTC, original submission:  

I test lwip on stm32f207 chip, when act as tcp server, it worked well. But I cannot establish tcp connection when lwip act as tcp client. Through wireshark, I found that lwip failed to fill source address in Neighbor Solicitation Message, this cause server to responsed an Unsolicited Neighbor Advertisement Message. Debug messages and screenshots are as fellow.

ATTACHMENT:
debug_message.txt is lwip debug output when sending neighbor soliciation message.
lwip2linux.png is show the neighbor solicitation message lwip send, corresponding to the debug output.
win72linux.png is the neighbor solicitation message when I use win7 pc to ping a linux box.

lishen <lishen5>

 

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

Attached Files
file #38494:  win72linux.png added by lishen5 (109KiB - image/png)
file #38493:  lwip2linux.png added by lishen5 (103KiB - image/png)
file #38492:  debug_message.txt added by lishen5 (2KiB - text/plain)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by goldsimon (Updated the item)
  • -email is unavailable- added by idelamer (Posted a comment)
  • -email is unavailable- added by dziegel (Posted a comment)
  • -email is unavailable- added by lishen5 (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 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-09-29 goldsimon StatusFixed Invalid
    2016-09-29 dziegel StatusNone Fixed
        Open/ClosedOpen Closed
    2016-09-13 lishen5 Attached File- Added debug_message.txt, #38492
        Attached File- Added lwip2linux.png, #38493
        Attached File- Added win72linux.png, #38494

    Back to the top

    Powered by Savane 3.13-aa77.
    Corresponding source code