From 1d6dac93e429289322d9cac0c53db096e49d055d Mon Sep 17 00:00:00 2001 From: David Cantrell Date: Apr 17 2009 21:10:07 +0000 Subject: - Fix setting default route when client IP address changes (#486512, #473658) - Restore SELinux context on /etc/ntp.conf and /etc/yp.conf (#483747) - 'reload' and 'try-restart' on dhcpd and dhcrelay init scripts will display usage information and return code 3 --- diff --git a/dhclient-script b/dhclient-script index 5008b0b..a23cd04 100755 --- a/dhclient-script +++ b/dhclient-script @@ -3,7 +3,7 @@ # dhclient-script: Network interface configuration script run by # dhclient based on DHCP client communication # -# Copyright (C) 2008 Red Hat, Inc. +# Copyright (C) 2008, 2009 Red Hat, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -40,6 +40,12 @@ logmessage() { logger -p ${LOGFACILITY}.${LOGLEVEL} -t "NET" "dhclient: ${msg}" } +fix_context() { + if [ -x /sbin/restorecon ]; then + /sbin/restorecon ${1} >/dev/null 2>&1 + fi +} + save_previous() { origfile="${1}" savefile="${SAVEDIR}/${origfile##*/}.predhclient.${interface}" @@ -54,7 +60,7 @@ save_previous() { echo > ${savefile} fi - restorecon ${savefile} >/dev/null 2>&1 + fix_context ${savefile} } make_resolv_conf() { @@ -94,9 +100,7 @@ make_resolv_conf() { change_resolv_conf ${rscf} rm -f ${rscf} - if [ -x /sbin/restorecon ]; then - /sbin/restorecon /etc/resolv.conf >/dev/null 2>&1 - fi + fix_context /etc/resolv.conf fi } @@ -227,6 +231,7 @@ dhconfig() { [ ! "${old_routers}" = "${new_routers}" ] || [ ! "${old_interface_mtu}" = "${new_interface_mtu}" ]; then ip -family inet addr add ${new_ip_address}/${new_prefix} broadcast ${new_broadcast_address} dev ${interface} + ip -family inet link set dev ${interface} up if [ -n "${new_interface_mtu}" ]; then ip link set ${interface} mtu ${new_interface_mtu} @@ -400,7 +405,7 @@ dhconfig() { [ -n "${new_ntp_servers}" ] && [ -e /etc/ntp.conf ]; then save_previous /etc/ntp.conf egrep -v '^server .* # added by /sbin/dhclient-script$'< ${SAVEDIR}/ntp.conf.predhclient.${interface} > /etc/ntp.conf - restorecon /etc/ntp.conf >/dev/null 2>&1 + fix_context /etc/ntp.conf for s in ${new_ntp_servers} ; do echo "server ${s} # added by /sbin/dhclient-script" >> /etc/ntp.conf @@ -523,18 +528,21 @@ case "${reason}" in rm -f /etc/localtime mv ${SAVEDIR}/localtime.predhclient.${interface} /etc/localtime touch /etc/localtime + fix_context /etc/localtime fi fi if [ -f ${SAVEDIR}/ntp.conf.predhclient.${interface} ]; then rm -f /etc/ntp.conf - mv -f ${SAVEDIR}/ntp.conf.predhclient.${interface} /etc/ntp.conf + mv ${SAVEDIR}/ntp.conf.predhclient.${interface} /etc/ntp.conf + fix_context /etc/ntp.conf service ntpd condrestart >/dev/null 2>&1 fi if [ -f ${SAVEDIR}/yp.conf.predhclient.${interface} ]; then rm -f /etc/yp.conf - mv -f ${SAVEDIR}/yp.conf.predhclient.${interface} /etc/yp.conf + mv ${SAVEDIR}/yp.conf.predhclient.${interface} /etc/yp.conf + fix_context /etc/yp.conf if [ -x /etc/rc.d/init.d/ypbind ] && [ -r /var/run/ypbind.pid ]; then service ypbind restart >/dev/null 2>&1 fi diff --git a/dhcp.spec b/dhcp.spec index ee4d884..adc254f 100644 --- a/dhcp.spec +++ b/dhcp.spec @@ -4,7 +4,7 @@ Summary: DHCP (Dynamic Host Configuration Protocol) server and relay agent Name: dhcp Version: 4.0.0 -Release: 33%{?dist} +Release: 34%{?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. @@ -449,6 +449,12 @@ fi %{_libdir}/libdhcp4client.so %changelog +* Thu Apr 16 2009 David Cantrell - 12:4.0.0-34 +- Fix setting default route when client IP address changes (#486512, #473658) +- Restore SELinux context on /etc/ntp.conf and /etc/yp.conf (#483747) +- 'reload' and 'try-restart' on dhcpd and dhcrelay init scripts + will display usage information and return code 3 + * Wed Dec 03 2008 David Cantrell - 12:4.0.0-33 - Do not calculate a prefix for an address we did not receive (#473885) diff --git a/dhcpd.init b/dhcpd.init index acc88f8..95cf4e5 100644 --- a/dhcpd.init +++ b/dhcpd.init @@ -121,9 +121,6 @@ case "$1" in stop ; start RETVAL=$? ;; - try-restart|reload) - RETVAL=3 - ;; condrestart) if [ -f $lockfile ]; then stop ; start diff --git a/dhcrelay.init b/dhcrelay.init index 27aaebf..02d1a3e 100644 --- a/dhcrelay.init +++ b/dhcrelay.init @@ -99,9 +99,6 @@ case "$1" in stop && start RETVAL=$? ;; - try-restart|reload) - RETVAL=3 - ;; condrestart) if [ -f $lockfile ]; then stop && start