[systemd-commits] src/libsystemd

Tom Gundersen tomegun at kemper.freedesktop.org
Thu Mar 12 11:35:32 PDT 2015


 src/libsystemd/sd-rtnl/sd-rtnl.c |    5 +++++
 1 file changed, 5 insertions(+)

New commits:
commit d422e52a3523ad0955bec4f9fbed46e234d28590
Author: Richard Maw <richard.maw at codethink.co.uk>
Date:   Thu Mar 12 18:14:58 2015 +0000

    networkd: Begin with serial number 1 for netlink requests
    
    "Notifications are of informal nature and no reply is expected, therefore the
    sequence number is typically set to 0."[1]
    
    If networkd is started soon after recent netlink activity, then there
    will be messages with sequence number 0 in the buffer.
    
    The first thing networkd does is to request a dump of all the links. If
    it uses sequence number 0 for this, then it may confuse the dump request's
    response with that of a notification.
    
    This will result in it failing to properly enumerate all the links,
    but more importantly, when it comes to enumerate all the addresses, it
    will still have the link dump in progress, so the address enumeration
    will fail with -EBUSY.
    
    [1]: http://www.infradead.org/~tgr/libnl/doc/core.html#core_msg_types
    
    [tomegun: sequence -> serial]

diff --git a/src/libsystemd/sd-rtnl/sd-rtnl.c b/src/libsystemd/sd-rtnl/sd-rtnl.c
index ae49c77..7cdcc5d 100644
--- a/src/libsystemd/sd-rtnl/sd-rtnl.c
+++ b/src/libsystemd/sd-rtnl/sd-rtnl.c
@@ -61,6 +61,11 @@ static int sd_rtnl_new(sd_rtnl **ret) {
                             sizeof(struct nlmsghdr), sizeof(uint8_t)))
                 return -ENOMEM;
 
+        /* Change notification responses have sequence 0, so we must
+         * start our request sequence numbers at 1, or we may confuse our
+         * responses with notifications from the kernel */
+        rtnl->serial = 1;
+
         *ret = rtnl;
         rtnl = NULL;
 



More information about the systemd-commits mailing list