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

Martin Storsjö martin
Fri Jan 8 09:05:27 CET 2010


On Fri, 8 Jan 2010, M?ns Rullg?rd wrote:

> > From 8783c7162749e85da5425f9d458b51246644ad59 Mon Sep 17 00:00:00 2001
> > From: Martin Storsjo <martin at martin.st>
> > Date: Wed, 6 Jan 2010 14:48:55 +0100
> > Subject: [PATCH 10/13] Don't check for getaddrinfo/getnameinfo in the ipv6 check
> >
> > We already provide fallbacks for them, so they can be relied upon.
> > ---
> >  configure |    2 --
> >  1 files changed, 0 insertions(+), 2 deletions(-)
> >
> > diff --git a/configure b/configure
> > index 9fe0bea..8839069 100755
> > --- a/configure
> > +++ b/configure
> > @@ -2473,8 +2473,6 @@ enabled_all network ipv6 && check_ld <<EOF || disable ipv6
> >  int main(void) {
> >      struct sockaddr_storage saddr;
> >      struct ipv6_mreq mreq6;
> > -    getaddrinfo(0,0,0,0);
> > -    getnameinfo(0,0,0,0,0,0,0);
> >      IN6_IS_ADDR_MULTICAST((const struct in6_addr *)0);
> >  }
> >  EOF
> >
> > From a43471cff029e2c9fb17a3bb259c56e95b778740 Mon Sep 17 00:00:00 2001
> > From: Martin Storsjo <martin at martin.st>
> > Date: Wed, 6 Jan 2010 14:52:56 +0100
> > Subject: [PATCH 11/13] When doing the IPv6 check, check in mingw specific headers, too
> >
> > ---
> >  configure |    6 +++++-
> >  1 files changed, 5 insertions(+), 1 deletions(-)
> >
> > diff --git a/configure b/configure
> > index 8839069..ccaf9b7 100755
> > --- a/configure
> > +++ b/configure
> > @@ -2465,11 +2465,15 @@ if enabled network; then
> >      fi
> >  fi
> >  
> > -enabled_all network ipv6 && check_ld <<EOF || disable ipv6
> > +enabled_all network ipv6 && check_ld $network_extralibs <<EOF || disable ipv6
> > +#ifdef __MINGW32__
> > +#include <ws2tcpip.h>
> > +#else
> >  #include <sys/types.h>
> >  #include <sys/socket.h>
> >  #include <netinet/in.h>
> >  #include <netdb.h>
> > +#endif
> >  int main(void) {
> >      struct sockaddr_storage saddr;
> >      struct ipv6_mreq mreq6;
> 
> What is the purpose of that check?  Whatever it's looking for can
> probably be checked individually with the various standard tests.

Initially, the check looked for the whole getaddrinfo/ipv6 suite of 
functions, structs and macros - used by the ipv6 codepath in the udp 
protocol. Since the getaddrinfo/address family independence are provided 
by us if missing, CONFIG_IPV6 can be changed into simply looking for 
ipv6/multicast-related structs/macros. In later commits, this is cleaned 
up by removing the non-ipv6 codepath that is redundant when we've got the 
address family independence functions available, leaving only CONFIG_IPV6 
for the multicast specific things.

So this check could indeed be changed to check for header items 
individually - but I'd say that could be done as later commits on top of 
these ones. Otherwise, I guess these two commits can be skipped for now.

// Martin



More information about the ffmpeg-devel mailing list