rpms/dhcp/devel dhcp-3.0.3-dhclient-script-up-down-hooks.patch, NONE, 1.1 dhcp.spec, 1.66, 1.67
fedora-cvs-commits at redhat.com
fedora-cvs-commits at redhat.com
Mon Aug 29 22:32:58 UTC 2005
Author: jvdias
Update of /cvs/dist/rpms/dhcp/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv13163
Modified Files:
dhcp.spec
Added Files:
dhcp-3.0.3-dhclient-script-up-down-hooks.patch
Log Message:
fix bug 166926: handle interface-mtu option in dhclient script. Add dhclient-{,$IF}-{up,down}-hooks mechanism to handle other non-default DHCP options. Handle time-offset DHCP option that is requested by default - now all default DHCP options are handled in dhclient-script.
dhcp-3.0.3-dhclient-script-up-down-hooks.patch:
dhclient-script.8 | 23 ++++++++++++++++++++++-
scripts/linux | 34 ++++++++++++++++++++++++++++++++--
2 files changed, 54 insertions(+), 3 deletions(-)
--- NEW FILE dhcp-3.0.3-dhclient-script-up-down-hooks.patch ---
--- dhcp-3.0.3/client/scripts/linux.dhclient-script-up-down-hooks 2005-08-29 18:04:47.797909000 -0400
+++ dhcp-3.0.3/client/scripts/linux 2005-08-29 18:04:58.911786000 -0400
@@ -210,7 +210,15 @@
if [ -z "${dhc_dbus}" ] || (( ( dhc_dbus & 2 ) != 2 )); then
ifconfig $interface inet $new_ip_address $new_subnet_arg \
$new_broadcast_arg
- fi
+ if [ -n "$new_interface_mtu" ]; then
+ /sbin/ip link set $interface mtu $new_interface_mtu;
+ fi;
+ if [ -x /etc/dhclient-${interface}-up-hooks ]; then
+ . /etc/dhclient-${interface}-up-hooks;
+ elif [ -x /etc/dhclient-up-hooks ]; then
+ . /etc/dhclient-up-hooks;
+ fi;
+ fi;
if [ -z "${dhc_dbus}" ] || (( ( dhc_dbus & 4 ) != 4 )); then
prefix_bits=`mask_bits $new_subnet_mask`
@@ -305,6 +313,18 @@
fi
fi
if [ -z "${dhc_dbus}" ] || (( ( dhc_dbus & 16 ) != 16 )); then
+ if [ -n "$new_time_offset" ]; then
+ # DHCP option "time-offset" is requested by default and should be handled.
+ # The geographical zone abbreviation cannot be determined from the GMT offset,
+ # but the $ZONEINFO/Etc/GMT$offset file can be used:
+ ((z=new_time_offset/3600));
+ tzfile=/usr/share/zoneinfo/Etc/GMT`printf '%+d' $z`;
+ if [ -e $tzfile ]; then
+ /bin/mv -f /etc/localtime /etc/localtime.predhclient;
+ /bin/cp -fp $tzfile /etc/localtime;
+ /bin/touch /etc/localtime;
+ fi;
+ fi;
if [ "${PEERNTP}" = no ]; then
:
elif [ -n "$new_ntp_servers" ] && [ -e /etc/ntp.conf ]; then
@@ -401,6 +421,11 @@
change_resolv_conf /etc/resolv.conf.predhclient
rm -f /etc/resolv.conf.predhclient
fi
+ if [ -e /etc/localtime.predhclient ]; then
+ /bin/rm -f /etc/localtime
+ /bin/mv -f /etc/localtime.predhclient /etc/localtime;
+ /bin/touch /etc/localtime;
+ fi;
if [ -f /etc/ntp.conf.predhclient ]; then
/bin/rm -f /etc/ntp.conf
/bin/mv -f /etc/ntp.conf.predhclient /etc/ntp.conf
@@ -422,6 +447,11 @@
kill -HUP $yppid;
fi
fi
+ if [ -x /etc/dhclient-${interface}-down-hooks ]; then
+ . /etc/dhclient-${interface}-down-hooks;
+ elif [ -x /etc/dhclient-down-hooks ]; then
+ . /etc/dhclient-down-hooks;
+ fi;
if [ x$alias_ip_address != x ]; then
# Turn off alias interface.
ifconfig $interface:0- inet 0
@@ -444,7 +474,7 @@
fi
ifconfig $interface inet $new_ip_address $new_subnet_arg \
$new_broadcast_arg
- fi
+ fi;
set $new_routers
if ping -q -c 1 -w 10 -I $interface $1; then
dhconfig ;
--- dhcp-3.0.3/client/dhclient-script.8.dhclient-script-up-down-hooks 2004-06-10 13:59:12.000000000 -0400
+++ dhcp-3.0.3/client/dhclient-script.8 2005-08-29 18:04:49.228476000 -0400
@@ -47,7 +47,7 @@
exit hooks provided (see HOOKS for details). These hooks will allow the
user to override the default behaviour of the client in creating a
.B /etc/resolv.conf
-file.
+file, and to handle DHCP options not handled by default.
.PP
No standard client script exists for some operating systems, even though
the actual client may work, so a pioneering user may well need to create
@@ -91,6 +91,27 @@
.B ETCDIR/dhclient-exit-hooks
script can modify the valid of exit_status to change the exit status
of dhclient-script.
+.PP
+Immediately after dhclient brings an interface UP with a new IP address,
+subnet mask, and routes, in the REBOOT/BOUND states, it will check for the
+existence of an executable
+.B ETCDIR/dhclient-up-hooks
+script, and source it if found. This script can handle DHCP options in
+the environment that are not handled by default. A per-interface
+.B ETCDIR/dhclient-up-${IF}-hooks
+script will override the generic script and be sourced when interface
+$IF has been brought up.
+.PP
+Immediately before dhclient brings an interface DOWN, removing its IP
+address, subnet mask, and routes, in the STOP/RELEASE states, it will
+check for the existence of an executable
+.B ETCDIR/dhclient-down-hooks
+script, and source it if found. This script can handle DHCP options in
+the environment that are not handled by default. A per-interface
+.B ETCDIR/dhclient-down-${IF}-hooks
+script will override the generic script and be sourced when interface
+$IF is about to be brought down.
+
.SH OPERATION
When dhclient needs to invoke the client configuration script, it
defines a set of variables in the environment, and then invokes
Index: dhcp.spec
===================================================================
RCS file: /cvs/dist/rpms/dhcp/devel/dhcp.spec,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -r1.66 -r1.67
--- dhcp.spec 23 Aug 2005 21:27:54 -0000 1.66
+++ dhcp.spec 29 Aug 2005 22:32:55 -0000 1.67
@@ -2,7 +2,7 @@
Summary: A DHCP (Dynamic Host Configuration Protocol) server and relay agent.
Name: dhcp
Version: 3.0.3
-Release: 3
+Release: 4
Epoch: 11
License: distributable
Group: System Environment/Daemons
@@ -61,6 +61,7 @@
Patch154: dhcp-3.0.3-trailing_nul_options.patch
Patch155: dhcp-3.0.3-gcc4_warnings.patch
Patch156: dhcp-3.0.3-version.patch
+Patch157: dhcp-3.0.3-dhclient-script-up-down-hooks.patch
URL: http://isc.org/products/DHCP/
BuildRoot: %{_tmppath}/%{name}-%{version}-root
Prereq: /sbin/chkconfig
@@ -164,6 +165,7 @@
%patch154 -p1 -b .trailing_nul_options
%patch155 -p1 -b .gcc4_warnings
%patch156 -p1 -b .version
+%patch157 -p1 -b .dhclient-script-up-down-hooks
cp %SOURCE1 .
cat <<EOF >site.conf
VARDB=%{_localstatedir}/lib/dhcp
@@ -297,6 +299,13 @@
%{_mandir}/man3/*
%changelog
+* Mon Aug 29 2005 Jason Vas Dias <jvdias at redhat.com> - 11:3.0.3-4
+- fix bug 166926: make dhclient-script handle interface-mtu option
+ make dhclient-script support /etc/dhclient{,-$IF}-{up,down}-hooks scripts
+ to allow easy customization to support other non-default DHCP options -
+ documented in 'man 8 dhclient-script' .
+- handle the 'time-offset' DHCP option, requested by default.
+
* Tue Aug 23 2005 Jason Vas Dias <jvdias at redhat.com> - 11:3.0.3-3
- fix bug 160655: strip trailing '\0' bytes from text options before append
- fix gcc4 compiler warnings ; now compiles with -Werror
@@ -733,7 +742,7 @@
* Wed Feb 14 2001 Tim Waugh <twaugh at redhat.com>
- Fix initscript typo (bug #27624).
-* Wed Feb 7 2001 Trond Eivind Glomsrød <teg at redhat.com>
+* Wed Feb 7 2001 Trond Eivind Glomsrød <teg at redhat.com>
- Improve spec file i18n
* Mon Feb 5 2001 Bernhard Rosenkraenzer <bero at redhat.com>
More information about the fedora-cvs-commits
mailing list