[FFmpeg-devel] [PATCH/RFC] Prefer getaddrinfo over gethostbyname

Martin Storsjö martin
Tue Jan 12 18:21:50 CET 2010


On Tue, 12 Jan 2010, Ronald S. Bultje wrote:

> So, I think the attached would be easier. RFC-2553 defines the storage
> size to be 128, and although it may be more because of alignment, the
> result of the attached version would always be >=128, as defined in
> RFC-2553.

I'm not sure this is guaranteed to work. As described in the same RFC, 
sockaddr may include a member "sa_len" before the sa_family member, so the 
location within sockaddr_storage would have to match that. And the size of 
sa_family isn't necessarily 16 bit. (The same RFC says that it is 16 bit 
"on most implementations", but if sa_len is present, it probably is 8 bit 
instead, but afaik, an implementation is free to layout it in any other 
way.)

So I'm really at a loss for how to provide a reliable replacement for this 
struct including the correct fields.

// Martin



More information about the ffmpeg-devel mailing list