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

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