philipp / rpms / dhcp

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