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