Blame SOURCES/README.dhclient.d

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