You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2007/03/28 20:13:03 UTC

DO NOT REPLY [Bug 41973] New: - IPv6 APR Connectors assumes IPv4-mapped IPv6 address support

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41973>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41973

           Summary: IPv6 APR Connectors assumes IPv4-mapped IPv6 address
                    support
           Product: Tomcat 5
           Version: 5.5.23
          Platform: Other
        OS/Version: OpenBSD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Native:Integration
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: truk@optonline.net


Several operating systems don't support IPv4-mapped IPv6 address or have it 
disabled by default (windows, OpenBSD, FreeBSD, NetBSD).

In Sun's jvm on windows when a ServerSocket is created the jvm creates two 
sockets, one for IPv4 and another for IPv6. The BSD's haven't ported this 
feature yet and opted to disable IPv6 in jvm until someone ports the two socket 
approach.

When using tcnative on Windows or a *BSD system and the Connector element in 
Server.xml doesn't specify an address attribute, the behavior of the Connector
changes. On windows it goes from listening on both IPv6 and IPv4 to just 
listening on IPv6. For *BSD it goes from listening on IPv4 to listening on 
IPv6.

I should point out I've only seen the above described behavior change on the 
BSD's (I don't use windows), but based on my knowledge of how Sun's jvm works I 
expect the windows behavior to be as I described.

I believe the fully correct solution would be to implement the two socket 
approach like Sun did for server sockets on windows, however that's going to 
take a bit work. As a stop gap the following untested diff keeps IPv4 working 
for windows and *BSD. For windows to get both IPv4 and IPv6 support while using 
tcnative, users will need to configure a second Connector with address 
specified to "::" or other IPv6 address.

Index: util/java/org/apache/tomcat/util/net/AprEndpoint.java
===================================================================
--- util/java/org/apache/tomcat/util/net/AprEndpoint.java       (revision 
523411)
+++ util/java/org/apache/tomcat/util/net/AprEndpoint.java       (working copy)
@@ -555,10 +555,11 @@
         }
         int family = Socket.APR_INET;
         if (Library.APR_HAVE_IPV6) {
-            if (addressStr == null)
+            if (addressStr == null) {
+                if (!OS.IS_BSD && !OS.IS_WIN32 && !OS.IS_WIN64)
+                    family = Socket.APR_UNSPEC;
+            } else if (addressStr.indexOf(':') >= 0)
                 family = Socket.APR_UNSPEC;
-            else if (addressStr.indexOf(':') >= 0)
-                family = Socket.APR_UNSPEC;
         }
         long inetAddress = Address.info(addressStr, family,
                 port, 0, rootPool);

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 41973] - IPv6 APR Connectors assumes IPv4-mapped IPv6 address support

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41973>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41973





------- Additional Comments From mturk@apache.org  2007-03-28 11:54 -------
I agree with you, and yes windows has the same behavior as BSD
probably because Microsoft stole the entire networking from BSD ;)

Anyhow, in case the address is null it make sense to force the
IPV4 on those platforms (by default APR for windows comes without
IPV6 support, so you need to manually enable that during the build time).

On Windows and BSD one can simulate the same behavior like on Linux
or Solaris by using two connectors with the same port
IPV4 with address="0.0.0.0"
IPV6 with address="::"
(Something JDK is doing)

Anyhow, the problem is not with Tomcat native, but rather the APR
should probably support that transparently.
(It's on my TODO list for APR 2)


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 41973] - IPv6 APR Connectors assumes IPv4-mapped IPv6 address support

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41973>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41973


mturk@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Additional Comments From mturk@apache.org  2007-04-03 03:48 -------
Commited the proposed solution by using AF_INET for null addresses.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 41973] - IPv6 APR Connectors assumes IPv4-mapped IPv6 address support

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41973>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41973





------- Additional Comments From kurt@intricatesoftware.com  2007-03-29 07:15 -------
Making APR 2 transparently handle dual stacks sounds great. As a long term goal
that's the ideal solution. Also from a security standpoint, not using IPv4
mapped addresses for all OS's (even those that support it) would be a good idea,
IMO.

While tcnative is aligned with APR 1 could the proposed change be added? I
wasn't sure from your reply if it was. For the BSD's it is particularly needed
since our native jvm doesn't support IPv6. So what happens is that a working
server.xml stops working when tcnative is installed (due to the IPv4 to IPv6
shift when address is null).

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org