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: [EMAIL PROTECTED]


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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to