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

Nicolas George nicolas.george
Thu Nov 8 18:41:22 CET 2007


L'octidi 18 brumaire, an CCXVI, Luca Abeni a ?crit?:
> 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?)

It is the same for all socket families (that is supposed to be the meaning
of SOL_SOCKET: works for all sockets, and in that case that is true).

You are right, the call is missing.

> 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 think you found another bug indeed.

And I believe that the perror (which should probably be a av_log) should be
called only when all addresses have failed.

And this snippet will give very strange results if the standard input have
been closed: the correct test is probably udp_fd >= 0.

Regards,

-- 
  Nicolas George




More information about the ffmpeg-devel mailing list