read layer2 < /sys/class/net/$netif/device/layer2
fi
if [ "$layer2" != "0" ]; then
- if ! arping -f -q -D -c 2 -I $netif $new_ip_address ; then
- warn "Duplicate address detected for $new_ip_address while doing dhcp. retrying"
- exit 1
+ if command -v arping2 >/dev/null; then
+ if arping2 -q -C 1 -c 2 -I $netif $new_ip_address ; then
+ warn "Duplicate address detected for $new_ip_address while doing dhcp. retrying"
+ exit 1
+ fi
+ else
+ if ! arping -f -q -D -c 2 -I $netif $new_ip_address ; then
+ warn "Duplicate address detected for $new_ip_address while doing dhcp. retrying"
+ exit 1
+ fi
fi
fi
unset layer2
ip addr add $ip/$mask ${srv:+peer $srv} dev $netif
wait_for_ipv6_dad $netif
else
- if ! arping -f -q -D -c 2 -I $netif $ip; then
- warn "Duplicate address detected for $ip for interface $netif."
- return 1
+ if command -v arping2 >/dev/null; then
+ if arping2 -q -C 1 -c 2 -I $netif $ip ; then
+ warn "Duplicate address detected for $ip for interface $netif."
+ return 1
+ fi
+ else
+ if ! arping -f -q -D -c 2 -I $netif $ip ; then
+ warn "Duplicate address detected for $ip for interface $netif."
+ return 1
+ fi
fi
ip addr flush dev $netif
ip addr add $ip/$mask ${srv:+peer $srv} brd + dev $netif
check() {
local _program
- require_binaries ip arping dhclient || return 1
+ require_binaries ip dhclient || return 1
+ require_any_binaries arping arping2 || return 1
return 255
}
# called by dracut
install() {
local _arch _i _dir
- inst_multiple ip arping dhclient sed awk
+ inst_multiple ip arping arping2 dhclient sed awk
inst_multiple -o ping ping6
inst_multiple -o brctl
inst_multiple -o teamd teamdctl teamnl
fi
if [ "$layer2" != "0" ] && [ -n "$dest" ] && ! strstr "$dest" ":"; then
- arping -q -f -w 60 -I $netif $dest || info "Resolving $dest via ARP on $netif failed"
+ if command -v arping2 >/dev/null; then
+ arping2 -q -C 1 -c 60 -I $netif $dest || info "Resolving $dest via ARP on $netif failed"
+ else
+ arping -q -f -w 60 -I $netif $dest || info "Resolving $dest via ARP on $netif failed"
+ fi
fi
unset layer2