[pulseaudio-discuss] incomplete IPv6 support in pa_socket_client_new_string()
Tanu Kaskinen
tanu.kaskinen at linux.intel.com
Fri Nov 7 07:50:32 PST 2014
On Thu, 2014-11-06 at 22:26 -0600, Hajime Fujita wrote:
> Tanu Kaskinen wrote:
> > On Wed, 2014-11-05 at 22:29 -0600, Hajime Fujita wrote:
> >> Hi Tanu,
> >>
> >> Thank you for your comment and sorry for the late reply.
> >>
> >> Tanu Kaskinen wrote:
> >>> On Tue, 2014-10-21 at 00:49 -0500, Hajime Fujita wrote:
> >>>> Hello,
> >>>>
> >>>> I'm currently working on IPv6 support for the raop module [1].
> >>>>
> >>>> During the work I found a potential issue in
> >>>> pa_socket_client_new_string() (in pulsecore/socket-client.c) as pointed
> >>>> out in [1].
> >>>>
> >>>> It does not work as expected when an IPv6 address string like
> >>>> "2001:db8::1" is passed as the "name" parameter. This is because the
> >>>> name parameter is passed to pa_parse_address(), which thinks the last
> >>>> colon as a separator between hostname (or address) and a port number. To
> >>>> prevent pa_parse_address() from doing this, an IPv6 address must be
> >>>> bracketed with "[]" (e.g. "[2001:db8::1]").
> >>>>
> >>>> I'm wondering what would be the best solution for this situation.
> >>>> a. Modify callers: callers of pa_socket_client_new_string() must add
> >>>> brackets to IPv6 addresses.
> >>>> b. Modify pa_socket_client_new_string(): if an IPv6 address is given as
> >>>> the name parameter, it will be bracketed before being passed to
> >>>> pa_parse_address().
> >>>>
> >>>> Any opinions or suggestions?
> >>>
> >>> I think it makes more sense to fix this in the callers of
> >>> pa_socket_client_new_string(). It would be good to also add a comment in
> >>> socket-client.h saying that the name parameter can include also the port
> >>> using the usual syntax, and for that reason IPv6 addresses must be
> >>> enclosed in brackets.
> >>>
> >>
> >> Do you have any justification behind this?
> >
> > Yes, sorry for leaving it out from my answer. The justification: I think
> > you can't actually implement suggestion b, because there's no way you
> > can figure out in pa_socket_client_new_string() whether
> > "1234::1234:1234" contains only an IP address or an IP address and a
> > port.
>
> Well my justification for option b was:
> if the caller wants to pass "addr:port" style string to
> pa_socket_client_new_string(), "addr" must be surrounded by brackets for
> the very reason you described.
> So, if pa_socket_client_new_string() sees a string like
> "1234::1234:1234", I thought it would be safe to interpret it as an IPv6
> address alone, not including port.
Ok, now I understand (and looking back, I feel I should have understood
already from the first mail...). I think pa_parse_address() should be
changed so that "1234::1234:1234" is parsed as an IP address, not IP
address + port. That way the problem is fixed for all callers of
pa_parse_address(), not only for pa_socket_client_new_string().
--
Tanu
More information about the pulseaudio-discuss
mailing list