2013-04-12 14:31:53 +02:00
|
|
|
From 72a89fd9b4e35da375a1cdcf0d30a0f31a78d9a5 Mon Sep 17 00:00:00 2001
|
2013-02-04 15:33:09 +01:00
|
|
|
From: Eelco Dolstra <eelco.dolstra@logicblox.com>
|
|
|
|
Date: Mon, 4 Feb 2013 12:41:14 +0100
|
2013-04-12 14:31:53 +02:00
|
|
|
Subject: [PATCH 7/8] Ignore IPv6 link-local addresses
|
2013-02-04 15:33:09 +01:00
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
To prevent this, this patch filters out link-local addresses. So if
|
|
|
|
you don't have a routable IPv6 address, nss-myhostname will fall back
|
|
|
|
to returning ::1.
|
|
|
|
---
|
|
|
|
src/nss-myhostname/netlink.c | 4 ++++
|
|
|
|
1 file changed, 4 insertions(+)
|
|
|
|
|
|
|
|
diff --git a/src/nss-myhostname/netlink.c b/src/nss-myhostname/netlink.c
|
2013-04-12 14:31:53 +02:00
|
|
|
index b1ef912..4f2ab5c 100644
|
2013-02-04 15:33:09 +01:00
|
|
|
--- a/src/nss-myhostname/netlink.c
|
|
|
|
+++ b/src/nss-myhostname/netlink.c
|
2013-04-12 14:31:53 +02:00
|
|
|
@@ -113,6 +113,10 @@ static int read_reply(int fd, struct address **list, unsigned *n_list) {
|
|
|
|
ifaddrmsg->ifa_scope == RT_SCOPE_NOWHERE)
|
|
|
|
continue;
|
2013-02-04 15:33:09 +01:00
|
|
|
|
2013-04-12 14:31:53 +02:00
|
|
|
+ if (ifaddrmsg->ifa_family == AF_INET6 &&
|
|
|
|
+ ifaddrmsg->ifa_scope == RT_SCOPE_LINK)
|
|
|
|
+ continue;
|
2013-02-04 15:33:09 +01:00
|
|
|
+
|
2013-04-12 14:31:53 +02:00
|
|
|
if (ifaddrmsg->ifa_flags & IFA_F_DEPRECATED)
|
|
|
|
continue;
|
2013-02-04 15:33:09 +01:00
|
|
|
|
|
|
|
--
|
|
|
|
1.8.1
|
|
|
|
|