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