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

Martin Storsjö martin
Mon Jan 11 23:22:22 CET 2010


Hi Ronald,

On Mon, 11 Jan 2010, Ronald S. Bultje wrote:

> On Mon, Jan 11, 2010 at 2:45 PM, Martin Storsj? <martin at martin.st> wrote:
> > Agh, I thought I checked that none of the uses of sockaddr_storage
> > actually used its fields. (Instead of checking ->ss_family, one can cast
> > it to (struct sockaddr *) and check ->sa_family instead.) But apparently I
> > missed this one.
> [..]
> > The other option would be to avoid accessing the ss_family field - by
> > redefining the parameter to is_multicast_address to be struct sockaddr
> > insted, and use ->sa_family.
> 
> That's fine with me, if Luca is OK with it.

Ok, something like this, then? (Attached patch.) The (hopefully soon to be 
removed) ipv4 version of is_multicast_address gets a little messier due to 
this, but otherwise it's a relatively clean change imho.

> > Well, actually, udp.c defines some kind of fallback for
> > IN6_IS_ADDR_MULTICAST at the start of the file, but this might be a good
> > idea anyway.
> 
> Problem is, we don't know if sockaddr_in6 exists at all. Better leave
> it out if we're not sure.

Ah, indeed, missed that one. Yes, it needs to be within #if 
CONFIG_IPV6_MULTICAST or similar.

// Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: remove_ss_family.patch
Type: text/x-diff
Size: 1557 bytes
Desc: 
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100112/6989f22a/attachment.patch>



More information about the ffmpeg-devel mailing list