The Courier mail server (http://www.courier-mta.org) demonstrates a problem which may be a bug in glibc. When connecting to any local port that courier listens on (telnet localhost 25), courier tcpd accept()s an AF_INET6 connection. It attempts to verify the validity of the connection, during one of its checks, it compares the sizeof( struct sockaddr_in6 ) with the addrlen given by the call to accept(). The addrlen is 24, while sizeof( struct sockaddr_in6 ) is 28. Therefore, the test fails and the connection is dropped. The man page for accept states that addrlen will be set to "the actual length (in bytes) of the address returned". Courier, then, expects the addrlen to be at least the size of a struct sockaddr_in6. The kernel headers on this system are those from 2.2.16-22.
If you want to use IPv6, you must use 2.4 kernels. This is actually not related to glibc at all, because glibc accept directly passes its arguments to the kernel. IPv6 is a moving target and e.g. struct sockaddr_in6 has been updated in 2.4 by adding sin6_scope_id.
Noa Resare filed a bug with Sun. See bug 163006, comment #4. It's a bug in Sun's JVM. In comment #2, Ben Stringer writes: | connect(4, {sa_family=AF_INET6, sin6_port=htons(32774), | inet_pton(AF_INET6, "::1", &sin6_addr), sin6_flowinfo=0, | sin6_scope_id=3213364936}, 24) = -1 EINVAL Note that the value of the "addrlen" parameter to "connect" is 24 in the above call. It should be 28, because sizeof(struct sockaddr_in6) is 28.
oops, sorry. had too many tickets open in firefox. posted a comment on the wrong ticket.