Opened 8 years ago

Last modified 8 years ago

#1930 new defect

[PATCH] IPv6 Link-local addresses not working

Reported by: fcr@… Owned by: reimar
Priority: normal Component: streaming
Version: HEAD Severity: minor
Keywords: Cc: compn, fcr@…
Blocked By: Blocking:
Reproduced by developer: Analyzed by developer:

Description

When I try to connect to my local web server (on the same subnet), using link-local addresses, this should work, but it doesn't:

mplayer 'http://[fe80::250:8bff:fedb:54cd%wlan0]/'

It fails with messages like: "Couldn't resolve name for AF_INET6: fe80::250:8bff:fedb:54cd%wlan0".

The reason why it fails, is because it uses things like:

case AF_INET6: our_s_addr = (void *) &server_address.six.sin6_addr; break;

and gethostbyname2 (which is deprecated in favour of getaddrinfo)

The fix is simple: changing the gethostbyname* stuff of connect2Server_with_af (stream/tcp.c) to a more simple function using getaddrinfo, which handles link-local addresses successfully.

Attachments (1)

tcp-getaddrinfo.patch (8.4 KB) - added by fcr@… 8 years ago.
Patch fixing link-local IPv6 support

Download all attachments as: .zip

Change History (4)

Changed 8 years ago by fcr@…

Patch fixing link-local IPv6 support

comment:1 Changed 8 years ago by fcr@…

This may not be the best patch in the world, but at least it fixes this bug. It also checks the available DNS records (as returned from the resolver) until one of them works.

IMHO, the header should change a bit so that it receives the port as a string, not as an int, and gets resolved on the same call to getaddrinfo.

It was only tested on debian/sid (on x86) as I don't have access to other machines nor operating systems.

Microsoft's winsock specification says that they support getaddrinfo from windows 2000, so I believe that should be no problem. However I couldn't test this code on windows.

comment:2 Changed 8 years ago by fcr@…

  • Cc fcr@… added

comment:3 Changed 8 years ago by compn

  • Cc patriotact@… added
  • Summary changed from IPv6 Link-local addresses not working to [PATCH] IPv6 Link-local addresses not working

could you post this to the mplayer-dev-eng mailing list by chance? :)

Note: See TracTickets for help on using tickets.