[MPlayer-dev-eng] [PATCH] Don't try to connect to AF_INET address with AF_INET6

Alexander Strasser eclipse7 at gmx.net
Wed Jul 10 23:10:10 CEST 2013


Hi Aaron, hi Erik!

On 2013-07-06 17:59 +0200, Erik Auerswald wrote:
> On 07/06/2013 03:19 AM, Aaron Plattner wrote:
> >When _BSD_SOURCE isn't defined, gethostbyname2() isn't available.  This causes
> >HAVE_GETHOSTBYNAME2 to be undefined, making connect2Server_with_af fall back to
> >gethostbyname(), which always returns an AF_INET address.
> >
> >Without a check against hp->h_addrtype, this causes the memcpy to stuff the 4
> >bytes of the AF_INET address into the beginning of the AF_INET6 address field:
> >
> >  Playing http://www.facebook.com/.
> >  Resolving www.facebook.com for AF_INET6...
> >  Connecting to server www.facebook.com[45ab:ed14::]: 80...
> >
> >  Failed to connect to server with AF_INET6
> >  Resolving www.facebook.com for AF_INET...
> >  Connecting to server www.facebook.com[69.171.237.20]: 80...
> >
> >On systems with real IPv6 connections, this first connection attempt to a bogus
> >address can take a very long time to time out.
> 
> I have seen this problem for some time, but have not investigated it yet.
> 
> >To address this problem, bail out immediately if gethostbyname() returns an
> >address from an incompatible family.  The caller will immediately fallback to
> >AF_INET.
> 
> Great! This patch works for me. No more long timeouts for wrong IPv6
> addresses. :-)
> 
> Tested-by Erik Auerswald <auerswal at unix-ag.uni-kl.de>
> 
> @MPlayer devs: please accept this patch, it is helpful.

  Makes sense to me. I intent to apply the patch tomorrow evening.

  Alexander


More information about the MPlayer-dev-eng mailing list