Skip to content

Commit a1a333f

Browse files
Copilotlnykryn
andcommitted
Improve arping error handling for interface-not-ready scenarios
Co-authored-by: lnykryn <[email protected]>
1 parent dfd00bc commit a1a333f

File tree

3 files changed

+49
-13
lines changed

3 files changed

+49
-13
lines changed

network-scripts/ifup-aliases

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,17 @@ function new_interface ()
270270
ARPING=$(/sbin/arping -c 2 -w ${ARPING_WAIT:-3} -D -I ${parent_device} ${IPADDR})
271271
if [ $? = 1 ]; then
272272
ARPINGMAC=$(echo $ARPING | sed -ne 's/.*\[\(.*\)\].*/\1/p')
273-
net_log $"Error, some other host ($ARPINGMAC) already uses address ${IPADDR}."
273+
if [ -n "${ARPINGMAC}" ]; then
274+
net_log $"Error, some other host ($ARPINGMAC) already uses address ${IPADDR}."
275+
return 1
276+
fi
277+
# Check if arping failed because interface is not ready (no packets sent)
278+
if echo "$ARPING" | grep -q "Sent 0 probes"; then
279+
net_log $"Failed to bring up ${DEVICE}: interface not ready (no packets sent). Try increasing ARPING_WAIT or LINKDELAY, or check interface status."
280+
return 1
281+
fi
282+
# Some other arping failure
283+
net_log $"Error, some other host already uses address ${IPADDR}."
274284
return 1
275285
fi
276286
fi

network-scripts/ifup-eth

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,9 +301,19 @@ else
301301
net_log $"Error, some other host ($ARPINGMAC) already uses address ${ipaddr[$idx]}."
302302
exit 1
303303
fi
304+
# Check if arping failed because interface is not ready (no packets sent)
305+
if echo "$ARPING" | grep -q "Sent 0 probes"; then
306+
# Interface not ready, continue retrying
307+
continue
308+
fi
304309
done
305310
if [ "${tries}" -eq "${ARPING_TRIES}" ]; then
306-
net_log $"arping failed after $tries tries"
311+
# Check if the failure was due to interface not being ready
312+
if echo "$ARPING" | grep -q "Sent 0 probes"; then
313+
net_log $"Failed to bring up ${DEVICE}: interface not ready (no packets sent). Try increasing ARPING_WAIT or LINKDELAY, or check interface status."
314+
else
315+
net_log $"arping failed after $tries tries"
316+
fi
307317
exit 1
308318
fi
309319
fi

po/initscripts.pot

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,23 @@ msgstr ""
111111
msgid "Determining if IP address ${IPADDR} is already in use for device ${parent_device}…"
112112
msgstr ""
113113

114-
#: ../network-scripts/ifup-aliases:273
114+
#: ../network-scripts/ifup-aliases:274
115115
msgid "Error, some other host ($ARPINGMAC) already uses address ${IPADDR}."
116116
msgstr ""
117117

118-
#: ../network-scripts/ifup-aliases:335
118+
#: ../network-scripts/ifup-aliases:279 ../network-scripts/ifup-eth:313
119+
msgid "Failed to bring up ${DEVICE}: interface not ready (no packets sent). Try increasing ARPING_WAIT or LINKDELAY, or check interface status."
120+
msgstr ""
121+
122+
#: ../network-scripts/ifup-aliases:283
123+
msgid "Error, some other host already uses address ${IPADDR}."
124+
msgstr ""
125+
126+
#: ../network-scripts/ifup-aliases:345
119127
msgid "error in $FILE: IPADDR_START and IPADDR_END don't agree"
120128
msgstr ""
121129

122-
#: ../network-scripts/ifup-aliases:340
130+
#: ../network-scripts/ifup-aliases:350
123131
msgid "error in $FILE: IPADDR_START greater than IPADDR_END"
124132
msgstr ""
125133

@@ -151,35 +159,39 @@ msgstr ""
151159
msgid " failed; no link present. Check cable?"
152160
msgstr ""
153161

154-
#: ../network-scripts/ifup-eth:241 ../network-scripts/ifup-eth:389
162+
#: ../network-scripts/ifup-eth:241 ../network-scripts/ifup-eth:406
155163
msgid " done."
156164
msgstr ""
157165

158-
#: ../network-scripts/ifup-eth:244 ../network-scripts/ifup-eth:391
166+
#: ../network-scripts/ifup-eth:244 ../network-scripts/ifup-eth:408
159167
msgid " failed."
160168
msgstr ""
161169

162170
#: ../network-scripts/ifup-eth:268
163171
msgid "Failed to bring up ${DEVICE}."
164172
msgstr ""
165173

166-
#: ../network-scripts/ifup-eth:299
174+
#: ../network-scripts/ifup-eth:301
167175
msgid "Error, some other host ($ARPINGMAC) already uses address ${ipaddr[$idx]}."
168176
msgstr ""
169177

170-
#: ../network-scripts/ifup-eth:306
178+
#: ../network-scripts/ifup-eth:315
179+
msgid "arping failed after $tries tries"
180+
msgstr ""
181+
182+
#: ../network-scripts/ifup-eth:323
171183
msgid "Error adding address ${ipaddr[$idx]} for ${DEVICE}."
172184
msgstr ""
173185

174-
#: ../network-scripts/ifup-eth:333
186+
#: ../network-scripts/ifup-eth:350
175187
msgid "Error adding default gateway ${GATEWAY} for ${DEVICE}."
176188
msgstr ""
177189

178-
#: ../network-scripts/ifup-eth:338
190+
#: ../network-scripts/ifup-eth:355
179191
msgid "Error adding default gateway for ${REALDEVICE}."
180192
msgstr ""
181193

182-
#: ../network-scripts/ifup-eth:376
194+
#: ../network-scripts/ifup-eth:393
183195
msgid "Determining IPv6 information for ${DEVICE}..."
184196
msgstr ""
185197

@@ -275,7 +287,11 @@ msgstr ""
275287
msgid "usage: ifup-routes <net-device> [<nickname>]"
276288
msgstr ""
277289

278-
#: ../network-scripts/ifup-routes:26 ../network-scripts/ifup-routes:47
290+
#: ../network-scripts/ifup-routes:20
291+
msgid "Route entries are not sequentially ordered. Skipping $1 file"
292+
msgstr ""
293+
294+
#: ../network-scripts/ifup-routes:33 ../network-scripts/ifup-routes:54
279295
msgid "Failed to add route ${line}, using ip route replace instead."
280296
msgstr ""
281297

0 commit comments

Comments
 (0)