File 0162-network-Request-DHCP-lease-instead-of-getting-applyi.patch of Package dracut.13287

From b4216546ff3254f2ca21c6b29c745e1bfd4956cc Mon Sep 17 00:00:00 2001
From: Pawel Wieczorkiewicz <pwieczorkiewicz@suse.de>
Date: Wed, 24 Sep 2014 18:14:37 +0200
Subject: network:  Request DHCP lease instead of getting/applying the offer

- Request ipv6 lease in proper mode: auto when auto6+dhcp6 requested
  otherwise managed mode
- wait for DAD results in case of ipv6

Signed-off-by: Pawel Wieczorkiewicz <pwieczorkiewicz@suse.de>
---
 modules.d/40network/ifup.sh |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)

Index: dracut-044/modules.d/40network/ifup.sh
===================================================================
--- dracut-044.orig/modules.d/40network/ifup.sh
+++ dracut-044/modules.d/40network/ifup.sh
@@ -186,9 +186,15 @@ do_dhcp() {
 
     local dhclient=''
     if [ "$1" = "-6" ] ; then
-        dhclient="wickedd-dhcp6"
+        local ipv6_mode=''
+        if [ -f /tmp/net.$netif.auto6 ] ; then
+            ipv6_mode="auto"
+        else
+            ipv6_mode="managed"
+        fi
+        dhclient="wickedd-dhcp6 --test --test-mode $ipv6_mode"
     else
-        dhclient="wickedd-dhcp4"
+        dhclient="wickedd-dhcp4 --test"
     fi
 
     if ! iface_has_link $netif; then
@@ -201,10 +207,14 @@ do_dhcp() {
         fi
     fi
 
-    $dhclient --test $netif > /tmp/leaseinfo.${netif}.dhcp.ipv${1:1:1}
+    $dhclient --test-format leaseinfo --test-output /tmp/leaseinfo.${netif}.dhcp.ipv${1:1:1} --test-request - $netif << EOF
+<request type="lease"/>
+EOF
     dhcp_apply $1 || return $?
 
+    if [ "$1" = "-6" ] ; then
+        wait_for_ipv6_dad $netif
+    fi
-    echo $netif > /tmp/setup_net_${netif}.ok
     return 0
 }
 
@@ -224,6 +234,7 @@ do_ipv6auto() {
     echo 0 > /proc/sys/net/ipv6/conf/$netif/forwarding
     echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_ra
     echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_redirects
+    echo 1 > /proc/sys/net/ipv6/conf/$netif/autoconf
     linkup $netif
     wait_for_ipv6_auto $netif
 
@@ -515,6 +526,7 @@ for p in $(getargs ip=); do
                 load_ipv6
                 do_dhcp -6 ;;
             auto6)
+                echo $netif > /tmp/net.$netif.auto6
                 do_ipv6auto ;;
             static)
                 do_ifcfg ;;
openSUSE Build Service is sponsored by