patchlwIP - A Lightweight TCP/IP stack - Patches: patch #7808, IPv6: Add IPV6_V6ONLY functionality

 
 

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

patch #7808: IPv6: Add IPV6_V6ONLY functionality

Submitter:  James Smith <rallysmith>
Submitted:  Wed 27 Jun 2012 09:44:58 AM UTC
   
 
Category:  None Priority:  5 - Normal
Status:  Done Privacy:  Public
Assigned to:  idelamer Open/Closed:  Closed
Planned Release:  None

Tue 03 Jul 2012 07:18:03 PM UTC, comment #5: 

I have applied this patch (with minor cosmetic modifications) to GIT master.

Many thanks for the contribution!

PS: I will be working to support similar functionality in UDP netconns.

Ivan Delamer <idelamer>
Group Member
Thu 28 Jun 2012 03:02:52 PM UTC, comment #4: 

Thanks Jamie, I will review and try to work into HEAD in the coming weeks.

Cheers
Ivan

Ivan Delamer <idelamer>
Group Member
Thu 28 Jun 2012 09:24:23 AM UTC, comment #3: 

Typo: Should say:

... but if an application explicitly wants to ignore IPv4 connections on its IPv6 sockets then it should use the IPV6_V6ONLY option. ...

Sorry about that!

James Smith <rallysmith>
Thu 28 Jun 2012 08:32:36 AM UTC, comment #2: 

Ivan says in comment #1

> Could you summarize the RFC requirement, please?


Basically RFC#3493 states that by default AF_INET6 sockets should allow IPv4 connections, but if an application explicitly wants to ignore IPv6 connections on its IPv6 sockets then it should use the IPV6_V6ONLY option.

Here is a quote of (most) of the relevant section, since it is not too large (from http://www.faqs.org/rfcs/rfc3493.html):

 5.3 IPV6_V6ONLY option for AF_INET6 Sockets

  This socket option restricts AF_INET6 sockets to IPv6
  communications only. As stated in section
  <3.7 Compatibility with IPv4 Nodes>, AF_INET6 sockets
  may be used for both IPv4 and IPv6 communications.
  Some applications may want to restrict their use of an
  AF_INET6 socket to IPv6 communications only. For these
  applications the IPV6_V6ONLY socket option is defined.
  When this option is turned on, the socket can be used to
  send and receive IPv6 packets only. ...

  ...

  Note - This option has no effect on the use of IPv4 Mapped
  addresses which enter a node as a valid IPv6 addresses for
  IPv6 communications as defined by Stateless IP/ICMP
  Translation Algorithm (SIIT) [5].

Ivan says in comment #1

> ... I will try to implement it ...


Addmittedly the patch I supplied just provides the IPV_V6ONLY sockopt handling AND a solution for the sequential API (the RAW API users can always call tcp_listen or tcp_listen_dual as appropriate for their use of lwIP).

However, with the patch applied to the HEAD I can successfully create and listen on an AF_INET6 socket and have IPv4 or IPv6 clients attach, so what is in the HEAD "works" with the patch applied. So I think all of the heavy lifting had already been done and is in the HEAD, since all I had to do (and what is in the patch) is ensure tcp_listen_dual is called if IPV6_V6ONLY has NOT been set.

The caveat is that limited testing has been done so far, since I needed to put this patch in place to allow our stress test setup to operate and to start making use of lwIP IPv6 support. So far though I have run quite a few test sessions with IPv4 clients successfully connecting and transferring data to/from the IPv6 socket.

Admittedly on one architecture I did encounter an assert from within lwIP when doing a lot of large packet IPv6 transfers; but that issue is more than likely unrelated to this "allow IPv4 connections by default" change (and is on my debug pile to investigate :-)

Cheers,
-- Jamie

James Smith <rallysmith>
Wed 27 Jun 2012 04:20:40 PM UTC, comment #1: 

Thanks for the patch, James.

Could you summarize the RFC requirement, please? As you've noticed, at the moment we have sockets/netconns listening exclusively on IPv4 or IPv6 addresses. This is a nuisance and it's in my TODO list to implement listening on either, if desired.

IF you can summarize the requirement, I will try to implement it and push it to HEAD.

If you think current behavior is a bug or not conformant to RFC, you can file it as a bug report so we can track it and discuss implementation steps there.

Cheers
Ivan

Ivan Delamer <idelamer>
Group Member
Wed 27 Jun 2012 09:44:58 AM UTC, original submission:  

As recently discussed on lwip-devel a patch to implement IPV6_V6ONLY support to make use of tcp_listen_dual when using the sequential API listen() interface.

This (by default) allows AF_INET6 sockets to accept IPv4 connections on suitable ANY-address connections.

This however does mean a change in the "default" behaviour of previous LWIP_IPV6 builds where there was no control available and the default use of tcp_listen meant IPv4 connections were refused. This change in behaviour between the pre- and post-patched worlds is to conform to the RFC#3493 requirement of the feature being OFF by default.

James Smith <rallysmith>

 

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

Attached Files
file #26111:  ipv6_v6only.patch added by rallysmith (7KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by idelamer (Posted a comment)
  • -email is unavailable- added by rallysmith (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
    2012-07-03 idelamer StatusNone Done
        Assigned toNone idelamer
        Open/ClosedOpen Closed
    2012-06-27 rallysmith Attached File- Added ipv6_v6only.patch, #26111

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code