Validate the ip addresses added to the DHCP server

DHCP server certainly needs the IP address configured in order to lease
the address to the client. There is a bug in NM which wrongly removes
all addresses on the unmanaged interface while it should not. To
guarantee the IP address indeed configured for DHCP server, rescue it
via adding conditional loop for configuring IP address to DHCP server.

Notice that this workaround will be removed eventually when NM fixes
the bug.

https://bugzilla.redhat.com/show_bug.cgi?id=2079642

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
This commit is contained in:
Wen Liang 2022-04-06 20:05:45 -04:00 committed by Fernando Fernández Mancera
parent 3cbb6b24c1
commit 48b1619318

View file

@ -43,8 +43,17 @@
nmcli d set testbr managed false
fi
ip link set testbr up
ip addr add 192.0.2.1/24 dev testbr
ip -6 addr add 2001:DB8::1/32 dev testbr
timer=0
# The while loop following is a workaround for the NM bug, which can be
# tracked in https://bugzilla.redhat.com/show_bug.cgi?id=2079642
while ! ip addr show testbr | grep -q 'inet [1-9]'
do
let "timer+=1"
if [ $timer -eq 30 ]; then break; fi
sleep 1
ip addr add 192.0.2.1/24 dev testbr
ip -6 addr add 2001:DB8::1/32 dev testbr
done
if grep 'release 6' /etc/redhat-release; then
# We need bridge-utils and radvd only in rhel6