return 0;
if (network) {
+ _cleanup_free_ char *joined = strv_join(network->dropins, ", ");
+
if (link->state == LINK_STATE_INITIALIZED)
- log_link_info(link, "Configuring with %s.", network->filename);
+ log_link_info(link, "Configuring with %s%s%s%s.",
+ network->filename,
+ isempty(joined) ? "" : " (dropins: ",
+ joined,
+ isempty(joined) ? "" : ")");
else
- log_link_info(link, "Reconfiguring with %s.", network->filename);
+ log_link_info(link, "Reconfiguring with %s%s%s%s.",
+ network->filename,
+ isempty(joined) ? "" : " (dropins: ",
+ joined,
+ isempty(joined) ? "" : ")");
} else
log_link_full(link, link->state == LINK_STATE_INITIALIZED ? LOG_DEBUG : LOG_INFO,
"Unmanaging interface.");
--- /dev/null
+# SPDX-License-Identifier: MIT-0
+#
+# This config file is installed as part of systemd.
+# It may be freely copied and edited (following the MIT No Attribution license).
+#
+# To make local modifications, one of the following methods may be used:
+# 1. add a drop-in file that extends this file by creating the
+# /etc/systemd/network/99-default.link.d/ directory and creating a
+# new .conf file there.
+# 2. copy this file into /etc/systemd/network or one of the other paths checked
+# by systemd-udevd and edit it there.
+# This file should not be edited in place, because it'll be overwritten on upgrades.
+
+[Match]
+OriginalName=*
+
+[Link]
+NamePolicy=keep kernel database onboard slot path
+AlternativeNamesPolicy=database onboard slot path
+MACAddressPolicy=persistent
print(output)
self.assertRegex(output, 'Type: loopback')
- def test_udev_link_file(self):
- copy_network_unit('11-dummy.netdev', '11-dummy.network', '25-default.link')
+ def test_unit_file(self):
+ copy_network_unit('11-test-unit-file.netdev', '11-test-unit-file.network', '11-test-unit-file.link')
start_networkd()
self.wait_online(['test1:degraded'])
output = check_output(*networkctl_cmd, '-n', '0', 'status', 'test1', env=env)
print(output)
- self.assertRegex(output, r'Link File: /run/systemd/network/25-default.link')
- self.assertRegex(output, r'Network File: /run/systemd/network/11-dummy.network')
+ self.assertIn('Link File: /run/systemd/network/11-test-unit-file.link', output)
+ self.assertIn('/run/systemd/network/11-test-unit-file.link.d/dropin.conf', output)
+ self.assertIn('Network File: /run/systemd/network/11-test-unit-file.network', output)
+ self.assertIn('/run/systemd/network/11-test-unit-file.network.d/dropin.conf', output)
+
+ output = read_networkd_log()
+ self.assertIn('test1: Configuring with /run/systemd/network/11-test-unit-file.network (dropins: /run/systemd/network/11-test-unit-file.network.d/dropin.conf).', output)
# This test may be run on the system that has older udevd than 70f32a260b5ebb68c19ecadf5d69b3844896ba55 (v249).
# In that case, the udev DB for the loopback network interface may already have ID_NET_LINK_FILE property.
check_output(*udevadm_cmd, 'trigger', '--settle', '--action=add', '/sys/class/net/lo')
output = check_output(*networkctl_cmd, '-n', '0', 'status', 'lo', env=env)
print(output)
- self.assertRegex(output, r'Link File: n/a')
- self.assertRegex(output, r'Network File: n/a')
+ self.assertIn('Link File: n/a', output)
+ self.assertIn('Network File: n/a', output)
def test_delete_links(self):
copy_network_unit('11-dummy.netdev', '11-dummy.network',