Blame SOURCES/README.dhclient.d

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