Blame SOURCES/0136-network-dhclient-script.sh-DHCP-IPv6-interface-setup.patch

18971c
From 54c9094e2e25b13fa90a7fcce574e6e4a52df973 Mon Sep 17 00:00:00 2001
18971c
From: Harald Hoyer <harald@redhat.com>
18971c
Date: Tue, 25 Feb 2014 14:04:05 +0100
18971c
Subject: [PATCH] network/dhclient-script.sh:DHCP IPv6 interface setup
18971c
18971c
configure IPv6 interface for DHCP6
18971c
18971c
https://bugzilla.redhat.com/show_bug.cgi?id=1064365
18971c
---
18971c
 modules.d/40network/dhclient-script.sh | 49 ++++++++++++++++++++++++++
18971c
 1 file changed, 49 insertions(+)
18971c
18971c
diff --git a/modules.d/40network/dhclient-script.sh b/modules.d/40network/dhclient-script.sh
18971c
index 70a2b710..a9c25238 100755
18971c
--- a/modules.d/40network/dhclient-script.sh
18971c
+++ b/modules.d/40network/dhclient-script.sh
18971c
@@ -48,6 +48,31 @@ setup_interface() {
18971c
     [ -n "$hostname" ] && echo "echo ${hostname%.$domain}${domain:+.$domain} > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
18971c
 }
18971c
 
18971c
+setup_interface6() {
18971c
+    domain=$new_domain_name
18971c
+    search=$(printf -- "$new_domain_search")
18971c
+    namesrv=$new_domain_name_servers
18971c
+    hostname=$new_host_name
18971c
+    lease_time=$new_dhcp_lease_time
18971c
+
18971c
+    [ -f /tmp/net.$netif.override ] && . /tmp/net.$netif.override
18971c
+
18971c
+    ip -6 addr add ${new_ip6_address}/${new_ip6_prefixlen} \
18971c
+        dev ${netif} scope global valid_lft ${lease_time} \
18971c
+        preferred_lft ${lease_time}
18971c
+
18971c
+    [ -n "${search}${domain}" ] && echo "search $search $domain" > /tmp/net.$netif.resolv.conf
18971c
+    if  [ -n "$namesrv" ] ; then
18971c
+        for s in $namesrv; do
18971c
+            echo nameserver $s
18971c
+        done
18971c
+    fi >> /tmp/net.$netif.resolv.conf
18971c
+
18971c
+    # Note: hostname can be fqdn OR short hostname, so chop off any
18971c
+    # trailing domain name and explicity add any domain if set.
18971c
+    [ -n "$hostname" ] && echo "echo ${hostname%.$domain}${domain:+.$domain} > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
18971c
+}
18971c
+
18971c
 PATH=/usr/sbin:/usr/bin:/sbin:/bin
18971c
 
18971c
 export PS4="dhclient.$interface.$$ + "
18971c
@@ -66,6 +91,7 @@ case $reason in
18971c
         echo "dhcp: PREINIT $netif up"
18971c
         linkup $netif
18971c
         ;;
18971c
+
18971c
     BOUND)
18971c
         echo "dhcp: BOND setting $netif"
18971c
         unset layer2
18971c
@@ -95,6 +121,29 @@ case $reason in
18971c
             echo "rm -f -- $hookdir/initqueue/setup_net_$netif.sh"
18971c
         } > $hookdir/initqueue/setup_net_$netif.sh
18971c
 
18971c
+        echo "[ -f /tmp/setup_net_$netif.ok ]" > $hookdir/initqueue/finished/dhclient-$netif.sh
18971c
+        >/tmp/net.$netif.up
18971c
+        ;;
18971c
+
18971c
+    BOUND6)
18971c
+        echo "dhcp: BOND6 setting $netif"
18971c
+        setup_interface6
18971c
+
18971c
+        set | while read line; do
18971c
+            [ "${line#new_}" = "$line" ] && continue
18971c
+            echo "$line"
18971c
+        done >/tmp/dhclient.$netif.dhcpopts
18971c
+
18971c
+        {
18971c
+            echo '. /lib/net-lib.sh'
18971c
+            echo "setup_net $netif"
18971c
+            echo "source_hook initqueue/online $netif"
18971c
+            [ -e /tmp/net.$netif.manualup ] || echo "/sbin/netroot $netif"
18971c
+            echo "> /tmp/setup_net_$netif.ok"
18971c
+            echo "> /tmp/setup_net_\$(cat /sys/class/net/$netif/address).ok"
18971c
+            echo "rm -f -- $hookdir/initqueue/setup_net_$netif.sh"
18971c
+        } > $hookdir/initqueue/setup_net_$netif.sh
18971c
+
18971c
         echo "[ -f /tmp/setup_net_$netif.ok ]" > $hookdir/initqueue/finished/dhclient-$netif.sh
18971c
         >/tmp/net.$netif.up
18971c
         ;;