On Mon, Oct 20, 2003 at 08:04:04AM +0200, Pim van Pelt wrote: > Hoi Adam, > > | The current problem is that it cannot tolerate IPv4 addresses [1] > | as it can only bind to an IPv6 address and cannot do the > | same port on IPv4... [yes, I know, this is a "feature" of linux 2.4]. > | ie. you will NOT be able to connect from remote IPv4 clients. > | > | If anyone knows of a good, quick fix for this, then > | please send me a patch. Note that lpr must also > | work on legacy IPv4 only systems... > > The only good fix for interoperable code is to have two sockets. Not > all OS'es support IPv4 transport through IPv6 sockets. Linux does indeed. > One way is to getaddrinfo() for your fqdn and make a socket for each address > that gets returned (ipv4, ipv6), then select() or poll() on them all.
This is what is done by OpenBSD's lpr. Now I know that I can use IPV6_V6ONLY to only bind to ipv6.. This helps.. But now the problem is that it doesn't bind to IPV6 anymore enough though it doesn't give any errors. And yes, I checked that IPV6 goes though bind(), listen() and to select().. It is now the -test2 version at http://people.debian.org/~adamm/ See if it binds to IPv6 on your system... > | [1] - It barfs when it compares xxx.yyy.zzz.www to ::ffff:xxx:yyy:zzz:www > Check Stevens' Vol1, chapter 10, page 267. It handles IPv4/IPv6 > interoperability and your mapped addresses (::ffff:xxx.yyy.zzz.www by the > way). A pointer to what you need is defined in netinet/in.h, look for > IN6_IS_ADDR_* macro's. Is it preferred to bind to IPv4 AND IPv6 at the same time (same socket) instead of IPv4 and IPv6 on seperate sockets? If yes, then I can get rid of the IPV6_ONLY thing I added and just add IPv4 mapped address handling. - Adam

