|
|
049c96 |
From fe077314f11f76536a7952e8b96951be104f89d1 Mon Sep 17 00:00:00 2001
|
|
|
049c96 |
From: Phil Sutter <psutter@redhat.com>
|
|
|
049c96 |
Date: Wed, 17 Feb 2016 14:03:59 +0100
|
|
|
049c96 |
Subject: [PATCH] iproute2: Ignore EADDRNOTAVAIL errors during address flush
|
|
|
049c96 |
operation
|
|
|
049c96 |
|
|
|
049c96 |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1291825
|
|
|
049c96 |
Upstream Status: commit e149d4e84384f
|
|
|
049c96 |
|
|
|
049c96 |
commit e149d4e84384f88965ce43a6390acf7ba356187c
|
|
|
049c96 |
Author: Neil Horman <nhorman@tuxdriver.com>
|
|
|
049c96 |
Date: Thu Nov 5 14:54:17 2015 -0500
|
|
|
049c96 |
|
|
|
049c96 |
iproute2: Ignore EADDRNOTAVAIL errors during address flush operation
|
|
|
049c96 |
|
|
|
049c96 |
I found recently that, if I disabled address promotion in the kernel, that
|
|
|
049c96 |
ip addr flush dev <dev>
|
|
|
049c96 |
|
|
|
049c96 |
would fail with an EADDRNOTAVAIL errno (though the flush operation would in fact
|
|
|
049c96 |
flush all addresses from an interface properly)
|
|
|
049c96 |
|
|
|
049c96 |
Whats happening is that, if I add a primary and multiple secondary addresses to
|
|
|
049c96 |
an interface, the flush operation first ennumerates them all with a GETADDR |
|
|
|
049c96 |
DUMP operation, then sends a delete request for each address. But the kernel,
|
|
|
049c96 |
having promotion disabled, deletes all secondary addresses when the primary is
|
|
|
049c96 |
removed. That means, that several delete requests may still be pending in the
|
|
|
049c96 |
netlink request for addresses that have been removed on our behalf, resulting in
|
|
|
049c96 |
EADDRNOTAVAIL return codes.
|
|
|
049c96 |
|
|
|
049c96 |
It seems the simplest thing to do is to understand that EADDRUNAVAIL isn't a
|
|
|
049c96 |
fatal outcome on a flush operation, as it just indicates that an address which
|
|
|
049c96 |
you want to remove is already removed, so it can safely be ignored.
|
|
|
049c96 |
|
|
|
049c96 |
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
|
|
|
049c96 |
CC: Stephen Hemminger <stephen@networkplumber.org>
|
|
|
049c96 |
CC: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
|
|
|
049c96 |
---
|
|
|
049c96 |
ip/ipaddress.c | 12 +++++++++++-
|
|
|
049c96 |
1 file changed, 11 insertions(+), 1 deletion(-)
|
|
|
049c96 |
|
|
|
049c96 |
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
|
|
|
049c96 |
index 53c7001..f4537db 100644
|
|
|
049c96 |
--- a/ip/ipaddress.c
|
|
|
049c96 |
+++ b/ip/ipaddress.c
|
|
|
049c96 |
@@ -651,7 +651,17 @@ int print_linkinfo(const struct sockaddr_nl *who,
|
|
|
049c96 |
|
|
|
049c96 |
static int flush_update(void)
|
|
|
049c96 |
{
|
|
|
049c96 |
- if (rtnl_send_check(&rth, filter.flushb, filter.flushp) < 0) {
|
|
|
049c96 |
+
|
|
|
049c96 |
+ /*
|
|
|
049c96 |
+ * Note that the kernel may delete multiple addresses for one
|
|
|
049c96 |
+ * delete request (e.g. if ipv4 address promotion is disabled).
|
|
|
049c96 |
+ * Since a flush operation is really a series of delete requests
|
|
|
049c96 |
+ * its possible that we may request an address delete that has
|
|
|
049c96 |
+ * already been done by the kernel. Therefore, ignore EADDRNOTAVAIL
|
|
|
049c96 |
+ * errors returned from a flush request
|
|
|
049c96 |
+ */
|
|
|
049c96 |
+ if ((rtnl_send_check(&rth, filter.flushb, filter.flushp) < 0) &&
|
|
|
049c96 |
+ (errno != EADDRNOTAVAIL)) {
|
|
|
049c96 |
perror("Failed to send flush request");
|
|
|
049c96 |
return -1;
|
|
|
049c96 |
}
|
|
|
049c96 |
--
|
|
|
049c96 |
1.8.3.1
|
|
|
049c96 |
|