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

Submitted by:  lishen <lishen5>
Submitted on:  Tue 13 Sep 2016 03:47:45 AM UTC  
 
Category: IPv6Severity: 3 - Normal
Item Group: Faulty BehaviourStatus: Invalid
Privacy: PublicAssigned to: None
Open/Closed: ClosedPlanned 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>
Project 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>
Project Member
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>

 

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

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by goldsimon (Updated the item)
  • -unavailable- added by idelamer (Posted a comment)
  • -unavailable- added by dziegel (Posted a comment)
  • -unavailable- added by lishen5 (Submitted the item)
  •  

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

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 29 Sep 2016 10:32:31 AM UTCgoldsimonStatusFixed=>Invalid
    Thu 29 Sep 2016 10:03:11 AM UTCdziegelStatusNone=>Fixed
      Open/ClosedOpen=>Closed
    Tue 13 Sep 2016 03:47:45 AM UTClishen5Attached 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.1-cleanup1