Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F147806516
D49108.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D49108.diff
View Options
diff --git a/libexec/rc/rc.d/netwait b/libexec/rc/rc.d/netwait
--- a/libexec/rc/rc.d/netwait
+++ b/libexec/rc/rc.d/netwait
@@ -86,19 +86,28 @@
count=1
while [ ${count} -le ${netwait_timeout} ]; do
- /sbin/ping -t 1 -c 1 -o ${ip} >/dev/null 2>&1
- rc=$?
-
- if [ $rc -eq 0 ]; then
- # Restore default SIGINT handler
- trap - SIGINT
-
- echo ', got response.'
- return
- fi
- count=$((count+1))
- done
- warn ', failed: No response from host.'
+ if echo "$ip" | grep -E "^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$" >/dev/null; then
+ # IPv4
+ /sbin/ping -t 1 -c 1 -o "$ip" >/dev/null 2>&1
+ elif echo "$ip" | grep -E "^[0-9a-fA-F:]+$" >/dev/null; then
+ # IPv6
+ /sbin/ping6 -c 1 "$ip" >/dev/null 2>&1
+ else
+ warn "Invalid IP address format."
+ exit 1
+ fi
+
+ rc=$?
+ if [ $rc -eq 0 ]; then
+ # Restore default SIGINT handler
+ trap - SIGINT
+
+ echo "Got response."
+ exit 0
+ fi
+ count=$((count+1))
+ done
+ echo "No response after $netwait_timeout attempts."
done
# Restore default SIGINT handler
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Mar 14, 7:44 PM (6 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29682250
Default Alt Text
D49108.diff (1 KB)
Attached To
Mode
D49108: Add IPv6 support to /etc/rc.d/netwait
Attached
Detach File
Event Timeline
Log In to Comment