reopen 436988
severity 436988 minor
thanks

(Richard, if you do a wide reply, please make sure you remove control@
from the CC.)

I'm afraid that my patch may have broken compilation on older libc
releases.  Pierre, do we still care about libc 2.4 and earlier?

There are two incompatible IPv6 socket APIs: the one defined in
RFC 3542, which is implemented by GNU libc 2.5 and later, and the one
defined in RFC 2292, which is implemented by 2.4 and earlier.

In our case, the right thing to do is

  - setsockopt(IPV6_RECVPKTINFO) according to RFC 3542;
  - setsockopt(IPV6_PKTINFO) according to RFC 2292.

To add to the confusion, Linux defines a non-standard socket option
IPV6_2292PKTINFO which has the RFC 2292 semantics even on recent
systems.

I may be wrong, but I believe that something like the following should
work under all libc/kernel combinations.  However, I have not tested it.

  rc = -1; errno = ENOPROTOOPT;

#ifdef IPv6_RECVPKTINFO
rc = setsockopt(sock,SOL_IPV6,IPV6_RECVPKTINFO,&so,sizeof(so));
#endif
#ifdef IPV6_2292PKTINFO
if(rc < 0 && errno == ENOPROTOOPT)
  rc = setsockopt(sock,SOL_IPV6,IPV6_2292PKTINFO,&so,sizeof(so));
#endif
if(rc < 0 && errno == ENOPROTOOPT)
  rc = setsockopt(sock,SOL_IPV6,IPV6_PKTINFO,&so,sizeof(so));
  
                                        Juliusz


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to