From 2216508846177ff4a4e92665b48c56da52edfb50 Mon Sep 17 00:00:00 2001 From: alarig Date: Tue, 22 Jan 2019 14:45:41 +0100 Subject: [PATCH] Take in account the case of `ip neigh add` failure --- creationRoutesVM.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/creationRoutesVM.sh b/creationRoutesVM.sh index 3ddc46d..7731586 100755 --- a/creationRoutesVM.sh +++ b/creationRoutesVM.sh @@ -176,6 +176,12 @@ for ID_RANGE_V4 in ${ID_RANGES_V4}; do echo "${COMMAND}" write_log INFO "${COMMAND}" ${COMMAND} + + # If the previous command fails, it’s because trafic has + # already be sent to the VM + if [ $? =2 ]; then + ip neigh replace ${VM_IPV4} lladdr ${MAC} dev tap${VM_ID}i0 + fi else # En cas d'echec, on continue de parcourir les autres RANGES write_log WARN 'Empty value or doen’t correspond to an IPv4' @@ -213,6 +219,12 @@ for ID_RANGE_V6 in ${ID_RANGES_V6}; do echo "${COMMAND}" write_log INFO "${COMMAND}" ${COMMAND} + + # If the previous command fails, it’s because trafic has + # already be sent to the VM + if [ $? =2 ]; then + ip neigh replace ${VM_NH} lladdr ${MAC} dev tap${VM_ID}i0 + fi else # En cas d'echec, on continue de parcourir les autres RANGES echo "Valeur vide ou ne correspond pas à un range IPV6"