[FFmpeg-devel] [PATCH] IPv6 support v.2

Luca Abeni lucabe72
Thu Nov 8 09:55:09 CET 2007


Hi Nicolas,

Nicolas George wrote:
[...]
>>> - Simply drop the IPv4-only code.
>>>
>>> - If people complain that ffmpeg does not build anymore on their old
>>>   operating system, write a limited implementation of getaddrinfo.
>> As I said, I do not like this idea too much, and I'd prefer to arrive to
>> this result by committing small patches.
> 
> Then the opposite order could be ok:
> 
> - Implement a version of getaddrinfo and getnameinfo suitable for ffmppeg's
>   needs.
> 
> - Drop the IPv4-only code.

I am considering this approach... But before dropping the IPv4-only code I want
to be reasonably sure that the protocol-independent code is ok.
The point of the patches I just sent is to make sure that the code under
"CONFIG_IPV6" is equivalent to the "old" code.

I am currently looking at udp_ipv6_set_local(), and I have some doubts...
For example, the protocol-independent code seems to forget about SO_REUSEADDR
(question: does "setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, ...)" work on
IPv6 sockets too, or is a different setsockopt needed for the IPv6 case?)
Also, I see the following code:

     res0 = udp_ipv6_resolve_host(0, s->local_port, SOCK_DGRAM, family, AI_PASSIVE);
     if (res0 == 0)
         goto fail;
     for (res = res0; res; res=res->ai_next) {
         udp_fd = socket(res->ai_family, SOCK_DGRAM, 0);
         if (udp_fd > 0) break;
         perror("socket");
     }

     if (udp_fd < 0)
         goto fail;

     if (bind(udp_fd, res0->ai_addr, res0->ai_addrlen) < 0) {

Is this correct? Shouldn't the bind() be performed using "res" instead of "res0"?
I mean: doesn't the current code risk to open the socket for a family and to
bind to an address belonging to a different family?


			Thanks,
				Luca




More information about the ffmpeg-devel mailing list