From owner-freebsd-java@FreeBSD.ORG Mon Aug 25 11:51:26 2008 Return-Path: Delivered-To: freebsd-java@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2A9811065672 for ; Mon, 25 Aug 2008 11:51:26 +0000 (UTC) (envelope-from bjo@cs.vu.nl) Received: from open.nlnetlabs.nl (open.nlnetlabs.nl [IPv6:2001:7b8:206:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id C19F78FC19 for ; Mon, 25 Aug 2008 11:51:25 +0000 (UTC) (envelope-from bjo@cs.vu.nl) Received: from tinkerbell.nlnetlabs.nl (tinkerbell.nlnetlabs.nl [213.154.224.13]) (authenticated bits=0) by open.nlnetlabs.nl (8.14.2/8.14.2) with ESMTP id m7PBpJul086159 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 25 Aug 2008 13:51:19 +0200 (CEST) (envelope-from bjo@cs.vu.nl) Message-ID: <48B29CB7.9010907@cs.vu.nl> Date: Mon, 25 Aug 2008 13:51:19 +0200 From: Benno Overeinder User-Agent: Thunderbird 2.0.0.16 (Macintosh/20080707) MIME-Version: 1.0 To: freebsd-java@freebsd.org X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-3.0 (open.nlnetlabs.nl [213.154.224.1]); Mon, 25 Aug 2008 13:51:19 +0200 (CEST) X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on open.nlnetlabs.nl Subject: FreeBSD Java, IPv6, and DNS SRV query type X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Aug 2008 11:51:26 -0000 Hi, Sometimes you just want it all: Java, IPv6, *and* DNS SRV query type requests. Well, why? We run an Openfire Jabber/XMPP server and want to run this service with IPv6 support. So what is the situation. With the Diablo Caffe/Latte package, IPv6 support is not enabled. (I don't know why, maybe someone can shed a light on this?) To get Java with IPv6 support, we installed jdk15 (and later jdk16) using ports (java/jdk15 and java/jdk16). During installation process we enabled IPv6 in the configuration. All set and go, and IPv6 worked with our Java programs, including the Openfire server. However, DNS SRV _xmpp-server._tcp.domain.name resolution fails with the ports java/jdk16 build. (Consequently, only Jabber servers that are running on hosts known by their DNS domain name are found.) For example, contacts with a Google Talk account are not found. I have written a small test program (http://www.nlnetlabs.nl/~benno/opendir/DNSSRV.java) to check what is going wrong. Running DNSSRV with diablo jdk16 (no IPv6) or on a Linux box with jdk16 (*with* IPv6), gives the following output: Hostname: google.com, resolved hostname: xmpp-server4.l.google.com (the result of a DNS SRV request type to google.com) Running DNSSRV with Sun jdk16 from ports java/jdk16 results in the following exception: DNS error javax.naming.CommunicationException: DNS error [Root exception is java.io.IOException: Invalid argument]; remaining name '_xmpp-server._tcp.google.com' at com.sun.jndi.dns.DnsClient.query(DnsClient.java:283) at com.sun.jndi.dns.Resolver.query(Resolver.java:64) at com.sun.jndi.dns.DnsContext.c_getAttributes(DnsContext.java:413) at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_getAttributes(ComponentDirContext.java:213) at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.getAttributes(PartialCompositeDirContext.java:121) at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.getAttributes(PartialCompositeDirContext.java:109) at javax.naming.directory.InitialDirContext.getAttributes(InitialDirContext.java:123) at DNSSRV.resolveXMPPServerDomain(DNSSRV.java:80) at DNSSRV.main(DNSSRV.java:122) Caused by: java.io.IOException: Invalid argument at java.net.PlainDatagramSocketImpl.send(Native Method) at java.net.DatagramSocket.send(DatagramSocket.java:612) at com.sun.jndi.dns.DnsClient.doUdpQuery(DnsClient.java:379) at com.sun.jndi.dns.DnsClient.query(DnsClient.java:186) ... 8 more Catch 11 DNS error Hostname: google.com, resolved hostname: google.com >From what I can deduce, is that although the _xmpp-server._tcp.google.com is a valid name for a DNS SRV request type, the method DnsClient.query receives an invalid argument error (from a native library, or other Java method not shown in the call stack trace?). Is the DNS SRV query type lost somewhere in interaction chain with the native DNS resolver library? Is this a problem with compiling jdk16 against our own libraries (FreeBSD 6.3 and FreeBSD 7.0) and what is going wrong here? Why does DNS SRV works with Diablo jdk16, but not with our own compile ports java/jdk16? Or how do we get IPv6 working with Diablo jdk16? Thanks, -- Benno -- Benno J. Overeinder NLnet Labs http://www.nlnetlabs.nl/