From: Yu Watanabe Date: Sun, 23 May 2021 07:59:40 +0000 (+0900) Subject: udev/net: do not manage loopback interfaces X-Git-Tag: v249-rc1~167^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=70f32a260b5ebb68c19ecadf5d69b3844896ba55;p=thirdparty%2Fsystemd.git udev/net: do not manage loopback interfaces There are nothing we can configure in udevd for loopback interfaces; no ethertool configs can be applied, MAC address, interface name should not be touched. --- diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c index 35923b272a8..a9e263a095d 100644 --- a/src/udev/net/link-config.c +++ b/src/udev/net/link-config.c @@ -243,6 +243,7 @@ int link_config_get(LinkConfigContext *ctx, sd_device *device, LinkConfig **ret) unsigned short iftype; LinkConfig *link; const char *name; + unsigned flags; int ifindex, r; assert(ctx); @@ -257,10 +258,14 @@ int link_config_get(LinkConfigContext *ctx, sd_device *device, LinkConfig **ret) if (r < 0) return r; - r = rtnl_get_link_info(&ctx->rtnl, ifindex, &iftype, NULL); + r = rtnl_get_link_info(&ctx->rtnl, ifindex, &iftype, &flags); if (r < 0) return r; + /* Do not configure loopback interfaces by .link files. */ + if (flags & IFF_LOOPBACK) + return -ENOENT; + r = ethtool_get_permanent_macaddr(&ctx->ethtool_fd, name, &permanent_mac); if (r < 0) log_device_debug_errno(device, r, "Failed to get permanent MAC address, ignoring: %m"); diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py index 56a22b0a448..d6b790bc35a 100755 --- a/test/test-network/systemd-networkd-tests.py +++ b/test/test-network/systemd-networkd-tests.py @@ -762,7 +762,7 @@ class NetworkctlTests(unittest.TestCase, Utilities): output = check_output(*networkctl_cmd, '-n', '0', 'status', 'lo', env=env) print(output) - self.assertRegex(output, r'Link File: (/usr)?/lib/systemd/network/99-default.link') + self.assertRegex(output, r'Link File: n/a') self.assertRegex(output, r'Network File: n/a') def test_delete_links(self):