Blame SOURCES/rear-bz2035939.patch

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