Revert to dhcp-3.1.0 for now.

This commit is contained in:
David Cantrell 2008-01-11 00:19:03 +00:00
parent 203b45caac
commit db449ef09b
26 changed files with 9282 additions and 2 deletions

View File

@ -1 +1 @@
dhcp-4.0.0.tar.gz
dhcp-3.1.0.tar.gz

150
Makefile.libdhcp4client Normal file
View File

@ -0,0 +1,150 @@
#
# Makefile.dist for libdhcp4client
#
# We get the libdhcp4client library from the patched ISC source code. We
# rebuild key C files with -DLIBDHCP to turn on the library features we
# need. Normal build results in standard ISC code (i.e., not LIBDHCP
# stuff enabled). We then link together a static library and a shared
# library with the new resulting objects.
#
# Copyright (C) 2006, 2007 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY expressed or implied, including the implied warranties of
# MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU General
# Public License for more details. You should have received a copy of the
# GNU General Public License along with this program; if not, write to the
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA. Any Red Hat trademarks that are incorporated in the
# source code or documentation are not subject to the GNU General Public
# License and may only be used or replicated with the express permission of
# Red Hat, Inc.
#
# Red Hat Author(s): Jason Vas Dias
# David Cantrell <dcantrell@redhat.com>
#
# What version of ISC DHCP is this?
VER = $(shell grep DHCP_VERSION ../../includes/version.h | head -1 | cut -d '"' -f 2 | cut -d 'V' -f 2 | cut -d '-' -f 1)
PROGS = libdhcp4client.a libdhcp4client-$(VER).so.0
# NOTE: The ordering of these file lists is important! We are using the
# whole program optimization features of gcc, so the order matters here.
# Source files shared by all objects
COMMON_SRCS = client_clparse.c client_dhclient.c common_alloc.c common_bpf.c \
common_comapi.c common_conflex.c common_discover.c \
common_dispatch.c common_dns.c common_ethernet.c \
common_execute.c common_inet.c common_lpf.c common_memory.c \
common_options.c common_packet.c common_parse.c common_print.c \
common_socket.c common_tables.c common_tr.c common_tree.c \
dst_dst_api.c dst_base64.c dst_hmac_link.c dst_md5_dgst.c \
omapip_alloc.c omapip_array.c omapip_auth.c omapip_buffer.c \
omapip_connection.c omapip_convert.c omapip_dispatch.c \
omapip_errwarn.c omapip_handle.c omapip_hash.c \
omapip_listener.c omapip_mrtrace.c omapip_result.c \
omapip_support.c omapip_toisc.c omapip_trace.c
# Source files for libdhcp4client.o
CLIENT_SRCS = common_ctrace.c common_dlpi.c common_nit.c common_upf.c \
dst_dst_support.c dst_prandom.c omapip_generic.c \
omapip_message.c omapip_protocol.c
# Source files for libres.o (minires)
MINIRES_SRCS = minires_ns_date.c minires_ns_name.c minires_ns_parse.c \
minires_ns_samedomain.c minires_ns_sign.c minires_ns_verify.c \
minires_res_comp.c minires_res_findzonecut.c \
minires_res_init.c minires_res_mkquery.c \
minires_res_mkupdate.c minires_res_query.c minires_res_send.c \
minires_res_sendsigned.c minires_res_update.c
# ISC dhcp headers we need to copy to /usr/include/dhcp4client
DHCP_HEADERS = dhcpd.h cdefs.h osdep.h arpa/nameser.h minires/minires.h \
site.h cf/linux.h dhcp.h statement.h tree.h inet.h dhctoken.h \
omapip/omapip_p.h failover.h ctrace.h minires/resolv.h \
minires/res_update.h omapip/convert.h omapip/hash.h \
omapip/trace.h
HDRS = dhcp4client.h
SRCS = $(COMMON_SRCS) $(CLIENT_SRCS)
OBJS = $(SRCS:.c=.o)
INCLUDES = -I$(TOP) -I$(TOP)/includes -I$(TOP)/dst -I.
CFLAGS = $(DEBUG) $(PREDEFINES) $(INCLUDES) $(COPTS) \
-DCLIENT_PATH=${CLIENT_PATH} -DLIBDHCP -DUSE_MD5
all: $(PROGS)
install: all
install -p -m 0755 -D libdhcp4client-$(VER).so.0 $(DESTDIR)$(LIBDIR)/libdhcp4client-$(VER).so.0
ln -sf libdhcp4client-$(VER).so.0 $(DESTDIR)/$(LIBDIR)/libdhcp4client.so
install -p -m 0644 -D libdhcp4client.a $(DESTDIR)$(LIBDIR)/libdhcp4client.a
install -p -m 0644 -D dhcp4client.h $(DESTDIR)$(INCDIR)/dhcp4client/dhcp4client.h
for hdr in $(DHCP_HEADERS) ; do \
install -p -m 0644 -D $(TOP)/includes/$${hdr} $(DESTDIR)$(INCDIR)/dhcp4client/$${hdr} ; \
done
depend:
$(MKDEP) $(INCLUDES) $(PREDEFINES) $(SRCS)
clean:
-rm -f $(OBJS)
realclean: clean
-rm -f $(PROG) *~ #*
distclean: realclean
-rm -f Makefile
# This isn't the cleanest way to set up links, but I prefer this so I don't
# need object targets for each subdirectory. The idea is simple. Since
# libdhcp4client is a linked together wad of objects from across the source
# tree, we change / to _ when linking source files here. Follow this example:
#
# We need to use client/dhclient.c, so we make this link:
# rm -f client_dhclient.c
# ln -s $(TOP)/client/dhclient.c client_dhclient.c
#
# Simple. Given the way the ISC build system works, this is the easiest to
# maintain and least invasive.
#
# David Cantrell <dcantrell@redhat.com>
links:
@for target in $(SRCS); do \
source="`echo $$target | sed -e 's|_|/|'`"; \
if [ ! -b $$target ]; then \
rm -f $$target; \
fi; \
ln -s $(TOP)/$$source $$target; \
done; \
for hdr in $(HDRS); do \
if [ ! -b $$hdr ]; then \
rm -f $$hdr; \
fi; \
ln -s $(TOP)/libdhcp4client/$$hdr $$hdr; \
done
# minires is difficult to build because it overrides things in common and dst,
# so we just link with the already built libres.a since we need it all anyway
libres.a:
if [ ! -f ../minires/$@ ]; then \
$(MAKE) -C ../minires; \
fi; \
ln ../minires/libres.a .; \
$(AR) x libres.a
# Create the libraries
# minires/res_query.o contains an undefined symbol __h_errno_set, is not
# used by any dhcp code, and is optimized out by the linker when producing
# the dhclient executable or a shared library
libdhcp4client.a: $(OBJS) libres.a
$(AR) crus $@ $(OBJS) `$(AR) t libres.a | grep -v res_query.o`
libdhcp4client-$(VER).so.0: $(OBJS) libres.a
$(CC) -shared -o $@ -Wl,-soname,$@ $(OBJS) `$(AR) t libres.a | grep -v res_query.o`
# Dependencies (semi-automatically-generated)

192
README.ldap Normal file
View File

@ -0,0 +1,192 @@
LDAP Support in DHCP
Brian Masney <masneyb@ntelos.net>
Last updated 3/23/2003
This document describes setting up the DHCP server to read it's configuration
from LDAP. This work is based on the IETF document
draft-ietf-dhc-ldap-schema-01.txt included in the doc directory. For the
latest version of this document, please see http://home.ntelos.net/~masneyb.
First question on most people's mind is "Why do I want to store my
configuration in LDAP?" If you run a small DHCP server, and the configuration
on it rarely changes, then you won't need to store your configuration in LDAP.
But, if you have several DHCP servers, and you want an easy way to manage your
configuration, this can be a solution.
The first step will be to setup your LDAP server. I am using OpenLDAP from
www.openldap.org. Building and installing OpenLDAP is beyond the scope of
this document. There is plenty of documentation out there about this. Once
you have OpenLDAP installed, you will have to edit your slapd.conf file. I
added the following 2 lines to my configuration file:
include /etc/ldap/schema/dhcp.schema
index dhcpHWAddress eq
index dhcpClassData eq
The first line tells it to include the dhcp schema file. You will find this
file under the contrib directory in this distribution. You will need to copy
this file to where your other schema files are (maybe
/usr/local/openldap/etc/openldap/schema/). The second line sets up an index
for the dhcpHWAddress parameter. The third parameter is for reading subclasses
from LDAP every time a DHCP request comes in. Make sure you run the slapindex
command and restart slapd to have these changes to into effect.
Now that you have LDAP setup, you should be able to use gq
(http://biot.com/gq/) to verify that the dhcp schema file is loaded into LDAP.
Pull up gq, and click on the Schema tab. Go under objectClasses, and you
should see at least the following object classes listed: dhcpClass, dhcpGroup,
dhcpHost, dhcpOptions, dhcpPool, dhcpServer, dhcpService, dhcpSharedNetwork,
dhcpSubClass, and dhcpSubnet. If you do not see these, you need to check over
your LDAP configuration before you go any further.
You should now be ready to build DHCP. If you would like to enable LDAP over
SSL, you will need to perform the following steps:
* Edit the includes/site.h file and uncomment the USE_SSL line
or specify "-DUSE_SSL" via CFLAGS.
* Edit the dst/Makefile.dist file and remove md5_dgst.c and md5_dgst.o
from the SRC= and OBJ= lines (around line 24)
* Now run configure in the base source directory. If you chose to enable
LDAP over SSL, you must append -lcrypto -lssl to the LIBS= line in the
file work.os/server/Makefile (replace os with your operating system,
linux-2.2 on my machine). You should now be able to type make to build
your DHCP server.
If you choose to not enable LDAP over SSL, then you only need to run configure
and make in the toplevel source directory.
Once you have DHCP installed, you will need to setup your initial plaintext
config file. In my /etc/dhcpd.conf file, I have:
ldap-server "localhost";
ldap-port 389;
ldap-username "cn=DHCP User, dc=ntelos, dc=net";
ldap-password "blah";
ldap-base-dn "dc=ntelos, dc=net";
ldap-method dynamic;
ldap-debug-file "/var/log/dhcp-ldap-startup.log";
If SSL has been enabled at compile time using the USE_SSL flag, the dhcp
server trys to use TLS if possible, but continues without TLS if not.
You can modify this behaviour using following option in /etc/dhcpd.conf:
ldap-ssl <off | ldaps | start_tls | on>
off: disables TLS/LDAPS.
ldaps: enables LDAPS -- don't forget to set ldap-port to 636.
start_tls: enables TLS using START_TLS command
on: enables LDAPS if ldap-port is set to 636 or TLS in
other cases.
See also "man 5 ldap.conf" for description the following TLS related
options:
ldap-tls-reqcert, ldap-tls-ca-file, ldap-tls-ca-dir, ldap-tls-cert
ldap-tls-key, ldap-tls-crlcheck, ldap-tls-ciphers, ldap-tls-randfile
All of these parameters should be self explanatory except for the ldap-method.
You can set this to static or dynamic. If you set it to static, the
configuration is read once on startup, and LDAP isn't used anymore. But, if
you set this to dynamic, the configuration is read once on startup, and the
hosts that are stored in LDAP are looked up every time a DHCP request comes
in.
When the optional statement ldap-debug-file is specified, on startup the DHCP
server will write out the configuration that it generated from LDAP. If you
are getting errors about your LDAP configuration, this is a good place to
start looking.
The next step is to set up your LDAP tree. Here is an example config that will
give a 10.100.0.x address to machines that have a host entry in LDAP.
Otherwise, it will give a 10.200.0.x address to them. (NOTE: replace
dc=ntelos, dc=net with your base dn). If you would like to convert your
existing dhcpd.conf file to LDIF format, there is a script
contrib/dhcpd-conf-to-ldap.pl that will convert it for you. Type
dhcpd-conf-to-ldap.pl --help to see the usage information for this script.
# You must specify the server's host name in LDAP that you are going to run
# DHCP on and point it to which config tree you want to use. Whenever DHCP
# first starts up, it will do a search for this entry to find out which
# config to use
dn: cn=brian.ntelos.net, dc=ntelos, dc=net
objectClass: top
objectClass: dhcpServer
cn: brian.ntelos.net
dhcpServiceDN: cn=DHCP Service Config, dc=ntelos, dc=net
# Here is the config tree that brian.ntelos.net points to.
dn: cn=DHCP Service Config, dc=ntelos, dc=net
cn: DHCP Service Config
objectClass: top
objectClass: dhcpService
dhcpPrimaryDN: dc=ntelos, dc=net
dhcpStatements: ddns-update-style none
dhcpStatements: default-lease-time 600
dhcpStatements: max-lease-time 7200
# Set up a shared network segment
dn: cn=WV Test, cn=DHCP Service Config, dc=ntelos, dc=net
cn: WV
objectClass: top
objectClass: dhcpSharedNetwork
# Set up a subnet declaration with a pool statement. Also note that we have
# a dhcpOptions object with this entry
dn: cn=10.100.0.0, cn=WV Test, cn=DHCP Service Config, dc=ntelos, dc=net
cn: 10.100.0.0
objectClass: top
objectClass: dhcpSubnet
objectClass: dhcpOptions
dhcpOption: domain-name-servers 10.100.0.2
dhcpOption: routers 10.100.0.1
dhcpOption: subnet-mask 255.255.255.0
dhcpOption: broadcast-address 10.100.0.255
dhcpNetMask: 24
# Set up a pool for this subnet. Only known hosts will get these IPs
dn: cn=Known Pool, cn=10.100.0.0, cn=WV Test, cn=DHCP Service Config, dc=ntelos, dc=net
cn: Known Pool
objectClass: top
objectClass: dhcpPool
dhcpRange: 10.100.0.3 10.100.0.254
dhcpPermitList: deny unknown-clients
# Set up another subnet declaration with a pool statement
dn: cn=10.200.0.0, cn=WV Test, cn=DHCP Service Config, dc=ntelos, dc=net
cn: 10.200.0.0
objectClass: top
objectClass: dhcpSubnet
objectClass: dhcpOptions
dhcpOption: domain-name-servers 10.200.0.2
dhcpOption: routers 10.200.0.1
dhcpOption: subnet-mask 255.255.255.0
dhcpOption: broadcast-address 10.200.0.255
dhcpNetMask: 24
# Set up a pool for this subnet. Only unknown hosts will get these IPs
dn: cn=Known Pool, cn=10.200.0.0, cn=WV Test, cn=DHCP Service Config, dc=ntelos, dc=net
cn: Known Pool
objectClass: top
objectClass: dhcpPool
dhcpRange: 10.200.0.3 10.200.0.254
dhcpPermitList: deny known clients
# Set aside a group for all of our known MAC addresses
dn: cn=Customers, cn=DHCP Service Config, dc=ntelos, dc=net
objectClass: top
objectClass: dhcpGroup
cn: Customers
# Host entry for my laptop
dn: cn=brianlaptop, cn=Customers, cn=DHCP Service Config, dc=ntelos, dc=net
objectClass: top
objectClass: dhcpHost
cn: brianlaptop
dhcpHWAddress: ethernet 00:00:00:00:00:00
You can use the command slapadd to load all of these entries into your LDAP
server. After you load this, you should be able to start up DHCP. If you run
into problems reading the configuration, try running dhcpd with the -d flag.
If you still have problems, edit the site.conf file in the DHCP source and
add the line: COPTS= -DDEBUG_LDAP and recompile DHCP. (make sure you run make
clean and rerun configure before you rebuild).

255
dhclient-script.8 Normal file
View File

@ -0,0 +1,255 @@
.\" dhclient-script.8
.\"
.\" Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC")
.\" Copyright (c) 1996-2003 by Internet Software Consortium
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
.\" OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.\" Internet Systems Consortium, Inc.
.\" 950 Charter Street
.\" Redwood City, CA 94063
.\" <info@isc.org>
.\" http://www.isc.org/
.\"
.\" This software has been written for Internet Systems Consortium
.\" by Ted Lemon in cooperation with Vixie Enterprises and Nominum, Inc.
.\" To learn more about Internet Systems Consortium, see
.\" ``http://www.isc.org/''. To learn more about Vixie Enterprises,
.\" see ``http://www.vix.com''. To learn more about Nominum, Inc., see
.\" ``http://www.nominum.com''.
.\"
.\" $Id: dhclient-script.8,v 1.1 2007/11/12 23:16:08 dcantrel Exp $
.\"
.TH dhclient-script 8
.SH NAME
dhclient-script - DHCP client network configuration script
.SH DESCRIPTION
The DHCP client network configuration script is invoked from time to
time by \fBdhclient(8)\fR. This script is used by the dhcp client to
set each interface's initial configuration prior to requesting an
address, to test the address once it has been offered, and to set the
interface's final configuration once a lease has been acquired. If no
lease is acquired, the script is used to test predefined leases, if
any, and also called once if no valid lease can be identified.
.PP
This script is not meant to be customized by the end user. If local
customizations are needed, they should be possible using the enter and
exit hooks provided (see HOOKS for details). These hooks will allow the
user to override the default behaviour of the client in creating a
.B /etc/resolv.conf
file, and to handle DHCP options not handled by default.
.PP
No standard client script exists for some operating systems, even though
the actual client may work, so a pioneering user may well need to create
a new script or modify an existing one. In general, customizations specific
to a particular computer should be done in the
.B ETCDIR/dhclient.conf
file. If you find that you can't make such a customization without
customizing
.B ETCDIR/dhclient.conf
or using the enter and exit hooks, please submit a bug report.
.SH HOOKS
When it starts, the client script first defines a shell function,
.B make_resolv_conf ,
which is later used to create the
.B /etc/resolv.conf
file. To override the default behaviour, redefine this function in
the enter hook script.
.PP
On after defining the make_resolv_conf function, the client script checks
for the presence of an executable
.B ETCDIR/dhclient-enter-hooks
script, and if present, it invokes the script inline, using the Bourne
shell '.' command. The entire environment documented under OPERATION
is available to this script, which may modify the environment if needed
to change the behaviour of the script. If an error occurs during the
execution of the script, it can set the exit_status variable to a nonzero
value, and
.B CLIENTBINDIR/dhclient-script
will exit with that error code immediately after the client script exits.
.PP
After all processing has completed,
.B CLIENTBINDIR/dhclient-script
checks for the presence of an executable
.B ETCDIR/dhclient-exit-hooks
script, which if present is invoked using the '.' command. The exit
status of dhclient-script will be passed to dhclient-exit-hooks in the
exit_status shell variable, and will always be zero if the script
succeeded at the task for which it was invoked. The rest of the
environment as described previously for dhclient-enter-hooks is also
present. The
.B ETCDIR/dhclient-exit-hooks
script can modify the valid of exit_status to change the exit status
of dhclient-script.
.PP
Immediately after dhclient brings an interface UP with a new IP address,
subnet mask, and routes, in the REBOOT/BOUND states, it will check for the
existence of an executable
.B ETCDIR/dhclient-up-hooks
script, and source it if found. This script can handle DHCP options in
the environment that are not handled by default. A per-interface.
.B ETCDIR/dhclient-${IF}-up-hooks
script will override the generic script and be sourced when interface
$IF has been brought up.
.PP
Immediately before dhclient brings an interface DOWN, removing its IP
address, subnet mask, and routes, in the STOP/RELEASE states, it will
check for the existence of an executable
.B ETCDIR/dhclient-down-hooks
script, and source it if found. This script can handle DHCP options in
the environment that are not handled by default. A per-interface
.B ETCDIR/dhclient-${IF}-down-hooks
script will override the generic script and be sourced when interface
$IF is about to be brought down.
.SH OPERATION
When dhclient needs to invoke the client configuration script, it
defines a set of variables in the environment, and then invokes
.B CLIENTBINDIR/dhclient-script.
In all cases, $reason is set to the name of the reason why the script
has been invoked. The following reasons are currently defined:
MEDIUM, PREINIT, BOUND, RENEW, REBIND, REBOOT, EXPIRE, FAIL, STOP, RELEASE,
NBI and TIMEOUT.
.PP
.SH MEDIUM
The DHCP client is requesting that an interface's media type
be set. The interface name is passed in $interface, and the media
type is passed in $medium.
.SH PREINIT
The DHCP client is requesting that an interface be configured as
required in order to send packets prior to receiving an actual
address. For clients which use the BSD socket library, this means
configuring the interface with an IP address of 0.0.0.0 and a
broadcast address of 255.255.255.255. For other clients, it may be
possible to simply configure the interface up without actually giving
it an IP address at all. The interface name is passed in $interface,
and the media type in $medium.
.PP
If an IP alias has been declared in dhclient.conf, its address will be
passed in $alias_ip_address, and that ip alias should be deleted from
the interface, along with any routes to it.
.SH BOUND
The DHCP client has done an initial binding to a new address. The
new ip address is passed in $new_ip_address, and the interface name is
passed in $interface. The media type is passed in $medium. Any
options acquired from the server are passed using the option name
described in \fBdhcp-options\fR, except that dashes ('-') are replaced
by underscores ('_') in order to make valid shell variables, and the
variable names start with new_. So for example, the new subnet mask
would be passed in $new_subnet_mask.
.PP
Before actually configuring the address, dhclient-script should
somehow ARP for it and exit with a nonzero status if it receives a
reply. In this case, the client will send a DHCPDECLINE message to
the server and acquire a different address. This may also be done in
the RENEW, REBIND, or REBOOT states, but is not required, and indeed
may not be desirable.
.PP
When a binding has been completed, a lot of network parameters are
likely to need to be set up. A new /etc/resolv.conf needs to be
created, using the values of $new_domain_name and
$new_domain_name_servers (which may list more than one server,
separated by spaces). A default route should be set using
$new_routers, and static routes may need to be set up using
$new_static_routes.
.PP
If an IP alias has been declared, it must be set up here. The alias
IP address will be written as $alias_ip_address, and other DHCP
options that are set for the alias (e.g., subnet mask) will be passed
in variables named as described previously except starting with
$alias_ instead of $new_. Care should be taken that the alias IP
address not be used if it is identical to the bound IP address
($new_ip_address), since the other alias parameters may be incorrect
in this case.
.SH RENEW
When a binding has been renewed, the script is called as in BOUND,
except that in addition to all the variables starting with $new_,
there is another set of variables starting with $old_. Persistent
settings that may have changed need to be deleted - for example, if a
local route to the bound address is being configured, the old local
route should be deleted. If the default route has changed, the old default
route should be deleted. If the static routes have changed, the old
ones should be deleted. Otherwise, processing can be done as with
BOUND.
.SH REBIND
The DHCP client has rebound to a new DHCP server. This can be handled
as with RENEW, except that if the IP address has changed, the ARP
table should be cleared.
.SH REBOOT
The DHCP client has successfully reacquired its old address after a
reboot. This can be processed as with BOUND.
.SH EXPIRE
The DHCP client has failed to renew its lease or acquire a new one,
and the lease has expired. The IP address must be relinquished, and
all related parameters should be deleted, as in RENEW and REBIND.
.SH FAIL
The DHCP client has been unable to contact any DHCP servers, and any
leases that have been tested have not proved to be valid. The
parameters from the last lease tested should be deconfigured. This
can be handled in the same way as EXPIRE.
.SH STOP
The dhclient has been informed to shut down gracefully, the
dhclient-script should unconfigure or shutdown the interface as
appropriate.
.SH RELEASE
The dhclient has been executed using the -r flag, indicating that the
administrator wishes it to release its lease(s). dhclient-script should
unconfigure or shutdown the interface.
.SH NBI
No-Broadcast-Interfaces...dhclient was unable to find any interfaces
upon which it believed it should commence DHCP. What dhclient-script
should do in this situation is entirely up to the implementor.
.SH TIMEOUT
The DHCP client has been unable to contact any DHCP servers.
However, an old lease has been identified, and its parameters have
been passed in as with BOUND. The client configuration script should
test these parameters and, if it has reason to believe they are valid,
should exit with a value of zero. If not, it should exit with a
nonzero value.
.PP
The usual way to test a lease is to set up the network as with REBIND
(since this may be called to test more than one lease) and then ping
the first router defined in $routers. If a response is received, the
lease must be valid for the network to which the interface is
currently connected. It would be more complete to try to ping all of
the routers listed in $new_routers, as well as those listed in
$new_static_routes, but current scripts do not do this.
.SH FILES
Each operating system should generally have its own script file,
although the script files for similar operating systems may be similar
or even identical. The script files included in Internet
Systems Consortium DHCP distribution appear in the distribution tree
under client/scripts, and bear the names of the operating systems on
which they are intended to work.
.SH BUGS
If more than one interface is being used, there's no obvious way to
avoid clashes between server-supplied configuration parameters - for
example, the stock dhclient-script rewrites /etc/resolv.conf. If
more than one interface is being configured, /etc/resolv.conf will be
repeatedly initialized to the values provided by one server, and then
the other. Assuming the information provided by both servers is
valid, this shouldn't cause any real problems, but it could be
confusing.
.SH SEE ALSO
dhclient(8), dhcpd(8), dhcrelay(8), dhclient.conf(5) and
dhclient.leases(5).
.SH AUTHOR
.B dhclient-script(8)
has been written for Internet Systems Consortium
by Ted Lemon in cooperation with Vixie
Enterprises. To learn more about Internet Systems Consortium,
see
.B http://www.isc.org.
To learn more about Vixie
Enterprises, see
.B http://www.vix.com.

428
dhclient.8 Normal file
View File

@ -0,0 +1,428 @@
.\" dhclient.8
.\"
.\" Copyright (c) 2004,2007 by Internet Systems Consortium, Inc. ("ISC")
.\" Copyright (c) 1996-2003 by Internet Software Consortium
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
.\" OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.\" Internet Systems Consortium, Inc.
.\" 950 Charter Street
.\" Redwood City, CA 94063
.\" <info@isc.org>
.\" http://www.isc.org/
.\"
.\" Support and other services are available for ISC products - see
.\" http://www.isc.org for more information.
.\"
.\" $Id: dhclient.8,v 1.1 2007/11/12 23:16:08 dcantrel Exp $
.\"
.TH dhclient 8
.SH NAME
dhclient - Dynamic Host Configuration Protocol Client
.SH SYNOPSIS
.B dhclient
[
.B -p
.I port
]
[
.B -d
]
[
.B -e
.I VAR=value
]
[
.B -q
]
[
.B -1
]
[
.B -r
]
[
.B -x
]
[
.B -lf
.I lease-file
]
[
.B -pf
.I pid-file
]
[
.B -cf
.I config-file
]
[
.B -sf
.I script-file
]
[
.B -s
server
]
[
.B -g
relay
]
[
.B -n
]
[
.B -nw
]
[
.B -w
]
[
.B -B
]
[
.B -I
.I dhcp-client-identifier
]
[
.B -H
.I host-name
.R |
.B -F fqdn.fqdn
]
[
.B -V
.I vendor-class-identifier
]
[
.B -R
.I request option list
]
[
.B -T
.I timeout
]
[
.I if0
[
.I ...ifN
]
]
.SH DESCRIPTION
The Internet Systems Consortium DHCP Client, dhclient, provides a
means for configuring one or more network interfaces using the Dynamic
Host Configuration Protocol, BOOTP protocol, or if these protocols
fail, by statically assigning an address.
.SH OPERATION
.PP
The DHCP protocol allows a host to contact a central server which
maintains a list of IP addresses which may be assigned on one or more
subnets. A DHCP client may request an address from this pool, and
then use it on a temporary basis for communication on network. The
DHCP protocol also provides a mechanism whereby a client can learn
important details about the network to which it is attached, such as
the location of a default router, the location of a name server, and
so on.
.PP
On startup, dhclient reads the
.IR dhclient.conf
for configuration instructions. It then gets a list of all the
network interfaces that are configured in the current system. For
each interface, it attempts to configure the interface using the DHCP
protocol.
.PP
In order to keep track of leases across system reboots and server
restarts, dhclient keeps a list of leases it has been assigned in the
dhclient.leases(5) file. On startup, after reading the dhclient.conf
file, dhclient reads the dhclient.leases file to refresh its memory
about what leases it has been assigned.
.PP
When a new lease is acquired, it is appended to the end of the
dhclient.leases file. In order to prevent the file from becoming
arbitrarily large, from time to time dhclient creates a new
dhclient.leases file from its in-core lease database. The old version
of the dhclient.leases file is retained under the name
.IR dhclient.leases~
until the next time dhclient rewrites the database.
.PP
Old leases are kept around in case the DHCP server is unavailable when
dhclient is first invoked (generally during the initial system boot
process). In that event, old leases from the dhclient.leases file
which have not yet expired are tested, and if they are determined to
be valid, they are used until either they expire or the DHCP server
becomes available.
.PP
A mobile host which may sometimes need to access a network on which no
DHCP server exists may be preloaded with a lease for a fixed
address on that network. When all attempts to contact a DHCP server
have failed, dhclient will try to validate the static lease, and if it
succeeds, will use that lease until it is restarted.
.PP
A mobile host may also travel to some networks on which DHCP is not
available but BOOTP is. In that case, it may be advantageous to
arrange with the network administrator for an entry on the BOOTP
database, so that the host can boot quickly on that network rather
than cycling through the list of old leases.
.PP
The names of the network interfaces that dhclient should attempt to
configure may be specified on the command line. If no interface names
are specified on the command line dhclient will normally identify all
network interfaces, eliminating non-broadcast interfaces if
possible, and attempt to configure each interface.
.PP
It is also possible to specify interfaces by name in the
.B dhclient.conf(5)
file. If interfaces are specified in this way, then the client will
only configure interfaces that are either specified in the
configuration file or on the command line, and will ignore all other
interfaces.
.SH OPTIONS
.TP
.BI \-p\ <port\ number>
The UDP port number the DHCP client should listen and transmit on. If
unspecified,
.B dhclient
uses the default port 68. This option is mostly useful for debugging
purposes. If a different port is specified for the client to listen and
transmit on, the client will also use a different destination port - one
greater than the specified destination port.
.TP
.BI \-d
Force
.B dhclient
to run as a foreground process. This is useful when running the client
under a debugger, or when running it out of inittab on System V systems.
.TP
.BI \-e\ VAR=value
Define additional environment variables for the environment where
dhclient-script executes. You may specify multiple
.B \-e
options on the command line.
.TP
.BI \-q
Suppress all terminal and log output except error messages.
.TP
.BI \-1
Try one to get a lease. On failure, exit with code 2.
.TP
.BI \-r
Tell
.B dhclient
to release the current lease it has from the server. This is not required
by the DHCP protocol, but some ISPs require their clients to notify the
server if they wish to release an assigned IP address.
.TP
.BI \-lf\ <lease-file>
Path to the lease database file. If unspecified, the default
.B DBDIR/dhclient.leases
is used.
.TP
.BI \-pf\ <pid-file>
Path to the process ID file. If unspecified, the default
.B RUNDIR/dhclient.pid
is used.
.TP
.BI \-cf\ <config-file>
Path to the client configuration file. If unspecified, the default
.B ETCDIR/dhclient.conf
is used.
.TP
.BI \-sf\ <script-file>
Path to the network configuration script invoked by
.B dhclient
when it gets a lease. If unspecified, the default
.B CLIENTBINDIR/dhclient-script
is used.
.TP
.BI \-s\ <server>
Specifiy the server IP address or fully qualified domain name to transmit
DHCP protocol messages to. Normally,
.B dhclient
transmits these messages to 255.255.255.255 (the IP limited broadcast
address). Overriding this is mostly useful for debugging purposes.
.TP
.BI \-g\ <relay>
Only for debugging. Set the giaddr field of all packets the client
sends to the IP address specified. This should not be expected to work
in any consistent or useful way.
.TP
.BI \-n
Do not configure any interfaces. Most useful combined with the
.B -w
option.
.TP
.BI \-nw
Become a daemon process immediately (nowait) rather than waiting until an IP
address has been acquired.
.TP
.BI \-w
Keep running even if no network interfaces are found. The
.B omshell
program can be used to notify the client when a network interface has been
added or removed so it can attempt to configure an IP address on that
interface.
.TP
.BI \-B
Set the BOOTP broadcast flag in request packets so servers will always
broadcast replies.
.TP
.BI \-I\ <dhcp-client-identifier>
Specify the dhcp-client-identifier option to send to the DHCP server.
.TP
.BI \-H\ <host-name>
Specify the host-name option to send to the DHCP server. The host-name
string only contains the client's hostname prefix, to which the server will
append the ddns-domainname or domain-name options, if any, to derive the
fully qualified domain name of the client. The
.B -H
option cannot be used with the
.B -F
option.
.TP
.BI \-F\ <fqdn.fqdn>
Specify the fqdn.fqdn option to send to the DHCP server. This option cannot
be used with the
.B -H
option. The fqdn.fqdn option must specify the complete domain name of the
client host, which the server may use for dynamic DNS updates.
.TP
.BI \-V\ <vendor-class-identifier>
Specify the vendor-class-identifier option to send to the DHCP server.
.TP
.BI \-R\ <option>[,<option>...]
Specify the list of options the client is to request from the server. The
option list must be a single string consisting of option names separated
by at least one command and optional space characters. The default option
list is:
.BR
subnet-mask, broadcast-address, time-offset, routers,
.BR
domain-name, domain-name-servers, host-name, nis-domain,
.BR
nis-servers, ntp-servers
The
.B -R
option does not append options to the default request, it overrides the
default request list. Keep this in mind if you want to request an
additional option besides the default request list. You will have to
specify all option names for the
.B -R
parameter.
.TP
.BI \-T\ <timeout>
Specify the time after which
.B dhclient
will decide that no DHCP servers can be contacted when no responses have been
received.
.PP
If the client is killed by a signal (for example at shutdown or reboot)
it won't execute the
.B dhclient-script (8)
at exit. However if you shut the client down gracefully with
.B -r
or
.B -x
it will execute
.B dhclient-script (8)
at shutdown with the specific reason for calling the script set.
.PP
.SH CONFIGURATION
The syntax of the dhclient.conf(5) file is discussed separately.
.SH OMAPI
The DHCP client provides some ability to control it while it is
running, without stopping it. This capability is provided using OMAPI,
an API for manipulating remote objects. OMAPI clients connect to the
client using TCP/IP, authenticate, and can then examine the client's
current status and make changes to it.
.PP
Rather than implementing the underlying OMAPI protocol directly, user
programs should use the dhcpctl API or OMAPI itself. Dhcpctl is a
wrapper that handles some of the housekeeping chores that OMAPI does
not do automatically. Dhcpctl and OMAPI are documented in \fBdhcpctl(3)\fR
and \fBomapi(3)\fR. Most things you'd want to do with the client can
be done directly using the \fBomshell(1)\fR command, rather than
having to write a special program.
.SH THE CONTROL OBJECT
The control object allows you to shut the client down, releasing all
leases that it holds and deleting any DNS records it may have added.
It also allows you to pause the client - this unconfigures any
interfaces the client is using. You can then restart it, which
causes it to reconfigure those interfaces. You would normally pause
the client prior to going into hibernation or sleep on a laptop
computer. You would then resume it after the power comes back.
This allows PC cards to be shut down while the computer is hibernating
or sleeping, and then reinitialized to their previous state once the
computer comes out of hibernation or sleep.
.PP
The control object has one attribute - the state attribute. To shut
the client down, set its state attribute to 2. It will automatically
do a DHCPRELEASE. To pause it, set its state attribute to 3. To
resume it, set its state attribute to 4.
.PP
.SH FILES
.B CLIENTBINDIR/dhclient-script,
.B ETCDIR/dhclient.conf, DBDIR/dhclient.leases, RUNDIR/dhclient.pid,
.B DBDIR/dhclient.leases~.
.SH SEE ALSO
dhcpd(8), dhcrelay(8), dhclient-script(8), dhclient.conf(5),
dhclient.leases(5), dhcp-eval(5).
.SH AUTHOR
.B dhclient(8)
has been written for Internet Systems Consortium
by Ted Lemon in cooperation with Vixie
Enterprises. To learn more about Internet Systems Consortium,
see
.B http://www.isc.org
To learn more about Vixie
Enterprises, see
.B http://www.vix.com.
.PP
This client was substantially modified and enhanced by Elliot Poger
for use on Linux while he was working on the MosquitoNet project at
Stanford.
.PP
The current version owes much to Elliot's Linux enhancements, but
was substantially reorganized and partially rewritten by Ted Lemon
so as to use the same networking framework that the Internet Systems
Consortium DHCP server uses. Much system-specific configuration code
was moved into a shell script so that as support for more operating
systems is added, it will not be necessary to port and maintain
system-specific configuration code to these operating systems - instead,
the shell script can invoke the native tools to accomplish the same
purpose.
.PP

660
dhclient.conf.5 Normal file
View File

@ -0,0 +1,660 @@
.\" $Id: dhclient.conf.5,v 1.1 2007/11/12 23:16:08 dcantrel Exp $
.\"
.\" Copyright (c) 2004,2007 by Internet Systems Consortium, Inc. ("ISC")
.\" Copyright (c) 1996-2003 by Internet Software Consortium
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
.\" OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.\" Internet Systems Consortium, Inc.
.\" 950 Charter Street
.\" Redwood City, CA 94063
.\" <info@isc.org>
.\" http://www.isc.org/
.\"
.\" This software has been written for Internet Software Consortium
.\" by Ted Lemon in cooperation with Vixie Enterprises and Nominum, Inc.
.\" To learn more about Internet Software Consortium, see
.\" ``http://www.isc.org/''. To learn more about Vixie Enterprises,
.\" see ``http://www.vix.com''. To learn more about Nominum, Inc., see
.\" ``http://www.nominum.com''.
.\"
.\" $Id: dhclient.conf.5,v 1.1 2007/11/12 23:16:08 dcantrel Exp $
.\"
.TH dhclient.conf 5
.SH NAME
dhclient.conf - DHCP client configuration file
.SH DESCRIPTION
The dhclient.conf file contains configuration information for
.IR dhclient,
the Internet Systems Consortium DHCP Client.
.PP
The dhclient.conf file is a free-form ASCII text file. It is parsed by
the recursive-descent parser built into dhclient. The file may contain
extra tabs and newlines for formatting purposes. Keywords in the file
are case-insensitive. Comments may be placed anywhere within the
file (except within quotes). Comments begin with the # character and
end at the end of the line.
.PP
The dhclient.conf file can be used to configure the behaviour of the
client in a wide variety of ways: protocol timing, information
requested from the server, information required of the server,
defaults to use if the server does not provide certain information,
values with which to override information provided by the server, or
values to prepend or append to information provided by the server.
The configuration file can also be preinitialized with addresses to
use on networks that don't have DHCP servers.
.SH PROTOCOL TIMING
The timing behaviour of the client need not be configured by the user.
If no timing configuration is provided by the user, a fairly
reasonable timing behaviour will be used by default - one which
results in fairly timely updates without placing an inordinate load on
the server.
.PP
The following statements can be used to adjust the timing behaviour of
the DHCP client if required, however:
.PP
.I The
.B timeout
.I statement
.PP
.B timeout
.I time
.B ;
.PP
The
.I timeout
statement determines the amount of time that must pass between the
time that the client begins to try to determine its address and the
time that it decides that it's not going to be able to contact a
server. By default, this timeout is sixty seconds. After the
timeout has passed, if there are any static leases defined in the
configuration file, or any leases remaining in the lease database that
have not yet expired, the client will loop through these leases
attempting to validate them, and if it finds one that appears to be
valid, it will use that lease's address. If there are no valid
static leases or unexpired leases in the lease database, the client
will restart the protocol after the defined retry interval.
.PP
.I The
.B retry
.I statement
.PP
\fBretry \fItime\fR\fB;\fR
.PP
The
.I retry
statement determines the time that must pass after the client has
determined that there is no DHCP server present before it tries again
to contact a DHCP server. By default, this is five minutes.
.PP
.I The
.B select-timeout
.I statement
.PP
\fBselect-timeout \fItime\fR\fB;\fR
.PP
It is possible (some might say desirable) for there to be more than
one DHCP server serving any given network. In this case, it is
possible that a client may be sent more than one offer in response to
its initial lease discovery message. It may be that one of these
offers is preferable to the other (e.g., one offer may have the
address the client previously used, and the other may not).
.PP
The
.I select-timeout
is the time after the client sends its first lease discovery request
at which it stops waiting for offers from servers, assuming that it
has received at least one such offer. If no offers have been
received by the time the
.I select-timeout
has expired, the client will accept the first offer that arrives.
.PP
By default, the select-timeout is zero seconds - that is, the client
will take the first offer it sees.
.PP
.I The
.B reboot
.I statement
.PP
\fBreboot \fItime\fR\fB;\fR
.PP
When the client is restarted, it first tries to reacquire the last
address it had. This is called the INIT-REBOOT state. If it is
still attached to the same network it was attached to when it last
ran, this is the quickest way to get started. The
.I reboot
statement sets the time that must elapse after the client first tries
to reacquire its old address before it gives up and tries to discover
a new address. By default, the reboot timeout is ten seconds.
.PP
.I The
.B backoff-cutoff
.I statement
.PP
\fBbackoff-cutoff \fItime\fR\fB;\fR
.PP
The client uses an exponential backoff algorithm with some randomness,
so that if many clients try to configure themselves at the same time,
they will not make their requests in lockstep. The
.I backoff-cutoff
statement determines the maximum amount of time that the client is
allowed to back off, the actual value will be evaluated randomly between
1/2 to 1 1/2 times the \fItime\fR specified. It defaults to two minutes.
.PP
.I The
.B initial-interval
.I statement
.PP
\fBinitial-interval \fItime\fR\fB;\fR
.PP
The
.I initial-interval
statement sets the amount of time between the first attempt to reach a
server and the second attempt to reach a server. Each time a message
is sent, the interval between messages is incremented by twice the
current interval multiplied by a random number between zero and one.
If it is greater than the backoff-cutoff amount, it is set to that
amount. It defaults to ten seconds.
.SH LEASE REQUIREMENTS AND REQUESTS
The DHCP protocol allows the client to request that the server send it
specific information, and not send it other information that it is not
prepared to accept. The protocol also allows the client to reject
offers from servers if they don't contain information the client
needs, or if the information provided is not satisfactory.
.PP
There is a variety of data contained in offers that DHCP servers send
to DHCP clients. The data that can be specifically requested is what
are called \fIDHCP Options\fR. DHCP Options are defined in
\fBdhcp-options(5)\fR.
.PP
.I The
.B request
.I statement
.PP
\fBrequest [ \fIoption\fR ] [\fB,\fI ... \fIoption\fR ]\fB;\fR
.PP
The request statement causes the client to request that any server
responding to the client send the client its values for the specified
options. Only the option names should be specified in the request
statement - not option parameters. By default, the DHCP server
requests the subnet-mask, broadcast-address, time-offset, routers,
domain-name, domain-name-servers, host-name, nis-domain, nis-servers,
and ntp-servers options.
.PP
In some cases, it may be desirable to send no parameter request list
at all. To do this, simply write the request statement but specify
no parameters:
.PP
.nf
request;
.fi
.PP
.I The
.B require
.I statement
.PP
\fBrequire [ \fIoption\fR ] [\fB,\fI ... \fIoption ]\fB;\fR
.PP
The require statement lists options that must be sent in order for an
offer to be accepted. Offers that do not contain all the listed
options will be ignored.
.PP
.I The
.B send
.I statement
.PP
\fBsend { [ \fIoption declaration\fR ]
[\fB,\fI ... \fIoption declaration\fR ]\fB}\fR
.PP
The send statement causes the client to send the specified options to
the server with the specified values. These are full option
declarations as described in \fBdhcp-options(5)\fR. Options that are
always sent in the DHCP protocol should not be specified here, except
that the client can specify a \fBrequested-lease-time\fR option other
than the default requested lease time, which is two hours. The other
obvious use for this statement is to send information to the server
that will allow it to differentiate between this client and other
clients or kinds of clients.
.SH DYNAMIC DNS
The client now has some very limited support for doing DNS updates
when a lease is acquired. This is prototypical, and probably doesn't
do what you want. It also only works if you happen to have control
over your DNS server, which isn't very likely.
.PP
To make it work, you have to declare a key and zone as in the DHCP
server (see \fBdhcpd.conf\fR(5) for details). You also need to
configure the fqdn option on the client, as follows:
.PP
.nf
send fqdn.fqdn "grosse.fugue.com.";
send fqdn.encoded on;
send fqdn.server-update off;
.fi
.PP
The \fIfqdn.fqdn\fR option \fBMUST\fR be a fully-qualified domain
name. You \fBMUST\fR define a zone statement for the zone to be
updated. The \fIfqdn.encoded\fR option may need to be set to
\fIon\fR or \fIoff\fR, depending on the DHCP server you are using.
.PP
.I The
.B do-forward-updates
.I statement
.PP
\fBdo-forward-updates [ \fIflag\fR ] \fB;\fR
.PP
If you want to do DNS updates in the DHCP client
script (see \fBdhclient-script(8)\fR) rather than having the
DHCP client do the update directly (for example, if you want to
use SIG(0) authentication, which is not supported directly by the
DHCP client, you can instruct the client not to do the update using
the \fBdo-forward-updates\fR statement. \fIFlag\fR should be \fBtrue\fR
if you want the DHCP client to do the update, and \fBfalse\fR if
you don't want the DHCP client to do the update. By default, the DHCP
client will do the DNS update.
.SH OPTION MODIFIERS
In some cases, a client may receive option data from the server which
is not really appropriate for that client, or may not receive
information that it needs, and for which a useful default value
exists. It may also receive information which is useful, but which
needs to be supplemented with local information. To handle these
needs, several option modifiers are available.
.PP
.I The
.B default
.I statement
.PP
\fBdefault [ \fIoption declaration\fR ] \fB;\fR
.PP
If for some option the client should use the value supplied by
the server, but needs to use some default value if no value was supplied
by the server, these values can be defined in the
.B default
statement.
.PP
.I The
.B supersede
.I statement
.PP
\fBsupersede [ \fIoption declaration\fR ] \fB;\fR
.PP
If for some option the client should always use a locally-configured
value or values rather than whatever is supplied by the server, these
values can be defined in the
.B supersede
statement.
.PP
.I The
.B prepend
.I statement
.PP
\fBprepend [ \fIoption declaration\fR ] \fB;\fR
.PP
If for some set of options the client should use a value you
supply, and then use the values supplied by
the server, if any, these values can be defined in the
.B prepend
statement. The
.B prepend
statement can only be used for options which
allow more than one value to be given. This restriction is not
enforced - if you ignore it, the behaviour will be unpredictable.
.PP
.I The
.B append
.I statement
.PP
\fBappend [ \fIoption declaration\fR ] \fB;\fR
.PP
If for some set of options the client should first use the values
supplied by the server, if any, and then use values you supply, these
values can be defined in the
.B append
statement. The
.B append
statement can only be used for options which
allow more than one value to be given. This restriction is not
enforced - if you ignore it, the behaviour will be unpredictable.
.SH LEASE DECLARATIONS
.PP
.I The
.B lease
.I declaration
.PP
\fBlease {\fR \fIlease-declaration\fR [ ... \fIlease-declaration ] \fB}\fR
.PP
The DHCP client may decide after some period of time (see \fBPROTOCOL
TIMING\fR) that it is not going to succeed in contacting a
server. At that time, it consults its own database of old leases and
tests each one that has not yet timed out by pinging the listed router
for that lease to see if that lease could work. It is possible to
define one or more \fIfixed\fR leases in the client configuration file
for networks where there is no DHCP or BOOTP service, so that the
client can still automatically configure its address. This is done
with the
.B lease
statement.
.PP
NOTE: the lease statement is also used in the dhclient.leases file in
order to record leases that have been received from DHCP servers.
Some of the syntax for leases as described below is only needed in the
dhclient.leases file. Such syntax is documented here for
completeness.
.PP
A lease statement consists of the lease keyword, followed by a left
curly brace, followed by one or more lease declaration statements,
followed by a right curly brace. The following lease declarations
are possible:
.PP
\fBbootp;\fR
.PP
The
.B bootp
statement is used to indicate that the lease was acquired using the
BOOTP protocol rather than the DHCP protocol. It is never necessary
to specify this in the client configuration file. The client uses
this syntax in its lease database file.
.PP
\fBinterface\fR \fB"\fR\fIstring\fR\fB";\fR
.PP
The
.B interface
lease statement is used to indicate the interface on which the lease
is valid. If set, this lease will only be tried on a particular
interface. When the client receives a lease from a server, it always
records the interface number on which it received that lease.
If predefined leases are specified in the dhclient.conf file, the
interface should also be specified, although this is not required.
.PP
\fBfixed-address\fR \fIip-address\fR\fB;\fR
.PP
The
.B fixed-address
statement is used to set the ip address of a particular lease. This
is required for all lease statements. The IP address must be
specified as a dotted quad (e.g., 12.34.56.78).
.PP
\fBfilename "\fR\fIstring\fR\fB";\fR
.PP
The
.B filename
statement specifies the name of the boot filename to use. This is
not used by the standard client configuration script, but is included
for completeness.
.PP
\fBserver-name "\fR\fIstring\fR\fB";\fR
.PP
The
.B server-name
statement specifies the name of the boot server name to use. This is
also not used by the standard client configuration script.
.PP
\fBoption\fR \fIoption-declaration\fR\fB;\fR
.PP
The
.B option
statement is used to specify the value of an option supplied by the
server, or, in the case of predefined leases declared in
dhclient.conf, the value that the user wishes the client configuration
script to use if the predefined lease is used.
.PP
\fBscript "\fIscript-name\fB";\fR
.PP
The
.B script
statement is used to specify the pathname of the dhcp client
configuration script. This script is used by the dhcp client to set
each interface's initial configuration prior to requesting an address,
to test the address once it has been offered, and to set the
interface's final configuration once a lease has been acquired. If
no lease is acquired, the script is used to test predefined leases, if
any, and also called once if no valid lease can be identified. For
more information, see
.B dhclient-script(8).
.PP
\fBvendor option space "\fIname\fB";\fR
.PP
The
.B vendor option space
statement is used to specify which option space should be used for
decoding the vendor-encapsulate-options option if one is received.
The \fIdhcp-vendor-identifier\fR can be used to request a specific
class of vendor options from the server. See
.B dhcp-options(5)
for details.
.PP
\fBmedium "\fImedia setup\fB";\fR
.PP
The
.B medium
statement can be used on systems where network interfaces cannot
automatically determine the type of network to which they are
connected. The media setup string is a system-dependent parameter
which is passed to the dhcp client configuration script when
initializing the interface. On Unix and Unix-like systems, the
argument is passed on the ifconfig command line when configuring the
interface.
.PP
The dhcp client automatically declares this parameter if it uses a
media type (see the
.B media
statement) when configuring the interface in order to obtain a lease.
This statement should be used in predefined leases only if the network
interface requires media type configuration.
.PP
\fBrenew\fR \fIdate\fB;\fR
.PP
\fBrebind\fR \fIdate\fB;\fR
.PP
\fBexpire\fR \fIdate\fB;\fR
.PP
The \fBrenew\fR statement defines the time at which the dhcp client
should begin trying to contact its server to renew a lease that it is
using. The \fBrebind\fR statement defines the time at which the dhcp
client should begin to try to contact \fIany\fR dhcp server in order
to renew its lease. The \fBexpire\fR statement defines the time at
which the dhcp client must stop using a lease if it has not been able
to contact a server in order to renew it.
.PP
These declarations are automatically set in leases acquired by the
DHCP client, but must also be configured in predefined leases - a
predefined lease whose expiry time has passed will not be used by the
DHCP client.
.PP
Dates are specified as follows:
.PP
\fI<weekday> <year>\fB/\fI<month>\fB/\fI<day>
<hour>\fB:\fI<minute>\fB:\fI<second>\fR
.PP
The weekday is present to make it easy for a human to tell when a
lease expires - it's specified as a number from zero to six, with zero
being Sunday. When declaring a predefined lease, it can always be
specified as zero. The year is specified with the century, so it
should generally be four digits except for really long leases. The
month is specified as a number starting with 1 for January. The day
of the month is likewise specified starting with 1. The hour is a
number between 0 and 23, the minute a number between 0 and 59, and the
second also a number between 0 and 59.
.SH ALIAS DECLARATIONS
\fBalias { \fI declarations ... \fB}\fR
.PP
Some DHCP clients running TCP/IP roaming protocols may require that in
addition to the lease they may acquire via DHCP, their interface also
be configured with a predefined IP alias so that they can have a
permanent IP address even while roaming. The Internet Systems
Consortium DHCP client doesn't support roaming with fixed addresses
directly, but in order to facilitate such experimentation, the dhcp
client can be set up to configure an IP alias using the
.B alias
declaration.
.PP
The alias declaration resembles a lease declaration, except that
options other than the subnet-mask option are ignored by the standard
client configuration script, and expiry times are ignored. A typical
alias declaration includes an interface declaration, a fixed-address
declaration for the IP alias address, and a subnet-mask option
declaration. A medium statement should never be included in an alias
declaration.
.SH OTHER DECLARATIONS
\fBreject \fIcidr-ip-address\fR [\fB,\fR \fI...\fB \fIcidr-ip-address\fR ] \fB;\fR
.PP
The
.B reject
statement causes the DHCP client to reject offers from
servers whose server identifier matches any of the specified hosts or
subnets. This can be used to avoid being configured by rogue or
misconfigured dhcp servers, although it should be a last resort -
better to track down the bad DHCP server and fix it.
.PP
The \fIcidr-ip-address\fR configuration type is of the
form \fIip-address\fR[\fB/\fIprefixlen\fR], where \fIip-address\fR is a
dotted quad IP address, and \fRprefixlen\fR is the CIDR prefix length of
the subnet, counting the number of significant bits in the netmask starting
from the leftmost end. Example configuration syntax:
.PP
\fIreject\fR 192.168.0.0\fB/\fR16\fB,\fR 10.0.0.5\fB;\fR
.PP
The above example would cause offers from any server identifier in the
entire RFC 1918 "Class C" network 192.168.0.0/16, or the specific
single address 10.0.0.5, to be rejected.
.PP
\fBinterface "\fIname\fB" { \fIdeclarations ... \fB }
.PP
A client with more than one network interface may require different
behaviour depending on which interface is being configured. All
timing parameters and declarations other than lease and alias
declarations can be enclosed in an interface declaration, and those
parameters will then be used only for the interface that matches the
specified name. Interfaces for which there is no interface
declaration will use the parameters declared outside of any interface
declaration, or the default settings.
.PP
.B Note well:
ISC dhclient only maintains one list of interfaces, which is either
determined at startup from command line arguments, or otherwise is
autodetected. If you supplied the list of interfaces on the command
line, this configuration clause will add the named interface to the
list in such a way that will cause it to be configured by DHCP. Which
may not be the result you had intended. This is an undesirable side
effect that will be addressed in a future release.
.PP
\fBpseudo "\fIname\fR" "\fIreal-name\fB" { \fIdeclarations ... \fB }
.PP
Under some circumstances it can be useful to declare a pseudo-interface
and have the DHCP client acquire a configuration for that interface.
Each interface that the DHCP client is supporting normally has a DHCP
client state machine running on it to acquire and maintain its lease.
A pseudo-interface is just another state machine running on the
interface named \fIreal-name\fR, with its own lease and its own
state. If you use this feature, you must provide a client identifier
for both the pseudo-interface and the actual interface, and the two
identifiers must be different. You must also provide a separate
client script for the pseudo-interface to do what you want with the IP
address. For example:
.PP
.nf
interface "ep0" {
send dhcp-client-identifier "my-client-ep0";
}
pseudo "secondary" "ep0" {
send dhcp-client-identifier "my-client-ep0-secondary";
script "/etc/dhclient-secondary";
}
.fi
.PP
The client script for the pseudo-interface should not configure the
interface up or down - essentially, all it needs to handle are the
states where a lease has been acquired or renewed, and the states
where a lease has expired. See \fBdhclient-script(8)\fR for more
information.
.PP
\fBmedia "\fImedia setup\fB"\fI [ \fB, "\fImedia setup\fB", \fI... ]\fB;\fR
.PP
The
.B media
statement defines one or more media configuration parameters which may
be tried while attempting to acquire an IP address. The dhcp client
will cycle through each media setup string on the list, configuring
the interface using that setup and attempting to boot, and then trying
the next one. This can be used for network interfaces which aren't
capable of sensing the media type unaided - whichever media type
succeeds in getting a request to the server and hearing the reply is
probably right (no guarantees).
.PP
The media setup is only used for the initial phase of address
acquisition (the DHCPDISCOVER and DHCPOFFER packets). Once an
address has been acquired, the dhcp client will record it in its lease
database and will record the media type used to acquire the address.
Whenever the client tries to renew the lease, it will use that same
media type. The lease must expire before the client will go back to
cycling through media types.
.PP
\fBbootp-broadcast-always;\fR
.PP
The
.B bootp-broadcast-always
statement instructs dhclient to always set the bootp broadcast flag in
request packets, so that servers will always broadcast replies.
This is equivalent to supplying the dhclient -B argument, and has
the same effect as specifying 'always-broadcast' in the server's dhcpd.conf.
This option is provided as an extension to enable dhclient to work
on IBM s390 Linux guests.
.PP
.SH SAMPLE
The following configuration file is used on a laptop running NetBSD
1.3. The laptop has an IP alias of 192.5.5.213, and has one
interface, ep0 (a 3com 3C589C). Booting intervals have been
shortened somewhat from the default, because the client is known to
spend most of its time on networks with little DHCP activity. The
laptop does roam to multiple networks.
.nf
timeout 60;
retry 60;
reboot 10;
select-timeout 5;
initial-interval 2;
reject 192.33.137.209;
interface "ep0" {
send host-name "andare.fugue.com";
send dhcp-client-identifier 1:0:a0:24:ab:fb:9c;
send dhcp-lease-time 3600;
supersede domain-name "fugue.com rc.vix.com home.vix.com";
prepend domain-name-servers 127.0.0.1;
request subnet-mask, broadcast-address, time-offset, routers,
domain-name, domain-name-servers, host-name;
require subnet-mask, domain-name-servers;
script "CLIENTBINDIR/dhclient-script";
media "media 10baseT/UTP", "media 10base2/BNC";
}
alias {
interface "ep0";
fixed-address 192.5.5.213;
option subnet-mask 255.255.255.255;
}
.fi
This is a very complicated dhclient.conf file - in general, yours
should be much simpler. In many cases, it's sufficient to just
create an empty dhclient.conf file - the defaults are usually fine.
.SH SEE ALSO
dhcp-options(5), dhcp-eval(5), dhclient.leases(5), dhcpd(8), dhcpd.conf(5),
RFC2132, RFC2131.
.SH AUTHOR
.B dhclient(8)
was written by Ted Lemon
under a contract with Vixie Labs. Funding
for this project was provided by Internet Systems Consortium.
Information about Internet Systems Consortium can be found at
.B http://www.isc.org.

48
dhcp-3.0.5-Makefile.patch Normal file
View File

@ -0,0 +1,48 @@
--- dhcp-3.0.5/Makefile.Makefile 2004-06-10 13:59:10.000000000 -0400
+++ dhcp-3.0.5/Makefile 2006-11-10 11:09:32.000000000 -0500
@@ -33,7 +33,7 @@
if [ ! -d work.$$sysname ]; then \
echo No build directory for $$sysname - please run ./configure.; \
else \
- (cd work.$$sysname; make all); \
+ (cd work.$$sysname; $(MAKE) all); \
fi
install:
@@ -41,7 +41,7 @@
if [ ! -d work.$$sysname ]; then \
echo No build directory for $$sysname - please run ./configure.; \
else \
- (cd work.$$sysname; make install); \
+ (cd work.$$sysname; $(MAKE) install); \
fi
depend:
@@ -49,7 +49,7 @@
if [ ! -d work.$$sysname ]; then \
echo No build directory for $$sysname - please run ./configure.; \
else \
- (cd work.$$sysname; make depend); \
+ (cd work.$$sysname; $(MAKE) depend); \
fi
clean:
@@ -81,6 +81,6 @@
if [ ! -d work.$$sysname ]; then \
echo No build directory for $$sysname - please run ./configure.; \
else \
- (cd work.$$sysname; make links); \
+ (cd work.$$sysname; $(MAKE) links); \
fi
--- dhcp-3.0.5/Makefile.conf.Makefile 2005-06-16 15:39:35.000000000 -0400
+++ dhcp-3.0.5/Makefile.conf 2006-11-10 11:12:43.000000000 -0500
@@ -49,7 +49,7 @@
DEBUG = -g
#WARNERR = -Werror
RANLIB = ranlib
-MKDEP = mkdep
+MKDEP = $(CC)
CLIENT_PATH = '"PATH=/usr/ucb:/usr/bin:/usr/sbin:/bin:/sbin"'
BINDLIB = ../minires/libres.a

View File

@ -0,0 +1,12 @@
--- dhcp-3.0.5/client/clparse.c.dho 2007-03-30 16:40:14.000000000 -0400
+++ dhcp-3.0.5/client/clparse.c 2007-03-30 16:43:53.000000000 -0400
@@ -49,6 +49,9 @@
DHO_DOMAIN_NAME,
DHO_DOMAIN_NAME_SERVERS,
DHO_HOST_NAME,
+ DHO_NIS_DOMAIN,
+ DHO_NIS_SERVERS,
+ DHO_NTP_SERVERS,
0
};

View File

@ -0,0 +1,58 @@
--- dhcp-3.0.5/client/dhclient.c.decline 2007-03-30 15:29:58.000000000 -0400
+++ dhcp-3.0.5/client/dhclient.c 2007-03-30 15:50:25.000000000 -0400
@@ -934,6 +934,7 @@
void *cpp;
{
struct client_state *client = cpp;
+ enum dhcp_state init_state = client->state;
ASSERT_STATE(state, S_INIT);
@@ -946,9 +947,16 @@
client -> first_sending = cur_time;
client -> interval = client -> config -> initial_interval;
- /* Add an immediate timeout to cause the first DHCPDISCOVER packet
- to go out. */
- send_discover (client);
+ if (init_state != S_DECLINED) {
+ /* Add an immediate timeout to cause the first DHCPDISCOVER packet
+ to go out. */
+ send_discover(client);
+ } else {
+ /* We've received an OFFER and it has been DECLINEd by dhclient-script.
+ * wait for a random time between 1 and backoff_cutoff seconds before
+ * trying again. */
+ add_timeout(cur_time + ((1 + (random() >> 2)) % client->config->backoff_cutoff), send_discover, client, 0, 0);
+ }
}
/* state_selecting is called when one or more DHCPOFFER packets have been
@@ -1215,6 +1223,7 @@
send_decline (client);
destroy_client_lease (client -> new);
client -> new = (struct client_lease *)0;
+ client -> state = S_DECLINED;
state_init (client);
return;
}
@@ -3183,6 +3192,7 @@
case S_INIT:
case S_REBINDING:
case S_STOPPED:
+ case S_DECLINED:
break;
}
client -> state = S_INIT;
--- dhcp-3.0.5/includes/dhcpd.h.decline 2007-03-30 15:30:14.000000000 -0400
+++ dhcp-3.0.5/includes/dhcpd.h 2007-03-30 15:50:53.000000000 -0400
@@ -704,7 +704,8 @@
S_BOUND = 5,
S_RENEWING = 6,
S_REBINDING = 7,
- S_STOPPED = 8
+ S_STOPPED = 8,
+ S_DECLINED = 9
};
/* Authentication and BOOTP policy possibilities (not all values work

View File

@ -0,0 +1,15 @@
--- dhcp-3.0.5/common/dispatch.c.ecat 2006-02-22 17:43:27.000000000 -0500
+++ dhcp-3.0.5/common/dispatch.c 2007-03-30 15:54:15.000000000 -0400
@@ -195,7 +195,6 @@
}
}
-#if defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
void cancel_all_timeouts ()
{
struct timeout *t, *n;
@@ -216,4 +215,3 @@
dfree (t, MDL);
}
}
-#endif

View File

@ -0,0 +1,29 @@
--- dhcp-3.0.5/omapip/errwarn.c.message 2007-03-29 15:03:12.000000000 -0400
+++ dhcp-3.0.5/omapip/errwarn.c 2007-03-29 15:08:50.000000000 -0400
@@ -80,20 +80,13 @@
#if !defined (NOMINUM)
log_error ("%s", "");
- log_error ("If you did not get this software from ftp.isc.org, please");
- log_error ("get the latest from ftp.isc.org and install that before");
- log_error ("requesting help.");
+ log_error ("This version of ISC DHCP is based on the release available");
+ log_error ("on ftp.isc.org. Features have been added and other changes");
+ log_error ("have been made to the base software release in order to make");
+ log_error ("it work better with this distribution.");
log_error ("%s", "");
- log_error ("If you did get this software from ftp.isc.org and have not");
- log_error ("yet read the README, please read it before requesting help.");
- log_error ("If you intend to request help from the dhcp-server@isc.org");
- log_error ("mailing list, please read the section on the README about");
- log_error ("submitting bug reports and requests for help.");
- log_error ("%s", "");
- log_error ("Please do not under any circumstances send requests for");
- log_error ("help directly to the authors of this software - please");
- log_error ("send them to the appropriate mailing list as described in");
- log_error ("the README file.");
+ log_error ("Please report for this software via the Red Hat Bugzilla site:");
+ log_error (" http://bugzilla.redhat.com");
log_error ("%s", "");
log_error ("exiting.");
#endif

View File

@ -0,0 +1,22 @@
--- dhcp-3.0.5/server/confpars.c.failover 2007-03-30 16:28:08.000000000 -0400
+++ dhcp-3.0.5/server/confpars.c 2007-03-30 16:32:39.000000000 -0400
@@ -998,10 +998,17 @@
parse_warn (cfile, "peer address may not be omitted");
/* XXX - when/if we get a port number assigned, just set as default */
+ /* See Red Hat Bugzilla 167292:
+ * we do now: dhcp-failover 647/tcp
+ * dhcp-failover 647/udp
+ * dhcp-failover 847/tcp
+ * dhcp-failover 847/udp
+ * IANA registration by Bernard Volz <volz@cisco.com>
+ */
if (!peer -> me.port)
- parse_warn (cfile, "local port may not be omitted");
+ peer -> me.port = 647;
if (!peer -> partner.port)
- parse_warn (cfile, "peer port may not be omitted");
+ peer -> partner.port = 847;
if (peer -> i_am == primary) {
if (!peer -> hba) {

1642
dhcp-options.5 Normal file

File diff suppressed because it is too large Load Diff

462
dhcp.schema Normal file
View File

@ -0,0 +1,462 @@
attributetype ( 2.16.840.1.113719.1.203.4.1
NAME 'dhcpPrimaryDN'
EQUALITY distinguishedNameMatch
DESC 'The DN of the dhcpServer which is the primary server for the configuration.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 SINGLE-VALUE )
attributetype ( 2.16.840.1.113719.1.203.4.2
NAME 'dhcpSecondaryDN'
EQUALITY distinguishedNameMatch
DESC 'The DN of dhcpServer(s) which provide backup service for the configuration.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
attributetype ( 2.16.840.1.113719.1.203.4.3
NAME 'dhcpStatements'
EQUALITY caseIgnoreIA5Match
DESC 'Flexible storage for specific data depending on what object this exists in. Like conditional statements, server parameters, etc. This allows the standard to evolve without needing to adjust the schema.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
attributetype ( 2.16.840.1.113719.1.203.4.4
NAME 'dhcpRange'
EQUALITY caseIgnoreIA5Match
DESC 'The starting & ending IP Addresses in the range (inclusive), separated by a hyphen; if the range only contains one address, then just the address can be specified with no hyphen. Each range is defined as a separate value.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
attributetype ( 2.16.840.1.113719.1.203.4.5
NAME 'dhcpPermitList'
EQUALITY caseIgnoreIA5Match
DESC 'This attribute contains the permit lists associated with a pool. Each permit list is defined as a separate value.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
attributetype ( 2.16.840.1.113719.1.203.4.6
NAME 'dhcpNetMask'
EQUALITY integerMatch
DESC 'The subnet mask length for the subnet. The mask can be easily computed from this length.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
attributetype ( 2.16.840.1.113719.1.203.4.7
NAME 'dhcpOption'
EQUALITY caseIgnoreIA5Match
DESC 'Encoded option values to be sent to clients. Each value represents a single option and contains (OptionTag, Length, OptionValue) encoded in the format used by DHCP.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
attributetype ( 2.16.840.1.113719.1.203.4.8
NAME 'dhcpClassData'
EQUALITY caseIgnoreIA5Match
DESC 'Encoded text string or list of bytes expressed in hexadecimal, separated by colons. Clients match subclasses based on matching the class data with the results of match or spawn with statements in the class name declarations.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
attributetype ( 2.16.840.1.113719.1.203.4.9
NAME 'dhcpOptionsDN'
EQUALITY distinguishedNameMatch
DESC 'The distinguished name(s) of the dhcpOption objects containing the configuration options provided by the server.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
attributetype ( 2.16.840.1.113719.1.203.4.10
NAME 'dhcpHostDN'
EQUALITY distinguishedNameMatch
DESC 'the distinguished name(s) of the dhcpHost objects.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
attributetype ( 2.16.840.1.113719.1.203.4.11
NAME 'dhcpPoolDN'
EQUALITY distinguishedNameMatch
DESC 'The distinguished name(s) of pools.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
attributetype ( 2.16.840.1.113719.1.203.4.12
NAME 'dhcpGroupDN'
EQUALITY distinguishedNameMatch
DESC 'The distinguished name(s) of the groups.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
attributetype ( 2.16.840.1.113719.1.203.4.13
NAME 'dhcpSubnetDN'
EQUALITY distinguishedNameMatch
DESC 'The distinguished name(s) of the subnets.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
attributetype ( 2.16.840.1.113719.1.203.4.14
NAME 'dhcpLeaseDN'
EQUALITY distinguishedNameMatch
DESC 'The distinguished name of a client address.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 SINGLE-VALUE)
attributetype ( 2.16.840.1.113719.1.203.4.15
NAME 'dhcpLeasesDN'
DESC 'The distinguished name(s) client addresses.'
EQUALITY distinguishedNameMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
attributetype ( 2.16.840.1.113719.1.203.4.16
NAME 'dhcpClassesDN'
EQUALITY distinguishedNameMatch
DESC 'The distinguished name(s) of a class(es) in a subclass.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
attributetype ( 2.16.840.1.113719.1.203.4.17
NAME 'dhcpSubclassesDN'
EQUALITY distinguishedNameMatch
DESC 'The distinguished name(s) of subclass(es).'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
attributetype ( 2.16.840.1.113719.1.203.4.18
NAME 'dhcpSharedNetworkDN'
EQUALITY distinguishedNameMatch
DESC 'The distinguished name(s) of sharedNetworks.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
attributetype ( 2.16.840.1.113719.1.203.4.19
NAME 'dhcpServiceDN'
EQUALITY distinguishedNameMatch
DESC 'The DN of dhcpService object(s)which contain the configuration information. Each dhcpServer object has this attribute identifying the DHCP configuration(s) that the server is associated with.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
attributetype ( 2.16.840.1.113719.1.203.4.20
NAME 'dhcpVersion'
DESC 'The version attribute of this object.'
EQUALITY caseIgnoreIA5Match
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
attributetype ( 2.16.840.1.113719.1.203.4.21
NAME 'dhcpImplementation'
EQUALITY caseIgnoreIA5Match
DESC 'Description of the DHCP Server implementation e.g. DHCP Servers vendor.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
attributetype ( 2.16.840.1.113719.1.203.4.22
NAME 'dhcpAddressState'
EQUALITY caseIgnoreIA5Match
DESC 'This stores information about the current binding-status of an address. For dynamic addresses managed by DHCP, the values should be restricted to the following: "FREE", "ACTIVE", "EXPIRED", "RELEASED", "RESET", "ABANDONED", "BACKUP". For other addresses, it SHOULD be one of the following: "UNKNOWN", "RESERVED" (an address that is managed by DHCP that is reserved for a specific client), "RESERVED-ACTIVE" (same as reserved, but address is currently in use), "ASSIGNED" (assigned manually or by some other mechanism), "UNASSIGNED", "NOTASSIGNABLE".'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
attributetype ( 2.16.840.1.113719.1.203.4.23
NAME 'dhcpExpirationTime'
EQUALITY generalizedTimeMatch
DESC 'This is the time the current lease for an address expires.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 SINGLE-VALUE )
attributetype ( 2.16.840.1.113719.1.203.4.24
NAME 'dhcpStartTimeOfState'
EQUALITY generalizedTimeMatch
DESC 'This is the time of the last state change for a leased address.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 SINGLE-VALUE )
attributetype ( 2.16.840.1.113719.1.203.4.25
NAME 'dhcpLastTransactionTime'
EQUALITY generalizedTimeMatch
DESC 'This is the last time a valid DHCP packet was received from the client.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 SINGLE-VALUE )
attributetype ( 2.16.840.1.113719.1.203.4.26
NAME 'dhcpBootpFlag'
EQUALITY booleanMatch
DESC 'This indicates whether the address was assigned via BOOTP.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE )
attributetype ( 2.16.840.1.113719.1.203.4.27
NAME 'dhcpDomainName'
EQUALITY caseIgnoreIA5Match
DESC 'This is the name of the domain sent to the client by the server. It is essentially the same as the value for DHCP option 15 sent to the client, and represents only the domain - not the full FQDN. To obtain the full FQDN assigned to the client you must prepend the "dhcpAssignedHostName" to this value with a ".".'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
attributetype ( 2.16.840.1.113719.1.203.4.28
NAME 'dhcpDnsStatus'
EQUALITY integerMatch
DESC 'This indicates the status of updating DNS resource records on behalf of the client by the DHCP server for this address. The value is a 16-bit bitmask.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
attributetype ( 2.16.840.1.113719.1.203.4.29
NAME 'dhcpRequestedHostName'
EQUALITY caseIgnoreIA5Match
DESC 'This is the hostname that was requested by the client.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
attributetype ( 2.16.840.1.113719.1.203.4.30
NAME 'dhcpAssignedHostName'
EQUALITY caseIgnoreIA5Match
DESC 'This is the actual hostname that was assigned to a client. It may not be the name that was requested by the client. The fully qualified domain name can be determined by appending the value of "dhcpDomainName" (with a dot separator) to this name.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
attributetype ( 2.16.840.1.113719.1.203.4.31
NAME 'dhcpReservedForClient'
EQUALITY distinguishedNameMatch
DESC 'The distinguished name of a "dhcpClient" that an address is reserved for. This may not be the same as the "dhcpAssignedToClient" attribute if the address is being reassigned but the current lease has not yet expired.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 SINGLE-VALUE )
attributetype ( 2.16.840.1.113719.1.203.4.32
NAME 'dhcpAssignedToClient'
EQUALITY distinguishedNameMatch
DESC 'This is the distinguished name of a "dhcpClient" that an address is currently assigned to. This attribute is only present in the class when the address is leased.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 SINGLE-VALUE )
attributetype ( 2.16.840.1.113719.1.203.4.33
NAME 'dhcpRelayAgentInfo'
EQUALITY octetStringMatch
DESC 'If the client request was received via a relay agent, this contains information about the relay agent that was available from the DHCP request. This is a hex-encoded option value.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 SINGLE-VALUE )
attributetype ( 2.16.840.1.113719.1.203.4.34
NAME 'dhcpHWAddress'
EQUALITY caseIgnoreIA5Match
DESC 'The clients hardware address that requested this IP address.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
attributetype ( 2.16.840.1.113719.1.203.4.35
NAME 'dhcpHashBucketAssignment'
EQUALITY octetStringMatch
DESC 'HashBucketAssignment bit map for the DHCP Server, as defined in DHC Load Balancing Algorithm [RFC 3074].'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 SINGLE-VALUE )
attributetype ( 2.16.840.1.113719.1.203.4.36
NAME 'dhcpDelayedServiceParameter'
EQUALITY integerMatch
DESC 'Delay in seconds corresponding to Delayed Service Parameter configuration, as defined in DHC Load Balancing Algorithm [RFC 3074]. '
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
attributetype ( 2.16.840.1.113719.1.203.4.37
NAME 'dhcpMaxClientLeadTime'
EQUALITY integerMatch
DESC 'Maximum Client Lead Time configuration in seconds, as defined in DHCP Failover Protocol [FAILOVR]'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
attributetype ( 2.16.840.1.113719.1.203.4.38
NAME 'dhcpFailOverEndpointState'
EQUALITY caseIgnoreIA5Match
DESC 'Server (Failover Endpoint) state, as defined in DHCP Failover Protocol [FAILOVR]'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
attributetype ( 2.16.840.1.113719.1.203.4.39
NAME 'dhcpErrorLog'
EQUALITY caseIgnoreIA5Match
DESC 'Generic error log attribute that allows logging error conditions within a dhcpService or a dhcpSubnet, like no IP addresses available for lease.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
attributetype ( 2.16.840.1.113719.1.203.4.40
NAME 'dhcpLocatorDN'
EQUALITY distinguishedNameMatch
DESC 'The DN of dhcpLocator object which contain the DNs of all DHCP configuration objects. There will be a single dhcpLocator object in the tree with links to all the DHCP objects in the tree'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
attributetype ( 2.16.840.1.113719.1.203.4.41
NAME 'dhcpKeyAlgorithm'
EQUALITY caseIgnoreIA5Match
DESC 'Algorithm to generate TSIG Key'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
attributetype ( 2.16.840.1.113719.1.203.4.42
NAME 'dhcpKeySecret'
EQUALITY octetStringMatch
DESC 'Secret to generate TSIG Key' SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 SINGLE-VALUE )
attributetype ( 2.16.840.1.113719.1.203.4.43
NAME 'dhcpDnsZoneServer'
EQUALITY caseIgnoreIA5Match
DESC 'Master server of the DNS Zone'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
attributetype ( 2.16.840.1.113719.1.203.4.44
NAME 'dhcpKeyDN'
EQUALITY distinguishedNameMatch
DESC 'The DNs of TSIG Key to use in secure dynamic updates. In case of locator object, this will be list of TSIG keys. In case of DHCP Service, Shared Network, Subnet and DNS Zone, it will be a single key.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.12)
attributetype ( 2.16.840.1.113719.1.203.4.45
NAME 'dhcpZoneDN'
EQUALITY distinguishedNameMatch
DESC 'The DNs of DNS Zone. In case of locator object, this will be list of DNS Zones in the tree. In case of DHCP Service, Shared Network and Subnet, it will be a single DNS Zone.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.12)
attributetype ( 2.16.840.1.113719.1.203.4.46
NAME 'dhcpFailOverPrimaryServer'
EQUALITY caseIgnoreIA5Match
DESC 'IP address or DNS name of the server playing primary role in DHC Load Balancing and Fail over.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
attributetype ( 2.16.840.1.113719.1.203.4.47
NAME 'dhcpFailOverSecondaryServer'
EQUALITY caseIgnoreIA5Match
DESC 'IP address or DNS name of the server playing secondary role in DHC Load Balancing and Fail over.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
attributetype ( 2.16.840.1.113719.1.203.4.48
NAME 'dhcpFailOverPrimaryPort'
EQUALITY integerMatch
DESC 'Port on which primary server listens for connections from its fail over peer (secondary server)'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )
attributetype ( 2.16.840.1.113719.1.203.4.49
NAME 'dhcpFailOverSecondaryPort'
EQUALITY integerMatch
DESC 'Port on which secondary server listens for connections from its fail over peer (primary server)'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )
attributetype ( 2.16.840.1.113719.1.203.4.50
NAME 'dhcpFailOverResponseDelay'
EQUALITY integerMatch
DESC 'Maximum response time in seconds, before Server assumes that connection to fail over peer has failed'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )
attributetype ( 2.16.840.1.113719.1.203.4.51
NAME 'dhcpFailOverUnackedUpdates'
EQUALITY integerMatch
DESC 'Number of BNDUPD messages that server can send before it receives BNDACK from its fail over peer'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )
attributetype ( 2.16.840.1.113719.1.203.4.52
NAME 'dhcpFailOverSplit'
EQUALITY integerMatch
DESC 'Split between the primary and secondary servers for fail over purpose'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )
attributetype ( 2.16.840.1.113719.1.203.4.53
NAME 'dhcpFailOverLoadBalanceTime'
EQUALITY integerMatch
DESC 'Cutoff time in seconds, after which load balance is disabled'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )
attributetype ( 2.16.840.1.113719.1.203.4.54
NAME 'dhcpFailOverPeerDN'
EQUALITY distinguishedNameMatch
DESC 'The DNs of Fail over peers. In case of locator object, this will be list of fail over peers in the tree. In case of Subnet and pool, it will be a single Fail Over Peer'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
#List of all servers in the tree
attributetype ( 2.16.840.1.113719.1.203.4.55
NAME 'dhcpServerDN'
EQUALITY distinguishedNameMatch
DESC 'List of all DHCP Servers in the tree. Used by dhcpLocatorObject'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
attributetype ( 2.16.840.1.113719.1.203.4.56
NAME 'dhcpComments'
EQUALITY caseIgnoreIA5Match
DESC 'Generic attribute that allows coments within any DHCP object'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
# Classes
objectclass ( 2.16.840.1.113719.1.203.6.1
NAME 'dhcpService'
DESC 'Service object that represents the actual DHCP Service configuration. This is a container object.'
SUP top
MUST (cn)
MAY ( dhcpPrimaryDN $ dhcpSecondaryDN $ dhcpServerDN $ dhcpSharedNetworkDN $ dhcpSubnetDN $ dhcpGroupDN $ dhcpHostDN $ dhcpClassesDN $ dhcpOptionsDN $ dhcpZoneDN $ dhcpKeyDN $ dhcpFailOverPeerDN $ dhcpStatements $dhcpComments $ dhcpOption) )
objectclass ( 2.16.840.1.113719.1.203.6.2
NAME 'dhcpSharedNetwork'
DESC 'This stores configuration information for a shared network.'
SUP top
MUST cn
MAY ( dhcpSubnetDN $ dhcpPoolDN $ dhcpOptionsDN $ dhcpZoneDN $ dhcpStatements $dhcpComments $ dhcpOption) X-NDS_CONTAINMENT ('dhcpService' ) )
objectclass ( 2.16.840.1.113719.1.203.6.3
NAME 'dhcpSubnet'
DESC 'This class defines a subnet. This is a container object.'
SUP top
MUST ( cn $ dhcpNetMask )
MAY ( dhcpRange $ dhcpPoolDN $ dhcpGroupDN $ dhcpHostDN $ dhcpClassesDN $ dhcpLeasesDN $ dhcpOptionsDN $ dhcpZoneDN $ dhcpKeyDN $ dhcpFailOverPeerDN $ dhcpStatements $ dhcpComments $ dhcpOption ) X-NDS_CONTAINMENT ('dhcpService' 'dhcpSharedNetwork') )
objectclass ( 2.16.840.1.113719.1.203.6.4
NAME 'dhcpPool'
DESC 'This stores configuration information about a pool.'
SUP top
MUST ( cn $ dhcpRange )
MAY ( dhcpClassesDN $ dhcpPermitList $ dhcpLeasesDN $ dhcpOptionsDN $ dhcpZoneDN $dhcpKeyDN $ dhcpStatements $ dhcpComments $ dhcpOption )
X-NDS_CONTAINMENT ('dhcpSubnet' 'dhcpSharedNetwork') )
objectclass ( 2.16.840.1.113719.1.203.6.5
NAME 'dhcpGroup'
DESC 'Group object that lists host DNs and parameters. This is a container object.'
SUP top
MUST cn
MAY ( dhcpHostDN $ dhcpOptionsDN $ dhcpStatements $ dhcpComments $ dhcpOption )
X-NDS_CONTAINMENT ('dhcpSubnet' 'dhcpService' ) )
objectclass ( 2.16.840.1.113719.1.203.6.6
NAME 'dhcpHost'
DESC 'This represents information about a particular client'
SUP top
MUST cn
MAY (dhcpLeaseDN $ dhcpHWAddress $ dhcpOptionsDN $ dhcpStatements $ dhcpComments $ dhcpOption)
X-NDS_CONTAINMENT ('dhcpService' 'dhcpSubnet' 'dhcpGroup') )
objectclass ( 2.16.840.1.113719.1.203.6.7
NAME 'dhcpClass'
DESC 'Represents information about a collection of related clients.'
SUP top
MUST cn
MAY (dhcpSubClassesDN $ dhcpOptionsDN $ dhcpStatements $ dhcpComments $ dhcpOption)
X-NDS_CONTAINMENT ('dhcpService' 'dhcpSubnet' ) )
objectclass ( 2.16.840.1.113719.1.203.6.8
NAME 'dhcpSubClass'
DESC 'Represents information about a collection of related classes.'
SUP top
MUST cn
MAY (dhcpClassData $ dhcpOptionsDN $ dhcpStatements $ dhcpComments $ dhcpOption) X-NDS_CONTAINMENT 'dhcpClass' )
objectclass ( 2.16.840.1.113719.1.203.6.9
NAME 'dhcpOptions'
DESC 'Represents information about a collection of options defined.'
SUP top AUXILIARY
MUST cn
MAY ( dhcpOption $ dhcpComments )
X-NDS_CONTAINMENT ('dhcpService' 'dhcpSharedNetwork' 'dhcpSubnet' 'dhcpPool' 'dhcpGroup' 'dhcpHost' 'dhcpClass' ) )
objectclass ( 2.16.840.1.113719.1.203.6.10
NAME 'dhcpLeases'
DESC 'This class represents an IP Address, which may or may not have been leased.'
SUP top
MUST ( cn $ dhcpAddressState )
MAY ( dhcpExpirationTime $ dhcpStartTimeOfState $ dhcpLastTransactionTime $ dhcpBootpFlag $ dhcpDomainName $ dhcpDnsStatus $ dhcpRequestedHostName $ dhcpAssignedHostName $ dhcpReservedForClient $ dhcpAssignedToClient $ dhcpRelayAgentInfo $ dhcpHWAddress )
X-NDS_CONTAINMENT ( 'dhcpService' 'dhcpSubnet' 'dhcpPool') )
objectclass ( 2.16.840.1.113719.1.203.6.11
NAME 'dhcpLog'
DESC 'This is the object that holds past information about the IP address. The cn is the time/date stamp when the address was assigned or released, the address state at the time, if the address was assigned or released.'
SUP top
MUST ( cn )
MAY ( dhcpAddressState $ dhcpExpirationTime $ dhcpStartTimeOfState $ dhcpLastTransactionTime $ dhcpBootpFlag $ dhcpDomainName $ dhcpDnsStatus $ dhcpRequestedHostName $ dhcpAssignedHostName $ dhcpReservedForClient $ dhcpAssignedToClient $ dhcpRelayAgentInfo $ dhcpHWAddress $ dhcpErrorLog)
X-NDS_CONTAINMENT ('dhcpLeases' 'dhcpPool' 'dhcpSubnet' 'dhcpSharedNetwork' 'dhcpService' ) )
objectclass ( 2.16.840.1.113719.1.203.6.12
NAME 'dhcpServer'
DESC 'DHCP Server Object'
SUP top
MUST ( cn )
MAY (dhcpServiceDN $ dhcpLocatorDN $ dhcpVersion $ dhcpImplementation $ dhcpHashBucketAssignment $ dhcpDelayedServiceParameter $ dhcpMaxClientLeadTime $ dhcpFailOverEndpointState $ dhcpStatements $ dhcpComments $ dhcpOption)
X-NDS_CONTAINMENT ('organization' 'organizationalunit' 'domain') )
objectclass ( 2.16.840.1.113719.1.203.6.13
NAME 'dhcpTSigKey'
DESC 'TSIG key for secure dynamic updates'
SUP top
MUST (cn $ dhcpKeyAlgorithm $ dhcpKeySecret )
MAY ( dhcpComments )
X-NDS_CONTAINMENT ('dhcpService' 'dhcpSharedNetwork' 'dhcpSubnet') )
objectclass ( 2.16.840.1.113719.1.203.6.14
NAME 'dhcpDnsZone'
DESC 'DNS Zone for updating leases'
SUP top
MUST (cn $ dhcpDnsZoneServer )
MAY (dhcpKeyDN $ dhcpComments)
X-NDS_CONTAINMENT ('dhcpService' 'dhcpSharedNetwork' 'dhcpSubnet') )
objectclass ( 2.16.840.1.113719.1.203.6.15
NAME 'dhcpFailOverPeer'
DESC 'This class defines the Fail over peer'
SUP top
MUST ( cn $ dhcpFailOverPrimaryServer $ dhcpFailOverSecondaryServer $ dhcpFailoverPrimaryPort $ dhcpFailOverSecondaryPort) MAY (dhcpFailOverResponseDelay $ dhcpFailOverUnackedUpdates $ dhcpMaxClientLeadTime $ dhcpFailOverSplit $ dhcpHashBucketAssignment $ dhcpFailOverLoadBalanceTime $ dhcpComments )
X-NDS_CONTAINMENT ('dhcpService' 'dhcpSharedNetwork' 'dhcpSubnet') )
objectclass ( 2.16.840.1.113719.1.203.6.16
NAME 'dhcpLocator'
DESC 'Locator object for DHCP configuration in the tree. There will be a single dhcpLocator object in the tree with links to all the DHCP objects in the tree'
SUP top
MUST ( cn )
MAY ( dhcpServiceDN $dhcpServerDN $ dhcpSharedNetworkDN $ dhcpSubnetDN $ dhcpPoolDN $ dhcpGroupDN $ dhcpHostDN $ dhcpClassesDN $ dhcpKeyDN $ dhcpZoneDN $ dhcpFailOverPeerDN $ dhcpOption $ dhcpComments)
X-NDS_CONTAINMENT ('organization' 'organizationalunit' 'domain') )

30
dhcp4client.h Normal file
View File

@ -0,0 +1,30 @@
/* dhcp4client.h
*
* Interface to the ISC dhcp IPv4 client libdhcp4client library.
*
* Copyright (C) 2006 Red Hat, Inc. All rights reserved.
*
* This copyrighted material is made available to anyone wishing to use,
* modify, copy, or redistribute it subject to the terms and conditions of
* the GNU General Public License v.2, or (at your option) any later version.
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY expressed or implied, including the implied warranties of
* MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU General
* Public License for more details. You should have received a copy of the
* GNU General Public License along with this program; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA. Any Red Hat trademarks that are incorporated in the
* source code or documentation are not subject to the GNU General Public
* License and may only be used or replicated with the express permission of
* Red Hat, Inc.
*
* Red Hat Author(s): Jason Vas Dias
* David Cantrell <dcantrell@redhat.com>
*/
/* include libdhcp_control.h or libdhcp.h for this */
extern struct libdhcp_control_s;
/* The ISC IPv4 DHCP client main() function */
extern int dhcpv4_client(struct libdhcp_control_s *dhc_ctl,
int argc, char **argv, char **envp);

488
dhcpctl.3 Normal file
View File

@ -0,0 +1,488 @@
.\" -*- nroff -*-
.\"
.\" Project: DHCP
.\" File: dhcpctl.3
.\" RCSId: $Id: dhcpctl.3,v 1.1 2007/11/12 23:16:08 dcantrel Exp $
.\"
.\" Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
.\" Copyright (c) 2000-2003 by Internet Software Consortium
.\" Copyright (c) 2000 Nominum, Inc.
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
.\" OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.\" Internet Systems Consortium, Inc.
.\" 950 Charter Street
.\" Redwood City, CA 94063
.\" <info@isc.org>
.\" http://www.isc.org/
.\"
.\" Description: dhcpctl man page.
.\"
.\"
.Dd Nov 15, 2000
.Dt DHCPCTL 3
.Os DHCP 3
.ds vT DHCP Programmer's Manual
.\"
.\"
.\"
.Sh NAME
.Nm dhcpctl_initialize
.Nd dhcpctl library initialization.
.\"
.\"
.\"
.Sh SYNOPSIS
.Fd #include <dhcpctl.h>
.Ft dhcpctl_status
.Fo dhcpctl_initialize
.Fa void
.Fc
.\"
.Ft dhcpctl_status
.Fo dhcpctl_connect
.Fa "dhcpctl_handle *cxn"
.Fa "const char *host"
.Fa "int port"
.Fa "dhcpctl_handle auth"
.Fc
.\"
.\"
.\"
.Ft dhcpctl_status
.Fo dhcpctl_wait_for_completion
.Fa "dhcpctl_handle object"
.Fa "dhcpctl_status *status"
.Fc
.\"
.\"
.\"
.Ft dhcpctl_status
.Fo dhcpctl_get_value
.Fa "dhcpctl_data_string *value"
.Fa "dhcpctl_handle object"
.Fa "const char *name"
.Fc
.\"
.\"
.\"
.Ft dhcpctl_status
.Fo dhcpctl_get_boolean
.Fa "int *value"
.Fa "dhcpctl_handle object"
.Fa "const char *name"
.Fc
.\"
.\"
.\"
.Ft dhcpctl_status
.Fo dhcpctl_set_value
.Fa "dhcpctl_handle object"
.Fa "dhcpctl_data_string value"
.Fa "const char *name"
.Fc
.\"
.\"
.\"
.Ft dhcpctl_status
.Fo dhcpctl_set_string_value
.Fa "dhcpctl_handle object"
.Fa "const char *value"
.Fa "const char *name"
.Fc
.\"
.\"
.\"
.Ft dhcpctl_status
.Fo dhcpctl_set_boolean_value
.Fa "dhcpctl_handle object"
.Fa "int value"
.Fa "const char *name"
.Fc
.\"
.\"
.\"
.Ft dhcpctl_status
.Fo dhcpctl_set_int_value
.Fa "dhcpctl_handle object"
.Fa "int value"
.Fa "const char *name"
.Fc
.\"
.\"
.\"
.Ft dhcpctl_status
.Fo dhcpctl_object_update
.Fa "dhcpctl_handle connection"
.Fa "dhcpctl_handle object"
.Fc
.\"
.\"
.\"
.Ft dhcpctl_status
.Fo dhcpctl_object_refresh
.Fa "dhcpctl_handle connection"
.Fa "dhcpctl_handle object"
.Fc
.\"
.\"
.\"
.Ft dhcpctl_status
.Fo dhcpctl_object_remove
.Fa "dhcpctl_handle connection"
.Fa "dhcpctl_handle object"
.Fc
.\"
.\"
.\"
.Ft dhcpctl_status
.Fo dhcpctl_set_callback
.Fa "dhcpctl_handle object"
.Fa "void *data"
.Fa "void (*function) (dhcpctl_handle, dhcpctl_status, void *)"
.Fc
.\"
.\"
.\"
.Ft dhcpctl_status
.Fo dhcpctl_new_authenticator
.Fa "dhcpctl_handle *object"
.Fa "const char *name"
.Fa "const char *algorithm"
.Fa "const char *secret"
.Fa "unsigned secret_len"
.Fc
.\"
.\"
.\"
.Ft dhcpctl_status
.Fo dhcpctl_new_object
.Fa "dhcpctl_handle *object"
.Fa "dhcpctl_handle connection"
.Fa "const char *object_type"
.Fc
.\"
.\"
.\"
.Ft dhcpctl_status
.Fo dhcpctl_open_object
.Fa "dhcpctl_handle object"
.Fa "dhcpctl_handle connection"
.Fa "int flags"
.Fc
.\"
.\"
.\"
.Ft isc_result_t
.Fo omapi_data_string_new
.Fa dhcpctl_data_string *data
.Fa unsigned int length
.Fa const char *filename,
.Fa int lineno
.Fc
.\"
.\"
.\"
.Ft isc_result_t
.Fo dhcpctl_data_string_dereference
.Fa "dhcpctl_data_string *"
.Fa "const char *"
.Fa "int"
.Fc
.Sh DESCRIPTION
The dhcpctl set of functions provide an API that can be used to communicate
with and manipulate a running ISC DHCP server. All functions return a value of
.Dv isc_result_t .
The return values reflects the result of operations to local data
structures. If an operation fails on the server for any reason, then the error
result will be returned through the
second parameter of the
.Fn dhcpctl_wait_for_completion
call.
.\"
.\"
.\"
.Pp
.Fn dhcpctl_initialize
sets up the data structures the library needs to do its work. This function
must be called once before any other.
.Pp
.Fn dhcpctl_connect
opens a connection to the DHCP server at the given host and port. If an
authenticator has been created for the connection, then it is given as the 4th
argument. On a successful return the address pointed at by the first
argument will have a new connection object assigned to it.
.Pp
For example:
.Bd -literal -offset indent
s = dhcpctl_connect(&cxn, "127.0.0.1", 7911, NULL);
.Ed
.Pp
connects to the DHCP server on the localhost via port 7911 (the standard
OMAPI port). No authentication is used for the connection.
.\"
.\"
.\"
.Pp
.Fn dhcpctl_wait_for_completion
flushes a pending message to the server and waits for the response. The result
of the request as processed on the server is returned via the second
parameter.
.Bd -literal -offset indent
s = dhcpctl_wait_for_completion(cxn, &wv);
if (s != ISC_R_SUCCESS)
local_failure(s);
else if (wv != ISC_R_SUCCESS)
server_failure(wc);
.Ed
.Pp
The call to
.Fn dhcpctl_wait_for_completion
won't return until the remote message processing completes or the connection
to the server is lost.
.\"
.\"
.\"
.Pp
.Fn dhcpctl_get_value
extracts a value of an attribute from the handle. The value can be of any
length and is treated as a sequence of bytes. The handle must have been
created first with
.Fn dhcpctl_new_object
and opened with
.Fn dhcpctl_open_object .
The value is returned via the parameter named
.Dq value .
The last parameter is the name of attribute to retrieve.
.Bd -literal -offset indent
dhcpctl_data_string value = NULL;
dhcpctl_handle lease;
time_t thetime;
s = dhcpctl_get_value (&value, lease, "ends");
assert(s == ISC_R_SUCCESS && value->len == sizeof(thetime));
memcpy(&thetime, value->value, value->len);
.Ed
.\"
.\"
.\"
.Pp
.Fn dhcpctl_get_boolean
extracts a boolean valued attribute from the object handle.
.\"
.\"
.\"
.Pp
The
.Fn dhcpctl_set_value ,
.Fn dhcpctl_set_string_value ,
.Fn dhcpctl_set_boolean_value ,
and
.Fn dhcpctl_set_int_value
functions all set a value on the object handle.
.\"
.\"
.\"
.Pp
.Fn dhcpctl_object_update
function queues a request for
all the changes made to the object handle be be sent to the remote
for processing. The changes made to the atributes on the handle will be
applied to remote object if permitted.
.\"
.\"
.\"
.Pp
.Fn dhcpctl_object_refresh
queues up a request for a fresh copy of all the attribute values to be sent
from the remote to
refresh the values in the local object handle.
.\"
.\"
.\"
.Pp
.Fn dhcpctl_object_remove
queues a request for the removal on the server of the object referenced by the
handle.
.\"
.\"
.\"
.Pp
The
.Fn dhcpctl_set_callback
function sets up a user-defined function to be called when an event completes
on the given object handle. This is needed for asynchronous handling of
events, versus the synchronous handling given by
.Fn dhcpctl_wait_for_completion .
When the function is called the first parameter is the object the event
arrived for, the second is the status of the message that was processed, the
third is the same value as the second parameter given to
.Fn dhcpctl_set_callback .
.\"
.\"
.\"
.Pp
The
.Fn dhcpctl_new_authenticator
creates a new authenticator object to be used for signing the messages
that cross over the network. The
.Dq name ,
.Dq algorithm ,
and
.Dq secret
values must all match what the server uses and are defined in its
configuration file. The created object is returned through the first parameter
and must be used as the 4th parameter to
.Fn dhcpctl_connect .
Note that the 'secret' value must not be base64 encoded, which is different
from how the value appears in the dhcpd.conf file.
.\"
.\"
.\"
.Pp
.Fn dhcpctl_new_object
creates a local handle for an object on the the server. The
.Dq object_type
parameter is the ascii name of the type of object being accessed. e.g.
.Qq lease .
This function only sets up local data structures, it does not queue any
messages
to be sent to the remote side,
.Fn dhcpctl_open_object
does that.
.\"
.\"
.\"
.Pp
.Fn dhcpctl_open_object
builds and queues the request to the remote side. This function is used with
handle created via
.Fn dhcpctl_new_object .
The flags argument is a bit mask with the following values available for
setting:
.Bl -tag -offset indent -width 20
.It DHCPCTL_CREATE
if the object does not exist then the remote will create it
.It DHCPCTL_UPDATE
update the object on the remote side using the
attributes already set in the handle.
.It DHCPCTL_EXCL
return and error if the object exists and DHCPCTL_CREATE
was also specified
.El
.\"
.\"
.\"
.Pp
The
.Fn omapi_data_string_new
function allocates a new
.Ft dhcpctl_data_string
object. The data string will be large enough to hold
.Dq length
bytes of data. The
.Dq file
and
.Dq lineno
arguments are the source file location the call is made from, typically by
using the
.Dv __FILE__
and
.Dv __LINE__
macros or the
.Dv MDL
macro defined in
.
.\"
.\"
.\"
.Pp
.Fn dhcpctl_data_string_dereference
deallocates a data string created by
.Fn omapi_data_string_new .
The memory for the object won't be freed until the last reference is
released.
.Sh EXAMPLES
.Pp
The following program will connect to the DHCP server running on the local
host and will get the details of the existing lease for IP address
10.0.0.101. It will then print out the time the lease is due to expire. Note
that most error checking has been ommitted for brevity.
.Bd -literal -offset indent
#include <stdarg.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <stdio.h>
#include <netinet/in.h>
#include <isc/result.h>
#include <dhcpctl.h>
int main (int argc, char **argv) {
dhcpctl_data_string ipaddrstring = NULL;
dhcpctl_data_string value = NULL;
dhcpctl_handle connection = NULL;
dhcpctl_handle lease = NULL;
isc_result_t waitstatus;
struct in_addr convaddr;
time_t thetime;
dhcpctl_initialize ();
dhcpctl_connect (&connection, "127.0.0.1",
7911, 0);
dhcpctl_new_object (&lease, connection,
"lease");
memset (&ipaddrstring, 0, sizeof
ipaddrstring);
inet_pton(AF_INET, "10.0.0.101",
&convaddr);
omapi_data_string_new (&ipaddrstring,
4, MDL);
memcpy(ipaddrstring->value, &convaddr.s_addr, 4);
dhcpctl_set_value (lease, ipaddrstring,
"ip-address");
dhcpctl_open_object (lease, connection, 0);
dhcpctl_wait_for_completion (lease,
&waitstatus);
if (waitstatus != ISC_R_SUCCESS) {
/* server not authoritative */
exit (0);
}
dhcpctl_data_string_dereference(&ipaddrstring,
MDL);
dhcpctl_get_value (&value, lease, "ends");
memcpy(&thetime, value->value, value->len);
dhcpctl_data_string_dereference(&value, MDL);
fprintf (stdout, "ending time is %s",
ctime(&thetime));
}
.Ed
.Sh SEE ALSO
omapi(3), omshell(3), dhcpd(8), dhclient(8), dhcpd.conf(5), dhclient.conf(5).
.Sh AUTHOR
.Em dhcpctl
was written by Ted Lemon of Nominum, Inc.
This preliminary documentation was written by James Brister of Nominum, Inc.

2682
dhcpd.conf.5 Normal file

File diff suppressed because it is too large Load Diff

31
dhcpd.conf.sample Normal file
View File

@ -0,0 +1,31 @@
ddns-update-style interim;
ignore client-updates;
subnet 192.168.0.0 netmask 255.255.255.0 {
# --- default gateway
option routers 192.168.0.1;
option subnet-mask 255.255.255.0;
option nis-domain "domain.org";
option domain-name "domain.org";
option domain-name-servers 192.168.1.1;
option time-offset -18000; # Eastern Standard Time
# option ntp-servers 192.168.1.1;
# option netbios-name-servers 192.168.1.1;
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# -- you understand Netbios very well
# option netbios-node-type 2;
range dynamic-bootp 192.168.0.128 192.168.0.254;
default-lease-time 21600;
max-lease-time 43200;
# we want the nameserver to appear at a fixed address
host ns {
next-server marvin.redhat.com;
hardware ethernet 12:34:56:78:AB:CD;
fixed-address 207.175.42.254;
}
}

142
dhcpd.init Normal file
View File

@ -0,0 +1,142 @@
#!/bin/sh
#
### BEGIN INIT INFO
# Provides: dhcpd
# Default-Start:
# Default-Stop:
# Should-Start:
# Required-Start: $network
# Required-Stop:
# Short-Description: Start and stop the DHCP server
# Description: dhcpd provides the Dynamic Host Configuration Protocol (DHCP)
# server.
### END INIT INFO
#
# The fields below are left around for legacy tools (will remove later).
#
# chkconfig: - 65 35
# description: dhcpd provides the Dynamic Host Configuration Protocol (DHCP) \
# server
# processname: dhcpd
# config: /etc/dhcpd.conf
# config: /var/lib/dhcpd/dhcpd.leases
# pidfile: /var/run/dhcpd.pid
. /etc/init.d/functions
RETVAL=0
prog=dhcpd
dhcpd=/usr/sbin/dhcpd
lockfile=/var/lock/subsys/dhcpd
pidfile=/var/run/dhcpd.pid
statedir=/var/lib/dhcpd
[ -f /etc/sysconfig/dhcpd ] && . /etc/sysconfig/dhcpd
# if the user specified a different config file, make sure we reference it
findConfig() {
for arg in $DHCPDARGS ; do
if [ "$found" = 1 ]; then
[ -f "$arg" ] && echo "$arg"
return
fi
if [ "$arg" = "-cf" ]; then
found=1
continue
fi
done
echo "/etc/dhcpd.conf"
}
conf="$(findConfig "$DHCPDARGS")"
if [ ! -f $statedir/dhcpd.leases ] ; then
mkdir -p $statedir
touch $statedir/dhcpd.leases
[ -x /sbin/restorecon ] && [ -d /selinux ] && /sbin/restorecon $statedir/dhcpd.leases >/dev/null 2>&1
fi
configtest() {
[ -x $dhcpd ] || return 5
[ -f $conf ] || return 6
$dhcpd -q -t -cf $conf
RETVAL=$?
return $RETVAL
}
start() {
[ -x $dhcpd ] || return 5
[ -f $conf ] || return 6
pidofproc $prog >/dev/null 2>&1
RETVAL=$?
[ $RETVAL -eq 0 ] && return $RETVAL
echo -n $"Starting $prog: "
daemon $dhcpd $DHCPDARGS 2>/dev/null
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch $lockfile
return $RETVAL
}
stop() {
pidofproc $prog >/dev/null 2>&1
if [ $? -ne 0 ]; then
RETVAL=7
return $RETVAL
fi
echo -n $"Shutting down $prog: "
killproc $prog
RETVAL=$?
[ $RETVAL = 0 ] && success || failure
echo
[ $RETVAL = 0 ] && rm -f $lockfile
return $RETVAL
}
if [ $# -gt 1 ]; then
RETVAL=2
exit $RETVAL
fi
case "$1" in
start)
start
RETVAL=$?
;;
stop)
stop
RETVAL=$?
;;
restart|force-reload)
stop ; start
RETVAL=$?
;;
try-restart|reload)
RETVAL=3
;;
condrestart)
if [ -f $lockfile ]; then
stop ; start
RETVAL=$?
fi
;;
configtest)
configtest
RETVAL=$?
;;
status)
status $dhcpd
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart|configtest|status}"
RETVAL=3
;;
esac
exit $RETVAL

125
dhcrelay.init Normal file
View File

@ -0,0 +1,125 @@
#!/bin/sh
#
### BEGIN INIT INFO
# Provides: dhcrelay
# Default-Start:
# Default-Stop:
# Should-Start:
# Required-Start: $network
# Required-Stop:
# Short-Description: Start and stop the DHCP relay server
# Description: dhcrelay provides the Dynamic Host Configuration Protocol (DHCP)
# relay server. This is required when your DHCP server is on
# another network segment from the clients.
### END INIT INFO
#
# The fields below are left around for legacy tools (will remove later).
#
# chkconfig: - 65 35
# description: dhcrelay provides a relay for Dynamic Host Control Protocol.
# processname: dhcrelay
# # pidfile: /var/run/dhcrelay.pid
. /etc/init.d/functions
RETVAL=0
prog=dhcrelay
dhcrelay=/usr/sbin/dhcrelay
lockfile=/var/lock/subsys/dhcrelay
pidfile=/var/run/dhcrelay.pid
conf=/etc/sysconfig/dhcrelay
# The dhcrelay daemon uses the sysconfig file for configuration information.
# There is no native configuration file for this program and you must specify
# its settings on the command line.
[ -f /etc/sysconfig/dhcrelay ] && . /etc/sysconfig/dhcrelay
configtest() {
[ -x $dhcrelay ] || exit 5
[ -f $conf ] || exit 6
[ -z "$DHCPSERVERS" ] && exit 6
RETVAL=0
return $RETVAL
}
start() {
[ -x $dhcrelay ] || exit 5
[ -f $conf ] || exit 6
pidofproc $prog >/dev/null 2>&1
RETVAL=$?
[ $RETVAL -eq 0 ] && return $RETVAL
echo -n $"Starting $prog: "
daemon $dhcrelay $([ -n "$INTERFACES" ] && for int in $INTERFACES ; do echo -n " -i $int" ; done) $DHCPSERVERS 2>/dev/null
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch $lockfile
return $RETVAL
}
stop() {
pidofproc $prog >/dev/null 2>&1
if [ $? -ne 0 ]; then
RETVAL=7
return $RETVAL
fi
echo -n $"Shutting down $prog: "
killproc $prog -TERM
RETVAL=$?
[ $RETVAL = 0 ] && success || failure
echo
[ $RETVAL = 0 ] && rm -f $lockfile
return $RETVAL
}
if [ ! -x $dhcrelay ]; then
RETVAL=5
exit $RETVAL
fi
if [ $# -gt 1 ]; then
RETVAL=2
exit $RETVAL
fi
case "$1" in
start)
start
RETVAL=$?
;;
stop)
stop
RETVAL=$?
;;
restart|force-reload)
stop && start
RETVAL=$?
;;
try-restart|reload)
RETVAL=3
;;
condrestart)
if [ -f $lockfile ]; then
stop && start
RETVAL=$?
fi
;;
configtest)
configtest
RETVAL=$?
;;
status)
status $prog
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart|configtest|status}"
RETVAL=3
;;
esac
exit $RETVAL

File diff suppressed because it is too large Load Diff

26
get-ldap-patch.sh Executable file
View File

@ -0,0 +1,26 @@
#!/bin/bash
#
# Fetch latest version of LDAP patch. The patch is downloaded and split in
# the ldap/ subdirectory. It is up to the packager to merge the updates with
# the RPM.
#
# Upstream: http://home.ntelos.net/~masneyb/
#
# David Cantrell <dcantrell@redhat.com>
#
CWD=$(pwd)
rm -f masneyb.html-$$
wget -O masneyb.html-$$ http://home.ntelos.net/~masneyb
p="$(grep "ldap-patch" masneyb.html-$$ | cut -d '>' -f 3 | cut -d '<' -f 1)"
rm -f masneyb.html-$$
rm -rf ldap/
mkdir -p ldap/
cd ldap/
wget -N http://home.ntelos.net/~masneyb/$p
splitdiff -a -d $p
rm -f $p
rm -f *_debian_*

5
libdhcp4client.pc Normal file
View File

@ -0,0 +1,5 @@
Name: libdhcp4client
Description: ISC DHCP IPv4 client library
Version: @DHCP_VERSION@
Libs: -ldhcp4client
Cflags: -I/usr/include/dhcp4client

132
libdhcp_control.h Normal file
View File

@ -0,0 +1,132 @@
/* libdhcp_control.h
*
* DHCP client control API for libdhcp, a minimal interface to the
* ISC dhcp IPv4 client libdhcp4client library,
* and to the dhcpv6 DHCPv6 client libdhcp6client library.
*
* Each DHCP client library must include this file to be controlled
* by libdhcp.
*
* Copyright (C) 2006 Red Hat, Inc. All rights reserved.
*
* This copyrighted material is made available to anyone wishing to use,
* modify, copy, or redistribute it subject to the terms and conditions of
* the GNU General Public License v.2, or (at your option) any later version.
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY expressed or implied, including the implied warranties of
* MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU General
* Public License for more details. You should have received a copy of the
* GNU General Public License along with this program; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA. Any Red Hat trademarks that are incorporated in the
* source code or documentation are not subject to the GNU General Public
* License and may only be used or replicated with the express permission of
* Red Hat, Inc.
*
* Red Hat Author(s): Jason Vas Dias
* David Cantrell <dcantrell@redhat.com>
*/
#ifndef LIBDHCP_CONTROL_H
#define LIBDHCP_CONTROL_H
#include <stdarg.h>
#include <stdint.h>
#define LOG_FATAL 8
typedef enum dhcp_state_e {
/* DHCPv4 client states
* third callback arg will be a 'struct client_state *'
*/
DHC4_NBI, /* failed: no broadcast interfaces found */
DHC4_PREINIT, /* configuration started - bring the interface "UP" */
DHC4_BOUND, /* lease obtained */
DHC4_RENEW, /* lease renewed */
DHC4_REBOOT, /* have valid lease, but now obtained a different one */
DHC4_REBIND, /* new, different lease */
DHC4_STOP, /* remove old lease */
DHC4_MEDIUM, /* media selection begun */
DHC4_TIMEOUT, /* timed out contacting DHCP server */
DHC4_FAIL, /* all attempts to contact server timed out, sleeping */
DHC4_EXPIRE, /* lease has expired, renewing */
DHC4_RELEASE, /* releasing lease */
/* This state raised by both clients: */
DHC_TIMEDOUT, /* libdhcp_control timeout has been exceeded */
/* DHCPv6 client states: */
DHC6_BOUND, /* new lease obtained - arg is optinfo * */
DHC6_REBIND, /* existing expired lease rebound - arg is optinfo * */
DHC6_RELEASE /* existing lease expired - arg is dhcp6_iaidaddr*/
} DHCP_State;
struct libdhcp_control_s;
/* ala syslog(3): LOG_EMERG=0 - LOG_DEBUG=7 (+ LOG_FATAL=8 : finished -> 1) */
typedef int (*LIBDHCP_Error_Handler) (struct libdhcp_control_s *ctl,
int priority, const char *fmt,
va_list ap);
/* The DHCP clients will call the users' callback on important state change
* events, with the second arg set to the client DHCP_State, and the third
* arg set to a client specific pointer as described below. */
typedef int (*LIBDHCP_Callback) (struct libdhcp_control_s *control,
enum dhcp_state_e, void*);
typedef struct libdhcp_control_s {
/* the DHCP clients' main loop calls this on state changes */
LIBDHCP_Callback callback;
/* LIBDHCP_Capability bits to enable */
uint16_t capability;
/* set to one to make clients exit their main loop */
uint8_t finished;
/* set to one to decline the lease (DHCPv4 only) */
uint8_t decline;
/* (timeout+now) == time after which clients MUST return */
time_t timeout;
/* clients set this to time(0) on entering main loop */
time_t now;
/* user data pointer */
void *arg;
LIBDHCP_Error_Handler eh;
} LIBDHCP_Control;
/* DHCP client "capabilities" */
typedef enum libdhcp_capability_e {
/* use / do not use persistent lease database files */
DHCP_USE_LEASE_DATABASE = 1,
/* use / do not use pid file */
DHCP_USE_PID_FILE = 2,
/*
* DHCPv6 supports these capabilities in process,
* while the DHCPv4 client will fork and exec the dhclient-script to
* implement them if these bits are set - otherwise, if no bits are set,
* the callback is called and the script is not run.
*/
/* configure interfaces UP/DOWN as required */
DHCP_CONFIGURE_INTERFACES = 4,
/* configure interface addresses as required */
DHCP_CONFIGURE_ADDRESSES = 8,
/* configure routes as required */
DHCP_CONFIGURE_ROUTES = 16,
/* configure resolv.conf as required */
DHCP_CONFIGURE_RESOLVER = 32,
/* DHCPv6 only: */
/* configure radvd.conf & restart radvd as required */
DHCP_CONFIGURE_RADVD = 64,
} LIBDHCP_Capability;
#endif

557
linux Executable file
View File

@ -0,0 +1,557 @@
#!/bin/bash
# dhclient-script for Linux. Dan Halbert, March, 1997.
# Updated for Linux 2.[12] by Brian J. Murrell, January 1999.
# No guarantees about this. I'm a novice at the details of Linux
# networking.
#
# Modified by David Cantrell <dcantrell@redhat.com> for Fedora and RHEL
# Notes:
# 0. This script is based on the netbsd script supplied with dhcp-970306.
# 1. ifconfig down apparently deletes all relevant routes and flushes
# the arp cache, so this doesn't need to be done explicitly.
# 2. The alias address handling here has not been tested AT ALL.
# I'm just going by the doc of modern Linux ip aliasing, which uses
# notations like eth0:0, eth0:1, for each alias.
# 3. I have to calculate the network address, and calculate the broadcast
# address if it is not supplied. This might be much more easily done
# by the dhclient C code, and passed on.
PATH=/bin:/usr/bin
function save_previous() {
if [ -e $1 ]; then
mv $1 $1.predhclient
else
echo ''> $1.predhclient
fi
}
make_resolv_conf() {
if [ "${PEERDNS}" == "no" ]; then
return
fi
if [ x$reason == xRENEW ] &&
[ "$new_domain_name" == "$old_domain_name" ] &&
[ "$new_domain_name_servers" == "$old_domain_name_servers" ]; then
return
fi
if [ -n "$new_domain_name" ] || [ -n "$new_domain_name_servers" ]; then
cp -fp /etc/resolv.conf /etc/resolv.conf.predhclient
rscf=`mktemp /tmp/XXXXXX`;
echo '; generated by /sbin/dhclient-script' > $rscf
if [ -n "$SEARCH" ]; then
echo search $SEARCH >> $rscf
else
if [ -n "$new_domain_name" ]; then
echo search $new_domain_name >> $rscf
fi
fi
for nameserver in $new_domain_name_servers; do
echo nameserver $nameserver >> $rscf
done
change_resolv_conf $rscf
rm -f $rscf
fi
}
# Must be used on exit. Invokes the local dhcp client exit hooks, if any.
exit_with_hooks() {
exit_status=$1
if [ -f /etc/dhclient-exit-hooks ]; then
. /etc/dhclient-exit-hooks
fi
# probably should do something with exit status of the local script
exit $exit_status
}
# Invoke the local dhcp client enter hooks, if they exist.
if [ -f /etc/dhclient-enter-hooks ]; then
exit_status=0
. /etc/dhclient-enter-hooks
# allow the local script to abort processing of this state
# local script must set exit_status variable to nonzero.
if [ $exit_status -ne 0 ]; then
exit $exit_status
fi
fi
# Import Red Hat Linux configuration
cd /etc/sysconfig/network-scripts;
. /etc/sysconfig/network-scripts/network-functions
. /etc/rc.d/init.d/functions
[ -f ../network ] && . ../network
[ -f ../networking/network ] && . ../networking/network
CONFIG=$interface
need_config ${CONFIG}
if [ -f "${CONFIG}" ]; then
source_config
else
echo $"$0: configuration for $interface not found. Continuing with defaults." >&2
fi
source_config
release=$(uname -r)
relmajor=$(echo $release | cut -f1 -d'.')
relminor=$(echo $release | cut -f2 -d'.')
# simple IP arithmetic functions:
function quad2num() {
if [ $# -eq 4 ]; then
let n="$1<<24|$2<<16|$3<<8|$4"
echo $n
return 0
fi
echo '0'
return 1
}
function ip2num() {
IFS='.' quad2num $1
}
function num2ip() {
let n="$1"
let o1='(n>>24)&0xff'
let o2='(n>>16)&0xff'
let o3='(n>>8)&0xff'
let o4='n & 0xff'
echo $o1.$o2.$o3.$o4
}
function mask() {
ip=$1
m=$2
let ip=$(IFS='.' ip2num $ip)
let m=$(IFS='.' ip2num $m)
let n='ip&m'
num2ip $n
}
function mask_bits() {
ip=$1
let ip=$(IFS='.' ip2num $ip)
let bits=0
for ((bit=1; '((ip&bit)==0) && (bits < 32)'; 'bit<<=1')) do
let bits+=1
done
let n_bits=32-bits
echo $n_bits
}
function class_bits() {
let ip=$(IFS='.' ip2num $1)
let bits=32
let mask='255'
for ((i=0; i <= 3; i++, 'mask<<=8')); do
let v='ip&mask'
if [ "$v" -eq 0 ] ; then
let bits-=8
else
break
fi
done
echo $bits
}
function routerReachable() {
# Handle silly DHCP servers that give us a router not on our subnet:
router=$1
routerSubnet=$(mask $router $new_subnet_mask)
mySubnet=$(mask $new_ip_address $new_subnet_mask)
unreachable=0
if [ "$routerSubnet" != "$mySubnet" ]; then
unreachable=1
if /sbin/arping -f -q -I $interface -w2 $router; then
/sbin/ip route add ${router}/32 dev $interface
if [ $? -eq 0 ]; then
unreachable=0
else
/usr/bin/logger -p local7.notice -t "NET" "dhclient: failed to create host route for unreachable router $router not on subnet $mySubnet";
fi
else
unreachable=1
if [ -x /usr/bin/logger ]; then
/usr/bin/logger -p local7.notice -t "NET" "dhclient: DHCP router $router is unreachable on DHCP subnet $mySubnet router subnet $routerSubnet";
fi
fi
fi
return $unreachable
}
function add_default_gateway() {
router=$1
metric=''
if [ $# -gt 1 ] && [ "$2" -gt 0 ]; then
metric="metric $2"
fi
if routerReachable $router ; then
/sbin/ip route replace default via $router dev $interface $metric
if [ $? -ne 0 ]; then
/usr/bin/logger -p local7.notice -t "NET" 'dhclient: failed to create default route: '$router dev $interface $metric
return 1
else
return 0
fi
fi
return 1
}
function dhconfig() {
if [ x$old_ip_address != x ] && [ x$alias_ip_address != x ] && [ x$alias_ip_address != x$old_ip_address ]; then
# Possible new alias. Remove old alias.
ifconfig $interface:0- inet 0
fi
if [ x$old_ip_address != x ] && [ x$old_ip_address != x$new_ip_address ]; then
# IP address changed. Bringing down the interface will delete all
# routes, and clear the ARP cache.
ifconfig $interface inet 0 down
fi
if [ x$reason = xBOUND ] || [ x$reason = xREBOOT ] ||
[ x$old_ip_address != x$new_ip_address ] ||
[ x$old_subnet_mask != x$new_subnet_mask ] ||
[ x$new_network_number != x$new_network_number ] ||
[ x$old_broadcast_address != x$new_broadcast_address ] ||
[ "x$old_routers" != "x$new_routers" ] ||
[ x$old_interface_mtu != x$new_interface_mtu ] ; then
ifconfig $interface inet $new_ip_address $new_subnet_arg $new_broadcast_arg
if [ -n "$new_interface_mtu" ]; then
/sbin/ip link set $interface mtu $new_interface_mtu
fi
if [ -x /etc/dhclient-${interface}-up-hooks ]; then
. /etc/dhclient-${interface}-up-hooks
elif [ -x /etc/dhclient-up-hooks ]; then
. /etc/dhclient-up-hooks
fi
prefix_bits=$(mask_bits $new_subnet_mask)
# Add a network route to the computed network address.
if [ $relmajor -lt 2 ] || ( [ $relmajor -eq 2 ] && [ $relminor -eq 0 ] ); then
/sbin/ip route replace ${new_network_number}/${prefix_bits} dev $interface
if [ $added_old_broadcast_route -eq 1 ]; then
/sbin/ip route del default
fi
fi
if [[ (( -z "$GATEWAYDEV" ) || ( "$GATEWAYDEV" = "$interface" )) && (( -z "$GATEWAY" ) || (( -n "$DHCLIENT_IGNORE_GATEWAY" ) && ( "$DHCLIENT_IGNORE_GATEWAY" = [Yy]* ))) ]]; then
metric=${METRIC:-''}
let i=${METRIC:-0}
default_routers=()
for router in $new_routers; do
added_router=0
for r in ${default_routers[@]}; do
if [ "$r" == "$router" ]; then
added_router=1
fi
done
if [ -z "$router" ] || [ "$added_router" -eq 1 ] || [ $(IFS=. ip2num $router) -le 0 ] || [[ ( "$router" = "$new_broadcast_address" ) && ( "$new_subnet_mask" != "255.255.255.255" ) ]]; then
continue
fi
default_routers=(${default_routers[@]} $router)
add_default_gateway $router $metric
let i=i+1
metric=$i
done
elif [[ (( -z "$GATEWAYDEV" ) || ( "$GATEWAYDEV" = "$interface" )) && ( -n "$GATEWAY" ) ]]; then
routerSubnet=$(mask $GATEWAY $new_subnet_mask)
mySubnet=$(mask $new_ip_address $new_subnet_mask)
if [ "$routerSubnet" = "$mySubnet" ]; then
/sbin/ip route replace default via $GATEWAY dev $interface
fi
fi
# static routes
if [ "x$new_static_routes" != x ]; then
IFS=', ' static_routes=($new_static_routes)
route_targets=()
for((i=0; i<${#static_routes[@]}; i+=2)); do
target=${static_routes[$i]}
gateway=${static_routes[$i+1]}
metric=''
for t in ${route_targets[@]}; do
if [ $t == $target ]; then
if [ -z "$metric" ]; then
metric=1
else
((metric=metric+1))
fi
fi
done
if [ -n "$metric" ]; then
metric="metric $metric"
fi
if routerReachable $gateway; then
/sbin/ip route replace ${target}/$(class_bits $target) via ${gateway} dev $interface ${metric}
if [ $? -ne 0 ]; then
/usr/bin/logger -p local7.notice -t 'NET' 'dhclient: failed to create static route:' ${target}/`class_bits $target` via ${gateway} dev $interface ${metric}
else
route_targets=(${route_targets[@]} $target)
fi
fi
done
fi
fi
if [ x$new_ip_address != x$alias_ip_address ] && [ x$alias_ip_address != x ]; then
ifconfig $interface:0- inet 0
ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
/sbin/ip route replace ${alias_ip_address}/32 dev $interface:0
fi
make_resolv_conf
if [ -n "$new_host_name" ] && need_hostname; then
hostname $new_host_name
fi
if [ "${PEERNIS}" = no ]; then
:
elif [ -n "$new_nis_domain" ]; then
domainname "$new_nis_domain"
save_previous /etc/yp.conf
let contents=0
echo '# generated by /sbin/dhclient-script' > /etc/yp.conf
if [ -n "$new_nis_servers" ]; then
for I in $new_nis_servers; do
echo "domain $new_nis_domain server $I" >> /etc/yp.conf
let contents=contents+1
done
else
echo "domain $new_nis_domain broadcast" >> /etc/yp.conf
let contents=contents+1
fi
if [ $contents -gt 0 ] && [ -r /var/run/ypbind.pid ] && yppid=$(cat /var/run/ypbind.pid) && [ -d /proc/${yppid} ] && [ "$(if [ -x /usr/bin/readlink ]; then readlink /proc/${yppid}/exe; else echo /sbin/ypbind; fi)" = "/sbin/ypbind" ]; then
kill -HUP $yppid
fi
elif [ -n "$new_nis_servers" ]; then
save_previous /etc/yp.conf
echo '# generated by /sbin/dhclient-script' > /etc/yp.conf
let contents=0
for I in $new_nis_servers; do
echo "ypserver $I" >> /etc/yp.conf
let contents=contents+1
done
if [ $contents -gt 0 ] && [ -r /var/run/ypbind.pid ] && yppid=$(cat /var/run/ypbind.pid) && [ -d /proc/${yppid} ] && [ "$(if [ -x /usr/bin/readlink ]; then readlink /proc/${yppid}/exe; else echo /sbin/ypbind; fi)" = "/sbin/ypbind" ]; then
kill -HUP $yppid
fi
fi
if [ -n "$DHCP_TIME_OFFSET_SETS_TIMEZONE" ] && [[ "$DHCP_TIME_OFFSET_SETS_TIMEZONE" = [yY1]* ]]; then
if [ -n "$new_time_offset" ]; then
# DHCP option "time-offset" is requested by default and should be
# handled. The geographical zone abbreviation cannot be determined
# from the GMT offset, but the $ZONEINFO/Etc/GMT$offset file can be
# used - note: this disables DST.
((z=new_time_offset/3600))
((hoursWest=$(printf '%+d' $z)))
if (( $hoursWest < 0 )); then
# tzdata treats negative 'hours west' as positive 'gmtoff'!
((hoursWest*=-1))
fi
tzfile=/usr/share/zoneinfo/Etc/GMT$(printf '%+d' $hoursWest)
if [ -e $tzfile ]; then
/bin/mv -f /etc/localtime /etc/localtime.predhclient
/bin/cp -fp $tzfile /etc/localtime
/bin/touch /etc/localtime
fi
fi
fi
if [ "${PEERNTP}" = no ]; then
:
elif [ -n "$new_ntp_servers" ] && [ -e /etc/ntp.conf ]; then
save_previous /etc/ntp.conf
/bin/egrep -v '^server .* # added by /sbin/dhclient-script$'< /etc/ntp.conf.predhclient > /etc/ntp.conf
for s in $new_ntp_servers; do
echo "server $s # added by /sbin/dhclient-script" >> /etc/ntp.conf
done
if [ -x /usr/bin/diff ] && /usr/bin/diff -q /etc/ntp.conf /etc/ntp.conf.predhclient >/dev/null 2>&1; then
:
else
/sbin/service ntpd condrestart >/dev/null 2>&1
fi
fi
}
if [ x$new_broadcast_address != x ] && [ x$new_subnet_mask != x ] && [ "$new_subnet_mask" != "255.255.255.255" ]; then
new_broadcast_arg="broadcast $new_broadcast_address"
fi
if [ x$old_broadcast_address != x ]; then
old_broadcast_arg="broadcast $old_broadcast_address"
fi
if [ x$new_subnet_mask != x ]; then
new_subnet_arg="netmask $new_subnet_mask"
fi
if [ x$old_subnet_mask != x ]; then
old_subnet_arg="netmask $old_subnet_mask"
fi
if [ x$alias_subnet_mask != x ]; then
alias_subnet_arg="netmask $alias_subnet_mask"
fi
if [ x$reason = xMEDIUM ]; then
# Linux doesn't do mediums (ok, ok, media).
exit_with_hooks 0
fi
added_old_broadcast_route=0
if [ x$reason = xPREINIT ]; then
if [ x$alias_ip_address != x ]; then
# Bring down alias interface. Its routes will disappear too.
ifconfig $interface:0- inet 0
fi
if [ x$keep_old_ip = xyes ]; then
ifconfig $interface up
elif [ $relmajor -lt 2 ] || ( [ $relmajor -eq 2 ] && [ $relminor -eq 0 ] ) then
ifconfig $interface inet 0.0.0.0 netmask 0.0.0.0 broadcast 255.255.255.255 up
# Add route to make broadcast work. Do not omit netmask.
/sbin/ip route replace default dev $interface && added_old_broadcast_route=1
else
ifconfig $interface 0 up
fi
# We need to give the kernel some time to get the interface up.
# sleep 1
# I don't think this is necessary with modern kernels - no problems found
# during testing - JVD, 2005-06-17
# but just in case:
if [ -n "$DHCLIENT_DELAY" ] && [ "$DHCLIENT_DELAY" -gt 0 ] ; then
sleep $DHCLIENT_DELAY
fi
exit_with_hooks 0
fi
if [ x$reason = xARPCHECK ] || [ x$reason = xARPSEND ]; then
if [ -z "$new_ip_address" ] || [ -z "$interface" ] || /sbin/arping -q -f -c 2 -w 3 -D -I ${interface} ${new_ip_address}; then
exit_with_hooks 0
else
exit_with_hooks 1
fi
fi
if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \
[ x$reason = xREBIND ] || [ x$reason = xREBOOT ]; then
dhconfig
exit_with_hooks 0
fi
if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ] || [ x$reason = xRELEASE ] \
|| [ x$reason = xSTOP ]; then
if [ -f /etc/resolv.conf.predhclient ]; then
change_resolv_conf /etc/resolv.conf.predhclient
rm -f /etc/resolv.conf.predhclient
fi
if [ -n "$DHCP_TIME_OFFSET_SETS_TIMEZONE" ] && [[ "$DHCP_TIME_OFFSET_SETS_TIMEZONE" = [yY1]* ]]; then
if [ -e /etc/localtime.predhclient ]; then
/bin/rm -f /etc/localtime
/bin/mv -f /etc/localtime.predhclient /etc/localtime
/bin/touch /etc/localtime
fi
fi
if [ -f /etc/ntp.conf.predhclient ]; then
/bin/rm -f /etc/ntp.conf
/bin/mv -f /etc/ntp.conf.predhclient /etc/ntp.conf
service ntpd condrestart >/dev/null 2>&1
fi
if [ -f /etc/yp.conf.predhclient ]; then
/bin/rm -f /etc/yp.conf
/bin/mv -f /etc/yp.conf.predhclient /etc/yp.conf
if [ -r /var/run/ypbind.pid ] && yppid=$(cat /var/run/ypbind.pid) && [ -d /proc/${yppid} ] && [ "$(if [ -x /usr/bin/readlink ]; then readlink /proc/${yppid}/exe; else echo /sbin/ypbind; fi)" = "/sbin/ypbind" ]; then
kill -HUP $yppid
fi
fi
if [ -x /etc/dhclient-${interface}-down-hooks ]; then
. /etc/dhclient-${interface}-down-hooks
elif [ -x /etc/dhclient-down-hooks ]; then
. /etc/dhclient-down-hooks
fi
if [ x$alias_ip_address != x ]; then
# Turn off alias interface.
ifconfig $interface:0- inet 0
fi
if [ x$old_ip_address != x ]; then
# Shut down interface, which will delete routes and clear arp cache.
ifconfig $interface inet 0 down
fi
if [ x$alias_ip_address != x ]; then
ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
/sbin/ip route replace ${alias_ip_address}/32 $interface:0
fi
exit_with_hooks 0
fi
if [ x$reason = xTIMEOUT ] && [ "x$new_routers" != 'x' ]; then
if [ x$alias_ip_address != x ]; then
ifconfig $interface:0- inet 0
fi
ifconfig $interface inet $new_ip_address $new_subnet_arg $new_broadcast_arg
set $new_routers
if ping -q -c 1 -w 10 -I $interface $1; then
dhconfig
exit_with_hooks 0
fi
if [ -z "${dhc_dbus}" ] || (( ( dhc_dbus & 2 ) != 2 )); then
ifconfig $interface inet 0 down
fi
exit_with_hooks 1
elif [ x$reason = xTIMEOUT ]; then
exit_with_hooks 1
fi
exit_with_hooks 0

View File

@ -1 +1 @@
31d79b27ce4a94089a0b9ce7f72307fa dhcp-4.0.0.tar.gz
27d179a3c3fbef576566b456a1168246 dhcp-3.1.0.tar.gz