From f42d84d6b0cd49d4c7d3e9294343efae40769f28 Mon Sep 17 00:00:00 2001 From: hanjinpeng Date: Wed, 16 Sep 2026 09:15:32 -0400 Subject: [PATCH] ifup-eth: don't match configured addresses as substrings Before adding an address, ifup-eth checks whether it is already configured with grep "${ipaddr}/${prefix}" on the output of ip addr. The pattern also matched other addresses containing it (10.0.0.1/24 in 110.0.0.1/24) and '.' matched any character. In that case the duplicate address detection and "ip addr add" with broadcast, scope and label were skipped; the address was only created implicitly by the later "ip addr change" without a broadcast address. Match the address and prefix as a whole field. --- network-scripts/ifup-eth | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/network-scripts/ifup-eth b/network-scripts/ifup-eth index f4aac864..bf241b82 100755 --- a/network-scripts/ifup-eth +++ b/network-scripts/ifup-eth @@ -291,7 +291,7 @@ else break fi - if ! LC_ALL=C ip addr ls ${REALDEVICE} | LC_ALL=C grep -q "${ipaddr[$idx]}/${prefix[$idx]}" ; then + if ! LC_ALL=C ip addr ls ${REALDEVICE} | LC_ALL=C grep -qF " ${ipaddr[$idx]}/${prefix[$idx]} " ; then if [ "${REALDEVICE}" != "lo" ] && ! is_false "${arpcheck[$idx]}"; then for (( tries=0; tries<${ARPING_TRIES:=1}; tries++ )); do ARPING=$(/sbin/arping -c 2 -w ${ARPING_WAIT:-3} -D -I ${REALDEVICE} ${ipaddr[$idx]})