]> git.proxmox.com Git - mirror_iproute2.git/commit - ip/ipaddress.c
iproute2: Ignore EADDRNOTAVAIL errors during address flush operation
authorNeil Horman <nhorman@tuxdriver.com>
Thu, 5 Nov 2015 19:54:17 +0000 (14:54 -0500)
committerStephen Hemminger <shemming@brocade.com>
Mon, 23 Nov 2015 23:59:08 +0000 (15:59 -0800)
commite149d4e84384f88965ce43a6390acf7ba356187c
tree81db5443b1ec1036575b6e4f72250ea572a5c5fb
parent6e2e2cf03a2fe5777ee75e943444a343756042c0
iproute2: Ignore EADDRNOTAVAIL errors during address flush operation

I found recently that, if I disabled address promotion in the kernel, that
ip addr flush dev <dev>

would fail with an EADDRNOTAVAIL errno (though the flush operation would in fact
flush all addresses from an interface properly)

Whats happening is that, if I add a primary and multiple secondary addresses to
an interface, the flush operation first ennumerates them all with a GETADDR |
DUMP operation, then sends a delete request for each address.  But the kernel,
having promotion disabled, deletes all secondary addresses when the primary is
removed.  That means, that several delete requests may still be pending in the
netlink request for addresses that have been removed on our behalf, resulting in
EADDRNOTAVAIL return codes.

It seems the simplest thing to do is to understand that EADDRUNAVAIL isn't a
fatal outcome on a flush operation, as it just indicates that an address which
you want to remove is already removed, so it can safely be ignored.

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
CC: Stephen Hemminger <stephen@networkplumber.org>
CC: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
ip/ipaddress.c