Apply upstream PR#2736
Adds EXCLUDE_IP_ADDRESSES and EXCLUDE_NETWORK_INTERFACES configuration parameters. Resolves: rhbz2035939
This commit is contained in:
parent
0729a3dd1f
commit
3002b9a08f
56
rear-bz2035939.patch
Normal file
56
rear-bz2035939.patch
Normal file
@ -0,0 +1,56 @@
|
||||
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
|
@ -28,6 +28,7 @@ Patch37: rear-bz1747468.patch
|
||||
Patch38: rear-bz2049091.patch
|
||||
Patch39: rear-pr2675.patch
|
||||
Patch40: rear-bz2048454.patch
|
||||
Patch41: rear-bz2035939.patch
|
||||
|
||||
# rear contains only bash scripts plus documentation so that on first glance it could be "BuildArch: noarch"
|
||||
# but actually it is not "noarch" because it only works on those architectures that are explicitly supported.
|
||||
|
Loading…
Reference in New Issue
Block a user