- Update dhclient-script with handlers for DHCPv6 states

This commit is contained in:
David Cantrell 2009-09-19 06:22:33 +00:00
parent 8fe064a649
commit f195973b7b
2 changed files with 123 additions and 1 deletions

View File

@ -104,6 +104,32 @@ make_resolv_conf() {
change_resolv_conf ${rscf} change_resolv_conf ${rscf}
rm -f ${rscf} 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 fix_context /etc/resolv.conf
fi fi
} }
@ -376,6 +402,55 @@ dhconfig() {
fi 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() { get_prefix() {
ip="${1}" ip="${1}"
nm="${2}" nm="${2}"
@ -457,6 +532,16 @@ case "${reason}" in
exit_with_hooks 0 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) ARPCHECK|ARPSEND)
if [ -z "${new_ip_address}" ] || [ -z "${interface}" ] || if [ -z "${new_ip_address}" ] || [ -z "${interface}" ] ||
arping -q -f -c 2 -w 3 -D -I ${interface} ${new_ip_address}; then 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 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) EXPIRE|FAIL|RELEASE|STOP)
# only restore config files if there are no other dhclient processes # only restore config files if there are no other dhclient processes
# running (#306381) # running (#306381)

View File

@ -13,7 +13,7 @@
Summary: Dynamic host configuration protocol software Summary: Dynamic host configuration protocol software
Name: dhcp Name: dhcp
Version: %{basever}p1 Version: %{basever}p1
Release: 8%{?dist} Release: 9%{?dist}
# NEVER CHANGE THE EPOCH on this package. The previous maintainer (prior to # NEVER CHANGE THE EPOCH on this package. The previous maintainer (prior to
# dcantrell maintaining the package) made incorrect use of the epoch and # 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. # 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 %attr(0644,root,root) %{_mandir}/man3/omapi.3.gz
%changelog %changelog
* Fri Sep 18 2009 David Cantrell <dcantrell@redhat.com> - 12:4.1.0p1-9
- Update dhclient-script with handlers for DHCPv6 states
* Wed Aug 26 2009 David Cantrell <dcantrell@redhat.com> - 12:4.1.0p1-8 * Wed Aug 26 2009 David Cantrell <dcantrell@redhat.com> - 12:4.1.0p1-8
- Conditionalize restorecon calls in post scriptlets (#519479) - Conditionalize restorecon calls in post scriptlets (#519479)