Bug 43968 - [patch] support ipv6 with mod_jk
Summary: [patch] support ipv6 with mod_jk
Status: RESOLVED FIXED
Alias: None
Product: Tomcat Connectors
Classification: Unclassified
Component: Common (show other bugs)
Version: unspecified
Hardware: Other other
: P2 enhancement with 11 votes (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
: 51261 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-11-26 15:26 UTC by Eiji Takahashi
Modified: 2014-06-04 04:35 UTC (History)
3 users (show)



Attachments
ipv6 support patch (13.69 KB, patch)
2007-11-26 15:27 UTC, Eiji Takahashi
Details | Diff
patch for mod_jk-1.2.27-dev (14.20 KB, patch)
2008-02-03 22:38 UTC, Eiji Takahashi
Details | Diff
patch for 1.2.30 (20.63 KB, patch)
2011-05-25 09:01 UTC, Eiji Takahashi
Details | Diff
patch for trunk (14.12 KB, patch)
2011-05-25 09:01 UTC, Eiji Takahashi
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eiji Takahashi 2007-11-26 15:26:35 UTC
Dear developers.

I made the mod_jk patch to support ipv6 between mod_jk and Tomcat.
The detection of getaddrinfo() and implementation of jk_resolve()
referred to APR.

This patch was tested in the following environments (Do not compile in
other OS's).
1.RHEL4/5 with Apache 2.x
 Link-Local address cannot be used.

2.Windows XP Pro with IIS 5.1
 isapi_redirector.dll was constructed by VS 2005 Express + PSDK.
 when constructing the isapi_redirector.dll,  '/D "HAVE_IPV6"' and
'/D "HAVE_GETADDRINFO"' were specified.

My best regards.
Comment 1 Eiji Takahashi 2007-11-26 15:27:43 UTC
Created attachment 21189 [details]
ipv6 support patch
Comment 2 Eiji Takahashi 2008-02-03 22:38:59 UTC
Created attachment 21463 [details]
patch for mod_jk-1.2.27-dev

new patch for mod_jk-1.2.27-dev
Comment 3 Eiji Takahashi 2011-05-25 09:01:07 UTC
Created attachment 27058 [details]
patch for 1.2.30

Patch for 1.2.30.
I did only an easy connection test.

<<workers.properties>>
worker.ajp1.host=::1
worker.ajp1.port=8009

regards.
Comment 4 Eiji Takahashi 2011-05-25 09:01:43 UTC
Created attachment 27059 [details]
patch for trunk

Patch for trunk.
I did only an easy connection test.

<<workers.properties>>
worker.ajp1.host=::1
worker.ajp1.port=8009

regards.
Comment 5 qingkang xu 2011-05-26 09:19:16 UTC
I used ipv6_for_1230.patch on 64bit's linux OS, But it also failed when workers.properties file's host is ipv6 address.

my works.properties is like following:
-----------
worker.list=lb1

worker.ci1.type=ajp13
worker.ci1.host=2001::178
worker.ci1.port=18009
worker.ci1.lbfactor=50
worker.ci1.socket_connect_timeout=3000

worker.ci2.type=ajp13
worker.ci2.host=2001::178
worker.ci2.port=28009
worker.ci2.lbfactor=50
worker.ci2.socket_connect_timeout=3000

worker.lb1.type=lb
worker.lb1.balance_workers=ci1,ci2
worker.lb1.sticky_session=false
worker.lb1.sticky_session_force=false
worker.lb1.retries=0
-----------

I patched the ipv6_for_1230.patch and rebuilded jk
----
$patch -p1 < ipv6_for_1230.patch
$cd tomcat-connector-1.2.30-src/native
$CFLAGS="-m64" ./configure --with-apxs=$apache2.2.15_root/bin/apxs && make && make install
$$apache2.2.15_root/bin/apachectl -k start
----

then,vi $apache2.2.15_root/logs/mod_jk.log, Threr are following error messages
---
ajp_validate::jk_ajp_common.c (2619): worker ci1 can't resolve tomcat address 2001::178
ajp_validate::jk_ajp_common.c (2624): worker ci1 contact is disabled
...
Comment 6 Eiji Takahashi 2011-05-26 10:26:10 UTC
(In reply to comment #5)
(snip)
> I patched the ipv6_for_1230.patch and rebuilded jk
> ----
> $patch -p1 < ipv6_for_1230.patch
> $cd tomcat-connector-1.2.30-src/native
Before you do the configure command, execute buildconf.sh.

> $CFLAGS="-m64" ./configure --with-apxs=$apache2.2.15_root/bin/apxs && make &&
> make install
> $$apache2.2.15_root/bin/apachectl -k start
> ----
> 
> then,vi $apache2.2.15_root/logs/mod_jk.log, Threr are following error messages
> ---
> ajp_validate::jk_ajp_common.c (2619): worker ci1 can't resolve tomcat address
> 2001::178
> ajp_validate::jk_ajp_common.c (2624): worker ci1 contact is disabled
> ...

regards.
Comment 7 Rainer Jung 2011-10-23 20:17:34 UTC
*** Bug 51261 has been marked as a duplicate of this bug. ***
Comment 8 Rainer Jung 2011-10-24 18:37:25 UTC
Hi Eiji,

in jk_connect.c your removed a big block, which was executed when HAVE_APR was defined. Below the block it saqys we should use gethostbyname_r in a multi-threaded environment, which works here at least when using APR, because then we fall back to using APR.

When removing the block this is no longer true. Can you comment, why you removed that block starting at line 350?

Another question: will your patch only work for Apache, or also for IIS and NSAPI? Even without that it is an improvement, just trying to understand.

Regards,

Rainer
Comment 9 AlexL 2012-07-18 18:22:31 UTC
Hi,

I ran into this problem of mod_jk not supporting ipv6, and found this bug.  Is this going to be fixed,  or is mod_jk obsolete? On the Tomcat FAQ page on connectors (http://wiki.apache.org/tomcat/FAQ/Connectors),  mod_jk is presented as the preferred connector:

"mod_jk is mature, stable and extremely flexible.. It is under active development by members of the Tomcat community."

I found out that mod_proxy and mod_proxy_ajp do work with ipv6, so I guess I will try to use those instead.

Thanks,
Comment 10 Mladen Turk 2013-09-04 07:22:40 UTC
I'm going to work on this feature this and next week, so hopefully we'll have IPV6 support inside mod_jk.

First thing is that APR should be used for name resolution whenever present, so this means that the provided patch removing APR support completely will have to be modified.

Next thing is how to preserve backward compatibility for existing configurations where IPV4 is preferred over IPV6 when resolving hostnames.

There are two options.
a) have worker.name.hostname6 = localhost
b) have worker.name.hostname = ::localhost

In case there is a colon inside name (eg. ::1) use IPV6

Beside that most of the Eiji's patch can be reused.
Comment 11 Konstantin Kolinko 2014-06-03 22:25:54 UTC
IPv6 support in mod_jk has been added in 1.2.39.

Is there anything left here, or this can be closed as FIXED?
Comment 12 Mladen Turk 2014-06-04 04:35:54 UTC
Resolving the issue since it's been implemented