]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: log when no matching .network file found
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 15 Sep 2024 18:24:19 +0000 (03:24 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 17 Sep 2024 17:27:13 +0000 (02:27 +0900)
When an interface enters unmanaged state, there are two possibilities:
- no matching .network file found,
- found a matching .network with Unmanaged=yes.

When a matching .network file is found, networkd logs the filename.
Let's also log when no matching .network file is found.

This also slightly adjust the log message when a matching .network file
found.

Closes #34436.

src/network/networkd-link.c

index b464ea8405547dc5933e3b97d0aab36b2c206796..234e08680bfd9de2c9b08093bfad174bbe8251c4 100644 (file)
@@ -1293,9 +1293,9 @@ static int link_get_network(Link *link, Network **ret) {
                 }
 
                 log_link_full(link, warn ? LOG_WARNING : LOG_DEBUG,
-                              "found matching network '%s'%s.",
-                              network->filename,
-                              warn ? ", based on potentially unpredictable interface name" : "");
+                              "Found matching .network file%s: %s",
+                              warn ? ", based on potentially unpredictable interface name" : "",
+                              network->filename);
 
                 if (network->unmanaged)
                         return -ENOENT;
@@ -1304,7 +1304,7 @@ static int link_get_network(Link *link, Network **ret) {
                 return 0;
         }
 
-        return -ENOENT;
+        return log_link_debug_errno(link, SYNTHETIC_ERRNO(ENOENT), "No matching .network found.");
 }
 
 int link_reconfigure_impl(Link *link, bool force) {