Blame SOURCES/rear-bz2035939.patch

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