In your previous mail you wrote:

   I want to write the macro IPPROTO_IPvX(s), returning IPPROTO_IP if the
   socket's domain is PF_INET and IPPROTO_IPV6 if it's PF_INET6. 
   
   I have been going trhough rfc2553 but couldn't find it. Does anybody
   have a clue ?
   
=> RFC 2133 had it:

   An application may use IPV6_ADDRFORM with getsockopt() to learn
   whether an open socket is a PF_INET of PF_INET6 socket.  For example:

       int  addrform;
       size_t  len = sizeof(addrform);

       if (getsockopt(s, IPPROTO_IPV6, IPV6_ADDRFORM,
                      (char *) &addrform, &len) == -1)
           perror("getsockopt IPV6_ADDRFORM");
       else if (addrform == PF_INET)
           printf("This is an IPv4 socket.\n");
       else if (addrform == PF_INET6)
           printf("This is an IPv6 socket.\n");
       else
           printf("This system is broken.\n");

But RFC 2553 (which obsoletes RFC 2133) has removed it:

      Section 5.1: The IPV6_ADDRFORM socket option was removed.

I believe it is because of the setsockopt() (too hard to implement)
but the getsockopt() is still useful. You should ask for it in the
IPng IETF WG mailing-list because the successor of RFC 2553 is being
discussed these days.

[EMAIL PROTECTED]

---------------------------------------------------------------------
The IPv6 Users Mailing List
Unsubscribe by sending "unsubscribe users" to [EMAIL PROTECTED]

Reply via email to