Blame SOURCES/rear-bz2035939.patch

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