Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Jun 2011 22:11:12 +0100
From:      "Steven Hartland" <killing@multiplay.co.uk>
To:        <freebsd-java@freebsd.org>, <freebsd-net@freebsd.org>, <freebsd-hackers@freebsd.org>
Subject:   IPv4 socket bind using IPv6 socket on openjdk6 breaks udp send
Message-ID:  <9585F512F239475B8145C3D344F6EC62@multiplay.co.uk>

next in thread | raw e-mail | index | archive | help
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.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9585F512F239475B8145C3D344F6EC62>