From owner-freebsd-hackers@FreeBSD.ORG Fri Jun 24 21:22:33 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 05F93106564A; Fri, 24 Jun 2011 21:22:32 +0000 (UTC) (envelope-from prvs=1156dbda56=killing@multiplay.co.uk) Received: from mail1.multiplay.co.uk (mail1.multiplay.co.uk [85.236.96.23]) by mx1.freebsd.org (Postfix) with ESMTP id EB6EA8FC12; Fri, 24 Jun 2011 21:22:31 +0000 (UTC) X-MDAV-Processed: mail1.multiplay.co.uk, Fri, 24 Jun 2011 22:10:54 +0100 X-Spam-Processed: mail1.multiplay.co.uk, Fri, 24 Jun 2011 22:10:54 +0100 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on mail1.multiplay.co.uk X-Spam-Level: X-Spam-Status: No, score=-5.0 required=6.0 tests=USER_IN_WHITELIST shortcircuit=ham autolearn=disabled version=3.2.5 Received: from r2d2 ([188.220.16.49]) by mail1.multiplay.co.uk (mail1.multiplay.co.uk [85.236.96.23]) (MDaemon PRO v10.0.4) with ESMTP id md50013860081.msg; Fri, 24 Jun 2011 22:10:53 +0100 X-MDRemoteIP: 188.220.16.49 X-Return-Path: prvs=1156dbda56=killing@multiplay.co.uk X-Envelope-From: killing@multiplay.co.uk Message-ID: <9585F512F239475B8145C3D344F6EC62@multiplay.co.uk> From: "Steven Hartland" To: , , Date: Fri, 24 Jun 2011 22:11:12 +0100 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.5931 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6090 Cc: Subject: IPv4 socket bind using IPv6 socket on openjdk6 breaks udp send X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Jun 2011 21:22:33 -0000 We're trying to get our machines IPv6 enabled but in doing so this seems to break java apps using openjdk6 for UDP sends. The server seems quite happy to send and receive TCP packets on IPv6 socket that are bound to IPv4 addresses, but the same is not true for UDP. The socket bind works fine and the packets sent to the server arrive and are processed by the app but when it tries to reply using send the result is:- java.io.IOException: Invalid argument at java.net.PlainDatagramSocketImpl.send(Native Method) at java.net.DatagramSocket.send(DatagramSocket.java:629) using truss we see the following:- socket(PF_INET6,SOCK_DGRAM,0) = 20 (0x14) setsockopt(0x14,0x29,0x1b,0x7ffffedf0318,0x4,0x0) = 0 (0x0) setsockopt(0x14,0xffff,0x20,0x7ffffedf031c,0x4,0x0) = 0 (0x0) bind(20,{ AF_INET6 [3800::10:0:0:0]:20736 },28) = 0 (0x0) .. recvfrom(20,0x7ffffeaeb580,1460,0x0,0x7ffffeaed580,0x7ffffeaed5ac) ERR#60 'Operation timed out' .. sendto(20,"\M^?\M^?\M^?\M^?I\aMultiplay :: "...,82,0x0,{ AF_INET6 [3800::10:0:0:0]:20736 },0x1c) ERR#22 'Invalid argument' sockstat shows it binding correctly root java 894 21 tcp4 85.236.109.212:25675 *:* The following PR seems relevant but also seems to indicate it was fixed back in 2006 http://www.freebsd.org/cgi/query-pr.cgi?pr=92620 Setting -Djava.net.preferIPv4Stack=true does workaround the issue but when we come to support IPv6 as well as IPv4 this won't work. Note: net.inet6.ip6.v6only was set to the default 1 but changing it to 0 has no effect on the issue. An ideas why tcp in this setup works fine for udp fails only on send? Not sure which list is best for this so sorry about the cross posting. Regards Steve ================================================ This e.mail is private and confidential between Multiplay (UK) Ltd. and the person or entity to whom it is addressed. In the event of misdirection, the recipient is prohibited from using, copying, printing or otherwise disseminating it or any information contained in it. In the event of misdirection, illegible or incomplete transmission please telephone +44 845 868 1337 or return the E.mail to postmaster@multiplay.co.uk.