File 0557-40network-make-arping-optional.patch of Package dracut.15766

From a36a38050e9091b1325bd7cc9e2190a31bb0da26 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Tue, 30 Jan 2018 11:14:06 +0100
Subject: [PATCH 1/2] 40network: make arping optional

'arping' is not part of the standard installation on SLE15, so we
should be making it optional.

References: bsc#1078245

Signed-off-by: Hannes Reinecke <hare@suse.com>
---
 modules.d/40network/dhclient-script.sh | 3 +++
 modules.d/40network/ifup.sh            | 2 +-
 modules.d/40network/module-setup.sh    | 6 +++---
 modules.d/40network/net-lib.sh         | 4 ++++
 4 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/modules.d/40network/dhclient-script.sh b/modules.d/40network/dhclient-script.sh
index 9aac2b17..f8a558c7 100755
--- a/modules.d/40network/dhclient-script.sh
+++ b/modules.d/40network/dhclient-script.sh
@@ -113,6 +113,9 @@ case $reason in
         if [ -f /sys/class/net/$netif/device/layer2 ]; then
             read layer2 < /sys/class/net/$netif/device/layer2
         fi
+        if ! which arping > /dev/null 2>&1 ; then
+            layer2=0
+        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"
diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh
index d9a418e5..11377e6b 100755
--- a/modules.d/40network/ifup.sh
+++ b/modules.d/40network/ifup.sh
@@ -329,7 +329,7 @@ if strglobin $ip '*:*:*'; then
         wait_for_ipv6_dad $netif
         [ "$gw" = "::" ] && gw=""
     else
-        if ! arping -f -q -D -c 2 -I $netif $ip; then
+        if which arping > /dev/null 2>&1 -a ! arping -f -q -D -c 2 -I $netif $ip; then
             warn "Duplicate address detected for $ip for interface $netif."
             return 1
         fi
diff --git a/modules.d/40network/module-setup.sh b/modules.d/40network/module-setup.sh
index e23d9e06..18cebc91 100755
--- a/modules.d/40network/module-setup.sh
+++ b/modules.d/40network/module-setup.sh
@@ -7,7 +7,7 @@ WICKED_EXT_PATH="/etc/wicked/extensions"
 check() {
     local _program
 
-    require_binaries ip arping $WICKEDD_DHCP_PATH/wickedd-dhcp4 $WICKEDD_DHCP_PATH/wickedd-dhcp6 || return 1
+    require_binaries ip $WICKEDD_DHCP_PATH/wickedd-dhcp4 $WICKEDD_DHCP_PATH/wickedd-dhcp6 || return 1
 
     return 255
 }
@@ -33,8 +33,8 @@ installkernel() {
 # called by dracut
 install() {
     local _arch _i _dir
-    inst_multiple ip arping hostname sed
-    inst_multiple -o ping ping6
+    inst_multiple ip hostname sed
+    inst_multiple -o arping ping ping6
     inst_multiple -o brctl
     inst_multiple -o teamd teamdctl teamnl
     inst_simple /etc/libnl/classid
diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh
index 749dc47d..c8ab84d0 100755
--- a/modules.d/40network/net-lib.sh
+++ b/modules.d/40network/net-lib.sh
@@ -199,6 +199,10 @@ setup_net() {
         read layer2 < /sys/class/net/$netif/device/layer2
     fi
 
+    if ! which arping > /dev/null 2>&1 ; then
+        layer2=0
+    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"
     fi
-- 
2.13.6

openSUSE Build Service is sponsored by