On Tue, 2005-06-07 at 13:01 -0400, mclellan, dave wrote: > Hi everyone: I'm kind of new to IPv6, and I'm enhancing a client/server > application to support it. It's a simple application from the addressing > point of view, but running the server in a dual stack environment adds some > complexity. Essentially, the server needs to be availble to both IPv6 and > IPv4 clients. It seems that binding to the INADDR6_ANY address would be a > good thing to do, but this works differetnly on different OS's.
For all your answers, read Eva's excellent document at: http://gsyc.escet.urjc.es/~eva/IPv6-web/ipv6.html > I have found that Solaris allows bind() with socket using AF_INET6, > INADDR6_ANY, and that connections from IPv6 and IPv4 clients reach the > server and can be accepted. Using silly compatibility addresses > This is accomplished using only on passive > socket. Does this make sense? It was a tiny surprize (AF_INET6 was clearly > specified, and AF_INET was not), but from a migration and interoperability > point of view, it's a good thing. No it is not a good thing (IMHO), as your application gets a IPv6 connection and you suddenly have to handle it separately when displaying the information to the user. What I do actually in all my apps is strip the "::ffff:" from compatibility addresses, this to not confuse the user. It is very clear to them that 192.0.2.42 is IPv4, ::192.0.0.2.42 though must be a failure. There is another huge side effect, if you have application-side IP-based ACL's, the user might specify 192.0.2.0/24 to restrict access from that block. Because of the compatibility addresses one also has to apply those to all the incoming connections in IPv6 space, very convenient. Indeed great on first site, but starts crumbling down after that. > However, the same behavior is not true when the server is running on, e.g., > AIX or WIN2K. for these OSs, only IPv6 clients can connect to a server who > called bind with the same family and address. These both have split Btw, Win2k's stack works but is not complete and has minor issues, test your stuff on a XP SP1 box or higher (Win2k3 etc). > Here's the main question: > > - should it work consistently as a definition of the protocol: > bind(socket,sockaddr,len) where the socket is AF_INET6 and the IP address is > INADDR6_ANY. No, this will only bind to AF_INET6. Some OS's support the compatibility addresses, while some don't. > - server binds as described and clients connect from IP4 or IP6 families. On some platforms it does, on some it doesn't > - Are there some OSs that won't allow this? On these do I have to listen > on multiple sockets in different families, callling select() and then > accept()? Always use multiple sockets, for that matter, use getaddrinfo(). > Any shared experience would be helpful. I'm supporting Solaris, AIX, HP-UX, > Tru64, WIN2K, Linux various kernels, and some other oddball OS's. Read Eva's URL, that explains how you are supposed to be doing it :) And I can say, that except for HP-UX and Tru64 that trick works fine. Greets, Jeroen
signature.asc
Description: This is a digitally signed message part
