Re: [PATCH] ipv6 rework in udp_establish_listener

Pascal Terjan <[email protected]> Wed, 17 Aug 2005 14:36:37 +0200
Newsgroups gmane.comp.multimedia.xmms.devel
Organization Mandriva
Message-ID <1124282197.5167.20.camel@plop>
Le mercredi 17 août 2005 à 13:54 +0200, Samuel Thibault a écrit :
> Pascal Terjan, le Wed 17 Aug 2005 13:42:00 +0200, a écrit :
> > Le mercredi 17 août 2005 à 00:06 +0200, Pascal Terjan a écrit :
> > > Here is a new version, also changing udp_check_for_data so that no
> > > USE_IPV6 remain in the code (considering patch from the email "Patch re:
> > > the "IPv6" connection code" is applied).
> > 
> > BTW, I used sockaddr_storage, getnameinfo, INET6_ADDRSTRLEN and
> > AF_INET6. Does someone know if some is plateform dependant and may need
> > to get defined ?
> 
> Old systems without ipv6 won't have them indeed.

For AF_INET6 I would do :

#ifdef AF_INET6
        if ((*sock = socket(AF_INET6, SOCK_DGRAM, 0)) < 0)
#endif
        if ((*sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0)

INET6_ADDRSTRLEN is also OK :

#ifndef INET6_ADDRSTRLEN
#define INET6_ADDRSTRLEN 46 
#endif

sockaddr_storage can also easily get defined, so only getnameinfo (and
it's parameters NI_NUMERICSERV and NI_NUMERICHOST) needs writing code. 

I think the best way to handle that would be something like
HAVE_GETNAMEINFO and keeping the ipv4 specific code but I don't know if this is usefull...
I have no idea how much system do not have this but have all xmms dependencies building...

(talking only for my patch, not the other ipv6 patches that I did not
yet really read but I think it uses getaddrinfo so will be more tricky 
to have working...)