mirror of
https://github.com/Dasharo/systemd.git
synced 2026-03-06 15:02:31 -08:00
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:
@@ -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");
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user