rpms/dhcp/devel dhclient-script,1.13,1.14 dhcp.spec,1.273,1.274

David Cantrell dcantrel at fedoraproject.org
Sat Sep 19 06:22:33 UTC 2009


Author: dcantrel

Update of /cvs/pkgs/rpms/dhcp/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv1389

Modified Files:
	dhclient-script dhcp.spec 
Log Message:
* Fri Sep 18 2009 David Cantrell <dcantrell at redhat.com> - 12:4.1.0p1-9
- Update dhclient-script with handlers for DHCPv6 states



Index: dhclient-script
===================================================================
RCS file: /cvs/pkgs/rpms/dhcp/devel/dhclient-script,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -p -r1.13 -r1.14
--- dhclient-script	27 Jun 2009 03:17:04 -0000	1.13
+++ dhclient-script	19 Sep 2009 06:22:33 -0000	1.14
@@ -105,6 +105,32 @@ make_resolv_conf() {
         rm -f ${rscf}
 
         fix_context /etc/resolv.conf
+    elif [ -n "${new_dhcp6_name_servers}" ] ||
+         [ -n "${new_dhcp6_domain_search}" ]; then
+        save_previous /etc/resolv.conf
+        rscf="$(mktemp /tmp/XXXXXX)"
+        echo "; generated by /sbin/dhclient-script" > ${rscf}
+
+        if [ -n "${SEARCH}" ]; then
+            echo "search ${SEARCH}" >> $rscf
+        else
+            if [ -n "${new_dhcp6_domain_search}" ]; then
+                echo "search ${new_dhcp6_domain_search//\\032/ }" >> ${rscf}
+            fi
+        fi
+
+        if [ -n "${RES_OPTIONS}" ]; then
+            echo "options ${RES_OPTIONS}" >> ${rscf}
+        fi
+
+        for nameserver in ${new_dhcp6_name_servers} ; do
+            echo "nameserver ${nameserver}" >> ${rscf}
+        done
+
+        change_resolv_conf ${rscf}
+        rm -f ${rscf}
+
+        fix_context /etc/resolv.conf
     fi
 }
 
@@ -376,6 +402,55 @@ dhconfig() {
     fi
 }
 
+dh6config() {
+    case "${reason}" in
+        BOUND6)
+            if [ -n "${new_ip6_address}" ] ||
+               [ -n "${new_ip6_prefixlen}" ]; then
+                exit_with_hooks 2
+            fi
+
+            ip -f inet6 addr add ${new_ip6_address}/${new_ip6_prefixlen} \
+                dev ${interface} scope global
+            make_resolv_conf
+
+            break
+            ;;
+
+        RENEW6|REBIND6)
+            if [ ! "${new_dhcp6_name_servers}" = "${old_dhcp6_name_servers}" ] ||
+               [ ! "${new_dhcp6_domain_search}" = "${old_dhcp6_domain_search}" ]; then
+                make_resolv_conf
+            fi
+
+            break
+            ;;
+
+        DEPREF6)
+            if [ -n "${new_ip6_prefixlen}" ]; then
+                exit_with_hooks 2
+            fi
+
+            ip -f inet6 addr change ${new_ip6_address}/${new_ip6_prefixlen} \
+                dev ${interface} scope global preferred_lft 0
+
+            break
+            ;;
+    esac
+
+    # execute any additional client side configuration scripts we have
+    if [ -d ${ETCDIR}/dhclient.d ]; then
+        for f in ${ETCDIR}/dhclient.d/*.sh ; do
+            if [ -x ${f} ]; then
+                subsystem="${f%.sh}"
+                subsystem="${subsystem##*/}"
+                . ${f}
+                "${subsystem}_config"
+            fi
+        done
+    fi
+}
+
 get_prefix() {
     ip="${1}"
     nm="${2}"
@@ -457,6 +532,16 @@ case "${reason}" in
         exit_with_hooks 0
         ;;
 
+    PREINIT6)
+        # ensure interface is up
+        ip link set ${interface} up
+
+        # remove any stale addresses from aborted clients
+        ip -f inet6 addr flush dev ${interface} scope global permanent
+
+        exit_with_hooks 0
+        ;;
+
     ARPCHECK|ARPSEND)
         if [ -z "${new_ip_address}" ] || [ -z "${interface}" ] ||
            arping -q -f -c 2 -w 3 -D -I ${interface} ${new_ip_address}; then
@@ -471,6 +556,40 @@ case "${reason}" in
         exit_with_hooks 0
         ;;
 
+    BOUND6|RENEW6|REBIND6|DEPREF6)
+        dh6config
+        exit_with_hooks 0
+        ;;
+
+    EXPIRE6|RELEASE6|STOP6)
+        if [ -n "${old_ip6_address}" ] || [ -n "${old_ip6_prefixlen}" ]; then
+            exit_with_hooks 2
+        fi
+
+        ip -f inet6 addr del ${old_ip6_address}/${old_ip6_prefixlen} \
+            dev ${interface}
+
+        # execute any additional client side configuration scripts we have
+        if [ -d ${ETCDIR}/dhclient.d ]; then
+            for f in ${ETCDIR}/dhclient.d/*.sh ; do
+                if [ -x ${f} ]; then
+                    subsystem="${f%.sh}"
+                    subsystem="${subsystem##*/}"
+                    . ${f}
+                    "${subsystem}_restore"
+                fi
+            done
+        fi
+
+        if [ -x ${ETCDIR}/dhclient-${interface}-down-hooks ]; then
+            . ${ETCDIR}/dhclient-${interface}-down-hooks
+        elif [ -x ${ETCDIR}/dhclient-down-hooks ]; then
+            . ${ETCDIR}/dhclient-down-hooks
+        fi
+
+        exit_with_hooks 0
+        ;;
+
     EXPIRE|FAIL|RELEASE|STOP)
         # only restore config files if there are no other dhclient processes
         # running (#306381)


Index: dhcp.spec
===================================================================
RCS file: /cvs/pkgs/rpms/dhcp/devel/dhcp.spec,v
retrieving revision 1.273
retrieving revision 1.274
diff -u -p -r1.273 -r1.274
--- dhcp.spec	26 Aug 2009 21:34:50 -0000	1.273
+++ dhcp.spec	19 Sep 2009 06:22:33 -0000	1.274
@@ -13,7 +13,7 @@
 Summary:  Dynamic host configuration protocol software
 Name:     dhcp
 Version:  %{basever}p1
-Release:  8%{?dist}
+Release:  9%{?dist}
 # NEVER CHANGE THE EPOCH on this package.  The previous maintainer (prior to
 # dcantrell maintaining the package) made incorrect use of the epoch and
 # that's why it is at 12 now.  It should have never been used, but it was.
@@ -479,6 +479,9 @@ fi
 %attr(0644,root,root) %{_mandir}/man3/omapi.3.gz
 
 %changelog
+* Fri Sep 18 2009 David Cantrell <dcantrell at redhat.com> - 12:4.1.0p1-9
+- Update dhclient-script with handlers for DHCPv6 states
+
 * Wed Aug 26 2009 David Cantrell <dcantrell at redhat.com> - 12:4.1.0p1-8
 - Conditionalize restorecon calls in post scriptlets (#519479)
 




More information about the scm-commits mailing list