[bug #54315] IPV6_V6ONLY socket accepts IPV4 connections

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[bug #54315] IPV6_V6ONLY socket accepts IPV4 connections

Simon Goldschmidt
URL:
  <http://savannah.nongnu.org/bugs/?54315>

                 Summary: IPV6_V6ONLY socket accepts IPV4 connections
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: jllledo
            Submitted on: Sun 15 Jul 2018 06:16:55 PM CEST
                Category: IPv6
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None
            lwIP version: git head

    _______________________________________________________

Details:

Hello,

I observed a strange behaviour on a socket that has the option IPV6_V6ONLY
enabled.

I follow these steps:

        1.- Create an IPV6 only socket listening on ::
        2.- Create an IPV4 socket listening on 0.0.0.0
        3.- Call select() on both sockets
        4.- From another terminal, run netcat and connect using an IPV4 address

Result:
        The IPV6 only socket is being awaken by the stack, it shouldn't since it's
not supposed to listen to IPV4 connections.

Attached is a test program. When I run it using lwip stack & sockets API, it
prints:
        New IPV6 connection , socket fd is 2 , ip is : 192.168.30.1 , port : 34588

But when I run it using glibc and the linux stack, I see this:
        New IPV4 connection , socket fd is 5 , ip is : 192.168.30.1 , port : 56504

Which is the behaviour I assume is correct.



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Sun 15 Jul 2018 06:16:55 PM CEST  Name: select6.c  Size: 8KiB   By:
jllledo

<http://savannah.nongnu.org/bugs/download.php?file_id=44560>

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?54315>

_______________________________________________
  Message sent via Savannah
  https://savannah.nongnu.org/


_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel
Reply | Threaded
Open this post in threaded view
|

[bug #54315] IPV6_V6ONLY socket accepts IPV4 connections

Simon Goldschmidt
Update of bug #54315 (project lwip):

         Planned Release:                    None => 2.1.0                  


    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?54315>

_______________________________________________
  Message sent via Savannah
  https://savannah.nongnu.org/


_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel
Reply | Threaded
Open this post in threaded view
|

[bug #54315] IPV6_V6ONLY socket accepts IPV4 connections

Simon Goldschmidt
Update of bug #54315 (project lwip):

                  Status:                    None => Fixed                  
             Assigned to:                    None => goldsimon              
             Open/Closed:                    Open => Closed                

    _______________________________________________________

Follow-up Comment #1:

Fixed:
http://git.savannah.nongnu.org/cgit/lwip.git/commit/?id=258cab1b22327a31016fe9db92a98b2843f1c5a6

tcp_bind() did not update the local_ip in all required cases.

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?54315>

_______________________________________________
  Message sent via Savannah
  https://savannah.nongnu.org/


_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel
Reply | Threaded
Open this post in threaded view
|

[bug #54315] IPV6_V6ONLY socket accepts IPV4 connections

Simon Goldschmidt
Follow-up Comment #2, bug #54315 (project lwip):

Please note that this fix will also resolve the following case:
- IPv4 & IPv6 activated,
- tcp_bind called with IP_ANY_TYPE as ipaddr parameter,
-> only IPv4 client is accepted because type 46 address isn't copied to pcb
during the call of tcp_bind.

Regards

    _______________________________________________________

Reply to this item at:

  <https://savannah.nongnu.org/bugs/?54315>

_______________________________________________
  Message sent via Savannah
  https://savannah.nongnu.org/


_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel