read layer2 < /sys/class/net/$netif/device/layer2
fi
if [ "$layer2" != "0" ]; then
- if command -v arping2 >/dev/null; then
- if arping2 -q -C 1 -c 2 -I $netif -0 $new_ip_address ; then
+
+ if command -v wicked >/dev/null; then
+ wicked arp verify $netif $new_ip_address 2>/dev/null
+ if [ $? -eq 4 ]; 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
+ if command -v arping2 >/dev/null; then
+ if arping2 -q -C 1 -c 2 -I $netif -0 $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
fi
wait_for_ipv6_dad $netif
else
if [ -z "$srv" ]; then
- if command -v arping2 >/dev/null; then
- if arping2 -q -C 1 -c 2 -I $netif -0 $ip ; then
- warn "Duplicate address detected for $ip for interface $netif."
- return 1
+ if command -v wicked >/dev/null; then
+ wicked arp verify $netif $ip 2>/dev/null
+ if [ $? -eq 4 ]; then
+ warn "Duplicate address detected for $ip while doing dhcp. retrying"
+ exit 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
+ if command -v arping2 >/dev/null; then
+ if arping2 -q -C 1 -c 2 -I $netif -0 $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
fi
+ ip addr flush dev $netif
+ ip addr add $ip/$mask ${srv:+peer $srv} brd + dev $netif
fi
- ip addr flush dev $netif
- ip addr add $ip/$mask ${srv:+peer $srv} brd + dev $netif
fi
[ -n "$gw" ] && echo ip route replace default via $gw dev $netif > /tmp/net.$netif.gw
check() {
local _program
- require_binaries ip dhclient sed awk grep || return 1
- require_any_binary arping arping2 || return 1
+ require_binaries ip sed awk grep || return 1
+ require_any_binary arping arping2 wicked || return 1
+ require_any_binary dhclient wicked || return 1
return 255
}
inst_multiple -o arping arping2
strstr "$(arping 2>&1)" "ARPing 2" && mv "$initdir/bin/arping" "$initdir/bin/arping2"
-
+ inst_multiple -o wicked
inst_multiple -o ping ping6
inst_multiple -o teamd teamdctl teamnl
inst_simple /etc/libnl/classid
fi
if [ "$layer2" != "0" ] && [ -n "$dest" ] && ! strstr "$dest" ":"; then
- if command -v arping2 >/dev/null; then
- arping2 -q -C 1 -c 60 -I $netif $dest || info "Resolving $dest via ARP on $netif failed"
+ if command -v wicked >/dev/null; then
+ wicked arp ping --interval 3000 --replies 1 --timeout 60000 --quiet $netif $dest 2>/dev/null || 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"
+ 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
fi
unset layer2