]> git.proxmox.com Git - mirror_ifupdown2.git/commit - addons/address.py
addons: address: ignoring iproute2 'rtnetlink file exists' errors
authorJulien Fortin <julien@cumulusnetworks.com>
Wed, 14 Sep 2016 00:03:24 +0000 (17:03 -0700)
committerJulien Fortin <julien@cumulusnetworks.com>
Wed, 14 Sep 2016 00:03:24 +0000 (17:03 -0700)
commit0309264919237d263be903594cfefbb0f327e0aa
treea73cbdaea21faa08b5478a2577e69f21be32129d
parent4ef15f8114e901f9e9559b0d2f401c282fd80dd3
addons: address: ignoring iproute2 'rtnetlink file exists' errors

Ticket: CM-12798
Reviewed By: Roopa
Testing Done:

A customer discovered a corner case: the kernel is shrinking/reducing the ip
address fields containing 0s. For example if we configure and address such as
2a01:75e0:0000:09b0::1/64

Then if we query the kernel (using iproute2 or netlink) it will come back as:
2a01:75e0:0:09b0::1/64

Because of this issue we were seeing
root@r4u28:~# ifreload -a
error: bridge.200: cmd 'ip -force -batch - [addr add 10.50.103.193/26 dev bridge.200
addr add 2a01:75e0:0000:09b1::1/64 dev bridge.200
]' failed: returned 1 (RTNETLINK answers: File exists
Command failed -:1
)

Before adding an address to an iface we query it to know if the change is
necessary, since we only do a string comparaison between:
2a01:75e0:0000:09b1::1/64 and 2a01:75e0:0:09b1::1/64

it fails, ifupdown2 thinks that a change is needed. So we try to add the new
address via iproute2. iproute2 will fail because this address in a "shrinked"
format already exists.

This patch hot-fixes this problem by ignoring the error if it's an "exists"
error, we don't want to confuse the user.
A later fix will the real issue by normalizing all ip addr to the IPNetwork
format.

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
addons/address.py