Blame SOURCES/rear-bz2035939.patch

b9f7b3
diff --git a/usr/share/rear/conf/default.conf b/usr/share/rear/conf/default.conf
b9f7b3
index 0c230f38..f231bf3d 100644
b9f7b3
--- a/usr/share/rear/conf/default.conf
b9f7b3
+++ b/usr/share/rear/conf/default.conf
b9f7b3
@@ -2707,6 +2707,15 @@ WARN_MISSING_VOL_ID=1
b9f7b3
 USE_CFG2HTML=
b9f7b3
 # The SKIP_CFG2HTML variable is no longer supported since ReaR 1.18
b9f7b3
 
b9f7b3
+# IP addresses that are present on the system but must be excluded when
b9f7b3
+# building the network configuration used in recovery mode; this is typically
b9f7b3
+# used when floating IP addresses are used on the system
b9f7b3
+EXCLUDE_IP_ADDRESSES=()
b9f7b3
+
b9f7b3
+# Network interfaces that are present on the system but must be excluded when
b9f7b3
+# building the network configuration used in recovery mode
b9f7b3
+EXCLUDE_NETWORK_INTERFACES=()
b9f7b3
+
b9f7b3
 # Simplify bonding setups by configuring always the first active device of a
b9f7b3
 # bond, except when mode is 4 (IEEE 802.3ad policy)
b9f7b3
 SIMPLIFY_BONDING=no
b9f7b3
diff --git a/usr/share/rear/rescue/GNU/Linux/310_network_devices.sh b/usr/share/rear/rescue/GNU/Linux/310_network_devices.sh
b9f7b3
index f806bfbf..2385f5b6 100644
b9f7b3
--- a/usr/share/rear/rescue/GNU/Linux/310_network_devices.sh
b9f7b3
+++ b/usr/share/rear/rescue/GNU/Linux/310_network_devices.sh
b9f7b3
@@ -355,6 +355,11 @@ function is_interface_up () {
b9f7b3
     local network_interface=$1
b9f7b3
     local sysfspath=/sys/class/net/$network_interface
b9f7b3
 
b9f7b3
+    if IsInArray "$network_interface" "${EXCLUDE_NETWORK_INTERFACES[@]}"; then
b9f7b3
+        LogPrint "Excluding '$network_interface' per EXCLUDE_NETWORK_INTERFACES directive."
b9f7b3
+        return 1
b9f7b3
+    fi
b9f7b3
+
b9f7b3
     local state=$( cat $sysfspath/operstate )
b9f7b3
     if [ "$state" = "down" ] ; then
b9f7b3
         return 1
b9f7b3
@@ -403,11 +408,19 @@ function ipaddr_setup () {
b9f7b3
     if [ -n "$ipaddrs" ] ; then
b9f7b3
         # If some IP is found for the network interface, then use them
b9f7b3
         for ipaddr in $ipaddrs ; do
b9f7b3
+            if IsInArray "${ipaddr%%/*}" "${EXCLUDE_IP_ADDRESSES[@]}"; then
b9f7b3
+                LogPrint "Excluding IP address '$ipaddr' per EXCLUDE_IP_ADDRESSES directive even through it's defined in mapping file '$CONFIG_DIR/mappings/ip_addresses'."
b9f7b3
+                continue
b9f7b3
+            fi
b9f7b3
             echo "ip addr add $ipaddr dev $mapped_as"
b9f7b3
         done
b9f7b3
     else
b9f7b3
         # Otherwise, collect IP addresses for the network interface on the system
b9f7b3
         for ipaddr in $( ip a show dev $network_interface scope global | grep "inet.*\ " | tr -s " " | cut -d " " -f 3 ) ; do
b9f7b3
+            if IsInArray "${ipaddr%%/*}" "${EXCLUDE_IP_ADDRESSES[@]}"; then
b9f7b3
+                LogPrint "Excluding IP address '$ipaddr' per EXCLUDE_IP_ADDRESSES directive."
b9f7b3
+                continue
b9f7b3
+            fi
b9f7b3
             echo "ip addr add $ipaddr dev $mapped_as"
b9f7b3
         done
b9f7b3
     fi