Am Dienstag, den 16.05.2006, 13:30 +0200 schrieb Mladen Turk:
> Markus Schönhaber wrote:
> > Using APR_UNSPEC was introduced to make the APR Connector also listen on
> > IPv6 addresses if no specific address is configured - this way
> > resembling the behaviour of the Base Connector.
> > http://issues.apache.org/bugzilla/show_bug.cgi?id=37788
> > AFAICT by the change above this improvement is effectively undone.
> > 
> 
> No way. Try to use the IPV6 enabled APR and set the
> address="0.0.0.0" for the connector. It will fail,
> because with APR_UNSPEC if address is present it is
> presumed to be IPV6 address.

You're right, I can reproduce that.

> If the address is null then for IPV4 it will
> defaults to "0.0.0.0", and for IPV6 to "::"

Hm, if I do not set an address at all, without your change the Connector
binds to ::8080 on my (IPv6-enabled) machine. With your change, it binds
to 0.0.0.0:8080. That's what I meant by "improvement undone".
If I read the changed code correctly, APR_INET is always used, with the
single  exception when an IPv6 address is explicitly configured for the
Connector.
But, at least to my understanding, the only case APR_UNSPEC must not be
used on an IPv6-enabled machine is when an IPv4 address is configured
for the Connector. So maybe the condition should be changed to something
like:

---
tomcat/connectors/trunk/util/java/org/apache/tomcat/util/net/AprEndpoint.java.orig
       2006-05-16 09:58:48.000000000 +0200
+++
tomcat/connectors/trunk/util/java/org/apache/tomcat/util/net/AprEndpoint.java   
 2006-05-16 14:35:06.433662520 +0200
@@ -553,9 +553,9 @@
             addressStr = address.getHostAddress();
         }
         int family = Socket.APR_INET;
-        if (Library.APR_HAVE_IPV6 && addressStr != null) {
-            if (addressStr.indexOf(':') >= 0)
-                family= Socket.APR_UNSPEC;
+        if (Library.APR_HAVE_IPV6) {
+            if (addressStr == null || addressStr.indexOf(':') >= 0)
+                family = Socket.APR_UNSPEC;
         }
         long inetAddress = Address.info(addressStr, family,
                 port, 0, rootPool);


BTW: the Base Connector binds to ::ffff:<IPv4-address>:<port> if on an
IPv6-enabled machine an IPv4 address is configured for the Connector.
Maybe that can be achieved for the APR Connector too?

Regards
  mks



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to