Blame SOURCES/rear-bz2035939.patch

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