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

Nicolas George nicolas.george
Thu Nov 8 19:02:24 CET 2007


Le nonidi 9 brumaire, an CCXVI, Ronald S. Bultje a ?crit?:
> +int inetaddr_resolve(AVInetAddr **in_addr, const char *hostname,
> +                     int port, int flags)

I was going to advice the addition of a new argument, AVInetAddr
*other_addr, to require an address compatible with an address that we
already have. For example, a source address compatible with a destination
address. This was exactly the source of the macos bug, I believe.

But this is not good: if the source address is "localhost", which can mean
127.0.0.1 or ::1, then the source address family must be chosen according to
the destination address family. On the other hand, if the destination
address is an host name with both A and AAAA records, then the destination
address family must be chosen according to the source address family.

The conclusion is that, when dealing with potentially both a source address
and a destination address, both must be resolved in the beginning, and only
the compatible pairs should be kept.

> +#define INETADDR_PORT(a) \
> +    ((struct sockaddr_in *) a->addr)->sin_port

I believe this macro is wrong when dealing with addresses that are not IPv4.

> +#define INETADDR_ADDR(a) \
> +    a->addr->sa_data[a->addr->sa_family == AF_INET ? 2 : 6]

I do not understand this macro. In particular, what are 2 and 6?

Regards,

-- 
  Nicolas George




More information about the ffmpeg-devel mailing list