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

Ronald S. Bultje rsbultje
Thu Nov 8 19:21:33 CET 2007


Hi,

On Nov 8, 2007 1:02 PM, Nicolas George <nicolas.george at normalesup.org>
wrote:

> 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.


I added flags to force that already, see AV_RESOLVE_IPV[46]ONLY.


> > +#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.


No, the offset is the same for IPv4 and IPv6.


> > +#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?


The offset of the address from the data in the sockaddr_in and sockaddr_in6
struct. In both cases, there's a 16-bit port number, but after that, the
address follows directly in the sockaddr_in structure, whereas there's
another 32 bits in between for sockaddr_in6. Hence the different offset for
IPv4 and IPv6.

Ronald




More information about the ffmpeg-devel mailing list