[systemd-devel] [PATCH 1/2] Ignore IPv6 link-local addresses

Mantas Mikulėnas grawity at gmail.com
Mon Feb 4 07:36:13 PST 2013


On Mon, Feb 4, 2013 at 4:56 PM, Eelco Dolstra
<eelco.dolstra at logicblox.com> wrote:
> Returning IPv6 link-local addresses is a bad idea, because they only
> work if an application connects specifically over the corresponding
> interface.  So you get errors like:
>
>   $ curl -6 http://my-machine/
>   curl: (7) Failed to connect to fe80::d6be:d9ff:fe1b:8477: Invalid argument

nss-myhostname actually fills in the "scopeid" field, so returning
link-local addresses shouldn't cause such problems unless the program
itself handles returned addresses in an unusual way.

The actual problem seems to be elsewhere. I just tested with
getaddrinfo() in Python, and I'm seeing this:

py3.3 >>> from socket import *
py3.3 >>> from pprint import *
py3.3 >>> pprint(getaddrinfo(gethostname(), "ssh", AF_UNSPEC, SOCK_STREAM))
[(10, 1, 6, '', ('fe80::4a5d:60ff:fee8:658f%wlan0', 22, 0, 3)),
 (10, 1, 6, '', ('fe80::200:ff:fe51:83f2%vdetap', 22, 0, 4)),
 (10, 1, 6, '', ('fe80::200:ff:fe51:83f2%vmbr', 22, 0, 5)),
 (10, 1, 6, '', ('2001:470:1f0b:915:35eb:7f4c:a08a:2899%3', 22, 0, 3)),
 (10, 1, 6, '', ('2001:470:1f0b:915:4a5d:60ff:fee8:658f%3', 22, 0, 3)),
 (10, 1, 6, '', ('2001:470:736c:107::1%5', 22, 0, 5)),
 (2, 1, 6, '', ('192.168.1.183', 22)),
 (2, 1, 6, '', ('10.7.0.1', 22))]
py3.3 >>> pprint(getaddrinfo(gethostname(), "ssh", AF_INET6, SOCK_STREAM))
[(10, 1, 6, '', ('2001:470:1f0b:915:35eb:7f4c:a08a:2899', 22, 0, 0)),
 (10, 1, 6, '', ('2001:470:1f0b:915:4a5d:60ff:fee8:658f', 22, 0, 0)),
 (10, 1, 6, '', ('2001:470:736c:107::1', 22, 0, 0)),
 (10, 1, 6, '', ('fe80::4a5d:60ff:fee8:658f', 22, 0, 0)),
 (10, 1, 6, '', ('fe80::200:ff:fe51:83f2', 22, 0, 0)),
 (10, 1, 6, '', ('fe80::200:ff:fe51:83f2', 22, 0, 0))]

In other words, the scope ID is filled in correctly when I request
AF_UNSPEC, but it's empty for AF_INET6. I'm not sure which component
is broken here, but maybe it would be better to try to fix this,
instead of hurrying to ignore all link-local addresses? I'm not a dev
though.

--
Mantas Mikulėnas


More information about the systemd-devel mailing list