]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: if /sys is rw, then udev should be around 14229/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 4 Dec 2019 10:12:36 +0000 (19:12 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 4 Dec 2019 23:22:52 +0000 (08:22 +0900)
This switches detect_container() to path_is_read_only_rw("/sys"), as if
systemd-udevd.service is conditionalized with that way.

This also updates the log message.

src/network/networkd-link.c

index 36d24fd0f3d3bb4f805087931f9ce00d08790efb..fc822d10523ae6a65a93b7db485c7d53f96ac653 100644 (file)
@@ -36,6 +36,7 @@
 #include "qdisc.h"
 #include "set.h"
 #include "socket-util.h"
+#include "stat-util.h"
 #include "stdio-util.h"
 #include "string-table.h"
 #include "strv.h"
@@ -43,7 +44,6 @@
 #include "tmpfile-util.h"
 #include "udev-util.h"
 #include "util.h"
-#include "virt.h"
 #include "vrf.h"
 
 uint32_t link_get_vrf_table(Link *link) {
@@ -3292,8 +3292,8 @@ int link_add(Manager *m, sd_netlink_message *message, Link **ret) {
         if (r < 0)
                 return r;
 
-        if (detect_container() <= 0) {
-                /* not in a container, udev will be around */
+        if (path_is_read_only_fs("/sys") <= 0) {
+                /* udev should be around */
                 sprintf(ifindex_str, "n%d", link->ifindex);
                 r = sd_device_new_from_device_id(&device, ifindex_str);
                 if (r < 0) {
@@ -3303,7 +3303,7 @@ int link_add(Manager *m, sd_netlink_message *message, Link **ret) {
 
                 r = sd_device_get_is_initialized(device);
                 if (r < 0) {
-                        log_link_warning_errno(link, r, "Could not determine whether the device is initialized or not: %m");
+                        log_link_warning_errno(link, r, "Could not determine whether the device is initialized: %m");
                         goto failed;
                 }
                 if (r == 0) {
@@ -3314,11 +3314,11 @@ int link_add(Manager *m, sd_netlink_message *message, Link **ret) {
 
                 r = device_is_renaming(device);
                 if (r < 0) {
-                        log_link_warning_errno(link, r, "Failed to determine the device is renamed or not: %m");
+                        log_link_warning_errno(link, r, "Failed to determine the device is being renamed: %m");
                         goto failed;
                 }
                 if (r > 0) {
-                        log_link_debug(link, "Interface is under renaming, pending initialization.");
+                        log_link_debug(link, "Interface is being renamed, pending initialization.");
                         return 0;
                 }