. $dracutfunctions
-for program in ip hostname; do
+for program in ip arping; do
which $program >/dev/null 2>&1
if [ $? -ne 0 ]; then
dwarning "Could not find program \"$program\" required by network."
#!/bin/bash
-dracut_install ip dhclient brctl
+dracut_install ip dhclient brctl arping
inst "$moddir/ifup" "/sbin/ifup"
inst "$moddir/netroot" "/sbin/netroot"
inst "$moddir/dhclient-script" "/sbin/dhclient-script"
[ -e /tmp/net.$netif.hostname ] && . /tmp/net.$netif.hostname
[ -e /tmp/resolv.conf ] && cp -f /tmp/resolv.conf /etc/resolv.conf
+# Load interface options
+[ -e /tmp/net.$netif.override ] && . /tmp/net.$netif.override
+[ -e /tmp/dhclient.$netif.dhcpopts ] && . /tmp/dhclient.$netif.dhcpopts
+
+# Handle STP Timeout: arping default router or if not available the
+# root server. Note: This assumes that if no router is present the
+# root server is on the same subnet.
+#
+# TODO There's some netroot variants that don't (yet) have their
+# server-ip netroot
+[ -n "$new_routers" ] && dest=${new_routers%%,*}
+[ -n "$gw" ] && dest=$gw
+if [ -z "$dest" ] ; then
+ dummy=${netroot#*:}
+ dummy=${dummy%%:*}
+ case "$dummy" in
+ [0-9]*\.[0-9]*\.[0-9]*\.[0-9]*) dest=$dummy;;
+ esac
+fi
+if [ -n "$dest" ] && ! arping -q -f -w 60 -I $netif $dest ; then
+ die "Resolving $dest via ARP on $netif failed"
+fi
+
# Source netroot hooks before we start the handler
source_all netroot