Zbigniew Jędrzejewski-Szmek 62fe94
From bd2efe9219a3791b47c2c5c2ef0fe2579ffd547d Mon Sep 17 00:00:00 2001
Zbigniew Jędrzejewski-Szmek 62fe94
From: Tom Gundersen <teg@jklm.no>
Zbigniew Jędrzejewski-Szmek 62fe94
Date: Thu, 4 Sep 2014 13:40:24 +0200
Zbigniew Jędrzejewski-Szmek 62fe94
Subject: [PATCH] networkd: link - do not manage loopback links
Zbigniew Jędrzejewski-Szmek 62fe94
Zbigniew Jędrzejewski-Szmek 62fe94
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=83134.
Zbigniew Jędrzejewski-Szmek 62fe94
---
Zbigniew Jędrzejewski-Szmek 62fe94
 TODO                        | 3 ---
Zbigniew Jędrzejewski-Szmek 62fe94
 src/network/networkd-link.c | 6 ++++++
Zbigniew Jędrzejewski-Szmek 62fe94
 2 files changed, 6 insertions(+), 3 deletions(-)
Zbigniew Jędrzejewski-Szmek 62fe94
Zbigniew Jędrzejewski-Szmek 62fe94
diff --git a/TODO b/TODO
Zbigniew Jędrzejewski-Szmek 62fe94
index f0f2bcb12d..380fd494f2 100644
Zbigniew Jędrzejewski-Szmek 62fe94
--- a/TODO
Zbigniew Jędrzejewski-Szmek 62fe94
+++ b/TODO
Zbigniew Jędrzejewski-Szmek 62fe94
@@ -78,9 +78,6 @@ Features:
Zbigniew Jędrzejewski-Szmek 62fe94
   - ipv4ll with multiple interfaces doesn't work when both dhcp and
Zbigniew Jędrzejewski-Szmek 62fe94
     ipv4ll is used. for some reasons the kernel will currently pick an
Zbigniew Jędrzejewski-Szmek 62fe94
     ipv4ll source address to reach non-ipv4ll gateways.
Zbigniew Jędrzejewski-Szmek 62fe94
-  - dhcp and ipv4ll should probably be skipped for "lo" devices, even
Zbigniew Jędrzejewski-Szmek 62fe94
-    if the user has a catchall .network file installed, that might
Zbigniew Jędrzejewski-Szmek 62fe94
-    theoretically match it.
Zbigniew Jędrzejewski-Szmek 62fe94
   - the DHCP lease data (such as NTP/DNS) is still made available when
Zbigniew Jędrzejewski-Szmek 62fe94
     a carrier is lost on a link. It should be removed instantly.
Zbigniew Jędrzejewski-Szmek 62fe94
   - .network setting that allows overriding of the hostname to send to the dhcp server
Zbigniew Jędrzejewski-Szmek 62fe94
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
Zbigniew Jędrzejewski-Szmek 62fe94
index 1b7b1898c4..f726e2b570 100644
Zbigniew Jędrzejewski-Szmek 62fe94
--- a/src/network/networkd-link.c
Zbigniew Jędrzejewski-Szmek 62fe94
+++ b/src/network/networkd-link.c
Zbigniew Jędrzejewski-Szmek 62fe94
@@ -1250,6 +1250,12 @@ static int link_initialized_and_synced(sd_rtnl *rtnl, sd_rtnl_message *m,
Zbigniew Jędrzejewski-Szmek 62fe94
         } else if (r < 0)
Zbigniew Jędrzejewski-Szmek 62fe94
                 return r;
Zbigniew Jędrzejewski-Szmek 62fe94
 
Zbigniew Jędrzejewski-Szmek 62fe94
+        if (link->flags & IFF_LOOPBACK) {
Zbigniew Jędrzejewski-Szmek 62fe94
+                log_debug_link(link, "matching network ignored for loopback link");
Zbigniew Jędrzejewski-Szmek 62fe94
+                link_enter_unmanaged(link);
Zbigniew Jędrzejewski-Szmek 62fe94
+                return 1;
Zbigniew Jędrzejewski-Szmek 62fe94
+        }
Zbigniew Jędrzejewski-Szmek 62fe94
+
Zbigniew Jędrzejewski-Szmek 62fe94
         r = network_apply(link->manager, network, link);
Zbigniew Jędrzejewski-Szmek 62fe94
         if (r < 0)
Zbigniew Jędrzejewski-Szmek 62fe94
                 return r;