Blame SOURCES/0095-networkd-Begin-with-serial-number-1-for-netlink-requ.patch

17b0f1
From 0dd3b68d80bd32ecc5db65d634072390dad581aa Mon Sep 17 00:00:00 2001
17b0f1
From: Richard Maw <richard.maw@codethink.co.uk>
17b0f1
Date: Thu, 12 Mar 2015 18:14:58 +0000
17b0f1
Subject: [PATCH] networkd: Begin with serial number 1 for netlink requests
17b0f1
17b0f1
"Notifications are of informal nature and no reply is expected, therefore the
17b0f1
sequence number is typically set to 0."[1]
17b0f1
17b0f1
If networkd is started soon after recent netlink activity, then there
17b0f1
will be messages with sequence number 0 in the buffer.
17b0f1
17b0f1
The first thing networkd does is to request a dump of all the links. If
17b0f1
it uses sequence number 0 for this, then it may confuse the dump request's
17b0f1
response with that of a notification.
17b0f1
17b0f1
This will result in it failing to properly enumerate all the links,
17b0f1
but more importantly, when it comes to enumerate all the addresses, it
17b0f1
will still have the link dump in progress, so the address enumeration
17b0f1
will fail with -EBUSY.
17b0f1
17b0f1
[1]: http://www.infradead.org/~tgr/libnl/doc/core.html#core_msg_types
17b0f1
17b0f1
[tomegun: sequence -> serial]
17b0f1
17b0f1
(cherry picked from commit d422e52a3523ad0955bec4f9fbed46e234d28590)
17b0f1
---
17b0f1
 src/libsystemd/sd-rtnl/sd-rtnl.c | 5 +++++
17b0f1
 1 file changed, 5 insertions(+)
17b0f1
17b0f1
diff --git a/src/libsystemd/sd-rtnl/sd-rtnl.c b/src/libsystemd/sd-rtnl/sd-rtnl.c
17b0f1
index ae49c77e01..7cdcc5d96a 100644
17b0f1
--- a/src/libsystemd/sd-rtnl/sd-rtnl.c
17b0f1
+++ b/src/libsystemd/sd-rtnl/sd-rtnl.c
17b0f1
@@ -61,6 +61,11 @@ static int sd_rtnl_new(sd_rtnl **ret) {
17b0f1
                             sizeof(struct nlmsghdr), sizeof(uint8_t)))
17b0f1
                 return -ENOMEM;
17b0f1
 
17b0f1
+        /* Change notification responses have sequence 0, so we must
17b0f1
+         * start our request sequence numbers at 1, or we may confuse our
17b0f1
+         * responses with notifications from the kernel */
17b0f1
+        rtnl->serial = 1;
17b0f1
+
17b0f1
         *ret = rtnl;
17b0f1
         rtnl = NULL;
17b0f1