Bug 40785 - Error connecting to PulseAudio server via IPv6
Summary: Error connecting to PulseAudio server via IPv6
Status: RESOLVED FIXED
Alias: None
Product: PulseAudio
Classification: Unclassified
Component: daemon (show other bugs)
Version: unspecified
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: pulseaudio-bugs
QA Contact: pulseaudio-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-11 07:18 UTC by Ryan
Modified: 2014-01-15 10:23 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Proposed patch (1.75 KB, patch)
2012-07-05 17:58 UTC, Héctor Martín
Details | Splinter Review

Description Ryan 2011-09-11 07:18:43 UTC
Using the zeroconf modules, my laptop had problems connecting to my server.

Running PA in verbose mode, I saw the following errors:

socket-client.c: connect(): Invalid argument (22)
module-tunnel.c: Failed to connect to server '[fe80::21f:e2ff:fe5c:1e2]:4713'
module.c: Failed to load  module "module-tunnel-sink" (argument: "server=[fe80::21f:e2ff:fe5c:1e2]:4713 sink=alsa_output.pci-0000_00_1b.0.analog-stereo format=s16le channels=2 rate=44100 sink_name=tunnel.hermes.local.alsa_output.pci-0000_00_1b.0.analog-stereo channel_map=front-left,front-right"): initialization failed.

Using paplay gives a different error:

PULSE_SERVER="[fe80::21f:e2ff:fe5c:1e2]:4713" paplay /usr/lib/python2.6/dist-packages/pygame/examples/data/house_lo.ogg
Connection failure: Connection refused
pa_context_connect() failed: Connection refused


Connections via IPv4 worked fine.

I suspect that it because its a IPv6 link address, and not an IPv6 address assigned, for example, via DHCP. 

My work-around (thanks coling of #pulseaudio), was to disable ipv6 in avahi for both my server and my laptop. 

I suspect that PulseAudio (and maybe avahi) should not be publishing IPv6 addresses begining with 'f', which are reserved addresses.

Caveat: my knowledged and understanding of IPv6 is very limited, so my conjunctions very well maybe wrong. It very well may be that my router doesn't correctly support IPv6.
Comment 1 Tanu Kaskinen 2011-09-12 07:22:54 UTC
I'm not an expert either, but when I was experimenting with IPv6, I ran to similar problems. I wrote some notes for myself, pasted below:


Link-local addresses (fe80::/16) are not very useful
====================================================

bind() can have difficulties with link-local addresses, and therefore it's
common that server programs can't listen on link-local addresses. So, don't use
link-local addresses. Instead, set up unique local addresses
(http://en.wikipedia.org/wiki/Unique_local_address) on all machines if you for
some reason can't or don't want to use public IP addresses.


Setting up unique local addresses
=================================

A unique local address (ULA) is an address that is very likely globally unique,
but not routed in the public internet. See
http://en.wikipedia.org/wiki/Unique_local_address. Randomness of the subnet
part is important when using ULAs. A new subnet address can be easily generated
at http://www.sixxs.net/tools/grh/ula/. The subnet for my home network is
fdc5:4fe5:888d::/64.



So I think your suggestion that Pulseaudio or Avahi should refuse to publish link-local addresses is a good one.
Comment 2 Tyson Whitehead 2012-02-04 10:40:52 UTC
The problem is that a IPv6 link local destination require the interface to be specified.

If you manually load module-tunnel-sink with exact same arguments that failed but with the address suffixed with "%eth0" (or whatever interface it is on) it will load fine.  For example

$ pacmd
Welcome to PulseAudio! Use "help" for usage information.
>>> load-module module-tunnel-sink server=[fe80::21f:e2ff:fe5c:1e2%eth0]:4713 sink=alsa_output.pci-0000_00_1b.0.analog-stereo format=s16le channels=2 rate=44100 sink_name=tunnel.hermes.local.alsa_output.pci-0000_00_1b.0.analog-stereo channel_map=front-left,front-right

I notice that "avahi-browse -a" shows interfaces.  Presumably then, avahi makes this information is available, so not including the interface suffix on IPv6 link local address is a bug in the zeroconf modules.

Cheers!  -Tyson
Comment 3 Héctor Martín 2012-07-05 17:58:45 UTC
Created attachment 63872 [details] [review]
Proposed patch

Attached patch fixes the issue for me.

Note that the interface can be specified as the actual iface name, or as just the numerical index. Avahi gives us the index, so we just use that (even though it's less human-readable).
Comment 4 Héctor Martín 2014-01-12 02:21:04 UTC
Any feedback on the patch? This is still open 18 months after I provided a patch that fixes it. It's a bit sad that I've had to keep this in my patches directory for PA for this long.
Comment 5 Tanu Kaskinen 2014-01-15 10:23:09 UTC
Sorry, your patch was completely forgotten. I now applied it: http://cgit.freedesktop.org/pulseaudio/pulseaudio/commit/?id=4e5051db7297d8171d148ef7d15c2e06ebeff0ce


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.