Blame SOURCES/README.dhclient.d

26a25c
The /etc/dhcp/dhclient.d directory allows other packages and system
26a25c
administrators to create application-specific option handlers for dhclient.
26a25c
26a25c
When dhclient is run, any option listed in the dhcp-options(5) man page can
26a25c
be requested.  dhclient-script does not handle every option available
26a25c
because doing so would make the script unmaintainable as the components
26a25c
using those options might change over time.  The knowledge of how to handle
26a25c
those options should be under the responsibility of the package maintainer
26a25c
for that component (e.g., NTP options belong in a handler in the ntp
26a25c
package).
26a25c
26a25c
To make maintenance easier, application specific DHCP options can be handled
26a25c
by creating a bash script with two functions and placing it in /etc/dhcp/dhclient.d
26a25c
26a25c
The script must follow a specific form:
26a25c
26a25c
(1) The script must be named NAME.sh.  NAME can be anything, but it makes
26a25c
    sense to name it for the service it handles.  e.g., ntp.sh
26a25c
26a25c
(2) The script must provide a NAME_config() function to read the options and
26a25c
    do whatever it takes to put those options in place.
26a25c
26a25c
(3) The script must provide a NAME_restore() function to restore original
26a25c
    configuration state when dhclient stops.
26a25c
26a25c
(4) The script must be 'chmod +x' or dhclient-script will ignore it.
26a25c
26a25c
The scripts execute in the same environment as dhclient-script.  That means
26a25c
all of the functions and variables available to it are available to your
26a25c
NAME.sh script.  Things of note:
26a25c
26a25c
    ${SAVEDIR} is where original configuration files are saved.  Save your
26a25c
    original configuration files here before you take the DHCP provided
26a25c
    values and generate new files.
26a25c
26a25c
    Variables set in /etc/sysconfig/network, /etc/sysconfig/networking/network,
26a25c
    and /etc/sysconfig/network-scripts/ifcfg-$interface are available to
26a25c
    you.
26a25c
26a25c
See the scripts in /etc/dhcp/dhclient.d for examples.
26a25c
26a25c
NOTE:  Do not use functions defined in /usr/sbin/dhclient-script.  Consider
26a25c
dhclient-script a black box.  This script may change over time, so the
26a25c
dhclient.d scripts should not be using functions defined in it.
26a25c
26a25c
-- 
26a25c
David Cantrell <dcantrell@redhat.com>