[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: lpd with IPv6 support -- testing and patch needed



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.

| [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.

Basically, if you see that an address is an ipv6 ipv4-compat/ipv4-mapped 
one, you can take the last 32 bits of the 128 bit IPv6 address and assume
it is an ipv4 address (of type struct in_addr).

-- 
                             __________________
Met vriendelijke groet,     /\ ___/
Pim van Pelt               /- \ _/  Business Internet Trends BV
PBVP1-RIPE                /--- \/            __________________



Reply to: