[systemd-commits] 3 commits - src/libsystemd units/org.freedesktop.network1.busname

Tom Gundersen tomegun at kemper.freedesktop.org
Fri Feb 6 03:12:19 PST 2015


 src/libsystemd/sd-rtnl/rtnl-message.c  |   10 +++++-----
 src/libsystemd/sd-rtnl/rtnl-util.c     |    4 +---
 src/libsystemd/sd-rtnl/test-rtnl.c     |    9 +++++++++
 units/org.freedesktop.network1.busname |    6 ++++++
 4 files changed, 21 insertions(+), 8 deletions(-)

New commits:
commit 30ae637af31551f6c3d8f27db4537aaddda462bb
Author: Tom Gundersen <teg at jklm.no>
Date:   Fri Feb 6 12:09:36 2015 +0100

    units: networkd - fix busname to work on kdbus

diff --git a/units/org.freedesktop.network1.busname b/units/org.freedesktop.network1.busname
index c68f4ad..3a0e118 100644
--- a/units/org.freedesktop.network1.busname
+++ b/units/org.freedesktop.network1.busname
@@ -9,6 +9,12 @@
 Description=Network Service Bus Name
 Documentation=man:systemd-networkd.service(8)
 
+# This is pulled in by systemd-networkd.service, since it cannot run
+# without its policy set. However, let's conditionalize this unit on
+# non-kdbus system.
+ConditionPathExists=/sys/fs/kdbus/0-system/
+
 [BusName]
 Service=systemd-networkd.service
 AllowWorld=talk
+AllowUser=systemd-network own

commit da53c5516e3807145a321df08b853d6f9f21c6fc
Author: Tom Gundersen <teg at jklm.no>
Date:   Fri Feb 6 11:54:30 2015 +0100

    sd-rtnl: don't fall over when receiving 0 bytes from the socket
    
    causes EOF. Seems like a kernel bug. Ignoring it seems to work be the best we
    can do for now...
    
    See https://bugs.freedesktop.org/show_bug.cgi?id=88397

diff --git a/src/libsystemd/sd-rtnl/rtnl-message.c b/src/libsystemd/sd-rtnl/rtnl-message.c
index 2325302..f072899 100644
--- a/src/libsystemd/sd-rtnl/rtnl-message.c
+++ b/src/libsystemd/sd-rtnl/rtnl-message.c
@@ -1350,9 +1350,11 @@ static int socket_recv_message(int fd, struct iovec *iov, uint32_t *_group, bool
                         log_debug("rtnl: no data in socket");
 
                 return (errno == EAGAIN || errno == EINTR) ? 0 : -errno;
-        } else if (r == 0)
-                /* connection was closed by the kernel */
-                return -ECONNRESET;
+        } else if (r == 0) {
+                /* connection was closed by the kernel? */
+                log_warning("rtnl: ignoring empty message");
+                return 0;
+        }
 
         for (cmsg = CMSG_FIRSTHDR(&msg); cmsg; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
                 if (cmsg->cmsg_level == SOL_SOCKET &&

commit b621bfd2311a13311a45ccd5e31a9ce3214895fe
Author: Tom Gundersen <teg at jklm.no>
Date:   Fri Feb 6 11:49:07 2015 +0100

    sd-rtnl: fix creation of synthetic error replies

diff --git a/src/libsystemd/sd-rtnl/rtnl-message.c b/src/libsystemd/sd-rtnl/rtnl-message.c
index 1f44c34..2325302 100644
--- a/src/libsystemd/sd-rtnl/rtnl-message.c
+++ b/src/libsystemd/sd-rtnl/rtnl-message.c
@@ -71,8 +71,6 @@ int message_new(sd_rtnl *rtnl, sd_rtnl_message **ret, uint16_t type) {
         if (r < 0)
                 return r;
 
-        assert(nl_type->type == NLA_NESTED);
-
         r = message_new_empty(rtnl, &m);
         if (r < 0)
                 return r;
diff --git a/src/libsystemd/sd-rtnl/rtnl-util.c b/src/libsystemd/sd-rtnl/rtnl-util.c
index 194a267..5666ea4 100644
--- a/src/libsystemd/sd-rtnl/rtnl-util.c
+++ b/src/libsystemd/sd-rtnl/rtnl-util.c
@@ -107,12 +107,10 @@ int rtnl_message_new_synthetic_error(int error, uint32_t serial, sd_rtnl_message
 
         assert(error <= 0);
 
-        r = message_new(NULL, ret, NLMSG_SPACE(sizeof(struct nlmsgerr)));
+        r = message_new(NULL, ret, NLMSG_ERROR);
         if (r < 0)
                 return r;
 
-        (*ret)->hdr->nlmsg_len = NLMSG_LENGTH(sizeof(struct nlmsgerr));
-        (*ret)->hdr->nlmsg_type = NLMSG_ERROR;
         (*ret)->hdr->nlmsg_seq = serial;
 
         err = NLMSG_DATA((*ret)->hdr);
diff --git a/src/libsystemd/sd-rtnl/test-rtnl.c b/src/libsystemd/sd-rtnl/test-rtnl.c
index 72d8fe2..ed60b3c 100644
--- a/src/libsystemd/sd-rtnl/test-rtnl.c
+++ b/src/libsystemd/sd-rtnl/test-rtnl.c
@@ -353,6 +353,13 @@ static void test_get_addresses(sd_rtnl *rtnl) {
         }
 }
 
+static void test_message(void) {
+        _cleanup_rtnl_message_unref_ sd_rtnl_message *m = NULL;
+
+        assert_se(rtnl_message_new_synthetic_error(-ETIMEDOUT, 1, &m) >= 0);
+        assert_se(sd_rtnl_message_get_errno(m) == -ETIMEDOUT);
+}
+
 int main(void) {
         sd_rtnl *rtnl;
         sd_rtnl_message *m;
@@ -361,6 +368,8 @@ int main(void) {
         int if_loopback;
         uint16_t type;
 
+        test_message();
+
         test_match();
 
         test_multiple();



More information about the systemd-commits mailing list