Subject: Re: [RFC] [DCCP]: Deprecate SOCK_DCCP in favour of SOCK_DGRAM

From: Rémi Denis-Courmont <[email-masked]>
Date: Tue, 13 May 2008 20:37:38 +0300

Le Tuesday 13 May 2008 20:03:25 Gerrit Renker, vous avez écrit :
> Using work-arounds is brittle and frustrating when the API behaviour
> suddenly changes. My experience of using such a wrapper was:
>
>  * it passed UDP(-Lite), TCP through without changing the socket type;
>  * when passed DCCP, it set the socket type to 0, to avoid `ai_socktype
>    not supported' getaddrinfo error;

>  * this used to work fine until about January, when something in the
>    lookup machinery for dual-stack hosts changed:
>    - before, AF_UNSPEC + ai_socktype=0 put IPv6 first into the result list,
>    - now the the result order is reversed (IPv4 sockets are returned first)

You're probably using a recent libc that applies RFC3484 _properly_. If you 
still want IPv6 first, no matter what addresses the host has, I think the 
AI_PASSIVE flag should do the trick. Then again, working around RFC3484 
policy is _not_ a good idea.

As far as I am concerned, for DCCP, I (meaning VLC) currently use SOCK_STREAM, 
and overrides the socktype and protocol fields in the socket() call 
manually - so I don't get a TCP socjet.

In any case, getaddrinfo() should be patched to
1/ accept ai_socktype == SOCK_DCCP and ai_protocol == IPPROTO_DCCP,
2/ accept ai_socktype == SOCK_DCCP and ai_protocol == 0,
   and set ai_protocol to IPPROTO_DCCP in the results,
3/ (perhaps?) accept ai_protocol == IPPROTO_DCCP and ai_socktype == 0,
   and set ai_socktype to SOCK_DCCP in the results.

Similarly:
1/ accept ai_socktype == SOCK_DGRAM and ai_protocol == IPPROTO_UDPLITE,
2/ (intentionally omitted - keep normal UDP non-Lite behavior)
3/ (perhaps?) accept ai_protocol == IPPROTO_UDPLITE and ai_socktype == 0,
   and set ai_socktype to SOCK_DGRAM in the results.

Voilà. Best to check this with Ulrich Drepper, no?

-- 
Rémi Denis-Courmont
http://www.remlab.net/