[systemd-commits] 2 commits - src/network units/systemd-networkd.service.in

Tom Gundersen tomegun at kemper.freedesktop.org
Fri Jan 17 16:59:14 PST 2014


 src/network/networkd-link.c       |    6 +++++-
 src/network/networkd-manager.c    |   17 +++++++++++------
 units/systemd-networkd.service.in |    2 +-
 3 files changed, 17 insertions(+), 8 deletions(-)

New commits:
commit bcbca8291fe3beaed36dd672d8b544840cfc49de
Author: Tom Gundersen <teg at jklm.no>
Date:   Sat Jan 18 01:37:35 2014 +0100

    networkd: don't hard depend on system bus
    
    We may not have a dbus daemon in the initrd (until we can rely on kdbus). In
    this case, simply ignore any attempts at using the bus. There is only one user
    for now, but surely more to come.
    
    In order to work reliably in the real root without kdbus, but at the same time
    don't delay boot when kdbus is in use, order ourselves after dbus.service.

diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 7f692d1..f1a2695 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -325,11 +325,15 @@ static int set_hostname(sd_bus *bus, const char *hostname) {
         _cleanup_bus_message_unref_ sd_bus_message *m = NULL;
         int r = 0;
 
-        assert(bus);
         assert(hostname);
 
         log_debug("Setting transient hostname: '%s'", hostname);
 
+        if (!bus) { /* TODO: replace by assert when we can rely on kdbus */
+                log_info("Not connected to system bus, ignoring transient hostname.");
+                return 0;
+        }
+
         r = sd_bus_message_new_method_call(
                         bus,
                         "org.freedesktop.hostname1",
diff --git a/src/network/networkd-manager.c b/src/network/networkd-manager.c
index 8eaf101..c630ed7 100644
--- a/src/network/networkd-manager.c
+++ b/src/network/networkd-manager.c
@@ -55,7 +55,7 @@ int manager_new(Manager **ret) {
                 return r;
 
         r = sd_bus_default_system(&m->bus);
-        if (r < 0)
+        if (r < 0 && r != -ENOENT) /* TODO: drop when we can rely on kdbus */
                 return r;
 
         m->udev = udev_new();
@@ -288,6 +288,11 @@ int manager_rtnl_listen(Manager *m) {
 int manager_bus_listen(Manager *m) {
         int r;
 
+        assert(m->event);
+
+        if (!m->bus) /* TODO: drop when we can rely on kdbus */
+                return 0;
+
         r = sd_bus_attach_event(m->bus, m->event, 0);
         if (r < 0)
                 return r;
diff --git a/units/systemd-networkd.service.in b/units/systemd-networkd.service.in
index 850193b..835c07d 100644
--- a/units/systemd-networkd.service.in
+++ b/units/systemd-networkd.service.in
@@ -9,7 +9,7 @@
 Description=Network Service
 Documentation=man:systemd-networkd.service(8)
 DefaultDependencies=no
-After=dbus.socket
+After=dbus.service
 Before=network.target
 Wants=network.target
 ConditionCapability=CAP_NET_ADMIN

commit b2ad8a16eea1d125159fbd71974ea7c24dc0ab0a
Author: Tom Gundersen <teg at jklm.no>
Date:   Fri Jan 17 17:09:56 2014 +0100

    networkd: resolv.conf - reword comment
    
    Take into account that users may want to use resolvconf(8), or similar. Also,
    avoid repeated calls to fputs().

diff --git a/src/network/networkd-manager.c b/src/network/networkd-manager.c
index 27f806a..8eaf101 100644
--- a/src/network/networkd-manager.c
+++ b/src/network/networkd-manager.c
@@ -334,11 +334,11 @@ int manager_update_resolv_conf(Manager *m) {
 
         fchmod(fileno(f), 0644);
 
-        fputs("# This file is managed by systemd-networkd(8). Do not edit.\n#\n", f);
-        fputs("# Third party programs must not access this file directly, but\n", f);
-        fputs("# only through the symlink at /etc/resolv.conf. To manage your\n", f);
-        fputs("# own static resolv.conf(5), replace the symlink by a static\n", f);
-        fputs("# file at /etc/resolv.conf.\n\n", f);
+        fputs("# This file is managed by systemd-networkd(8). Do not edit.\n#\n"
+              "# Third party programs must not access this file directly, but\n"
+              "# only through the symlink at /etc/resolv.conf. To manage\n"
+              "# resolv.conf(5) in a different way, replace the symlink by a\n"
+              "# static file or a different symlink.\n\n", f);
 
         HASHMAP_FOREACH(link, m->links, i) {
                 if (link->dhcp) {



More information about the systemd-commits mailing list