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