From 5d6c7732ed9ea7ca90e1239dc01a5d49df426ecc Mon Sep 17 00:00:00 2001 From: Maximilian Wilhelm Date: Tue, 6 Oct 2020 03:26:36 +0200 Subject: [PATCH] static executor: Ignore errors while removing addresses When having multiple addresses set from the same prefix they might/will(?) be configured as 'secondary' and implicitly removed when removing the non-secondary address. This leads ip complaining about not being able to remove the secondaries as they are already gone. So we ignore errors while deconfiguring addresses as they liked occur when removing a vanish address anyway. Signed-off-by: Maximilian Wilhelm --- executor-scripts/linux/static | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/executor-scripts/linux/static b/executor-scripts/linux/static index 2790b64..4cc6a7b 100755 --- a/executor-scripts/linux/static +++ b/executor-scripts/linux/static @@ -29,7 +29,16 @@ configure_addresses() { PEER="" fi - ${MOCK} ip "${addrfam}" addr "${1}" "${addr}" ${PEER} dev "${IFACE}" + if [ -z "${MOCK}" -a "${1}" = "del" ]; then + # When having multiple addresses set from the same prefix they might/will(?) be configured + # as 'secondary' and implicitly removed when removing the non-secondary address. This + # leads ip complaining about not being able to remove the secondaries as they are already + # gone. So we ignore errors while deconfiguring addresses as they liked occur when removing + # a vanish address anyway. + ${MOCK} ip "${addrfam}" addr "${1}" "${addr}" ${PEER} dev "${IFACE}" 2>/dev/null + else + ${MOCK} ip "${addrfam}" addr "${1}" "${addr}" ${PEER} dev "${IFACE}" + fi done }