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.
This commit is contained in:
Yu Watanabe
2021-05-23 16:59:40 +09:00
parent f25e642bca
commit 70f32a260b
2 changed files with 7 additions and 2 deletions

View File

@@ -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");

View File

@@ -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):