[pkg-dhcp-commits] [SCM] ISC DHCP packaging for Debian branch, master, updated. debian/4.1.1-P1-16.1-14-g02638d8

Andrew Pollock apollock at debian.org
Thu May 19 05:53:11 UTC 2011


The following commit has been merged in the master branch:
commit 9a670c2dd6b63431e393a81ed4c60b2ddf00e5e5
Author: Peter Marschall <peter at adpm.de>
Date:   Sat Jan 8 16:12:14 2011 +0100

    dhclient-script.linux: add DHCPv6 support
    
    * add handlers for DHCPv6
    * extend make_resolv_conf() by DHCPv6 part
    
    Signed-off-by: Peter Marschall <peter at adpm.de>

diff --git a/debian/dhclient-script.linux b/debian/dhclient-script.linux
index 6667c49..7f74b4e 100644
--- a/debian/dhclient-script.linux
+++ b/debian/dhclient-script.linux
@@ -16,6 +16,7 @@
 make_resolv_conf() {
     local new_resolv_conf
 
+    # DHCPv4
     if [ -n "$new_domain_search" ] || [ -n "$new_domain_name" ] ||
        [ -n "$new_domain_name_servers" ]; then
         new_resolv_conf=/etc/resolv.conf.dhclient-new
@@ -55,6 +56,26 @@ make_resolv_conf() {
         chown --reference=/etc/resolv.conf $new_resolv_conf
         chmod --reference=/etc/resolv.conf $new_resolv_conf
         mv -f $new_resolv_conf /etc/resolv.conf
+    # DHCPv6
+    elif [ -n "$new_dhcp6_domain_search" ] || [ -n "$new_dhcp6_name_servers" ]; then
+        new_resolv_conf=/etc/resolv.conf.dhclient-new
+        rm -f $new_resolv_conf
+
+        if [ -n "$new_dhcp6_domain_search" ]; then
+            echo "search ${new_dhcp6_domain_search}" >> $new_resolv_conf
+        fi
+
+        if [ -n "$new_dhcp6_name_servers" ]; then
+            for nameserver in $new_dhcp6_name_servers; do
+                echo nameserver $nameserver >>$new_resolv_conf
+            done
+        else # keep 'old' nameservers
+            sed -n /^\w*[Nn][Aa][Mm][Ee][Ss][Ee][Rr][Vv][Ee][Rr]/p /etc/resolv.conf >>$new_resolv_conf
+        fi
+
+        chown --reference=/etc/resolv.conf $new_resolv_conf
+        chmod --reference=/etc/resolv.conf $new_resolv_conf
+        mv -f $new_resolv_conf /etc/resolv.conf
     fi
 }
 
@@ -149,6 +170,9 @@ run_hookdir /etc/dhcp/dhclient-enter-hooks.d
 
 # Execute the operation
 case "$reason" in
+
+    ### DHCPv4 Handlers
+
     MEDIUM|ARPCHECK|ARPSEND)
         # Do nothing
         ;;
@@ -261,6 +285,58 @@ case "$reason" in
         fi
 
         ;;
+
+    ### DHCPv6 Handlers
+    # TODO handle prefix change: ?based on ${old_ip6_prefix} and ${new_ip6_prefix}?
+
+    PREINIT6)
+        # ensure interface is up
+        ip link set ${interface} up
+
+        # flush any stale global permanent IPs from interface
+        ip -6 addr flush dev ${interface} scope global permanent
+
+        ;;
+
+    BOUND6|RENEW6|REBIND6)
+        if [ -z "${new_ip6_address}" ] || [ -z "${new_ip6_prefixlen}" ]; then
+            exit_with_hooks 2
+        fi
+
+        # set leased IP
+        ip -6 addr add ${new_ip6_address}/${new_ip6_prefixlen} \
+            dev ${interface} scope global
+
+        # update /etc/resolv.conf
+        if [ "${reason}" = BOUND6 ] ||
+           [ "${new_dhcp6_name_servers}" != "${old_dhcp6_name_servers}" ] ||
+           [ "${new_dhcp6_domain_search}" != "${old_dhcp6_domain_search}" ]; then
+            make_resolv_conf
+        fi
+
+        ;;
+
+    DEPREF6)
+        if [ -z "${cur_ip6_prefixlen}" ]; then
+            exit_with_hooks 2
+        fi
+
+        # set preferred lifetime of leased IP to 0
+        ip -6 addr change ${cur_ip6_address}/${cur_ip6_prefixlen} \
+            dev ${interface} scope global preferred_lft 0
+
+        ;;
+
+    EXPIRE6|RELEASE6|STOP6)
+        if [ -z "${old_ip6_address}" ] || [ -z "${old_ip6_prefixlen}" ]; then
+            exit_with_hooks 2
+        fi
+
+        # delete leased IP
+        ip -6 addr del ${old_ip6_address}/${old_ip6_prefixlen} \
+            dev ${interface}
+
+        ;;
 esac
 
 exit_with_hooks 0

-- 
ISC DHCP packaging for Debian



More information about the pkg-dhcp-commits mailing list