Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 20 Aug 2011 19:06:56 -0400
From:      Garrett Wollman <wollman@csail.mit.edu>
To:        java@freebsd.org, network@freebsd.org
Subject:   Why doesn't UDP work for ICSI Netalyzr in INET6 kernels?
Message-ID:  <20048.15888.402674.836232@khavrinen.csail.mit.edu>

next in thread | raw e-mail | index | archive | help
The ICSI Netalyzr tool (netalyzr.icsi.berkeley.edu) is a Java applet
and standalone Java program that checks for various issues with
network connections.  It attempts to use java.net.DatagramSocket.send
to send UDP packets to various destinations it's testing, and fails
with java.io.IOException:

002.097    main| Running test 3: checkUDP
002.097    main| ----------------------------
002.098  test-3| Sending UDP request to n4.netalyzr.icsi.berkeley.edu on port 1947
002.100  test-3| Test aborted due to IO exception:
002.102  test-3| java.io.IOException: Invalid argument
002.102  test-3| 	at java.net.PlainDatagramSocketImpl.send(Native Method)
002.102  test-3| 	at java.net.DatagramSocket.send(DatagramSocket.java:675)
002.102  test-3| 	at Netalyzr.checkUDP(Netalyzr.java:7509)
002.102  test-3| 	at Netalyzr$5.runImpl(Netalyzr.java:1701)
002.102  test-3| 	at Netalyzr$Test.run(Netalyzr.java:810)
002.102  test-3| 	at java.lang.Thread.run(Thread.java:722)

(excerpt from the Netalyzr client log).

I currently have openjdk-7.0.147_1 installed, but I've seen this
problem with recent openjdk6 as well.

Near as I can tell, the relevant system calls are as follows:

 54253 java     CALL  socket(PF_INET6,SOCK_DGRAM,IPPROTO_IP)
 54253 java     RET   socket 10/0xa
 54253 java     CALL  setsockopt(0xa,0x29,0x1b,0x7ffffe7ea4f8,0x4)
 54253 java     RET   setsockopt 0
 54253 java     CALL  setsockopt(0xa,SOL_SOCKET,SO_BROADCAST,0x7ffffe7ea4fc,0x4)
 54253 java     RET   setsockopt 0
 54253 java     CALL  bind(0xa,0x7ffffe7ea460,0x1c)
 54253 java     STRU  struct sockaddr { AF_INET6, [::]:0 }
 54253 java     RET   bind 0
 54253 java     CALL  getsockname(0xa,0x7ffffe7ea460,0x7ffffe7ea47c)
 54253 java     STRU  struct sockaddr { AF_INET6, [::]:49501 }
 54253 java     RET   getsockname 0
 54253 java     CALL  connect(0xa,0x7ffffe7ea490,0x1c)
 54253 java     STRU  struct sockaddr { AF_INET6, [::ffff:67.202.32.138]:1947 }
 54253 java     RET   connect 0
 54253 java     CALL  clock_gettime(0x4,0x7ffffe7e9b30)
 54253 java     RET   clock_gettime 0
 54253 java     CALL  clock_gettime(0x4,0x7ffffe7e9a80)
 54253 java     RET   clock_gettime 0
 54253 java     CALL  stat(0x83f85b460,0x7ffffe7e9090)
 54253 java     NAMI  "/usr/local/openjdk7/jre/lib/amd64/libnet.so"
 54253 java     STRU  struct stat {dev=1265533522, ino=31267, mode=-r--r--r-- , nlink=1, uid=0, gid=0, rdev=0, atime=1313879682.657870435, stime=1311142325.460426000, ctime=1311142337.955051534, birthtime=1311142337.333960566, size=99277, blksize=99328, blocks=195, flags=0x0 }
 54253 java     RET   stat 0
 54253 java     CALL  sendto(0xa,0x7ffffe7da570,0x25,0,0,0)
 54253 java     RET   sendto -1 errno 22 Invalid argument

At this point Netalyzr goes on to try the next thing on its list.

I am unable to figure out which EINVAL return in the kernel it is
hitting.  It is not the one related to net.inet6.ip6.v6only -- the
same error happens with it either on or off.  Netalyzr works just fine
if the kernel is compiled without options INET6 (so the Java libraries
seem to be correctly detecting the complete lack of IPv6 support, and
when they try to use only PF_INET sockets for IPv4 UDP traffic, it
does work).

The jar file can be downloaded at:
<http://netalyzr.icsi.berkeley.edu/NetalyzrCLI.jar>;

-GAWollman



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