]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
40network: Add wicked as an alternative to arping
authorDaniel Molkentin <dmolkentin@suse.com>
Fri, 27 Apr 2018 08:34:52 +0000 (10:34 +0200)
committerDaniel Molkentin <dmolkentin@suse.com>
Tue, 24 Jul 2018 15:03:43 +0000 (17:03 +0200)
modules.d/40network/dhclient-script.sh
modules.d/40network/ifup.sh
modules.d/40network/module-setup.sh
modules.d/40network/net-lib.sh

index fc6ed0a36110bb69ef9e5beb9d4b5ff31a209fa8..9cf991f9c5de389d09253e04cd5bd78042b56faa 100755 (executable)
@@ -168,15 +168,24 @@ case $reason in
             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
index 0db3c0213957d3a634b0517670cd2e9930b591e2..e1366d0a7a7c511516c976d9bcd4de04c86f8ee1 100755 (executable)
@@ -114,20 +114,28 @@ do_static() {
         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
index a10109115cef25fbc1272362a2c7a55b2f94e93e..b6828e97bd59ad65c4139d5eadeacf40d1874942 100755 (executable)
@@ -4,8 +4,9 @@
 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
 }
@@ -28,7 +29,7 @@ install() {
 
     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
index 71a665cdf29fc8429f22e6ea79166cd777d5eeb5..efea815872b8121b671ffe0a8d24a88c1238932f 100755 (executable)
@@ -171,10 +171,14 @@ setup_net() {
     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