- Upgrade to ISC dhcp-4.0.0 (#426634)

- first ISC release to incorporate DHCPv6 protocol support
- source tree now uses GNU autoconf/automake
- Removed the libdhcp4client-static package
This commit is contained in:
David Cantrell 2008-01-13 21:02:47 +00:00
parent d1dc4c0c6d
commit 82186fd6db
31 changed files with 1400 additions and 9897 deletions

View File

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

View File

@ -1,150 +0,0 @@
#
# 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)

View File

@ -1,255 +0,0 @@
.\" 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.

View File

@ -1,428 +0,0 @@
.\" 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

View File

@ -1,660 +0,0 @@
.\" $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.

View File

@ -1,48 +0,0 @@
--- 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

@ -1,12 +0,0 @@
--- 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

@ -1,14 +0,0 @@
--- dhcp-3.0.5/client/dhclient.c.fast 2007-03-30 16:22:54.000000000 -0400
+++ dhcp-3.0.5/client/dhclient.c 2007-03-30 16:26:11.000000000 -0400
@@ -766,10 +766,7 @@
do_release (client);
else {
client -> state = S_INIT;
- /* Set up a timeout to start the initialization
- process. */
- add_timeout (cur_time + random () % 5,
- state_reboot, client, 0, 0);
+ add_timeout (cur_time, state_reboot, client, 0, 0);
}
}
}

View File

@ -1,17 +0,0 @@
--- dhcp-3.0.5/client/dhclient.c.inherit 2007-03-30 16:06:30.000000000 -0400
+++ dhcp-3.0.5/client/dhclient.c 2007-03-30 16:09:06.000000000 -0400
@@ -720,6 +720,14 @@
continue;
script_init (ip -> client,
"PREINIT", (struct string_list *)0);
+ /* Has an active lease */
+ if (ip->client->active &&
+ !ip->client->active->is_bootp &&
+ ip->client->active->expiry > cur_time &&
+ ip->primary_address.s_addr != 0 &&
+ ip->client->active->address.len == 4 &&
+ memcmp(ip->client->active->address.iabuf, &ip->primary_address, 4) == 0)
+ client_envadd(ip->client, "", "keep_old_ip", "%s", "yes");
if (ip -> client -> alias)
script_write_params (ip -> client, "alias_",
ip -> client -> alias);

View File

@ -1,73 +0,0 @@
--- dhcp-3.0.5/dst/dst_api.c.prototypes 2007-04-01 16:29:10.000000000 -0400
+++ dhcp-3.0.5/dst/dst_api.c 2007-04-01 16:29:10.000000000 -0400
@@ -58,6 +58,10 @@
#include "dst_internal.h"
+/* prototypes */
+extern int b64_pton(char const *src, u_char *target, size_t targsize);
+extern int b64_ntop(u_char const *src, size_t srclength, char *target, size_t targsize);
+
/* static variables */
static int done_init = 0;
dst_func *dst_t_func[DST_MAX_ALGS];
--- dhcp-3.0.5/dst/dst_support.c.prototypes 2001-02-22 02:22:08.000000000 -0500
+++ dhcp-3.0.5/dst/dst_support.c 2007-04-01 16:29:10.000000000 -0400
@@ -32,6 +32,10 @@
#include "dst_internal.h"
+/* prototypes */
+extern int b64_pton(char const *src, u_char *target, size_t targsize);
+extern int b64_ntop(u_char const *src, size_t srclength, char *target, size_t targsize);
+
/*
* dst_s_conv_bignum_u8_to_b64
* This function converts binary data stored as a u_char[] to a
--- dhcp-3.0.5/includes/minires/minires.h.prototypes 2004-06-10 13:59:37.000000000 -0400
+++ dhcp-3.0.5/includes/minires/minires.h 2007-04-01 16:29:10.000000000 -0400
@@ -65,7 +65,6 @@
#define res_protocolname MRres_protocolname
#define res_servicename MRres_servicename
#define ns_datetosecs MRns_datetosecs
-#define b64_pton MRb64_pton
#define res_ninit minires_ninit
#define res_randomid MRres_randomid
#define res_findzonecut MRres_findzonecut
--- dhcp-3.0.5/minires/res_mkupdate.c.prototypes 2007-04-01 16:29:10.000000000 -0400
+++ dhcp-3.0.5/minires/res_mkupdate.c 2007-04-01 16:30:12.000000000 -0400
@@ -49,6 +49,10 @@
#include "minires/minires.h"
#include "arpa/nameser.h"
+/* prototypes */
+extern int b64_pton(char const *src, u_char *target, size_t targsize);
+int dn_comp(const char *src, u_char *dst, unsigned dstsiz, u_char **dnptrs, u_char **lastdnptr);
+
/* Options. Leave them on. */
#define DEBUG
#define MAXPORT 1024
--- dhcp-3.0.5/minires/res_comp.c.prototypes 2004-06-10 13:59:42.000000000 -0400
+++ dhcp-3.0.5/minires/res_comp.c 2007-04-01 16:31:02.000000000 -0400
@@ -91,6 +91,11 @@
#include "minires/minires.h"
#include "arpa/nameser.h"
+/* prototypes */
+int ns_name_uncompress(const u_char *msg, const u_char *eom, const u_char *src, char *dst, size_t dstsiz);
+int ns_name_compress(const char *src, u_char *dst, size_t dstsiz, const u_char **dnptrs, const u_char **lastdnptr);
+int ns_name_skip(const u_char **ptrptr, const u_char *eom);
+
/*
* Expand compressed domain name 'comp_dn' to full domain name.
* 'msg' is a pointer to the begining of the message,
--- dhcp-3.0.5/minires/res_init.c.prototypes 2004-06-10 13:59:43.000000000 -0400
+++ dhcp-3.0.5/minires/res_init.c 2007-04-01 16:31:38.000000000 -0400
@@ -102,6 +102,7 @@
#define DEBUG
static void res_setoptions (res_state, const char *, const char *);
+u_int res_randomid(void);
#ifdef RESOLVSORT
static const char sort_mask[] = "/&";

View File

@ -1,13 +0,0 @@
diff -up dhcp-3.0.6/client/dhclient.c.enoi dhcp-3.0.6/client/dhclient.c
--- dhcp-3.0.6/client/dhclient.c.enoi 2007-08-15 16:14:32.000000000 -0400
+++ dhcp-3.0.6/client/dhclient.c 2007-08-15 16:17:17.000000000 -0400
@@ -259,6 +259,9 @@ int main (argc, argv, envp)
} else if (!strcmp (argv [i], "--version")) {
log_info ("isc-dhclient-%s", DHCP_VERSION);
exit (0);
+ } else if (!strcmp (argv [i], "-x")) {
+ /* ignored for compatibility */
+ continue;
} else if (!strcmp (argv [i], "-I")) {
if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
usage ();

View File

@ -1,82 +0,0 @@
diff -up dhcp-3.1.0/common/lpf.c.anycast dhcp-3.1.0/common/lpf.c
--- dhcp-3.1.0/common/lpf.c.anycast 2007-10-22 16:16:48.000000000 -0400
+++ dhcp-3.1.0/common/lpf.c 2007-10-22 16:19:01.000000000 -0400
@@ -334,6 +334,9 @@ ssize_t send_packet (interface, packet,
return send_fallback (interface, packet, raw,
len, from, to, hto);
+ if (hto == NULL && interface->anycast_mac_addr.hlen)
+ hto = &interface->anycast_mac_addr;
+
/* Assemble the headers... */
assemble_hw_header (interface, (unsigned char *)hh, &hbufp, hto);
fudge = hbufp % 4; /* IP header must be word-aligned. */
diff -up dhcp-3.1.0/common/conflex.c.anycast dhcp-3.1.0/common/conflex.c
--- dhcp-3.1.0/common/conflex.c.anycast 2007-10-22 16:16:47.000000000 -0400
+++ dhcp-3.1.0/common/conflex.c 2007-10-22 16:18:52.000000000 -0400
@@ -549,6 +549,8 @@ static enum dhcp_token intern (atom, dfv
}
if (!strcasecmp (atom + 1, "nd"))
return AND;
+ if (!strcasecmp (atom + 1, "nycast-mac"))
+ return ANYCAST_MAC;
if (!strcasecmp (atom + 1, "ppend"))
return APPEND;
if (!strcasecmp (atom + 1, "llow"))
diff -up dhcp-3.1.0/includes/site.h.anycast dhcp-3.1.0/includes/site.h
--- dhcp-3.1.0/includes/site.h.anycast 2007-10-22 16:16:47.000000000 -0400
+++ dhcp-3.1.0/includes/site.h 2007-10-22 16:19:43.000000000 -0400
@@ -184,6 +184,8 @@
#define TRACING
+#define USE_LPF
+
/* Define this if you want to read your config from LDAP. Read README.ldap
about how to set this up */
diff -up dhcp-3.1.0/includes/dhcpd.h.anycast dhcp-3.1.0/includes/dhcpd.h
--- dhcp-3.1.0/includes/dhcpd.h.anycast 2007-10-22 16:16:48.000000000 -0400
+++ dhcp-3.1.0/includes/dhcpd.h 2007-10-22 16:19:17.000000000 -0400
@@ -990,6 +990,7 @@ struct interface_info {
int dlpi_sap_length;
struct hardware dlpi_broadcast_addr;
# endif /* DLPI_SEND || DLPI_RECEIVE */
+ struct hardware anycast_mac_addr;
};
struct hardware_link {
diff -up dhcp-3.1.0/includes/dhctoken.h.anycast dhcp-3.1.0/includes/dhctoken.h
--- dhcp-3.1.0/includes/dhctoken.h.anycast 2007-10-22 16:16:48.000000000 -0400
+++ dhcp-3.1.0/includes/dhctoken.h 2007-10-22 16:20:33.000000000 -0400
@@ -326,7 +326,8 @@ enum dhcp_token {
DOMAIN_LIST = 630,
LEASEQUERY = 631,
EXECUTE = 632,
- BOOTP_BROADCAST_ALWAYS = 633
+ BOOTP_BROADCAST_ALWAYS = 633,
+ ANYCAST_MAC = 634
};
#define is_identifier(x) ((x) >= FIRST_TOKEN && \
diff -up dhcp-3.1.0/client/clparse.c.anycast dhcp-3.1.0/client/clparse.c
--- dhcp-3.1.0/client/clparse.c.anycast 2007-10-22 16:16:48.000000000 -0400
+++ dhcp-3.1.0/client/clparse.c 2007-10-22 16:18:40.000000000 -0400
@@ -407,6 +407,17 @@ void parse_client_statement (cfile, ip,
}
return;
+ case ANYCAST_MAC:
+ token = next_token (&val, (unsigned *)0, cfile);
+ if (ip) {
+ parse_hardware_param (cfile, &ip -> anycast_mac_addr);
+ } else {
+ parse_warn (cfile, "anycast mac address parameter %s",
+ "not allowed here.");
+ skip_to_semi (cfile);
+ }
+ return;
+
case REQUEST:
token = next_token (&val, (unsigned *)0, cfile);
if (config -> requested_options == default_requested_options)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,34 @@
diff -up dhcp-4.0.0/client/clparse.c.dho dhcp-4.0.0/client/clparse.c
--- dhcp-4.0.0/client/clparse.c.dho 2007-12-29 06:32:16.000000000 -1000
+++ dhcp-4.0.0/client/clparse.c 2007-12-29 06:35:41.000000000 -1000
@@ -37,7 +37,7 @@
struct client_config top_level_config;
-#define NUM_DEFAULT_REQUESTED_OPTS 9
+#define NUM_DEFAULT_REQUESTED_OPTS 12
struct option *default_requested_options[NUM_DEFAULT_REQUESTED_OPTS + 1];
static void parse_client_default_duid(struct parse *cfile);
@@ -107,6 +107,21 @@ isc_result_t read_client_conf ()
option_code_hash_lookup(&default_requested_options[8],
dhcpv6_universe.code_hash, &code, 0, MDL);
+ /* 10 */
+ code = DHO_NIS_DOMAIN;
+ option_code_hash_lookup(&default_requested_options[9],
+ dhcp_universe.code_hash, &code, 0, MDL);
+
+ /* 11 */
+ code = DHO_NIS_SERVERS;
+ option_code_hash_lookup(&default_requested_options[10],
+ dhcp_universe.code_hash, &code, 0, MDL);
+
+ /* 12 */
+ code = DHO_NTP_SERVERS;
+ option_code_hash_lookup(&default_requested_options[11],
+ dhcp_universe.code_hash, &code, 0, MDL);
+
for (code = 0 ; code < NUM_DEFAULT_REQUESTED_OPTS ; code++) {
if (default_requested_options[code] == NULL)
log_fatal("Unable to find option definition for "

View File

@ -0,0 +1,70 @@
diff -up dhcp-4.0.0/common/lpf.c.anycast dhcp-4.0.0/common/lpf.c
--- dhcp-4.0.0/common/lpf.c.anycast 2007-12-29 06:44:46.000000000 -1000
+++ dhcp-4.0.0/common/lpf.c 2007-12-29 10:40:11.000000000 -1000
@@ -331,6 +331,9 @@ ssize_t send_packet (interface, packet,
return send_fallback (interface, packet, raw,
len, from, to, hto);
+ if (hto == NULL && interface->anycast_mac_addr.hlen)
+ hto = &interface->anycast_mac_addr;
+
/* Assemble the headers... */
assemble_hw_header (interface, (unsigned char *)hh, &hbufp, hto);
fudge = hbufp % 4; /* IP header must be word-aligned. */
diff -up dhcp-4.0.0/common/conflex.c.anycast dhcp-4.0.0/common/conflex.c
--- dhcp-4.0.0/common/conflex.c.anycast 2007-12-29 06:44:46.000000000 -1000
+++ dhcp-4.0.0/common/conflex.c 2007-12-29 10:39:30.000000000 -1000
@@ -715,6 +715,8 @@ intern(char *atom, enum dhcp_token dfv)
}
if (!strcasecmp (atom + 1, "nd"))
return AND;
+ if (!strcasecmp (atom + 1, "nycast-mac"))
+ return ANYCAST_MAC;
if (!strcasecmp (atom + 1, "ppend"))
return APPEND;
if (!strcasecmp (atom + 1, "llow"))
diff -up dhcp-4.0.0/includes/dhcpd.h.anycast dhcp-4.0.0/includes/dhcpd.h
--- dhcp-4.0.0/includes/dhcpd.h.anycast 2007-12-29 06:44:46.000000000 -1000
+++ dhcp-4.0.0/includes/dhcpd.h 2007-12-29 10:42:56.000000000 -1000
@@ -1188,6 +1188,7 @@ struct interface_info {
int dlpi_sap_length;
struct hardware dlpi_broadcast_addr;
# endif /* DLPI_SEND || DLPI_RECEIVE */
+ struct hardware anycast_mac_addr;
};
struct hardware_link {
diff -up dhcp-4.0.0/includes/dhctoken.h.anycast dhcp-4.0.0/includes/dhctoken.h
--- dhcp-4.0.0/includes/dhctoken.h.anycast 2007-12-29 06:44:46.000000000 -1000
+++ dhcp-4.0.0/includes/dhctoken.h 2007-12-29 10:44:00.000000000 -1000
@@ -346,7 +346,8 @@ enum dhcp_token {
WHITESPACE = 649,
TOKEN_ALSO = 650,
AFTER = 651,
- BOOTP_BROADCAST_ALWAYS = 652
+ BOOTP_BROADCAST_ALWAYS = 652,
+ ANYCAST_MAC = 653
};
#define is_identifier(x) ((x) >= FIRST_TOKEN && \
diff -up dhcp-4.0.0/client/clparse.c.anycast dhcp-4.0.0/client/clparse.c
--- dhcp-4.0.0/client/clparse.c.anycast 2007-12-29 06:44:46.000000000 -1000
+++ dhcp-4.0.0/client/clparse.c 2007-12-29 10:38:55.000000000 -1000
@@ -550,6 +550,17 @@ void parse_client_statement (cfile, ip,
}
return;
+ case ANYCAST_MAC:
+ token = next_token (&val, (unsigned *)0, cfile);
+ if (ip) {
+ parse_hardware_param (cfile, &ip -> anycast_mac_addr);
+ } else {
+ parse_warn (cfile, "anycast mac address parameter %s",
+ "not allowed here.");
+ skip_to_semi (cfile);
+ }
+ return;
+
case REQUEST:
token = next_token (&val, (unsigned *)0, cfile);
if (config -> requested_options == default_requested_options)

View File

@ -1,32 +1,36 @@
diff -up dhcp-3.1.0/client/dhclient.c.usage dhcp-3.1.0/client/dhclient.c
--- dhcp-3.1.0/client/dhclient.c.usage 2007-10-22 15:52:06.000000000 -0400
+++ dhcp-3.1.0/client/dhclient.c 2007-10-22 15:54:21.000000000 -0400
@@ -818,16 +818,25 @@ int main (argc, argv, envp)
diff -up dhcp-4.0.0/client/dhclient.c.usage dhcp-4.0.0/client/dhclient.c
--- dhcp-4.0.0/client/dhclient.c.usage 2007-12-31 18:05:29.000000000 -1000
+++ dhcp-4.0.0/client/dhclient.c 2007-12-31 18:05:43.000000000 -1000
@@ -893,21 +893,30 @@ main(int argc, char **argv) {
static void usage ()
{
- log_info ("%s %s", message, DHCP_VERSION);
- log_info ("%s %s", message, PACKAGE_VERSION);
- log_info (copyright);
- log_info (arr);
- log_info (url);
-
- log_error ("Usage: dhclient [-1dqrx] [-nw] [-p <port>] %s",
- "[-s server]");
- log_error (" [-cf config-file] [-lf lease-file]%s",
- "[-pf pid-file] [-e VAR=val]");
- log_fatal (" [-sf script-file] [interface]");
+ printf ("%s %s\n", message, DHCP_VERSION);
+ printf ("%s %s", message, PACKAGE_VERSION);
+ printf (copyright);
+ printf ("\n");
+ printf (arr);
+ printf ("\n");
+ printf (url);
+ printf ("\n");
+
+ printf ("Usage: dhclient [-1dqr] [-nw] [-p <port>] %s",
+ "[-s server]");
- log_error ("Usage: dhclient %s %s",
+ printf ("Usage: dhclient %s %s",
#ifdef DHCPv6
"[-4|-6] [-1dvrx] [-nw] [-p <port>]",
#else /* DHCPv6 */
"[-1dvrx] [-nw] [-p <port>]",
#endif /* DHCPv6 */
- "[-s server]");
- log_error (" [-cf config-file] [-lf lease-file]%s",
- "[-pf pid-file] [-e VAR=val]");
- log_fatal (" [-sf script-file] [interface]");
+ "[-s server]\n");
+ printf (" [-cf config-file] [-lf lease-file]%s",
+ "[-pf pid-file] [-e VAR=val]");
+ "[-pf pid-file] [-e VAR=val]\n");
+ printf (" [ -I <dhcp-client-identifier> ] [-B]\n");
+ printf (" [ -H <host-name> | -F <fqdn.fqdn> ] [ -T <timeout> ]\n");
+ printf (" [ -V <vendor-class-identifier> ]\n");

View File

@ -0,0 +1,15 @@
diff -up dhcp-4.0.0/client/dhclient.c.fast dhcp-4.0.0/client/dhclient.c
--- dhcp-4.0.0/client/dhclient.c.fast 2007-12-29 06:07:14.000000000 -1000
+++ dhcp-4.0.0/client/dhclient.c 2007-12-29 06:08:07.000000000 -1000
@@ -3624,10 +3624,7 @@ isc_result_t dhclient_interface_startup_
ip -> flags |= INTERFACE_RUNNING;
for (client = ip -> client; client; client = client -> next) {
client -> state = S_INIT;
- /* Set up a timeout to start the initialization
- process. */
- add_timeout (cur_time + random () % 5,
- state_reboot, client, 0, 0);
+ add_timeout (cur_time, state_reboot, client, 0, 0);
}
}
return ISC_R_SUCCESS;

View File

@ -1,9 +1,27 @@
diff -up dhcp-3.1.0/server/mdb.c.ldap dhcp-3.1.0/server/mdb.c
--- dhcp-3.1.0/server/mdb.c.ldap 2007-06-08 14:57:02.000000000 -0400
+++ dhcp-3.1.0/server/mdb.c 2007-11-12 15:41:15.000000000 -0500
@@ -454,6 +454,12 @@ int find_hosts_by_haddr (struct host_dec
diff -up dhcp-4.0.0/server/Makefile.am.ldap dhcp-4.0.0/server/Makefile.am
--- dhcp-4.0.0/server/Makefile.am.ldap 2007-05-29 06:32:11.000000000 -1000
+++ dhcp-4.0.0/server/Makefile.am 2008-01-11 17:45:47.000000000 -1000
@@ -4,12 +4,12 @@ dist_sysconf_DATA = dhcpd.conf
sbin_PROGRAMS = dhcpd
dhcpd_SOURCES = dhcpd.c dhcp.c bootp.c confpars.c db.c class.c failover.c \
omapi.c mdb.c stables.c salloc.c ddns.c dhcpleasequery.c \
- dhcpv6.c mdb6.c
+ dhcpv6.c mdb6.c ldap.c ldap_casa.c
# libomapi.a this is here twice to handle circular library dependencies :(
dhcpd_LDADD = ../common/libdhcp.a ../omapip/libomapi.a ../dst/libdst.a \
../dhcpctl/libdhcpctl.a ../minires/libres.a \
- ../omapip/libomapi.a
+ ../omapip/libomapi.a -lldap
man_MANS = dhcpd.8 dhcpd.conf.5 dhcpd.leases.5
EXTRA_DIST = $(man_MANS)
diff -up dhcp-4.0.0/server/mdb.c.ldap dhcp-4.0.0/server/mdb.c
--- dhcp-4.0.0/server/mdb.c.ldap 2007-11-30 11:51:43.000000000 -1000
+++ dhcp-4.0.0/server/mdb.c 2008-01-11 17:45:28.000000000 -1000
@@ -600,6 +600,12 @@ int find_hosts_by_haddr (struct host_dec
const char *file, int line)
{
struct host_decl *foo;
struct hardware h;
+ int ret;
+
@ -14,9 +32,9 @@ diff -up dhcp-3.1.0/server/mdb.c.ldap dhcp-3.1.0/server/mdb.c
h.hlen = hlen + 1;
h.hbuf [0] = htype;
diff -up /dev/null dhcp-3.1.0/server/ldap_casa.c
--- /dev/null 2007-11-12 10:55:50.854093917 -0500
+++ dhcp-3.1.0/server/ldap_casa.c 2007-11-12 15:41:15.000000000 -0500
diff -up /dev/null dhcp-4.0.0/server/ldap_casa.c
--- /dev/null 2008-01-11 10:40:59.147013395 -1000
+++ dhcp-4.0.0/server/ldap_casa.c 2008-01-11 17:45:28.000000000 -1000
@@ -0,0 +1,138 @@
+/* ldap_casa.c
+
@ -156,39 +174,10 @@ diff -up /dev/null dhcp-3.1.0/server/ldap_casa.c
+
+#endif /* LDAP_CASA_AUTH */
+
diff -up dhcp-3.1.0/server/Makefile.dist.ldap dhcp-3.1.0/server/Makefile.dist
--- dhcp-3.1.0/server/Makefile.dist.ldap 2006-07-25 09:26:00.000000000 -0400
+++ dhcp-3.1.0/server/Makefile.dist 2007-11-12 15:41:15.000000000 -0500
@@ -25,14 +25,14 @@
CATMANPAGES = dhcpd.cat8 dhcpd.conf.cat5 dhcpd.leases.cat5
SEDMANPAGES = dhcpd.man8 dhcpd.conf.man5 dhcpd.leases.man5
SRCS = dhcpd.c dhcp.c bootp.c confpars.c db.c class.c failover.c \
- omapi.c mdb.c stables.c salloc.c ddns.c dhcpleasequery.c
+ omapi.c mdb.c stables.c salloc.c ddns.c dhcpleasequery.c ldap.c ldap_casa.c
OBJS = dhcpd.o dhcp.o bootp.o confpars.o db.o class.o failover.o \
- omapi.o mdb.o stables.o salloc.o ddns.o dhcpleasequery.o
+ omapi.o mdb.o stables.o salloc.o ddns.o dhcpleasequery.o ldap.o ldap_casa.o
PROG = dhcpd
MAN = dhcpd.8 dhcpd.conf.5 dhcpd.leases.5
INCLUDES = -I$(TOP) $(BINDINC) -I$(TOP)/includes
-DHCPLIB = ../common/libdhcp.a $(BINDLIB) ../omapip/libomapi.a ../dst/libdst.a
+DHCPLIB = ../common/libdhcp.a $(BINDLIB) ../omapip/libomapi.a ../dst/libdst-nomd5.a
CFLAGS = $(DEBUG) $(PREDEFINES) $(INCLUDES) $(COPTS)
all: $(PROG) $(CATMANPAGES)
@@ -106,6 +106,6 @@ dhcpd.leases.man5: dhcpd.leases.5
-e "s#RUNDIR#$(VARRUN)#g" < dhcpd.leases.5 >dhcpd.leases.man5
dhcpd: $(OBJS) $(COBJ) $(DHCPLIB)
- $(CC) $(LFLAGS) -o dhcpd $(OBJS) $(DHCPLIB) $(LIBS)
+ $(CC) $(LFLAGS) -o dhcpd $(OBJS) $(DHCPLIB) $(LIBS) -lldap
# Dependencies (semi-automatically-generated)
diff -up dhcp-3.1.0/server/dhcpd.c.ldap dhcp-3.1.0/server/dhcpd.c
--- dhcp-3.1.0/server/dhcpd.c.ldap 2007-05-29 13:49:44.000000000 -0400
+++ dhcp-3.1.0/server/dhcpd.c 2007-11-12 15:41:15.000000000 -0500
@@ -440,6 +440,14 @@ int main (argc, argv, envp)
diff -up dhcp-4.0.0/server/dhcpd.c.ldap dhcp-4.0.0/server/dhcpd.c
--- dhcp-4.0.0/server/dhcpd.c.ldap 2007-11-30 11:51:43.000000000 -1000
+++ dhcp-4.0.0/server/dhcpd.c 2008-01-11 17:45:28.000000000 -1000
@@ -505,6 +505,14 @@ main(int argc, char **argv) {
/* Add the ddns update style enumeration prior to parsing. */
add_enumeration (&ddns_styles);
add_enumeration (&syslog_enum);
@ -203,10 +192,10 @@ diff -up dhcp-3.1.0/server/dhcpd.c.ldap dhcp-3.1.0/server/dhcpd.c
if (!group_allocate (&root_group, MDL))
log_fatal ("Can't allocate root group!");
diff -up /dev/null dhcp-3.1.0/server/ldap.c
--- /dev/null 2007-11-12 10:55:50.854093917 -0500
+++ dhcp-3.1.0/server/ldap.c 2007-11-12 17:31:46.000000000 -0500
@@ -0,0 +1,2003 @@
diff -up /dev/null dhcp-4.0.0/server/ldap.c
--- /dev/null 2008-01-11 10:40:59.147013395 -1000
+++ dhcp-4.0.0/server/ldap.c 2008-01-11 17:45:28.000000000 -1000
@@ -0,0 +1,2004 @@
+/* ldap.c
+
+ Routines for reading the configuration from LDAP */
@ -248,6 +237,7 @@ diff -up /dev/null dhcp-3.1.0/server/ldap.c
+
+#include "dhcpd.h"
+#include <signal.h>
+#include <errno.h>
+
+#if defined(LDAP_CONFIGURATION)
+
@ -2210,10 +2200,10 @@ diff -up /dev/null dhcp-3.1.0/server/ldap.c
+}
+
+#endif
diff -up dhcp-3.1.0/server/confpars.c.ldap dhcp-3.1.0/server/confpars.c
--- dhcp-3.1.0/server/confpars.c.ldap 2007-06-28 13:20:40.000000000 -0400
+++ dhcp-3.1.0/server/confpars.c 2007-11-12 15:41:15.000000000 -0500
@@ -63,7 +63,17 @@ void parse_trace_setup ()
diff -up dhcp-4.0.0/server/confpars.c.ldap dhcp-4.0.0/server/confpars.c
--- dhcp-4.0.0/server/confpars.c.ldap 2007-11-30 11:51:43.000000000 -1000
+++ dhcp-4.0.0/server/confpars.c 2008-01-11 17:45:28.000000000 -1000
@@ -60,7 +60,17 @@ void parse_trace_setup ()
isc_result_t readconf ()
{
@ -2232,10 +2222,10 @@ diff -up dhcp-3.1.0/server/confpars.c.ldap dhcp-3.1.0/server/confpars.c
}
isc_result_t read_conf_file (const char *filename, struct group *group,
diff -up dhcp-3.1.0/server/class.c.ldap dhcp-3.1.0/server/class.c
--- dhcp-3.1.0/server/class.c.ldap 2006-06-01 16:23:17.000000000 -0400
+++ dhcp-3.1.0/server/class.c 2007-11-12 15:41:15.000000000 -0500
@@ -90,6 +90,7 @@ int check_collection (packet, lease, col
diff -up dhcp-4.0.0/server/class.c.ldap dhcp-4.0.0/server/class.c
--- dhcp-4.0.0/server/class.c.ldap 2007-09-05 07:32:10.000000000 -1000
+++ dhcp-4.0.0/server/class.c 2008-01-11 17:45:28.000000000 -1000
@@ -84,6 +84,7 @@ int check_collection (packet, lease, col
int matched = 0;
int status;
int ignorep;
@ -2243,7 +2233,7 @@ diff -up dhcp-3.1.0/server/class.c.ldap dhcp-3.1.0/server/class.c
for (class = collection -> classes; class; class = class -> nic) {
#if defined (DEBUG_CLASS_MATCHING)
@@ -135,9 +136,15 @@ int check_collection (packet, lease, col
@@ -129,9 +130,15 @@ int check_collection (packet, lease, col
class -> submatch, MDL));
if (status && data.len) {
nc = (struct class *)0;
@ -2262,54 +2252,54 @@ diff -up dhcp-3.1.0/server/class.c.ldap dhcp-3.1.0/server/class.c
#if defined (DEBUG_CLASS_MATCHING)
log_info ("matches subclass %s.",
print_hex_1 (data.len,
diff -up dhcp-3.1.0/server/stables.c.ldap dhcp-3.1.0/server/stables.c
--- dhcp-3.1.0/server/stables.c.ldap 2007-04-27 18:48:10.000000000 -0400
+++ dhcp-3.1.0/server/stables.c 2007-11-12 15:41:15.000000000 -0500
diff -up dhcp-4.0.0/server/stables.c.ldap dhcp-4.0.0/server/stables.c
--- dhcp-4.0.0/server/stables.c.ldap 2007-11-20 08:34:37.000000000 -1000
+++ dhcp-4.0.0/server/stables.c 2008-01-11 17:45:28.000000000 -1000
@@ -238,9 +238,107 @@ static struct option server_options[] =
{ "adaptive-lease-time-threshold", "B", &server_universe, 50, 1 },
{ "do-reverse-updates", "f", &server_universe, 51, 1 },
{ "fqdn-reply", "f", &server_universe, 52, 1 },
{ "dhcpv6-lease-file-name", "t", &server_universe, 54, 1 },
{ "dhcpv6-pid-file-name", "t", &server_universe, 55, 1 },
{ "limit-addrs-per-ia", "L", &server_universe, 56, 1 },
+#if defined(LDAP_CONFIGURATION)
+ { "ldap-server", "t", &server_universe, 53 },
+ { "ldap-port", "d", &server_universe, 54 },
+ { "ldap-username", "t", &server_universe, 55 },
+ { "ldap-password", "t", &server_universe, 56 },
+ { "ldap-base-dn", "t", &server_universe, 57 },
+ { "ldap-method", "Nldap-methods.", &server_universe, 58 },
+ { "ldap-debug-file", "t", &server_universe, 59 },
+ { "ldap-dhcp-server-cn", "t", &server_universe, 60 },
+ { "ldap-referrals", "f", &server_universe, 61 },
+ { "ldap-server", "t", &server_universe, 57, 1 },
+ { "ldap-port", "d", &server_universe, 58, 1 },
+ { "ldap-username", "t", &server_universe, 59, 1 },
+ { "ldap-password", "t", &server_universe, 60, 1 },
+ { "ldap-base-dn", "t", &server_universe, 61, 1 },
+ { "ldap-method", "Nldap-methods.", &server_universe, 62, 1 },
+ { "ldap-debug-file", "t", &server_universe, 63, 1 },
+ { "ldap-dhcp-server-cn", "t", &server_universe, 64, 1 },
+ { "ldap-referrals", "f", &server_universe, 65, 1 },
+#if defined(USE_SSL)
+ { "ldap-ssl", "Nldap-ssl-usage.", &server_universe, 62 },
+ { "ldap-tls-reqcert", "Nldap-tls-reqcert.", &server_universe, 63 },
+ { "ldap-tls-ca-file", "t", &server_universe, 64 },
+ { "ldap-tls-ca-dir", "t", &server_universe, 65 },
+ { "ldap-tls-cert", "t", &server_universe, 66 },
+ { "ldap-tls-key", "t", &server_universe, 67 },
+ { "ldap-tls-crlcheck", "Nldap-tls-crlcheck.", &server_universe, 68 },
+ { "ldap-tls-ciphers", "t", &server_universe, 69 },
+ { "ldap-tls-randfile", "t", &server_universe, 70 },
+ { "ldap-ssl", "Nldap-ssl-usage.", &server_universe, 66, 1 },
+ { "ldap-tls-reqcert", "Nldap-tls-reqcert.", &server_universe, 67, 1 },
+ { "ldap-tls-ca-file", "t", &server_universe, 68, 1 },
+ { "ldap-tls-ca-dir", "t", &server_universe, 69, 1 },
+ { "ldap-tls-cert", "t", &server_universe, 70, 1 },
+ { "ldap-tls-key", "t", &server_universe, 71, 1 },
+ { "ldap-tls-crlcheck", "Nldap-tls-crlcheck.", &server_universe, 72, 1 },
+ { "ldap-tls-ciphers", "t", &server_universe, 73, 1 },
+ { "ldap-tls-randfile", "t", &server_universe, 74, 1 },
+#else
+ { "unknown-62", "X", &server_universe, 62 },
+ { "unknown-63", "X", &server_universe, 63 },
+ { "unknown-64", "X", &server_universe, 64 },
+ { "unknown-65", "X", &server_universe, 65 },
+ { "unknown-66", "X", &server_universe, 66 },
+ { "unknown-67", "X", &server_universe, 67 },
+ { "unknown-68", "X", &server_universe, 68 },
+ { "unknown-69", "X", &server_universe, 69 },
+ { "unknown-70", "X", &server_universe, 70 },
+ { "unknown-66", "X", &server_universe, 66, 1 },
+ { "unknown-67", "X", &server_universe, 67, 1 },
+ { "unknown-68", "X", &server_universe, 68, 1 },
+ { "unknown-69", "X", &server_universe, 69, 1 },
+ { "unknown-70", "X", &server_universe, 70, 1 },
+ { "unknown-71", "X", &server_universe, 71, 1 },
+ { "unknown-72", "X", &server_universe, 72, 1 },
+ { "unknown-73", "X", &server_universe, 73, 1 },
+ { "unknown-74", "X", &server_universe, 74, 1 },
+#endif
+#else
+ { "unknown-53", "X", &server_universe, 53 },
+ { "unknown-54", "X", &server_universe, 54 },
+ { "unknown-55", "X", &server_universe, 55 },
+ { "unknown-56", "X", &server_universe, 56 },
+ { "unknown-57", "X", &server_universe, 57 },
+ { "unknown-58", "X", &server_universe, 58 },
+ { "unknown-59", "X", &server_universe, 59 },
+ { "unknown-60", "X", &server_universe, 60 },
+ { "unknown-61", "X", &server_universe, 61 },
+ { "unknown-57", "X", &server_universe, 57, 1 },
+ { "unknown-58", "X", &server_universe, 58, 1 },
+ { "unknown-59", "X", &server_universe, 59, 1 },
+ { "unknown-60", "X", &server_universe, 60, 1 },
+ { "unknown-61", "X", &server_universe, 61, 1 },
+ { "unknown-62", "X", &server_universe, 62, 1 },
+ { "unknown-63", "X", &server_universe, 63, 1 },
+ { "unknown-64", "X", &server_universe, 64, 1 },
+ { "unknown-65", "X", &server_universe, 65, 1 },
+#endif
{ NULL, NULL, NULL, 0, 0 }
};
@ -2373,46 +2363,22 @@ diff -up dhcp-3.1.0/server/stables.c.ldap dhcp-3.1.0/server/stables.c
struct enumeration_value ddns_styles_values [] = {
{ "none", 0 },
{ "ad-hoc", 1 },
diff -up dhcp-3.1.0/dst/Makefile.dist.ldap dhcp-3.1.0/dst/Makefile.dist
--- dhcp-3.1.0/dst/Makefile.dist.ldap 2005-03-17 15:15:06.000000000 -0500
+++ dhcp-3.1.0/dst/Makefile.dist 2007-11-12 15:41:15.000000000 -0500
@@ -23,12 +23,13 @@
diff -up dhcp-4.0.0/dst/Makefile.am.ldap dhcp-4.0.0/dst/Makefile.am
--- dhcp-4.0.0/dst/Makefile.am.ldap 2007-05-29 06:32:10.000000000 -1000
+++ dhcp-4.0.0/dst/Makefile.am 2008-01-11 17:45:28.000000000 -1000
@@ -2,7 +2,7 @@ AM_CPPFLAGS = -DMINIRES_LIB -DHMAC_MD5
SRC = dst_support.c dst_api.c hmac_link.c md5_dgst.c base64.c prandom.c
OBJ = dst_support.o dst_api.o hmac_link.o md5_dgst.o base64.o prandom.o
+OBJ_NM5= dst_support.o dst_api.o hmac_link.o base64.o prandom.o
HDRS = dst_internal.h md5.h md5_locl.h
lib_LIBRARIES = libdst.a
INCLUDES = $(BINDINC) -I$(TOP)/includes
CFLAGS = $(DEBUG) $(PREDEFINES) $(INCLUDES) $(COPTS) -DHMAC_MD5 -DMINIRES_LIB
-libdst_a_SOURCES = dst_support.c dst_api.c hmac_link.c md5_dgst.c \
+libdst_a_SOURCES = dst_support.c dst_api.c hmac_link.c \
base64.c prandom.c
-all: libdst.a
+all: libdst.a libdst-nomd5.a
install:
@@ -37,11 +38,16 @@ libdst.a: $(OBJ)
ar cruv libdst.a $(OBJ)
$(RANLIB) libdst.a
+libdst-nomd5.a: $(OBJ_NM5)
+ rm -f libdst-nomd5.a
+ ar cruv libdst-nomd5.a $(OBJ_NM5)
+ $(RANLIB) libdst-nomd5.a
+
depend:
$(MKDEP) $(INCLUDES) $(PREDEFINES) $(SRC)
clean:
- -rm -f $(OBJ) libdst.a
+ -rm -f $(OBJ) libdst.a libdst-nomd5.a
realclean: clean
-rm -f *~ $(CATMANPAGES) $(SEDMANPAGES)
diff -up dhcp-3.1.0/common/print.c.ldap dhcp-3.1.0/common/print.c
--- dhcp-3.1.0/common/print.c.ldap 2007-05-29 13:49:44.000000000 -0400
+++ dhcp-3.1.0/common/print.c 2007-11-12 15:41:15.000000000 -0500
@@ -168,9 +168,9 @@ char *print_base64 (const unsigned char
EXTRA_DIST = dst_internal.h md5.h md5_locl.h
diff -up dhcp-4.0.0/common/print.c.ldap dhcp-4.0.0/common/print.c
--- dhcp-4.0.0/common/print.c.ldap 2007-10-01 04:47:35.000000000 -1000
+++ dhcp-4.0.0/common/print.c 2008-01-11 17:45:28.000000000 -1000
@@ -163,9 +163,9 @@ char *print_base64 (const unsigned char
}
char *print_hw_addr (htype, hlen, data)
@ -2425,56 +2391,46 @@ diff -up dhcp-3.1.0/common/print.c.ldap dhcp-3.1.0/common/print.c
{
static char habuf [49];
char *s;
diff -up dhcp-3.1.0/common/conflex.c.ldap dhcp-3.1.0/common/conflex.c
--- dhcp-3.1.0/common/conflex.c.ldap 2007-05-29 13:49:44.000000000 -0400
+++ dhcp-3.1.0/common/conflex.c 2007-11-12 15:41:15.000000000 -0500
@@ -47,6 +47,7 @@ static enum dhcp_token read_string PROTO
diff -up dhcp-4.0.0/common/conflex.c.ldap dhcp-4.0.0/common/conflex.c
--- dhcp-4.0.0/common/conflex.c.ldap 2007-10-31 09:13:33.000000000 -1000
+++ dhcp-4.0.0/common/conflex.c 2008-01-11 17:45:28.000000000 -1000
@@ -43,6 +43,7 @@ static enum dhcp_token read_string PROTO
static enum dhcp_token read_number PROTO ((int, struct parse *));
static enum dhcp_token read_num_or_name PROTO ((int, struct parse *));
static enum dhcp_token intern PROTO ((unsigned char *, enum dhcp_token));
static enum dhcp_token intern PROTO ((char *, enum dhcp_token));
+static int read_function PROTO ((struct parse *));
isc_result_t new_parse (cfile, file, inbuf, buflen, name, eolp)
struct parse **cfile;
@@ -74,6 +75,10 @@ isc_result_t new_parse (cfile, file, inb
tmp -> file = file;
tmp -> eol_token = eolp;
@@ -76,6 +77,10 @@ isc_result_t new_parse (cfile, file, inb
tmp->file = file;
tmp->eol_token = eolp;
+ if (file != -1) {
+ tmp -> read_function = read_function;;
+ tmp -> read_function = read_function;
+ }
+
tmp -> bufix = 0;
tmp -> buflen = buflen;
if (inbuf) {
@@ -113,22 +118,11 @@ static int get_char (cfile)
if (inbuf != NULL) {
tmp->inbuf = inbuf;
tmp->buflen = buflen;
@@ -170,9 +175,13 @@ static int get_char (cfile)
/* My kingdom for WITH... */
int c;
if (cfile -> bufix == cfile -> buflen) {
- if (cfile -> file != -1) {
- cfile -> buflen =
- read (cfile -> file,
- cfile -> inbuf, cfile -> bufsiz);
- if (cfile -> buflen == 0) {
- c = EOF;
- cfile -> bufix = 0;
- } else if (cfile -> buflen < 0) {
- c = EOF;
- cfile -> bufix = cfile -> buflen = 0;
- } else {
- c = cfile -> inbuf [0];
- cfile -> bufix = 1;
- }
- } else
- if (cfile->bufix == cfile->buflen)
- c = EOF;
- else {
+ if (cfile->bufix == cfile->buflen) {
+ if (cfile -> read_function) {
+ c = cfile -> read_function (cfile);
+ } else {
c = EOF;
+ c = EOF;
+ }
} else {
c = cfile -> inbuf [cfile -> bufix];
cfile -> bufix++;
@@ -1213,3 +1207,23 @@ static enum dhcp_token intern (atom, dfv
+ } else {
c = cfile->inbuf [cfile->bufix];
cfile->bufix++;
}
@@ -1415,3 +1424,23 @@ intern(char *atom, enum dhcp_token dfv)
}
return dfv;
}
@ -2498,10 +2454,10 @@ diff -up dhcp-3.1.0/common/conflex.c.ldap dhcp-3.1.0/common/conflex.c
+
+ return c;
+}
diff -up dhcp-3.1.0/includes/dhcpd.h.ldap dhcp-3.1.0/includes/dhcpd.h
--- dhcp-3.1.0/includes/dhcpd.h.ldap 2007-05-29 13:49:44.000000000 -0400
+++ dhcp-3.1.0/includes/dhcpd.h 2007-11-12 15:41:15.000000000 -0500
@@ -81,6 +81,11 @@ typedef struct hash_table class_hash_t;
diff -up dhcp-4.0.0/includes/dhcpd.h.ldap dhcp-4.0.0/includes/dhcpd.h
--- dhcp-4.0.0/includes/dhcpd.h.ldap 2007-12-08 09:36:00.000000000 -1000
+++ dhcp-4.0.0/includes/dhcpd.h 2008-01-11 17:45:28.000000000 -1000
@@ -101,6 +101,11 @@ typedef time_t TIME;
#include <isc-dhcp/result.h>
#include <omapip/omapip_p.h>
@ -2511,18 +2467,18 @@ diff -up dhcp-3.1.0/includes/dhcpd.h.ldap dhcp-3.1.0/includes/dhcpd.h
+#endif
+
#if !defined (BYTE_NAME_HASH_SIZE)
# define BYTE_NAME_HASH_SIZE 401 /* Default would be rediculous. */
# define BYTE_NAME_HASH_SIZE 401 /* Default would be ridiculous. */
#endif
@@ -251,6 +256,8 @@ struct parse {
char *inbuf;
unsigned bufix, buflen;
unsigned bufsiz;
@@ -290,6 +295,8 @@ struct parse {
size_t bufsiz;
struct parse *saved_state;
+
+ int (*read_function) (struct parse *);
};
/* Variable-length array of data. */
@@ -362,6 +369,32 @@ struct hardware {
@@ -421,6 +428,32 @@ struct hardware {
u_int8_t hbuf [17];
};
@ -2555,27 +2511,27 @@ diff -up dhcp-3.1.0/includes/dhcpd.h.ldap dhcp-3.1.0/includes/dhcpd.h
typedef enum {
server_startup = 0,
server_running = 1,
@@ -558,6 +591,29 @@ struct lease_state {
@@ -626,6 +659,29 @@ struct lease_state {
# define DEFAULT_PING_TIMEOUT 1
#endif
+#if defined(LDAP_CONFIGURATION)
+# define SV_LDAP_SERVER 47
+# define SV_LDAP_PORT 48
+# define SV_LDAP_USERNAME 49
+# define SV_LDAP_PASSWORD 50
+# define SV_LDAP_BASE_DN 51
+# define SV_LDAP_METHOD 52
+# define SV_LDAP_DEBUG_FILE 53
+# define SV_LDAP_SERVER 47
+# define SV_LDAP_PORT 48
+# define SV_LDAP_USERNAME 49
+# define SV_LDAP_PASSWORD 50
+# define SV_LDAP_BASE_DN 51
+# define SV_LDAP_METHOD 52
+# define SV_LDAP_DEBUG_FILE 53
+# define SV_LDAP_DHCP_SERVER_CN 54
+# define SV_LDAP_REFERRALS 55
+# define SV_LDAP_REFERRALS 55
+#if defined (USE_SSL)
+# define SV_LDAP_SSL 56
+# define SV_LDAP_SSL 56
+# define SV_LDAP_TLS_REQCERT 57
+# define SV_LDAP_TLS_CA_FILE 58
+# define SV_LDAP_TLS_CA_DIR 59
+# define SV_LDAP_TLS_CERT 60
+# define SV_LDAP_TLS_KEY 61
+# define SV_LDAP_TLS_CA_DIR 59
+# define SV_LDAP_TLS_CERT 60
+# define SV_LDAP_TLS_KEY 61
+# define SV_LDAP_TLS_CRLCHECK 62
+# define SV_LDAP_TLS_CIPHERS 63
+# define SV_LDAP_TLS_RANDFILE 64
@ -2585,7 +2541,7 @@ diff -up dhcp-3.1.0/includes/dhcpd.h.ldap dhcp-3.1.0/includes/dhcpd.h
#if !defined (DEFAULT_DEFAULT_LEASE_TIME)
# define DEFAULT_DEFAULT_LEASE_TIME 43200
#endif
@@ -1702,7 +1758,7 @@ extern int db_time_format;
@@ -2035,7 +2091,7 @@ extern int db_time_format;
char *quotify_string (const char *, const char *, int);
char *quotify_buf (const unsigned char *, unsigned, const char *, int);
char *print_base64 (const unsigned char *, unsigned, const char *, int);
@ -2594,11 +2550,10 @@ diff -up dhcp-3.1.0/includes/dhcpd.h.ldap dhcp-3.1.0/includes/dhcpd.h
void print_lease PROTO ((struct lease *));
void dump_raw PROTO ((const unsigned char *, unsigned));
void dump_packet_option (struct option_cache *, struct packet *,
@@ -2812,3 +2868,18 @@ OMAPI_OBJECT_ALLOC_DECL (dhcp_failover_l
#endif /* FAILOVER_PROTOCOL */
@@ -3158,6 +3214,20 @@ OMAPI_OBJECT_ALLOC_DECL (dhcp_failover_l
const char *binding_state_print (enum failover_state);
+
+/* ldap.c */
+#if defined(LDAP_CONFIGURATION)
+extern struct enumeration ldap_methods;
@ -2613,10 +2568,13 @@ diff -up dhcp-3.1.0/includes/dhcpd.h.ldap dhcp-3.1.0/includes/dhcpd.h
+int find_subclass_in_ldap (struct class *, struct class **,
+ struct data_string *);
+#endif
diff -up dhcp-3.1.0/includes/site.h.ldap dhcp-3.1.0/includes/site.h
--- dhcp-3.1.0/includes/site.h.ldap 2006-07-31 18:19:51.000000000 -0400
+++ dhcp-3.1.0/includes/site.h 2007-11-12 15:41:15.000000000 -0500
@@ -183,3 +183,18 @@
/* mdb6.c */
HASH_FUNCTIONS_DECL(ia_na, unsigned char *, struct ia_na, ia_na_hash_t);
diff -up dhcp-4.0.0/includes/site.h.ldap dhcp-4.0.0/includes/site.h
--- dhcp-4.0.0/includes/site.h.ldap 2006-07-31 12:19:51.000000000 -1000
+++ dhcp-4.0.0/includes/site.h 2008-01-11 17:45:28.000000000 -1000
@@ -183,3 +183,13 @@
traces. */
#define TRACING
@ -2630,14 +2588,9 @@ diff -up dhcp-3.1.0/includes/site.h.ldap dhcp-3.1.0/includes/site.h
+ to add -lcrypto -lssl to the LIBS= line of server/Makefile */
+
+#define USE_SSL
+
+#define _PATH_DHCPD_DB "/var/lib/dhcpd/dhcpd.leases"
+#define _PATH_DHCLIENT_DB "/var/lib/dhclient/dhclient.leases"
+#define _PATH_DHCPD_DB "/var/lib/dhcpd/dhcpd.leases"
+#define _PATH_DHCLIENT_DB "/var/lib/dhclient/dhclient.leases"
diff -up /dev/null dhcp-3.1.0/includes/ldap_casa.h
--- /dev/null 2007-11-12 10:55:50.854093917 -0500
+++ dhcp-3.1.0/includes/ldap_casa.h 2007-11-12 15:41:15.000000000 -0500
diff -up /dev/null dhcp-4.0.0/includes/ldap_casa.h
--- /dev/null 2008-01-11 10:40:59.147013395 -1000
+++ dhcp-4.0.0/includes/ldap_casa.h 2008-01-11 17:45:28.000000000 -1000
@@ -0,0 +1,83 @@
+/* ldap_casa.h
+

View File

@ -1,21 +1,89 @@
diff -up dhcp-3.1.0/omapip/dispatch.c.libdhcp4client dhcp-3.1.0/omapip/dispatch.c
--- dhcp-3.1.0/omapip/dispatch.c.libdhcp4client 2005-03-17 15:15:21.000000000 -0500
+++ dhcp-3.1.0/omapip/dispatch.c 2007-10-24 14:55:56.000000000 -0400
@@ -34,7 +34,7 @@
diff -up dhcp-4.0.0/configure.ac.libdhcp4client dhcp-4.0.0/configure.ac
--- dhcp-4.0.0/configure.ac.libdhcp4client 2007-12-14 08:24:56.000000000 -1000
+++ dhcp-4.0.0/configure.ac 2008-01-12 17:19:29.000000000 -1000
@@ -1,5 +1,32 @@
AC_INIT([DHCP], [4.0.0], [dhcp-users@isc.org])
+dnl Versioning
+dnl (from glib's configure.in ...)
+dnl Making releases:
+dnl DHCP_MICRO_VERSION += 1;
+dnl DHCP_INTERFACE_AGE += 1;
+dnl DHCP_BINARY_AGE += 1;
+dnl if any functions have been added, set DHCP_INTERFACE_AGE to 0.
+dnl if backwards compatibility has been broken (e.g., functions removed,
+dnl function signatures changed),
+dnl set DHCP_BINARY_AGE and DHCP_INTERFACE_AGE to 0.
+DHCP_MAJOR_VERSION=4
+DHCP_MINOR_VERSION=0
+DHCP_MICRO_VERSION=0
+DHCP_INTERFACE_AGE=0
+DHCP_BINARY_AGE=0
+DHCP_VERSION_SUFFIX=
+DHCP_VERSION=$DHCP_MAJOR_VERSION.$DHCP_MINOR_VERSION.$DHCP_MICRO_VERSION$DHCP_VERSION_SUFFIX
+
+LT_RELEASE=$DHCP_MAJOR_VERSION.$DHCP_MINOR_VERSION
+LT_CURRENT=`expr $DHCP_MICRO_VERSION - $DHCP_INTERFACE_AGE`
+LT_REVISION=$DHCP_INTERFACE_AGE
+AC_SUBST(DHCP_VERSION)
+AC_SUBST(LT_RELEASE)
+AC_SUBST(LT_CURRENT)
+AC_SUBST(LT_REVISION)
+AC_SUBST(LT_AGE)
+
# we specify "foreign" to avoid having to have the GNU mandated files,
# like AUTHORS, COPYING, and such
AM_INIT_AUTOMAKE([foreign])
@@ -20,7 +47,8 @@ if test "$GCC" = "yes"; then
fi
fi
-AC_PROG_RANLIB
+AC_PROG_LIBTOOL
+
AC_CONFIG_HEADERS([includes/config.h])
# we sometimes need to know byte order for building packets
diff -up dhcp-4.0.0/omapip/Makefile.am.libdhcp4client dhcp-4.0.0/omapip/Makefile.am
--- dhcp-4.0.0/omapip/Makefile.am.libdhcp4client 2007-05-29 06:32:11.000000000 -1000
+++ dhcp-4.0.0/omapip/Makefile.am 2008-01-12 17:19:29.000000000 -1000
@@ -1,10 +1,18 @@
lib_LIBRARIES = libomapi.a
+noinst_LIBRARIES = libomapiLIBDHCP.a
noinst_PROGRAMS = svtest
libomapi_a_SOURCES = protocol.c buffer.c alloc.c result.c connection.c \
errwarn.c listener.c dispatch.c generic.c support.c \
handle.c message.c convert.c hash.c auth.c inet_addr.c \
array.c trace.c mrtrace.c toisc.c iscprint.c
+
+libomapiLIBDHCP_a_CFLAGS = -DLIBDHCP
+libomapiLIBDHCP_a_SOURCES = alloc.c array.c auth.c buffer.c connection.c \
+ convert.c dispatch.c errwarn.c handle.c hash.c listener.c \
+ mrtrace.c result.c support.c toisc.c trace.c generic.c message.c \
+ protocol.c
+
man_MANS = omapi.3
EXTRA_DIST = $(man_MANS)
diff -up dhcp-4.0.0/omapip/dispatch.c.libdhcp4client dhcp-4.0.0/omapip/dispatch.c
--- dhcp-4.0.0/omapip/dispatch.c.libdhcp4client 2007-11-30 11:51:43.000000000 -1000
+++ dhcp-4.0.0/omapip/dispatch.c 2008-01-12 17:19:29.000000000 -1000
@@ -37,7 +37,7 @@
#include <omapip/omapip_p.h>
#include <sys/time.h>
-static omapi_io_object_t omapi_io_states;
+omapi_io_object_t omapi_io_states;
TIME cur_time;
time_t cur_time;
OMAPI_OBJECT_ALLOC (omapi_io,
diff -up dhcp-3.1.0/omapip/errwarn.c.libdhcp4client dhcp-3.1.0/omapip/errwarn.c
--- dhcp-3.1.0/omapip/errwarn.c.libdhcp4client 2007-10-24 14:55:56.000000000 -0400
+++ dhcp-3.1.0/omapip/errwarn.c 2007-10-24 14:57:16.000000000 -0400
@@ -39,6 +39,11 @@ static char copyright[] =
#include <omapip/omapip_p.h>
diff -up dhcp-4.0.0/omapip/errwarn.c.libdhcp4client dhcp-4.0.0/omapip/errwarn.c
--- dhcp-4.0.0/omapip/errwarn.c.libdhcp4client 2008-01-12 17:19:29.000000000 -1000
+++ dhcp-4.0.0/omapip/errwarn.c 2008-01-12 17:19:29.000000000 -1000
@@ -37,6 +37,11 @@
#include <errno.h>
#include <syslog.h>
+#ifdef LIBDHCP
+#include <isc-dhcp/libdhcp_control.h>
@ -25,7 +93,7 @@ diff -up dhcp-3.1.0/omapip/errwarn.c.libdhcp4client dhcp-3.1.0/omapip/errwarn.c
#ifdef DEBUG
int log_perror = -1;
#else
@@ -48,7 +53,9 @@ int log_priority;
@@ -46,7 +51,9 @@ int log_priority;
void (*log_cleanup) (void);
#define CVT_BUF_MAX 1023
@ -35,7 +103,7 @@ diff -up dhcp-3.1.0/omapip/errwarn.c.libdhcp4client dhcp-3.1.0/omapip/errwarn.c
static char fbuf [CVT_BUF_MAX + 1];
/* Log an error message, then exit... */
@@ -58,6 +65,16 @@ void log_fatal (const char * fmt, ... )
@@ -56,6 +63,16 @@ void log_fatal (const char * fmt, ... )
va_list list;
do_percentm (fbuf, fmt);
@ -52,7 +120,7 @@ diff -up dhcp-3.1.0/omapip/errwarn.c.libdhcp4client dhcp-3.1.0/omapip/errwarn.c
/* %Audit% This is log output. %2004.06.17,Safe%
* If we truncate we hope the user can get a hint from the log.
@@ -91,6 +108,7 @@ void log_fatal (const char * fmt, ... )
@@ -89,6 +106,7 @@ void log_fatal (const char * fmt, ... )
if (log_cleanup)
(*log_cleanup) ();
exit (1);
@ -60,7 +128,7 @@ diff -up dhcp-3.1.0/omapip/errwarn.c.libdhcp4client dhcp-3.1.0/omapip/errwarn.c
}
/* Log an error message... */
@@ -101,6 +119,13 @@ int log_error (const char * fmt, ...)
@@ -99,6 +117,13 @@ int log_error (const char * fmt, ...)
do_percentm (fbuf, fmt);
@ -74,7 +142,7 @@ diff -up dhcp-3.1.0/omapip/errwarn.c.libdhcp4client dhcp-3.1.0/omapip/errwarn.c
/* %Audit% This is log output. %2004.06.17,Safe%
* If we truncate we hope the user can get a hint from the log.
*/
@@ -116,7 +141,7 @@ int log_error (const char * fmt, ...)
@@ -114,7 +139,7 @@ int log_error (const char * fmt, ...)
write (STDERR_FILENO, mbuf, strlen (mbuf));
write (STDERR_FILENO, "\n", 1);
}
@ -83,7 +151,7 @@ diff -up dhcp-3.1.0/omapip/errwarn.c.libdhcp4client dhcp-3.1.0/omapip/errwarn.c
return 0;
}
@@ -128,6 +153,13 @@ int log_info (const char *fmt, ...)
@@ -126,6 +151,13 @@ int log_info (const char *fmt, ...)
do_percentm (fbuf, fmt);
@ -97,7 +165,7 @@ diff -up dhcp-3.1.0/omapip/errwarn.c.libdhcp4client dhcp-3.1.0/omapip/errwarn.c
/* %Audit% This is log output. %2004.06.17,Safe%
* If we truncate we hope the user can get a hint from the log.
*/
@@ -143,7 +175,7 @@ int log_info (const char *fmt, ...)
@@ -141,7 +173,7 @@ int log_info (const char *fmt, ...)
write (STDERR_FILENO, mbuf, strlen (mbuf));
write (STDERR_FILENO, "\n", 1);
}
@ -106,7 +174,7 @@ diff -up dhcp-3.1.0/omapip/errwarn.c.libdhcp4client dhcp-3.1.0/omapip/errwarn.c
return 0;
}
@@ -154,7 +186,13 @@ int log_debug (const char *fmt, ...)
@@ -152,7 +184,13 @@ int log_debug (const char *fmt, ...)
va_list list;
do_percentm (fbuf, fmt);
@ -121,7 +189,7 @@ diff -up dhcp-3.1.0/omapip/errwarn.c.libdhcp4client dhcp-3.1.0/omapip/errwarn.c
/* %Audit% This is log output. %2004.06.17,Safe%
* If we truncate we hope the user can get a hint from the log.
*/
@@ -170,7 +208,7 @@ int log_debug (const char *fmt, ...)
@@ -168,7 +206,7 @@ int log_debug (const char *fmt, ...)
write (STDERR_FILENO, mbuf, strlen (mbuf));
write (STDERR_FILENO, "\n", 1);
}
@ -130,10 +198,10 @@ diff -up dhcp-3.1.0/omapip/errwarn.c.libdhcp4client dhcp-3.1.0/omapip/errwarn.c
return 0;
}
diff -up dhcp-3.1.0/omapip/alloc.c.libdhcp4client dhcp-3.1.0/omapip/alloc.c
--- dhcp-3.1.0/omapip/alloc.c.libdhcp4client 2006-02-24 18:16:30.000000000 -0500
+++ dhcp-3.1.0/omapip/alloc.c 2007-10-24 14:55:56.000000000 -0400
@@ -40,6 +40,33 @@ static char copyright[] =
diff -up dhcp-4.0.0/omapip/alloc.c.libdhcp4client dhcp-4.0.0/omapip/alloc.c
--- dhcp-4.0.0/omapip/alloc.c.libdhcp4client 2007-07-12 20:43:42.000000000 -1000
+++ dhcp-4.0.0/omapip/alloc.c 2008-01-12 17:19:29.000000000 -1000
@@ -37,6 +37,33 @@
#include <omapip/omapip_p.h>
@ -167,8 +235,8 @@ diff -up dhcp-3.1.0/omapip/alloc.c.libdhcp4client dhcp-3.1.0/omapip/alloc.c
#if defined (DEBUG_MEMORY_LEAKAGE) || defined (DEBUG_MALLOC_POOL) || \
defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
struct dmalloc_preamble *dmalloc_list;
@@ -78,7 +105,9 @@ VOIDPTR dmalloc (size, file, line)
return (VOIDPTR)0;
@@ -72,7 +99,9 @@ dmalloc(unsigned size, const char *file,
return NULL;
foo = malloc(len);
-
@ -176,9 +244,9 @@ diff -up dhcp-3.1.0/omapip/alloc.c.libdhcp4client dhcp-3.1.0/omapip/alloc.c
+ record_pointer(foo);
+#endif
if (!foo)
return (VOIDPTR)0;
bar = (VOIDPTR)(foo + DMDOFFSET);
@@ -200,6 +229,9 @@ void dfree (ptr, file, line)
return NULL;
bar = (void *)(foo + DMDOFFSET);
@@ -191,6 +220,9 @@ dfree(void *ptr, const char *file, int l
0, (unsigned char *)ptr + DMDOFFSET, 0, 1, RC_MALLOC);
#endif
free (ptr);
@ -188,22 +256,27 @@ diff -up dhcp-3.1.0/omapip/alloc.c.libdhcp4client dhcp-3.1.0/omapip/alloc.c
}
#if defined (DEBUG_MEMORY_LEAKAGE) || defined (DEBUG_MALLOC_POOL) || \
diff -up dhcp-3.1.0/configure.libdhcp4client dhcp-3.1.0/configure
--- dhcp-3.1.0/configure.libdhcp4client 2005-03-17 15:14:55.000000000 -0500
+++ dhcp-3.1.0/configure 2007-10-24 14:55:56.000000000 -0400
@@ -246,7 +246,7 @@ if [ ! -d $workname ]; then
fi
diff -up dhcp-4.0.0/dst/Makefile.am.libdhcp4client dhcp-4.0.0/dst/Makefile.am
--- dhcp-4.0.0/dst/Makefile.am.libdhcp4client 2008-01-12 17:19:29.000000000 -1000
+++ dhcp-4.0.0/dst/Makefile.am 2008-01-12 17:19:29.000000000 -1000
@@ -2,7 +2,13 @@ AM_CPPFLAGS = -DMINIRES_LIB -DHMAC_MD5
if [ x"$dirs" = x ]; then
- dirs=". client server relay common omapip dhcpctl minires dst"
+ dirs=". client server relay common omapip dhcpctl minires dst libdhcp4client"
fi
lib_LIBRARIES = libdst.a
for foo in $dirs; do
diff -up dhcp-3.1.0/dst/hmac_link.c.libdhcp4client dhcp-3.1.0/dst/hmac_link.c
--- dhcp-3.1.0/dst/hmac_link.c.libdhcp4client 2001-02-22 02:22:08.000000000 -0500
+++ dhcp-3.1.0/dst/hmac_link.c 2007-10-24 14:55:56.000000000 -0400
@@ -38,6 +38,10 @@ static const char rcsid[] = "$Header: /p
+noinst_LIBRARIES = libdstLIBDHCP.a
+
libdst_a_SOURCES = dst_support.c dst_api.c hmac_link.c \
base64.c prandom.c
+libdstLIBDHCP_a_CFLAGS = -DLIBDHCP
+libdstLIBDHCP_a_SOURCES = dst_support.c dst_api.c hmac_link.c \
+ base64.c prandom.c
+
EXTRA_DIST = dst_internal.h md5.h md5_locl.h
diff -up dhcp-4.0.0/dst/hmac_link.c.libdhcp4client dhcp-4.0.0/dst/hmac_link.c
--- dhcp-4.0.0/dst/hmac_link.c.libdhcp4client 2007-12-05 14:50:22.000000000 -1000
+++ dhcp-4.0.0/dst/hmac_link.c 2008-01-12 17:19:29.000000000 -1000
@@ -39,6 +39,10 @@ static const char rcsid[] = "$Header: /p
#include "dst_internal.h"
@ -214,7 +287,7 @@ diff -up dhcp-3.1.0/dst/hmac_link.c.libdhcp4client dhcp-3.1.0/dst/hmac_link.c
#ifdef USE_MD5
# include "md5.h"
# ifndef _MD5_H_
@@ -86,7 +90,11 @@ dst_hmac_md5_sign(const int mode, DST_KE
@@ -87,7 +91,11 @@ dst_hmac_md5_sign(const int mode, DST_KE
MD5_CTX *ctx = NULL;
if (mode & SIG_MODE_INIT)
@ -226,7 +299,7 @@ diff -up dhcp-3.1.0/dst/hmac_link.c.libdhcp4client dhcp-3.1.0/dst/hmac_link.c
else if (context)
ctx = (MD5_CTX *) *context;
if (ctx == NULL)
@@ -153,7 +161,11 @@ dst_hmac_md5_verify(const int mode, DST_
@@ -154,7 +162,11 @@ dst_hmac_md5_verify(const int mode, DST_
MD5_CTX *ctx = NULL;
if (mode & SIG_MODE_INIT)
@ -238,7 +311,7 @@ diff -up dhcp-3.1.0/dst/hmac_link.c.libdhcp4client dhcp-3.1.0/dst/hmac_link.c
else if (context)
ctx = (MD5_CTX *) *context;
if (ctx == NULL)
@@ -217,8 +229,11 @@ dst_buffer_to_hmac_md5(DST_KEY *dkey, co
@@ -218,8 +230,11 @@ dst_buffer_to_hmac_md5(DST_KEY *dkey, co
if (dkey == NULL || key == NULL || keylen < 0)
return (-1);
@ -251,7 +324,7 @@ diff -up dhcp-3.1.0/dst/hmac_link.c.libdhcp4client dhcp-3.1.0/dst/hmac_link.c
return (-2);
memset(hkey->hk_ipad, 0, sizeof(hkey->hk_ipad));
@@ -347,7 +362,11 @@ dst_hmac_md5_key_from_file_format(DST_KE
@@ -348,7 +363,11 @@ dst_hmac_md5_key_from_file_format(DST_KE
if (eol == NULL)
return (-4);
len = eol - p;
@ -263,7 +336,7 @@ diff -up dhcp-3.1.0/dst/hmac_link.c.libdhcp4client dhcp-3.1.0/dst/hmac_link.c
memcpy(tmp, p, len);
*(tmp + len) = 0x0;
key_len = b64_pton((char *)tmp, key, HMAC_LEN+1); /* see above */
@@ -439,8 +458,11 @@ dst_hmac_md5_generate_key(DST_KEY *key,
@@ -440,8 +459,11 @@ dst_hmac_md5_generate_key(DST_KEY *key,
return(0);
len = size > 64 ? 64 : size;
@ -276,7 +349,7 @@ diff -up dhcp-3.1.0/dst/hmac_link.c.libdhcp4client dhcp-3.1.0/dst/hmac_link.c
n = dst_random(DST_RAND_SEMI, len, buff);
n += dst_random(DST_RAND_KEY, len, buff);
if (n <= len) { /* failed getting anything */
@@ -463,7 +485,11 @@ dst_hmac_md5_init()
@@ -464,7 +486,11 @@ dst_hmac_md5_init()
{
if (dst_t_func[KEY_HMAC_MD5] != NULL)
return (1);
@ -288,10 +361,32 @@ diff -up dhcp-3.1.0/dst/hmac_link.c.libdhcp4client dhcp-3.1.0/dst/hmac_link.c
if (dst_t_func[KEY_HMAC_MD5] == NULL)
return (0);
memset(dst_t_func[KEY_HMAC_MD5], 0, sizeof(struct dst_func));
diff -up dhcp-3.1.0/common/discover.c.libdhcp4client dhcp-3.1.0/common/discover.c
--- dhcp-3.1.0/common/discover.c.libdhcp4client 2006-11-07 18:41:39.000000000 -0500
+++ dhcp-3.1.0/common/discover.c 2007-10-24 14:55:56.000000000 -0400
@@ -121,6 +121,10 @@ isc_result_t interface_initialize (omapi
diff -up dhcp-4.0.0/common/Makefile.am.libdhcp4client dhcp-4.0.0/common/Makefile.am
--- dhcp-4.0.0/common/Makefile.am.libdhcp4client 2007-11-16 01:04:11.000000000 -1000
+++ dhcp-4.0.0/common/Makefile.am 2008-01-12 17:19:29.000000000 -1000
@@ -1,11 +1,17 @@
AM_CPPFLAGS = -I.. -DLOCALSTATEDIR='"@localstatedir@"'
-noinst_LIBRARIES = libdhcp.a
+noinst_LIBRARIES = libdhcp.a libdhcpLIBDHCP.a
libdhcp_a_SOURCES = alloc.c bpf.c comapi.c conflex.c ctrace.c discover.c \
dispatch.c dlpi.c dns.c ethernet.c execute.c fddi.c \
icmp.c inet.c lpf.c memory.c nit.c options.c packet.c \
parse.c print.c raw.c resolv.c socket.c tables.c tr.c \
tree.c upf.c heap.c
+libdhcpLIBDHCP_a_CFLAGS = -DLIBDHCP
+libdhcpLIBDHCP_a_SOURCES = alloc.c bpf.c comapi.c conflex.c ctrace.c \
+ discover.c dispatch.c dlpi.c dns.c ethernet.c \
+ execute.c inet.c lpf.c memory.c nit.c options.c \
+ packet.c parse.c print.c resolv.c socket.c \
+ tables.c tr.c tree.c upf.c
man_MANS = dhcp-eval.5 dhcp-options.5
EXTRA_DIST = $(man_MANS)
diff -up dhcp-4.0.0/common/discover.c.libdhcp4client dhcp-4.0.0/common/discover.c
--- dhcp-4.0.0/common/discover.c.libdhcp4client 2007-10-05 12:29:51.000000000 -1000
+++ dhcp-4.0.0/common/discover.c 2008-01-12 17:19:29.000000000 -1000
@@ -883,6 +883,10 @@ add_ipv6_addr_to_interface(struct interf
register that interface with the network I/O software, figure out what
subnet it's on, and add it to the list of interfaces. */
@ -299,50 +394,50 @@ diff -up dhcp-3.1.0/common/discover.c.libdhcp4client dhcp-3.1.0/common/discover.
+int have_setup_fallback = 0;
+#endif
+
void discover_interfaces (state)
int state;
{
@@ -141,7 +145,9 @@ void discover_interfaces (state)
char *s;
#endif
void
discover_interfaces(int state) {
struct iface_conf_list ifaces;
@@ -902,7 +906,9 @@ discover_interfaces(int state) {
isc_result_t status;
int wifcount = 0;
+#ifndef LIBDHCP
static int setup_fallback = 0;
+#endif
int wifcount = 0;
/* Create an unbound datagram socket to do the SIOCGIFADDR ioctl on. */
@@ -695,10 +701,17 @@ void discover_interfaces (state)
if (!begin_iface_scan(&ifaces)) {
log_fatal("Can't get list of interfaces.");
@@ -1242,10 +1248,17 @@ discover_interfaces(int state) {
log_fatal ("Not configured to listen on any interfaces!");
}
+#ifdef LIBDHCP
+ if (!have_setup_fallback) {
+ if ((local_family == AF_INET) && !have_setup_fallback) {
+ have_setup_fallback = 1;
+ maybe_setup_fallback ();
+ }
+#else
if (!setup_fallback) {
if ((local_family == AF_INET) && !setup_fallback) {
setup_fallback = 1;
maybe_setup_fallback ();
maybe_setup_fallback();
}
+#endif
#if defined (HAVE_SETFD)
#if defined (F_SETFD)
if (fallback_interface) {
diff -up dhcp-3.1.0/common/tree.c.libdhcp4client dhcp-3.1.0/common/tree.c
--- dhcp-3.1.0/common/tree.c.libdhcp4client 2007-02-14 17:41:22.000000000 -0500
+++ dhcp-3.1.0/common/tree.c 2007-10-24 14:55:56.000000000 -0400
@@ -41,7 +41,7 @@ static char copyright[] =
#include <omapip/omapip_p.h>
#include <ctype.h>
diff -up dhcp-4.0.0/common/tree.c.libdhcp4client dhcp-4.0.0/common/tree.c
--- dhcp-4.0.0/common/tree.c.libdhcp4client 2007-08-22 03:41:37.000000000 -1000
+++ dhcp-4.0.0/common/tree.c 2008-01-12 17:19:29.000000000 -1000
@@ -41,7 +41,7 @@
# include <regex.h>
#endif
-struct binding_scope *global_scope;
+struct binding_scope __attribute__ ((visibility ("default"))) *global_scope;
static int do_host_lookup PROTO ((struct data_string *,
struct dns_host_entry *));
@@ -2761,6 +2761,7 @@ int evaluate_numeric_expression (result,
@@ -2859,6 +2859,7 @@ int evaluate_numeric_expression (result,
result of that evaluation. There should never be both an expression
and a valid data_string. */
@ -350,21 +445,21 @@ diff -up dhcp-3.1.0/common/tree.c.libdhcp4client dhcp-3.1.0/common/tree.c
int evaluate_option_cache (result, packet, lease, client_state,
in_options, cfg_options, scope, oc, file, line)
struct data_string *result;
diff -up dhcp-3.1.0/common/options.c.libdhcp4client dhcp-3.1.0/common/options.c
--- dhcp-3.1.0/common/options.c.libdhcp4client 2007-05-23 15:26:22.000000000 -0400
+++ dhcp-3.1.0/common/options.c 2007-10-24 14:55:56.000000000 -0400
@@ -2501,6 +2501,7 @@ int fqdn_option_space_encapsulate (resul
return 1;
diff -up dhcp-4.0.0/common/options.c.libdhcp4client dhcp-4.0.0/common/options.c
--- dhcp-4.0.0/common/options.c.libdhcp4client 2007-11-30 11:51:43.000000000 -1000
+++ dhcp-4.0.0/common/options.c 2008-01-12 17:19:29.000000000 -1000
@@ -3392,6 +3392,7 @@ fqdn6_universe_decode(struct option_stat
return 0;
}
+__attribute__ ((visibility ("default")))
void option_space_foreach (struct packet *packet, struct lease *lease,
struct client_state *client_state,
struct option_state *in_options,
diff -up dhcp-3.1.0/common/dispatch.c.libdhcp4client dhcp-3.1.0/common/dispatch.c
--- dhcp-3.1.0/common/dispatch.c.libdhcp4client 2007-10-24 14:55:56.000000000 -0400
+++ dhcp-3.1.0/common/dispatch.c 2007-10-24 14:55:56.000000000 -0400
@@ -39,8 +39,24 @@ static char copyright[] =
diff -up dhcp-4.0.0/common/dispatch.c.libdhcp4client dhcp-4.0.0/common/dispatch.c
--- dhcp-4.0.0/common/dispatch.c.libdhcp4client 2008-01-12 17:19:29.000000000 -1000
+++ dhcp-4.0.0/common/dispatch.c 2008-01-12 17:19:29.000000000 -1000
@@ -34,8 +34,24 @@
#include "dhcpd.h"
@ -391,7 +486,7 @@ diff -up dhcp-3.1.0/common/dispatch.c.libdhcp4client dhcp-3.1.0/common/dispatch.
void set_time(TIME t)
{
@@ -53,9 +69,41 @@ void set_time(TIME t)
@@ -48,9 +64,41 @@ void set_time(TIME t)
struct timeval *process_outstanding_timeouts (struct timeval *tvp)
{
@ -433,7 +528,7 @@ diff -up dhcp-3.1.0/common/dispatch.c.libdhcp4client dhcp-3.1.0/common/dispatch.
another:
if (timeouts) {
struct timeout *t;
@@ -73,9 +121,15 @@ struct timeval *process_outstanding_time
@@ -68,9 +116,15 @@ struct timeval *process_outstanding_time
tvp -> tv_sec = timeouts -> when;
tvp -> tv_usec = 0;
}
@ -449,7 +544,7 @@ diff -up dhcp-3.1.0/common/dispatch.c.libdhcp4client dhcp-3.1.0/common/dispatch.
}
/* Wait for packets to come in using select(). When one does, call
@@ -104,13 +158,28 @@ void add_timeout (when, where, what, ref
@@ -99,13 +153,28 @@ void add_timeout (when, where, what, ref
tvref_t ref;
tvunref_t unref;
{
@ -480,7 +575,7 @@ diff -up dhcp-3.1.0/common/dispatch.c.libdhcp4client dhcp-3.1.0/common/dispatch.
if (t)
t -> next = q -> next;
else
@@ -119,7 +188,29 @@ void add_timeout (when, where, what, ref
@@ -114,7 +183,29 @@ void add_timeout (when, where, what, ref
}
t = q;
}
@ -510,7 +605,7 @@ diff -up dhcp-3.1.0/common/dispatch.c.libdhcp4client dhcp-3.1.0/common/dispatch.
/* If we didn't supersede a timeout, allocate a timeout
structure now. */
if (!q) {
@@ -128,7 +219,7 @@ void add_timeout (when, where, what, ref
@@ -123,7 +214,7 @@ void add_timeout (when, where, what, ref
free_timeouts = q -> next;
} else {
q = ((struct timeout *)
@ -519,7 +614,7 @@ diff -up dhcp-3.1.0/common/dispatch.c.libdhcp4client dhcp-3.1.0/common/dispatch.
if (!q)
log_fatal ("add_timeout: no memory!");
}
@@ -158,22 +249,76 @@ void add_timeout (when, where, what, ref
@@ -153,22 +244,76 @@ void add_timeout (when, where, what, ref
if (t -> next -> when > q -> when) {
q -> next = t -> next;
t -> next = q;
@ -596,7 +691,7 @@ diff -up dhcp-3.1.0/common/dispatch.c.libdhcp4client dhcp-3.1.0/common/dispatch.
t = (struct timeout *)0;
for (q = timeouts; q; q = q -> next) {
if (q -> func == where && q -> what == what) {
@@ -193,10 +338,15 @@ void cancel_timeout (where, what)
@@ -188,10 +333,15 @@ void cancel_timeout (where, what)
q -> next = free_timeouts;
free_timeouts = q;
}
@ -612,7 +707,7 @@ diff -up dhcp-3.1.0/common/dispatch.c.libdhcp4client dhcp-3.1.0/common/dispatch.
struct timeout *t, *n;
for (t = timeouts; t; t = n) {
n = t -> next;
@@ -205,13 +355,20 @@ void cancel_all_timeouts ()
@@ -200,13 +350,20 @@ void cancel_all_timeouts ()
t -> next = free_timeouts;
free_timeouts = t;
}
@ -633,10 +728,10 @@ diff -up dhcp-3.1.0/common/dispatch.c.libdhcp4client dhcp-3.1.0/common/dispatch.
}
+#endif
}
diff -up dhcp-3.1.0/common/alloc.c.libdhcp4client dhcp-3.1.0/common/alloc.c
--- dhcp-3.1.0/common/alloc.c.libdhcp4client 2006-06-01 16:23:17.000000000 -0400
+++ dhcp-3.1.0/common/alloc.c 2007-10-24 14:55:56.000000000 -0400
@@ -1013,7 +1013,11 @@ int executable_statement_reference (ptr,
diff -up dhcp-4.0.0/common/alloc.c.libdhcp4client dhcp-4.0.0/common/alloc.c
--- dhcp-4.0.0/common/alloc.c.libdhcp4client 2007-10-23 14:54:11.000000000 -1000
+++ dhcp-4.0.0/common/alloc.c 2008-01-12 17:19:29.000000000 -1000
@@ -1004,7 +1004,11 @@ int executable_statement_reference (ptr,
return 1;
}
@ -648,10 +743,10 @@ diff -up dhcp-3.1.0/common/alloc.c.libdhcp4client dhcp-3.1.0/common/alloc.c
#if defined (DEBUG_MEMORY_LEAKAGE) || \
defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
diff -up dhcp-3.1.0/includes/dhcpd.h.libdhcp4client dhcp-3.1.0/includes/dhcpd.h
--- dhcp-3.1.0/includes/dhcpd.h.libdhcp4client 2007-10-24 14:55:56.000000000 -0400
+++ dhcp-3.1.0/includes/dhcpd.h 2007-10-24 14:55:56.000000000 -0400
@@ -1000,14 +1000,6 @@ struct hardware_link {
diff -up dhcp-4.0.0/includes/dhcpd.h.libdhcp4client dhcp-4.0.0/includes/dhcpd.h
--- dhcp-4.0.0/includes/dhcpd.h.libdhcp4client 2008-01-12 17:19:29.000000000 -1000
+++ dhcp-4.0.0/includes/dhcpd.h 2008-01-12 17:19:29.000000000 -1000
@@ -1199,14 +1199,6 @@ struct hardware_link {
typedef void (*tvref_t)(void *, void *, const char *, int);
typedef void (*tvunref_t)(void *, const char *, int);
@ -666,19 +761,50 @@ diff -up dhcp-3.1.0/includes/dhcpd.h.libdhcp4client dhcp-3.1.0/includes/dhcpd.h
struct protocol {
struct protocol *next;
@@ -1960,7 +1952,6 @@ extern void (*bootp_packet_handler) PROT
struct dhcp_packet *, unsigned,
unsigned int,
struct iaddr, struct hardware *));
@@ -1664,7 +1656,6 @@ extern const char *path_dhcpd_pid;
extern int dhcp_max_agent_option_packet_length;
-int main(int, char **);
void postconf_initialization(int);
void postdb_startup(void);
void cleanup PROTO ((void));
@@ -2337,7 +2328,6 @@ extern void (*bootp_packet_handler) PROT
extern void (*dhcpv6_packet_handler)(struct interface_info *,
const char *, int,
int, const struct iaddr *, isc_boolean_t);
-extern struct timeout *timeouts;
extern omapi_object_type_t *dhcp_type_interface;
#if defined (TRACING)
trace_type_t *interface_trace;
diff -up dhcp-3.1.0/client/dhclient.c.libdhcp4client dhcp-3.1.0/client/dhclient.c
--- dhcp-3.1.0/client/dhclient.c.libdhcp4client 2007-10-24 14:55:56.000000000 -0400
+++ dhcp-3.1.0/client/dhclient.c 2007-10-24 14:56:20.000000000 -0400
@@ -82,14 +82,50 @@ int quiet=0;
int nowait=0;
extern trace_type_t *interface_trace;
diff -up dhcp-4.0.0/client/Makefile.am.libdhcp4client dhcp-4.0.0/client/Makefile.am
--- dhcp-4.0.0/client/Makefile.am.libdhcp4client 2007-12-12 09:23:42.000000000 -1000
+++ dhcp-4.0.0/client/Makefile.am 2008-01-12 17:21:17.000000000 -1000
@@ -1,10 +1,19 @@
dist_sysconf_DATA = dhclient.conf
sbin_PROGRAMS = dhclient
+lib_LTLIBRARIES = libdhcp4client.la
dhclient_SOURCES = clparse.c dhclient.c dhc6.c \
scripts/bsdos scripts/freebsd scripts/linux scripts/netbsd \
scripts/nextstep scripts/openbsd scripts/solaris
dhclient_LDADD = ../common/libdhcp.a ../minires/libres.a \
../omapip/libomapi.a ../dst/libdst.a
+libdhcp4client_la_CFLAGS = -DLIBDHCP -DLOCALSTATEDIR='"@localstatedir@"' \
+ -fvisibility=hidden
+libdhcp4client_la_LDFLAGS = -version-info \
+ $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
+ -release $(LT_RELEASE)
+libdhcp4client_la_SOURCES = clparse.c dhclient.c dhc6.c
+libdhcp4client_la_LIBADD = ../common/libdhcpLIBDHCP.a ../minires/libres.a \
+ ../omapip/libomapiLIBDHCP.a ../dst/libdstLIBDHCP.a
man_MANS = dhclient.8 dhclient-script.8 dhclient.conf.5 dhclient.leases.5
EXTRA_DIST = $(man_MANS)
diff -up dhcp-4.0.0/client/dhclient.c.libdhcp4client dhcp-4.0.0/client/dhclient.c
--- dhcp-4.0.0/client/dhclient.c.libdhcp4client 2008-01-12 17:19:29.000000000 -1000
+++ dhcp-4.0.0/client/dhclient.c 2008-01-12 17:19:29.000000000 -1000
@@ -83,14 +83,50 @@ int nowait=0;
char *mockup_relay = NULL;
int bootp_broadcast_always = 0;
+#ifdef LIBDHCP
@ -689,6 +815,10 @@ diff -up dhcp-3.1.0/client/dhclient.c.libdhcp4client dhcp-3.1.0/client/dhclient.
static void usage PROTO ((void));
static isc_result_t write_duid(struct data_string *duid);
-int
-main(int argc, char **argv) {
+#ifdef LIBDHCP
+#include "isc-dhcp/libdhcp_control.h"
+LIBDHCP_Control *libdhcp_control;
@ -714,37 +844,35 @@ diff -up dhcp-3.1.0/client/dhclient.c.libdhcp4client dhcp-3.1.0/client/dhclient.
+extern void omapi_free_all_pointers(void);
+
+__attribute__ ((visibility ("default")))
+int dhcpv4_client (libdhcp_ctl, argc, argv, envp)
+ LIBDHCP_Control *libdhcp_ctl;
+int dhcpv4_client (LIBDHCP_Control *libdhcp_ctl, int argc, char **argv,
+ char **envp)
+#else
int main (argc, argv, envp)
+int main(int argc, char **argv, char **envp)
+#endif
int argc;
char **argv, **envp;
{
+{
+#ifdef LIBDHCP
+ libdhcp_control = libdhcp_ctl;
+#endif
int fd;
int i;
struct servent *ent;
@@ -120,6 +156,7 @@ int main (argc, argv, envp)
char *arg_conf = NULL;
int arg_conf_len = 0;
struct interface_info *ip;
@@ -122,6 +158,7 @@ main(int argc, char **argv) {
/* Initialize client globals. */
memset(&default_duid, 0, sizeof(default_duid));
+#ifndef LIBDHCP
/* Make sure that file descriptors 0 (stdin), 1, (stdout), and
2 (stderr) are open. To do this, we assume that when we
open a file the lowest available file decriptor is used. */
@@ -143,6 +180,7 @@ int main (argc, argv, envp)
#if !(defined (DEBUG) || defined (SYSLOG_4_2) || defined (__CYGWIN32__))
open a file the lowest available file descriptor is used. */
@@ -140,6 +177,7 @@ main(int argc, char **argv) {
#if !(defined (DEBUG) || defined (__CYGWIN32__))
setlogmask (LOG_UPTO (LOG_INFO));
#endif
+#endif
/* Set up the OMAPI. */
status = omapi_init ();
@@ -439,8 +477,12 @@ int main (argc, argv, envp)
@@ -485,8 +523,12 @@ main(int argc, char **argv) {
}
}
@ -755,17 +883,17 @@ diff -up dhcp-3.1.0/client/dhclient.c.libdhcp4client dhcp-3.1.0/client/dhclient.
+#ifndef LIBDHCP
if (!quiet) {
log_info ("%s %s", message, DHCP_VERSION);
log_info ("%s %s", message, PACKAGE_VERSION);
log_info (copyright);
@@ -449,6 +491,7 @@ int main (argc, argv, envp)
log_info ("%s", "");
} else
@@ -497,6 +539,7 @@ main(int argc, char **argv) {
log_perror = 0;
quiet_interface_discovery = 1;
}
+#endif
/* If we're given a relay agent address to insert, for testing
purposes, figure out what it is. */
@@ -680,11 +723,17 @@ int main (argc, argv, envp)
@@ -702,11 +745,17 @@ main(int argc, char **argv) {
arg_conf_len = 0;
}
@ -783,7 +911,7 @@ diff -up dhcp-3.1.0/client/dhclient.c.libdhcp4client dhcp-3.1.0/client/dhclient.
/* XXX */
/* config_counter(&snd_counter, &rcv_counter); */
@@ -703,7 +752,7 @@ int main (argc, argv, envp)
@@ -725,7 +774,7 @@ main(int argc, char **argv) {
if (!persist) {
/* Nothing more to do. */
log_info ("No broadcast interfaces found - exiting.");
@ -792,7 +920,7 @@ diff -up dhcp-3.1.0/client/dhclient.c.libdhcp4client dhcp-3.1.0/client/dhclient.
}
} else if (!release_mode && !exit_mode) {
/* Call the script with the list of interfaces. */
@@ -799,6 +848,7 @@ int main (argc, argv, envp)
@@ -863,6 +912,7 @@ main(int argc, char **argv) {
dmalloc_outstanding = 0;
#endif
@ -800,7 +928,7 @@ diff -up dhcp-3.1.0/client/dhclient.c.libdhcp4client dhcp-3.1.0/client/dhclient.
/* If we're not supposed to wait before getting the address,
don't. */
if (nowait)
@@ -811,6 +861,126 @@ int main (argc, argv, envp)
@@ -875,6 +925,126 @@ main(int argc, char **argv) {
/* Start dispatching packets and timeouts... */
dispatch ();
@ -902,7 +1030,7 @@ diff -up dhcp-3.1.0/client/dhclient.c.libdhcp4client dhcp-3.1.0/client/dhclient.
+ universes = 0;
+ universe_count = 0;
+ universe_max = 0;
+ config_universe = 0;
+ config_universe = 0;
+ extern struct hash_bucket *free_hash_buckets;
+ free_hash_buckets = NULL;
+ extern struct dhcp_packet *dhcp_free_list;
@ -927,7 +1055,7 @@ diff -up dhcp-3.1.0/client/dhclient.c.libdhcp4client dhcp-3.1.0/client/dhclient.
/*NOTREACHED*/
return 0;
@@ -1203,7 +1373,20 @@ void dhcpack (packet)
@@ -1270,7 +1440,20 @@ void dhcpack (packet)
if (client -> new -> rebind < cur_time)
client -> new -> rebind = TIME_MAX;
@ -948,7 +1076,7 @@ diff -up dhcp-3.1.0/client/dhclient.c.libdhcp4client dhcp-3.1.0/client/dhclient.
}
void bind_lease (client)
@@ -1241,6 +1424,9 @@ void bind_lease (client)
@@ -1306,6 +1489,9 @@ void bind_lease (client)
return;
}
@ -958,21 +1086,20 @@ diff -up dhcp-3.1.0/client/dhclient.c.libdhcp4client dhcp-3.1.0/client/dhclient.
/* Write out the new lease. */
write_client_lease (client, client -> new, 0, 0);
@@ -1343,11 +1529,13 @@ int commit_leases ()
return 0;
}
@@ -1398,10 +1584,12 @@ void state_stop (cpp)
}
}
+#ifndef LIBDHCP
int write_lease (lease)
struct lease *lease;
int commit_leases ()
{
return 0;
}
+#endif
int write_host (host)
struct host_decl *host;
@@ -1957,6 +2145,10 @@ void state_panic (cpp)
int write_lease (lease)
struct lease *lease;
@@ -2074,6 +2262,10 @@ void state_panic (cpp)
tell the shell script that we failed to allocate an address,
and try again later. */
if (onetry) {
@ -983,17 +1110,17 @@ diff -up dhcp-3.1.0/client/dhclient.c.libdhcp4client dhcp-3.1.0/client/dhclient.
if (!quiet)
log_info ("Unable to obtain a lease on first try.%s",
" Exiting.");
@@ -2579,7 +2771,9 @@ void destroy_client_lease (lease)
@@ -2691,7 +2883,9 @@ void destroy_client_lease (lease)
free_client_lease (lease, MDL);
}
+#ifndef LIBDHCP
FILE *leaseFile;
FILE *leaseFile = NULL;
+#endif
int leases_written = 0;
void rewrite_client_leases ()
{
@@ -2960,6 +3154,54 @@ void script_write_params (client, prefix
@@ -3218,6 +3412,54 @@ void script_write_params (client, prefix
int script_go (client)
struct client_state *client;
{
@ -1045,28 +1172,28 @@ diff -up dhcp-3.1.0/client/dhclient.c.libdhcp4client dhcp-3.1.0/client/dhclient.
+
+ return 0;
+#else
int rval;
char *scriptName;
char *argv [2];
@@ -3038,6 +3280,7 @@ int script_go (client)
GET_TIME (&cur_time);
char **envp;
@@ -3294,6 +3536,7 @@ int script_go (client)
time(&cur_time);
return (WIFEXITED (wstatus) ?
WEXITSTATUS (wstatus) : -WTERMSIG (wstatus));
+#endif
}
void client_envadd (struct client_state *client,
@@ -3120,6 +3363,9 @@ void go_daemon ()
@@ -3376,6 +3619,9 @@ void go_daemon ()
/* Don't become a daemon if the user requested otherwise. */
if (no_daemon) {
+#ifdef LIBDHCP
+ if (libdhcp_control && (libdhcp_control->capability & DHCP_USE_PID_FILE ))
+ if (libdhcp_control && (libdhcp_control->capability & DHCP_USE_PID_FILE))
+#endif
write_client_pid_file ();
return;
}
@@ -3129,6 +3375,10 @@ void go_daemon ()
@@ -3385,6 +3631,10 @@ void go_daemon ()
return;
state = 1;
@ -1077,15 +1204,3 @@ diff -up dhcp-3.1.0/client/dhclient.c.libdhcp4client dhcp-3.1.0/client/dhclient.
/* Stop logging to stderr... */
log_perror = 0;
diff -up dhcp-3.1.0/Makefile.dist.libdhcp4client dhcp-3.1.0/Makefile.dist
--- dhcp-3.1.0/Makefile.dist.libdhcp4client 2005-03-17 15:14:54.000000000 -0500
+++ dhcp-3.1.0/Makefile.dist 2007-10-24 14:55:56.000000000 -0400
@@ -22,7 +22,7 @@
# http://www.isc.org/
-SUBDIRS= common $(MINIRES) dst omapip server client relay dhcpctl
+SUBDIRS= common $(MINIRES) dst omapip server client relay dhcpctl libdhcp4client
all:
@for dir in ${SUBDIRS}; do \

533
dhcp-4.0.0-manpages.patch Normal file
View File

@ -0,0 +1,533 @@
diff -up dhcp-4.0.0/server/dhcpd.conf.5.manpages dhcp-4.0.0/server/dhcpd.conf.5
--- dhcp-4.0.0/server/dhcpd.conf.5.manpages 2007-11-20 08:34:37.000000000 -1000
+++ dhcp-4.0.0/server/dhcpd.conf.5 2008-01-02 11:26:38.000000000 -1000
@@ -513,6 +513,9 @@ pool {
};
.fi
.PP
+Dynamic BOOTP leases are not compatible with failover, and, as such,
+you need to disallow BOOTP in pools that you are using failover for.
+.PP
The server currently does very little sanity checking, so if you
configure it wrong, it will just fail in odd ways. I would recommend
therefore that you either do failover or don't do failover, but don't
@@ -527,9 +530,9 @@ primary server might look like this:
failover peer "foo" {
primary;
address anthrax.rc.vix.com;
- port 519;
+ port 647;
peer address trantor.rc.vix.com;
- peer port 520;
+ peer port 847;
max-response-delay 60;
max-unacked-updates 10;
mclt 3600;
@@ -588,9 +591,7 @@ statement
.B port \fIport-number\fR\fB;\fR
.PP
The \fBport\fR statement declares the TCP port on which the server
-should listen for connections from its failover peer. This statement
-may not currently be omitted, because the failover protocol does not
-yet have a reserved TCP port number.
+should listen for connections from its failover peer.
.RE
.PP
The
@@ -602,10 +603,8 @@ statement
.PP
The \fBpeer port\fR statement declares the TCP port to which the
server should connect to reach its failover peer for failover
-messages. This statement may not be omitted because the failover
-protocol does not yet have a reserved TCP port number. The port
-number declared in the \fBpeer port\fR statement may be the same as
-the port number declared in the \fBport\fR statement.
+messages. The port number declared in the \fBpeer port\fR statement
+may be the same as the port number declared in the \fBport\fR statement.
.RE
.PP
The
@@ -1272,7 +1271,7 @@ the zone containing PTR records - for IS
.PP
.nf
key DHCP_UPDATER {
- algorithm HMAC-MD5.SIG-ALG.REG.INT;
+ algorithm hmac-md5;
secret pRP5FapFoJ95JEL06sv4PQ==;
};
@@ -1295,7 +1294,7 @@ dhcpd.conf file:
.PP
.nf
key DHCP_UPDATER {
- algorithm HMAC-MD5.SIG-ALG.REG.INT;
+ algorithm hmac-md5;
secret pRP5FapFoJ95JEL06sv4PQ==;
};
@@ -2433,7 +2432,8 @@ statement
The \fInext-server\fR statement is used to specify the host address of
the server from which the initial boot file (specified in the
\fIfilename\fR statement) is to be loaded. \fIServer-name\fR should
-be a numeric IP address or a domain name.
+be a numeric IP address or a domain name. If no \fInext-server\fR statement
+applies to a given client, the address 0.0.0.0 is used.
.RE
.PP
The
diff -up dhcp-4.0.0/common/dhcp-options.5.manpages dhcp-4.0.0/common/dhcp-options.5
--- dhcp-4.0.0/common/dhcp-options.5.manpages 2007-09-17 07:52:01.000000000 -1000
+++ dhcp-4.0.0/common/dhcp-options.5 2008-01-02 11:26:38.000000000 -1000
@@ -896,6 +896,21 @@ classless IP routing - it does not inclu
classless IP routing is now the most widely deployed routing standard,
this option is virtually useless, and is not implemented by any of the
popular DHCP clients, for example the Microsoft DHCP client.
+.PP
+NOTE to @PRODUCTNAME@ dhclient users:
+.br
+dhclient-script interprets trailing 0 octets of the target as indicating
+the subnet class of the route, so for the following static-routes value:
+.br
+ option static-routes 172.0.0.0 172.16.2.254,
+.br
+ 192.168.0.0 192.168.2.254;
+.br
+dhclient-script will create routes:
+.br
+ 172/8 via 172.16.2.254 dev $interface
+.br
+ 192.168/16 via 192.168.2.254 dev $interface
.RE
.PP
.nf
diff -up dhcp-4.0.0/client/dhclient-script.8.manpages dhcp-4.0.0/client/dhclient-script.8
--- dhcp-4.0.0/client/dhclient-script.8.manpages 2006-02-24 13:16:27.000000000 -1000
+++ dhcp-4.0.0/client/dhclient-script.8 2008-01-02 11:26:38.000000000 -1000
@@ -47,7 +47,7 @@ customizations are needed, they should b
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.
+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
@@ -91,6 +91,26 @@ 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
diff -up dhcp-4.0.0/client/dhclient.conf.5.manpages dhcp-4.0.0/client/dhclient.conf.5
--- dhcp-4.0.0/client/dhclient.conf.5.manpages 2007-08-23 06:06:08.000000000 -1000
+++ dhcp-4.0.0/client/dhclient.conf.5 2008-01-02 11:26:38.000000000 -1000
@@ -186,9 +186,9 @@ responding to the client send the client
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 and host-name options. Note that if
-you enter a 'request' statement, you over-ride this default and these
-options will not be requested.
+domain-name, domain-name-servers host-name, nis-domain, nis-servers,
+and ntp-servers options. Note that if you enter a 'request' statement,
+you over-ride this default and these options will not be requested.
.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
@@ -626,6 +626,18 @@ database and will record the media type
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
diff -up dhcp-4.0.0/client/dhclient.8.manpages dhcp-4.0.0/client/dhclient.8
--- dhcp-4.0.0/client/dhclient.8.manpages 2007-10-04 07:13:25.000000000 -1000
+++ dhcp-4.0.0/client/dhclient.8 2008-01-02 11:26:38.000000000 -1000
@@ -91,6 +91,33 @@ relay
.B -w
]
[
+.B -B
+]
+[
+.B -I
+.I dhcp-client-identifier
+]
+[
+.B -H
+.I host-name
+]
+[
+.B -F
+.I fqdn.fqdn
+]
+[
+.B -V
+.I vendor-class-identifier
+]
+[
+.B -R
+.I request-option-list
+]
+[
+.B -T
+.I timeout
+]
+[
.B -v
]
[
@@ -118,16 +145,6 @@ important details about the network to w
the location of a default router, the location of a name server, and
so on.
.PP
-If given the -4 command line argument (default), dhclient will use the
-DHCPv4 protocol to obtain an IPv4 address and configuration parameters.
-.PP
-If given the -6 command line argument, dhclient will use the DHCPv6
-protocol to obtain whatever IPv6 addresses are available along with
-configuration parameters. Information-request is not yet supported.
-.PP
-If given the --version command line argument, dhclient will print its
-version number and exit.
-.PP
On startup, dhclient reads the
.IR dhclient.conf
for configuration instructions. It then gets a list of all the
@@ -181,67 +198,183 @@ file. If interfaces are specified in t
only configure interfaces that are either specified in the
configuration file or on the command line, and will ignore all other
interfaces.
-.PP
-If the DHCP client should listen and transmit on a port other than the
-standard (port 68), the
-.B -p
-flag may used. It should be followed by the udp port number that
-dhclient should use. This is mostly useful for debugging purposes.
-If a different port is specified for the client to listen on and
-transmit on, the client will also use a different destination port -
-one greater than the specified destination port.
-.PP
-The DHCP client normally transmits any protocol messages it sends
-before acquiring an IP address to, 255.255.255.255, the IP limited
-broadcast address. For debugging purposes, it may be useful to have
-the server transmit these messages to some other address. This can
-be specified with the
-.B -s
-flag, followed by the IP address or domain name of the destination.
-.PP
-For testing purposes, the giaddr field of all packets that the client
-sends can be set using the
-.B -g
-flag, followed by the IP address to send. This is only useful for testing,
-and should not be expected to work in any consistent or useful way.
-.PP
-The DHCP client will normally run in the foreground until it has
-configured an interface, and then will revert to running in the
-background. To run force dhclient to always run as a foreground
-process, the
-.B -d
-flag should be specified. This is useful when running the client
-under a debugger, or when running it out of inittab on System V
-systems.
-.PP
-The dhclient daemon creates its own environment when executing the
-dhclient-script to do the grunt work of interface configuration.
-To define extra environment variables and their values, use the
-.B -e
-flag, followed by the environment variable name and value assignment,
-just as one would assign a variable in a shell. Eg:
-.B -e
-.I IF_METRIC=1
-.PP
-The client normally prints no output during its startup sequence. It
-can be made to emit verbose messages displaying the startup sequence events
-until it has acquired an address by supplying the
-.B -v
-command line argument. In either case, the client logs messages using
-the
-.B syslog (3)
-facility. A
-.B -q
-command line argument is provided for backwards compatibility, but since
-dhclient is quiet by default, it has no effect.
-.PP
-The client normally doesn't release the current lease as it is not
-required by the DHCP protocol. Some cable ISPs require their clients
-to notify the server if they wish to release an assigned IP address.
+.SH OPTIONS
+.TP
+.BI \-4
+Use the DHCPv4 protocol to obtain an IPv4 address and configuration
+parameters.
+
+.TP
+.BI \-6
+Use the DHCPv6 protocol to obtain whatever IPv6 addresses are available
+along with configuration parameters. Information-request is not yet
+supported.
+
+.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
-flag explicitly releases the current lease, and once the lease has been
-released, the client exits.
+.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.
+
+.TP
+.BI \-v
+Enable verbose log messages.
+
.PP
If the client is killed by a signal (for example at shutdown or reboot)
it won't execute the
@@ -253,57 +386,7 @@ or
it will execute
.B dhclient-script (8)
at shutdown with the specific reason for calling the script set.
-.PP
-The
-.B -1
-flag will cause dhclient to try once to get a lease. If it fails, dhclient
-exits with exit code two.
-.PP
-The DHCP client normally gets its configuration information from
-.B ETCDIR/dhclient.conf,
-its lease database from
-.B DBDIR/dhclient.leases,
-stores its process ID in a file called
-.B RUNDIR/dhclient.pid,
-and configures the network interface using
-.B CLIENTBINDIR/dhclient-script
-To specify different names and/or locations for these files, use the
-.B -cf,
-.B -lf,
-.B -pf
-and
-.B -sf
-flags, respectively, followed by the name of the file. This can be
-particularly useful if, for example,
-.B DBDIR
-or
-.B RUNDIR
-has not yet been mounted when the DHCP client is started.
-.PP
-The DHCP client normally exits if it isn't able to identify any
-network interfaces to configure. On laptop computers and other
-computers with hot-swappable I/O buses, it is possible that a
-broadcast interface may be added after system startup. The
-.B -w
-flag can be used to cause the client not to exit when it doesn't find
-any such interfaces. The
-.B omshell (1)
-program can then be used to notify the client when a network interface
-has been added or removed, so that the client can attempt to configure an IP
-address on that interface.
-.PP
-The DHCP client can be directed not to attempt to configure any interfaces
-using the
-.B -n
-flag. This is most likely to be useful in combination with the
-.B -w
-flag.
-.PP
-The client can also be instructed to become a daemon immediately, rather
-than waiting until it has acquired an IP address. This can be done by
-supplying the
-.B -nw
-flag.
+
.SH CONFIGURATION
The syntax of the dhclient.conf(5) file is discussed separately.
.SH OMAPI

View File

@ -1,7 +1,7 @@
diff -up dhcp-3.1.0/common/conflex.c.options dhcp-3.1.0/common/conflex.c
--- dhcp-3.1.0/common/conflex.c.options 2007-10-22 15:46:24.000000000 -0400
+++ dhcp-3.1.0/common/conflex.c 2007-10-22 15:48:07.000000000 -0400
@@ -599,6 +599,8 @@ static enum dhcp_token intern (atom, dfv
diff -up dhcp-4.0.0/common/conflex.c.options dhcp-4.0.0/common/conflex.c
--- dhcp-4.0.0/common/conflex.c.options 2007-12-29 11:13:51.000000000 -1000
+++ dhcp-4.0.0/common/conflex.c 2007-12-29 11:13:51.000000000 -1000
@@ -769,6 +769,8 @@ intern(char *atom, enum dhcp_token dfv)
return BALANCE;
if (!strcasecmp (atom + 1, "ound"))
return BOUND;
@ -10,10 +10,10 @@ diff -up dhcp-3.1.0/common/conflex.c.options dhcp-3.1.0/common/conflex.c
break;
case 'c':
if (!strcasecmp (atom + 1, "ase"))
diff -up dhcp-3.1.0/includes/dhcpd.h.options dhcp-3.1.0/includes/dhcpd.h
--- dhcp-3.1.0/includes/dhcpd.h.options 2007-10-22 15:46:24.000000000 -0400
+++ dhcp-3.1.0/includes/dhcpd.h 2007-10-22 15:48:21.000000000 -0400
@@ -912,6 +912,9 @@ struct client_config {
diff -up dhcp-4.0.0/includes/dhcpd.h.options dhcp-4.0.0/includes/dhcpd.h
--- dhcp-4.0.0/includes/dhcpd.h.options 2007-12-29 11:13:51.000000000 -1000
+++ dhcp-4.0.0/includes/dhcpd.h 2007-12-29 11:13:51.000000000 -1000
@@ -1055,6 +1055,9 @@ struct client_config {
int do_forward_update; /* If nonzero, and if we have the
information we need, update the
A record for the address we get. */
@ -23,25 +23,25 @@ diff -up dhcp-3.1.0/includes/dhcpd.h.options dhcp-3.1.0/includes/dhcpd.h
};
/* Per-interface state used in the dhcp client... */
diff -up dhcp-3.1.0/includes/dhctoken.h.options dhcp-3.1.0/includes/dhctoken.h
--- dhcp-3.1.0/includes/dhctoken.h.options 2006-07-31 18:19:51.000000000 -0400
+++ dhcp-3.1.0/includes/dhctoken.h 2007-10-22 15:49:24.000000000 -0400
@@ -325,7 +325,8 @@ enum dhcp_token {
MIN_BALANCE = 629,
DOMAIN_LIST = 630,
LEASEQUERY = 631,
- EXECUTE = 632
+ EXECUTE = 632,
+ BOOTP_BROADCAST_ALWAYS = 633
diff -up dhcp-4.0.0/includes/dhctoken.h.options dhcp-4.0.0/includes/dhctoken.h
--- dhcp-4.0.0/includes/dhctoken.h.options 2007-10-31 09:13:33.000000000 -1000
+++ dhcp-4.0.0/includes/dhctoken.h 2007-12-29 11:13:51.000000000 -1000
@@ -345,7 +345,8 @@ enum dhcp_token {
RANGE6 = 648,
WHITESPACE = 649,
TOKEN_ALSO = 650,
- AFTER = 651
+ AFTER = 651,
+ BOOTP_BROADCAST_ALWAYS = 652
};
#define is_identifier(x) ((x) >= FIRST_TOKEN && \
diff -up dhcp-3.1.0/client/dhclient.c.options dhcp-3.1.0/client/dhclient.c
--- dhcp-3.1.0/client/dhclient.c.options 2007-05-22 16:37:04.000000000 -0400
+++ dhcp-3.1.0/client/dhclient.c 2007-10-22 15:47:51.000000000 -0400
@@ -38,6 +38,12 @@ static char ocopyright[] =
#include "dhcpd.h"
#include "version.h"
diff -up dhcp-4.0.0/client/dhclient.c.options dhcp-4.0.0/client/dhclient.c
--- dhcp-4.0.0/client/dhclient.c.options 2007-11-30 11:51:42.000000000 -1000
+++ dhcp-4.0.0/client/dhclient.c 2007-12-29 11:14:15.000000000 -1000
@@ -37,6 +37,12 @@
#include <sys/wait.h>
#include <limits.h>
+/*
+ * Defined in stdio.h when _GNU_SOURCE is set, but we don't want to define
@ -52,19 +52,19 @@ diff -up dhcp-3.1.0/client/dhclient.c.options dhcp-3.1.0/client/dhclient.c
TIME default_lease_time = 43200; /* 12 hours... */
TIME max_lease_time = 86400; /* 24 hours... */
@@ -74,6 +80,9 @@ int client_env_count=0;
int onetry=0;
int quiet=0;
@@ -75,6 +81,9 @@ int onetry=0;
int quiet=1;
int nowait=0;
char *mockup_relay = NULL;
+int bootp_broadcast_always = 0;
+
+extern u_int32_t default_requested_options[];
static void usage PROTO ((void));
@@ -101,6 +110,15 @@ int main (argc, argv, envp)
int no_dhclient_pid = 0;
@@ -100,6 +109,15 @@ main(int argc, char **argv) {
int no_dhclient_script = 0;
int local_family_set = 0;
char *s;
+ char *dhcp_client_identifier_arg = NULL;
+ char *dhcp_host_name_arg = NULL;
@ -76,11 +76,11 @@ diff -up dhcp-3.1.0/client/dhclient.c.options dhcp-3.1.0/client/dhclient.c
+ char *arg_conf = NULL;
+ int arg_conf_len = 0;
/* Make sure that file descriptors 0 (stdin), 1, (stdout), and
2 (stderr) are open. To do this, we assume that when we
@@ -211,6 +229,88 @@ int main (argc, argv, envp)
/* Initialize client globals. */
memset(&default_duid, 0, sizeof(default_duid));
@@ -224,6 +242,88 @@ main(int argc, char **argv) {
} else if (!strcmp (argv [i], "--version")) {
log_info ("isc-dhclient-%s", DHCP_VERSION);
log_info ("isc-dhclient-%s", PACKAGE_VERSION);
exit (0);
+ } else if (!strcmp (argv [i], "-I")) {
+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
@ -88,8 +88,8 @@ diff -up dhcp-3.1.0/client/dhclient.c.options dhcp-3.1.0/client/dhclient.c
+ return EXIT_FAILURE;
+ }
+
+ if (strlen(argv[i]) >= DHCP_OPTION_LEN) {
+ log_error("-I option dhcp-client-identifier string \"%s\" is too long - maximum length is: %d", argv[i], DHCP_OPTION_LEN-1);
+ if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) {
+ log_error("-I option dhcp-client-identifier string \"%s\" is too long - maximum length is: %d", argv[i], DHCP_MAX_OPTION_LEN-1);
+ exit(1);
+ }
+
@ -102,8 +102,8 @@ diff -up dhcp-3.1.0/client/dhclient.c.options dhcp-3.1.0/client/dhclient.c
+ return EXIT_FAILURE;
+ }
+
+ if (strlen(argv[i]) >= DHCP_OPTION_LEN) {
+ log_error("-H option host-name string \"%s\" is too long - maximum length is: %d", argv[i], DHCP_OPTION_LEN-1);
+ if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) {
+ log_error("-H option host-name string \"%s\" is too long - maximum length is: %d", argv[i], DHCP_MAX_OPTION_LEN-1);
+ exit(1);
+ }
+
@ -119,8 +119,8 @@ diff -up dhcp-3.1.0/client/dhclient.c.options dhcp-3.1.0/client/dhclient.c
+ return EXIT_FAILURE;
+ }
+
+ if (strlen(argv[i]) >= DHCP_OPTION_LEN) {
+ log_error("-F option fqdn.fqdn string \"%s\" is too long - maximum length is: %d", argv[i], DHCP_OPTION_LEN-1);
+ if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) {
+ log_error("-F option fqdn.fqdn string \"%s\" is too long - maximum length is: %d", argv[i], DHCP_MAX_OPTION_LEN-1);
+ exit(1);
+ }
+
@ -151,8 +151,8 @@ diff -up dhcp-3.1.0/client/dhclient.c.options dhcp-3.1.0/client/dhclient.c
+ return EXIT_FAILURE;
+ }
+
+ if (strlen(argv[i]) >= DHCP_OPTION_LEN) {
+ log_error("-V option vendor-class-identifier string \"%s\" is too long - maximum length is: %d", argv[i], DHCP_OPTION_LEN-1);
+ if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) {
+ log_error("-V option vendor-class-identifier string \"%s\" is too long - maximum length is: %d", argv[i], DHCP_MAX_OPTION_LEN-1);
+ exit(1);
+ }
+
@ -167,7 +167,7 @@ diff -up dhcp-3.1.0/client/dhclient.c.options dhcp-3.1.0/client/dhclient.c
} else if (argv [i][0] == '-') {
usage ();
} else {
@@ -347,6 +447,167 @@ int main (argc, argv, envp)
@@ -370,6 +470,166 @@ main(int argc, char **argv) {
/* Parse the dhclient.conf file. */
read_client_conf ();
@ -314,7 +314,6 @@ diff -up dhcp-3.1.0/client/dhclient.c.options dhcp-3.1.0/client/dhclient.c
+
+ if ((ip->client->config->reboot_timeout == 10) && (ip->client->config->reboot_timeout > ip->client->config->timeout))
+ ip->client->config->reboot_timeout = ip->client->config->timeout;
+
+ if ((ip->client->config->backoff_cutoff == 15) && (ip->client->config->backoff_cutoff > top_level_config.backoff_cutoff))
+ ip->client->config->backoff_cutoff = top_level_config.backoff_cutoff;
+ }
@ -335,7 +334,7 @@ diff -up dhcp-3.1.0/client/dhclient.c.options dhcp-3.1.0/client/dhclient.c
/* Parse the lease database. */
read_client_leases ();
@@ -1978,7 +2239,8 @@ void make_discover (client, lease)
@@ -2105,7 +2365,8 @@ void make_discover (client, lease)
client -> packet.xid = random ();
client -> packet.secs = 0; /* filled in by send_discover. */
@ -345,7 +344,7 @@ diff -up dhcp-3.1.0/client/dhclient.c.options dhcp-3.1.0/client/dhclient.c
client -> packet.flags = 0;
else
client -> packet.flags = htons (BOOTP_BROADCAST);
@@ -2065,7 +2327,9 @@ void make_request (client, lease)
@@ -2189,7 +2450,9 @@ void make_request (client, lease)
} else {
memset (&client -> packet.ciaddr, 0,
sizeof client -> packet.ciaddr);
@ -356,7 +355,7 @@ diff -up dhcp-3.1.0/client/dhclient.c.options dhcp-3.1.0/client/dhclient.c
client -> packet.flags = 0;
else
client -> packet.flags = htons (BOOTP_BROADCAST);
@@ -2125,7 +2389,8 @@ void make_decline (client, lease)
@@ -2248,7 +2511,8 @@ void make_decline (client, lease)
client -> packet.hops = 0;
client -> packet.xid = client -> xid;
client -> packet.secs = 0; /* Filled in by send_request. */
@ -366,18 +365,18 @@ diff -up dhcp-3.1.0/client/dhclient.c.options dhcp-3.1.0/client/dhclient.c
client -> packet.flags = 0;
else
client -> packet.flags = htons (BOOTP_BROADCAST);
diff -up dhcp-3.1.0/client/clparse.c.options dhcp-3.1.0/client/clparse.c
--- dhcp-3.1.0/client/clparse.c.options 2007-02-14 17:41:22.000000000 -0500
+++ dhcp-3.1.0/client/clparse.c 2007-10-22 15:47:12.000000000 -0400
@@ -84,6 +84,7 @@ isc_result_t read_client_conf ()
top_level_config.requested_options = default_requested_options;
top_level_config.omapi_port = -1;
top_level_config.do_forward_update = 1;
diff -up dhcp-4.0.0/client/clparse.c.options dhcp-4.0.0/client/clparse.c
--- dhcp-4.0.0/client/clparse.c.options 2007-12-08 09:36:00.000000000 -1000
+++ dhcp-4.0.0/client/clparse.c 2007-12-29 11:13:51.000000000 -1000
@@ -132,6 +132,7 @@ isc_result_t read_client_conf ()
/* Requested lease time, used by DHCPv6 (DHCPv4 uses the option cache)
*/
top_level_config.requested_lease = 7200;
+ top_level_config.bootp_broadcast_always = 0;
group_allocate (&top_level_config.on_receipt, MDL);
if (!top_level_config.on_receipt)
@@ -230,7 +231,8 @@ void read_client_leases ()
@@ -295,7 +296,8 @@ void read_client_leases ()
interface-declaration |
LEASE client-lease-statement |
ALIAS client-lease-statement |
@ -387,7 +386,7 @@ diff -up dhcp-3.1.0/client/clparse.c.options dhcp-3.1.0/client/clparse.c
void parse_client_statement (cfile, ip, config)
struct parse *cfile;
@@ -554,6 +556,12 @@ void parse_client_statement (cfile, ip,
@@ -685,6 +687,12 @@ void parse_client_statement (cfile, ip,
parse_reject_statement (cfile, config);
return;

31
dhcp-4.0.0-paths.patch Normal file
View File

@ -0,0 +1,31 @@
diff -up dhcp-4.0.0/includes/dhcpd.h.paths dhcp-4.0.0/includes/dhcpd.h
--- dhcp-4.0.0/includes/dhcpd.h.paths 2008-01-01 15:09:21.000000000 -1000
+++ dhcp-4.0.0/includes/dhcpd.h 2008-01-01 15:10:55.000000000 -1000
@@ -1306,11 +1306,11 @@ typedef unsigned char option_mask [16];
#endif /* DEBUG */
#ifndef _PATH_DHCPD_DB
-#define _PATH_DHCPD_DB LOCALSTATEDIR"/db/dhcpd.leases"
+#define _PATH_DHCPD_DB LOCALSTATEDIR"/dhcpd/dhcpd.leases"
#endif
#ifndef _PATH_DHCPD6_DB
-#define _PATH_DHCPD6_DB LOCALSTATEDIR"/db/dhcpd6.leases"
+#define _PATH_DHCPD6_DB LOCALSTATEDIR"/dhcpd/dhcpd6.leases"
#endif
#ifndef _PATH_DHCPD_PID
@@ -1340,11 +1340,11 @@ typedef unsigned char option_mask [16];
#endif
#ifndef _PATH_DHCLIENT_DB
-#define _PATH_DHCLIENT_DB LOCALSTATEDIR"/db/dhclient.leases"
+#define _PATH_DHCLIENT_DB LOCALSTATEDIR"/dhclient/dhclient.leases"
#endif
#ifndef _PATH_DHCLIENT6_DB
-#define _PATH_DHCLIENT6_DB LOCALSTATEDIR"/db/dhclient6.leases"
+#define _PATH_DHCLIENT6_DB LOCALSTATEDIR"/dhclient/dhclient6.leases"
#endif
#ifndef _PATH_RESOLV_CONF

View File

@ -0,0 +1,16 @@
diff -up dhcp-4.0.0/server/Makefile.am.mf dhcp-4.0.0/server/Makefile.am
--- dhcp-4.0.0/server/Makefile.am.mf 2008-01-12 12:40:59.000000000 -1000
+++ dhcp-4.0.0/server/Makefile.am 2008-01-12 12:41:55.000000000 -1000
@@ -6,10 +6,8 @@ dhcpd_SOURCES = dhcpd.c dhcp.c bootp.c c
omapi.c mdb.c stables.c salloc.c ddns.c dhcpleasequery.c \
dhcpv6.c mdb6.c ldap.c ldap_casa.c
-# libomapi.a this is here twice to handle circular library dependencies :(
-dhcpd_LDADD = ../common/libdhcp.a ../omapip/libomapi.a ../dst/libdst.a \
- ../dhcpctl/libdhcpctl.a ../minires/libres.a \
- ../omapip/libomapi.a -lldap
+dhcpd_LDADD = ../common/libdhcp.a ../omapip/libomapi.a ../minires/libres.a \
+ ../dhcpctl/libdhcpctl.a ../dst/libdst.a -lldap
man_MANS = dhcpd.8 dhcpd.conf.5 dhcpd.leases.5
EXTRA_DIST = $(man_MANS)

View File

@ -1,7 +1,7 @@
diff -up dhcp-3.1.0/common/nit.c.xen dhcp-3.1.0/common/nit.c
--- dhcp-3.1.0/common/nit.c.xen 2007-05-23 19:30:32.000000000 -0400
+++ dhcp-3.1.0/common/nit.c 2007-10-22 16:12:27.000000000 -0400
@@ -371,7 +371,7 @@ ssize_t receive_packet (interface, buf,
diff -up dhcp-4.0.0/common/nit.c.xen dhcp-4.0.0/common/nit.c
--- dhcp-4.0.0/common/nit.c.xen 2007-09-05 07:32:10.000000000 -1000
+++ dhcp-4.0.0/common/nit.c 2007-12-29 06:39:16.000000000 -1000
@@ -366,7 +366,7 @@ ssize_t receive_packet (interface, buf,
/* Decode the IP and UDP headers... */
offset = decode_udp_ip_header (interface, ibuf, bufix,
@ -10,10 +10,10 @@ diff -up dhcp-3.1.0/common/nit.c.xen dhcp-3.1.0/common/nit.c
/* If the IP or UDP checksum was bad, skip the packet... */
if (offset < 0)
diff -up dhcp-3.1.0/common/dlpi.c.xen dhcp-3.1.0/common/dlpi.c
--- dhcp-3.1.0/common/dlpi.c.xen 2007-05-23 19:30:32.000000000 -0400
+++ dhcp-3.1.0/common/dlpi.c 2007-10-22 16:12:11.000000000 -0400
@@ -680,7 +680,7 @@ ssize_t receive_packet (interface, buf,
diff -up dhcp-4.0.0/common/dlpi.c.xen dhcp-4.0.0/common/dlpi.c
--- dhcp-4.0.0/common/dlpi.c.xen 2007-10-08 04:27:53.000000000 -1000
+++ dhcp-4.0.0/common/dlpi.c 2007-12-29 06:39:13.000000000 -1000
@@ -689,7 +689,7 @@ ssize_t receive_packet (interface, buf,
length -= offset;
#endif
offset = decode_udp_ip_header (interface, dbuf, bufix,
@ -22,10 +22,10 @@ diff -up dhcp-3.1.0/common/dlpi.c.xen dhcp-3.1.0/common/dlpi.c
/* If the IP or UDP checksum was bad, skip the packet... */
if (offset < 0) {
diff -up dhcp-3.1.0/common/upf.c.xen dhcp-3.1.0/common/upf.c
--- dhcp-3.1.0/common/upf.c.xen 2007-05-23 19:30:32.000000000 -0400
+++ dhcp-3.1.0/common/upf.c 2007-10-22 16:12:52.000000000 -0400
@@ -322,7 +322,7 @@ ssize_t receive_packet (interface, buf,
diff -up dhcp-4.0.0/common/upf.c.xen dhcp-4.0.0/common/upf.c
--- dhcp-4.0.0/common/upf.c.xen 2007-07-12 20:43:42.000000000 -1000
+++ dhcp-4.0.0/common/upf.c 2007-12-29 06:39:24.000000000 -1000
@@ -317,7 +317,7 @@ ssize_t receive_packet (interface, buf,
/* Decode the IP and UDP headers... */
offset = decode_udp_ip_header (interface, ibuf, bufix,
@ -34,15 +34,16 @@ diff -up dhcp-3.1.0/common/upf.c.xen dhcp-3.1.0/common/upf.c
/* If the IP or UDP checksum was bad, skip the packet... */
if (offset < 0)
diff -up dhcp-3.1.0/common/lpf.c.xen dhcp-3.1.0/common/lpf.c
--- dhcp-3.1.0/common/lpf.c.xen 2007-10-22 16:11:12.000000000 -0400
+++ dhcp-3.1.0/common/lpf.c 2007-10-22 16:15:24.000000000 -0400
@@ -34,16 +34,31 @@ static char copyright[] =
diff -up dhcp-4.0.0/common/lpf.c.xen dhcp-4.0.0/common/lpf.c
--- dhcp-4.0.0/common/lpf.c.xen 2007-12-29 06:37:53.000000000 -1000
+++ dhcp-4.0.0/common/lpf.c 2007-12-29 06:43:08.000000000 -1000
@@ -29,18 +29,33 @@
#include "dhcpd.h"
#if defined (USE_LPF_SEND) || defined (USE_LPF_RECEIVE)
#include <sys/ioctl.h>
+#include <sys/socket.h>
#include <sys/uio.h>
#include <errno.h>
#include <asm/types.h>
#include <linux/filter.h>
@ -52,6 +53,7 @@ diff -up dhcp-3.1.0/common/lpf.c.xen dhcp-3.1.0/common/lpf.c
#include "includes/netinet/ip.h"
#include "includes/netinet/udp.h"
#include "includes/netinet/if_ether.h"
#include <net/if.h>
+#ifndef PACKET_AUXDATA
+#define PACKET_AUXDATA 8
@ -69,10 +71,10 @@ diff -up dhcp-3.1.0/common/lpf.c.xen dhcp-3.1.0/common/lpf.c
/* Reinitializes the specified interface after an address change. This
is not required for packet-filter APIs. */
@@ -71,10 +86,14 @@ int if_register_lpf (info)
@@ -66,10 +81,14 @@ int if_register_lpf (info)
struct interface_info *info;
{
int sock;
char filename[50];
int b;
- struct sockaddr sa;
+ union {
+ struct sockaddr_ll ll;
@ -86,7 +88,7 @@ diff -up dhcp-3.1.0/common/lpf.c.xen dhcp-3.1.0/common/lpf.c
htons((short)ETH_P_ALL))) < 0) {
if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT ||
@@ -89,11 +108,16 @@ int if_register_lpf (info)
@@ -84,11 +103,16 @@ int if_register_lpf (info)
log_fatal ("Open a socket for LPF: %m");
}
@ -106,7 +108,7 @@ diff -up dhcp-3.1.0/common/lpf.c.xen dhcp-3.1.0/common/lpf.c
if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT ||
errno == EAFNOSUPPORT || errno == EINVAL) {
@@ -173,9 +197,18 @@ static void lpf_gen_filter_setup (struct
@@ -170,9 +194,18 @@ static void lpf_gen_filter_setup (struct
void if_register_receive (info)
struct interface_info *info;
{
@ -125,7 +127,7 @@ diff -up dhcp-3.1.0/common/lpf.c.xen dhcp-3.1.0/common/lpf.c
#if defined (HAVE_TR_SUPPORT)
if (info -> hw_address.hbuf [0] == HTYPE_IEEE802)
lpf_tr_filter_setup (info);
@@ -294,7 +327,6 @@ ssize_t send_packet (interface, packet,
@@ -291,7 +324,6 @@ ssize_t send_packet (interface, packet,
double hh [16];
double ih [1536 / sizeof (double)];
unsigned char *buf = (unsigned char *)ih;
@ -133,7 +135,7 @@ diff -up dhcp-3.1.0/common/lpf.c.xen dhcp-3.1.0/common/lpf.c
int result;
int fudge;
@@ -312,15 +344,7 @@ ssize_t send_packet (interface, packet,
@@ -309,15 +341,7 @@ ssize_t send_packet (interface, packet,
(unsigned char *)raw, len);
memcpy (buf + ibufp, raw, len);
@ -150,8 +152,8 @@ diff -up dhcp-3.1.0/common/lpf.c.xen dhcp-3.1.0/common/lpf.c
if (result < 0)
log_error ("send_packet: %m");
return result;
@@ -338,14 +362,35 @@ ssize_t receive_packet (interface, buf,
int nread;
@@ -334,14 +358,35 @@ ssize_t receive_packet (interface, buf,
{
int length = 0;
int offset = 0;
+ int nocsum = 0;
@ -187,7 +189,7 @@ diff -up dhcp-3.1.0/common/lpf.c.xen dhcp-3.1.0/common/lpf.c
bufix = 0;
/* Decode the physical header... */
offset = decode_hw_header (interface, ibuf, bufix, hfrom);
@@ -362,7 +407,7 @@ ssize_t receive_packet (interface, buf,
@@ -358,7 +403,7 @@ ssize_t receive_packet (interface, buf,
/* Decode the IP and UDP headers... */
offset = decode_udp_ip_header (interface, ibuf, bufix, from,
@ -196,10 +198,10 @@ diff -up dhcp-3.1.0/common/lpf.c.xen dhcp-3.1.0/common/lpf.c
/* If the IP or UDP checksum was bad, skip the packet... */
if (offset < 0)
diff -up dhcp-3.1.0/common/bpf.c.xen dhcp-3.1.0/common/bpf.c
--- dhcp-3.1.0/common/bpf.c.xen 2007-05-23 19:30:32.000000000 -0400
+++ dhcp-3.1.0/common/bpf.c 2007-10-22 16:13:14.000000000 -0400
@@ -478,7 +478,7 @@ ssize_t receive_packet (interface, buf,
diff -up dhcp-4.0.0/common/bpf.c.xen dhcp-4.0.0/common/bpf.c
--- dhcp-4.0.0/common/bpf.c.xen 2007-08-22 23:49:51.000000000 -1000
+++ dhcp-4.0.0/common/bpf.c 2007-12-29 06:39:09.000000000 -1000
@@ -482,7 +482,7 @@ ssize_t receive_packet (interface, buf,
offset = decode_udp_ip_header (interface,
interface -> rbuf,
interface -> rbuf_offset,
@ -208,10 +210,10 @@ diff -up dhcp-3.1.0/common/bpf.c.xen dhcp-3.1.0/common/bpf.c
/* If the IP or UDP checksum was bad, skip the packet... */
if (offset < 0) {
diff -up dhcp-3.1.0/common/packet.c.xen dhcp-3.1.0/common/packet.c
--- dhcp-3.1.0/common/packet.c.xen 2007-10-22 16:11:12.000000000 -0400
+++ dhcp-3.1.0/common/packet.c 2007-10-22 16:12:41.000000000 -0400
@@ -215,7 +215,7 @@ ssize_t
diff -up dhcp-4.0.0/common/packet.c.xen dhcp-4.0.0/common/packet.c
--- dhcp-4.0.0/common/packet.c.xen 2007-12-29 06:37:53.000000000 -1000
+++ dhcp-4.0.0/common/packet.c 2007-12-29 06:39:20.000000000 -1000
@@ -210,7 +210,7 @@ ssize_t
decode_udp_ip_header(struct interface_info *interface,
unsigned char *buf, unsigned bufix,
struct sockaddr_in *from, unsigned buflen,
@ -220,7 +222,7 @@ diff -up dhcp-3.1.0/common/packet.c.xen dhcp-3.1.0/common/packet.c
{
unsigned char *data;
struct ip ip;
@@ -326,7 +326,7 @@ decode_udp_ip_header(struct interface_in
@@ -321,7 +321,7 @@ decode_udp_ip_header(struct interface_in
8, IPPROTO_UDP + ulen))));
udp_packets_seen++;
@ -229,10 +231,10 @@ diff -up dhcp-3.1.0/common/packet.c.xen dhcp-3.1.0/common/packet.c
udp_packets_bad_checksum++;
if (udp_packets_seen > 4 &&
(udp_packets_seen / udp_packets_bad_checksum) < 2) {
diff -up dhcp-3.1.0/includes/dhcpd.h.xen dhcp-3.1.0/includes/dhcpd.h
--- dhcp-3.1.0/includes/dhcpd.h.xen 2007-10-22 16:11:12.000000000 -0400
+++ dhcp-3.1.0/includes/dhcpd.h 2007-10-22 16:13:01.000000000 -0400
@@ -2140,7 +2140,7 @@ ssize_t decode_hw_header PROTO ((struct
diff -up dhcp-4.0.0/includes/dhcpd.h.xen dhcp-4.0.0/includes/dhcpd.h
--- dhcp-4.0.0/includes/dhcpd.h.xen 2007-12-29 06:37:53.000000000 -1000
+++ dhcp-4.0.0/includes/dhcpd.h 2007-12-29 06:39:27.000000000 -1000
@@ -2561,7 +2561,7 @@ ssize_t decode_hw_header PROTO ((struct
unsigned, struct hardware *));
ssize_t decode_udp_ip_header PROTO ((struct interface_info *, unsigned char *,
unsigned, struct sockaddr_in *,

File diff suppressed because it is too large Load Diff

335
dhcp.spec
View File

@ -1,19 +1,10 @@
# Use 64-bit pointers on POWER and z/Series
%ifarch ppc64 s390x
%define bigptrs -DPTRSIZE_64BIT
%endif
# The workdir is used in the build system for ISC dhcp, we set it to this
# value to avoid any problems guessing what it might be during installation.
%define workdir work.linux-2.2
# The vendor name to append to the version number
# vendor string (e.g., Fedora, EL)
%define vvendor Fedora
Summary: DHCP (Dynamic Host Configuration Protocol) server and relay agent
Name: dhcp
Version: 3.1.0
Release: 12%{?dist}
Version: 4.0.0
Release: 1%{?dist}
# NEVER CHANGE THE EPOCH on this package. The previous maintainer made
# incorrect use of the epoch and that's why it is at 12 now. It should have
# never been used, but it was. So we are stuck with it.
@ -22,49 +13,40 @@ License: ISC
Group: System Environment/Daemons
URL: http://isc.org/products/DHCP/
Source0: ftp://ftp.isc.org/isc/%{name}/%{name}-%{version}.tar.gz
Source1: dhcpd.conf.sample
Source2: dhcpd.init
Source3: dhcrelay.init
Source4: dhcpd.conf
Source5: libdhcp4client.pc
Source6: README.ldap
Source7: draft-ietf-dhc-ldap-schema-01.txt
Source8: dhcpd-conf-to-ldap
Source9: linux
Source10: Makefile.libdhcp4client
Source11: dhcp4client.h
Source12: libdhcp_control.h
Source13: dhcp.schema
Source14: dhclient-script.8
Source15: dhclient.8
Source16: dhclient.conf.5
Source17: dhcp-options.5
Source18: dhcpctl.3
Source19: dhcpd.conf.5
Source20: get-ldap-patch.sh
Source1: dhcpd.init
Source2: dhcrelay.init
Source3: libdhcp4client.pc
Source5: README.ldap
Source6: draft-ietf-dhc-ldap-schema-01.txt
Source7: dhcpd-conf-to-ldap
Source8: linux
Source9: dhcp4client.h
Source10: libdhcp_control.h
Source11: dhcp.schema
Source12: get-ldap-patch.sh
Patch0: %{name}-3.0.5-Makefile.patch
Patch1: %{name}-3.0.5-errwarn-message.patch
Patch2: %{name}-3.1.0-ldap-configuration.patch
Patch3: %{name}-3.0.6-memory.patch
Patch4: %{name}-3.1.0-options.patch
Patch5: %{name}-3.0.5-release-by-ifup.patch
Patch6: %{name}-3.0.5-dhclient-decline-backoff.patch
Patch7: %{name}-3.0.5-enable-timeout-functions.patch
Patch8: %{name}-3.0.5-inherit-leases.patch
Patch9: %{name}-3.0.5-unicast-bootp.patch
Patch10: %{name}-3.0.5-fast-timeout.patch
Patch11: %{name}-3.0.5-failover-ports.patch
Patch12: %{name}-3.1.0-dhclient-usage.patch
Patch13: %{name}-3.0.5-default-requested-options.patch
Patch14: %{name}-3.0.5-prototypes.patch
Patch15: %{name}-3.1.0-libdhcp4client.patch
Patch16: %{name}-3.1.0-xen-checksum.patch
Patch17: %{name}-3.1.0-dhclient-anycast.patch
Patch18: %{name}-3.0.6-ignore-hyphen-x.patch
Patch19: %{name}-3.1.0-warnings.patch
Patch0: %{name}-3.0.5-errwarn-message.patch
Patch1: %{name}-4.0.0-ldap-configuration.patch
Patch2: %{name}-3.0.6-memory.patch
Patch3: %{name}-4.0.0-options.patch
Patch4: %{name}-3.0.5-release-by-ifup.patch
Patch5: %{name}-3.0.5-dhclient-decline-backoff.patch
Patch6: %{name}-3.0.5-enable-timeout-functions.patch
Patch7: %{name}-3.0.5-unicast-bootp.patch
Patch8: %{name}-4.0.0-fast-timeout.patch
Patch9: %{name}-3.0.5-failover-ports.patch
Patch10: %{name}-4.0.0-dhclient-usage.patch
Patch11: %{name}-4.0.0-default-requested-options.patch
Patch12: %{name}-4.0.0-xen-checksum.patch
Patch13: %{name}-4.0.0-dhclient-anycast.patch
Patch14: %{name}-4.0.0-manpages.patch
Patch15: %{name}-4.0.0-paths.patch
Patch16: %{name}-4.0.0-libdhcp4client.patch
Patch17: %{name}-4.0.0-server-Makefile.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: groff
BuildRequires: openldap-devel
@ -136,221 +118,198 @@ Header files for development with the Internet Software Consortium (ISC)
Dynamic Host Configuration Protocol (DHCP) Internet Protocol version 4 (IPv4)
client library.
%package -n libdhcp4client-static
Summary: Static archive for libdhcp4client
Group: Development/Libraries
Requires: libdhcp4client-devel = %{epoch}:%{version}-%{release}
%description -n libdhcp4client-static
The libdhcp4client-static package contains the static archive for
libdhcp4client.
%prep
%setup -q
# Add vendor to the version number
%{__sed} -e 's|V%{version}|V%{version}-%{vvendor}|g' includes/version.h > includes/version.h.new
%{__mv} includes/version.h.new includes/version.h
# Use $(MAKE) and $(CC) in the Makefiles
%patch0 -p1 -b .Makefile
# Replace the standard ISC warning message about requesting help with an
# explanation that this is a patched build of ISC DHCP and bugs should be
# reported through bugzilla.redhat.com
%patch1 -p1 -b .message
%patch0 -p1
# Add support for dhcpd.conf data in LDAP
%patch2 -p1 -b .ldap
# NOTE: Use get-ldap-patch.sh to pull down latest LDAP patch and then modify
# it for this package.
%patch1 -p1
# Fix memory alignment and initialization problems in common/packet.c
# Fix buffer overflow in minires library
# Init struct sock_prog in common/lpf.c to NULL
%patch3 -p1 -b .memory
%patch2 -p1
# Add more dhclient options (-I, -B, -H, -F, -T, -V, and -R)
%patch4 -p1 -b .options
%patch3 -p1
# Handle releasing interfaces requested by /sbin/ifup
# pid file is assumed to be /var/run/dhclient-$interface.pid
%patch5 -p1 -b .release
%patch4 -p1
# If we receive a DHCP offer in dhclient and it's DECLINEd in dhclient-script,
# backoff for an amount of time before trying again
%patch6 -p1 -b .decline
%patch5 -p1
# Enable cancel_all_timeouts() and relinquish_timeouts() regardless of
# the DEBUG_MEMORY_LEAKAGE_ON_EXIT macro
%patch7 -p1 -b .etf
# Inherit active leases
%patch8 -p1 -b .inherit
%patch6 -p1
# Support unicast BOOTP for IBM pSeries systems (and maybe others)
%patch9 -p1 -b .unicast
%patch7 -p1
# Fast timeout for dhclient
%patch10 -p1 -b .fast
%patch8 -p1
# Use the following IANA-registered failover ports:
# dhcp-failover 647/tcp
# dhcp-failover 647/udp
# dhcp-failover 847/tcp
# dhcp-failover 847/udp
%patch11 -p1 -b .failover
%patch9 -p1
# Update the usage screen for dhclient(8) indicating new options
# Use printf() rather than log_info() to display the information
# Also, return EXIT_FAILURE when the usage() screen is displayed (stop parsing)
%patch12 -p1 -b .usage
%patch10 -p1
# Add NIS domain, NIS servers, and NTP servers to the list of default
# requested DHCP options
%patch13 -p1 -b .dho
# Add missing prototypes to take care of gcc warnings
# in dst/dst_api.c: add b64_pton() and b64_ntop()
# in includes/minires/minires.h: remove macro for b64_pton
# in minires/res_mkupdate.c: add b64_pton() and dn_comp()
# in minires/res_comp.c: add ns_name_uncompress(), ns_name_compress(), and
# ns_name_skip()
# in minires/res_init.c: add res_randomid()
%patch14 -p1 -b .prototypes
# Add the libdhcp4client target (library version of dhclient)
%patch15 -p1 -b .libdhcp4client
%patch11 -p1
# Handle Xen partial UDP checksums
%patch16 -p1 -b .xen
%patch12 -p1
# Add anycast support to dhclient (for OLPC)
%patch17 -p1 -b .anycast
%patch13 -p1
# Ignore the old extended new option info command line switch (-x)
%patch18 -p1 -b .enoi
# Patch man page contents
%patch14 -p1
# Fix up anything that fails -Wall -Werror
%patch19 -p1 -b .warnings
# Change paths to conform to our standards
%patch15 -p1
# Add the libdhcp4client target (library version of dhclient)
%patch16 -p1
# Modify LDADD in server/Makefile.am
%patch17 -p1
# Copy in documentation and example scripts for LDAP patch to dhcpd
%{__install} -p -m 0644 %{SOURCE6} .
%{__install} -p -m 0644 %{SOURCE7} doc/
%{__install} -p -m 0755 %{SOURCE8} contrib/
%{__install} -p -m 0644 %{SOURCE5} .
%{__install} -p -m 0644 %{SOURCE6} doc/
%{__install} -p -m 0755 %{SOURCE7} contrib/
# Copy in the Fedora/RHEL dhclient script
%{__install} -p -m 0755 %{SOURCE9} client/scripts/
%{__install} -p -m 0755 %{SOURCE8} client/scripts/
# Copy in the libdhcp4client headers and Makefile.dist
%{__mkdir} -p libdhcp4client
%{__install} -p -m 0644 %{SOURCE10} libdhcp4client/Makefile.dist
%{__install} -p -m 0644 %{SOURCE11} libdhcp4client/
%{__install} -p -m 0644 %{SOURCE9} includes/
# Copy in libdhcp_control.h to the isc-dhcp includes directory
%{__install} -p -m 0644 %{SOURCE12} includes/isc-dhcp/
%{__install} -p -m 0644 %{SOURCE10} includes/isc-dhcp/
# Ensure we don't pick up Perl as a dependency from the scripts and modules
# in the contrib directory (we copy this to /usr/share/doc in the final
# package).
%{__cp} -a contrib __fedora_contrib
%{__chmod} -x __fedora_contrib/3.0b1-lease-convert
%{__chmod} -x __fedora_contrib/dhcpd-conf-to-ldap
%{__mv} __fedora_contrib/ms2isc/Registry.pm __fedora_contrib/ms2isc/Registry.perlmodule
%{__rm} -f __fedora_contrib/dhcp.spec
pushd __fedora_contrib
%{__chmod} -x 3.0b1-lease-convert dhclient-tz-exithook.sh dhcpd-conf-to-ldap
%{__chmod} -x sethostname.sh solaris.init
%{__mv} ms2isc/Registry.pm ms2isc/Registry.perlmodule
%{__rm} -f dhcp.spec
# We want UNIX-style line endings
%{__sed} -i -e 's/\r//' __fedora_contrib/ms2isc/readme.txt
%{__sed} -i -e 's/\r//' __fedora_contrib/ms2isc/Registry.perlmodule
%{__sed} -i -e 's/\r//' __fedora_contrib/ms2isc/ms2isc.pl
%{__sed} -i -e 's/\r//' ms2isc/readme.txt
%{__sed} -i -e 's/\r//' ms2isc/Registry.perlmodule
%{__sed} -i -e 's/\r//' ms2isc/ms2isc.pl
popd
# Copy in our modified man pages
%{__install} -p -m 0644 %{SOURCE14} client/dhclient-script.8
%{__install} -p -m 0644 %{SOURCE15} client/dhclient.8
%{__install} -p -m 0644 %{SOURCE16} client/dhclient.conf.5
%{__install} -p -m 0644 %{SOURCE17} common/dhcp-options.5
%{__install} -p -m 0644 %{SOURCE18} dhcpctl/dhcpctl.3
%{__install} -p -m 0644 %{SOURCE19} server/dhcpd.conf.5
# Replace @PRODUCTNAME@ in dhcp-options.5
# Replace @PRODUCTNAME@
%{__sed} -i -e 's|@PRODUCTNAME@|%{vvendor}|g' common/dhcp-options.5
%{__sed} -i -e 's|@PRODUCTNAME@|%{vvendor}|g' configure.ac
aclocal
libtoolize --copy --force
autoconf
autoheader
automake --foreign --add-missing --copy
%build
%{__cp} %{SOURCE1} .
%{__cat} <<EOF > site.conf
VARDB=%{_localstatedir}/lib/dhcpd
ADMMANDIR=%{_mandir}/man8
FFMANDIR=%{_mandir}/man5
LIBMANDIR=%{_mandir}/man3
USRMANDIR=%{_mandir}/man1
LIBDIR=%{_libdir}
INCDIR=%{_includedir}
EOF
%{__cat} <<EOF >> includes/site.h
#define _PATH_DHCPD_DB "%{_localstatedir}/lib/dhcpd/dhcpd.leases"
#define _PATH_DHCLIENT_DB "%{_localstatedir}/lib/dhclient/dhclient.leases"
EOF
%configure \
--enable-dhcpv6 \
--with-srv-lease-file=%{_localstatedir}/lib/dhcpd/dhcpd.leases \
--with-cli-lease-file=%{_localstatedir}/lib/dhclient/dhclient.leases \
--with-srv-pid-file=%{_localstatedir}/run/dhcpd.pid \
--with-cli-pid-file=%{_localstatedir}/run/dhclient.pid \
--with-relay-pid-file=%{_localstatedir}/run/dhcrelay.pid
%{__make} %{?_smp_mflags}
# Disable gcc's strict aliasing since ISC code tends to cast a lot.
##
## Use -fvisibility=hidden for libdhcp4client. The way that library is
## constructed, we need to follow the hide-by-default/expose-what-we-need
## plan for the library API.
#COPTS="-fPIC -Werror -Dlint -fno-strict-aliasing -fvisibility=hidden"
COPTS="-fPIC -Werror -Dlint -fno-strict-aliasing"
# DO NOT use the %%configure macro because this configure script is not autognu
CC="%{__cc}" ./configure \
--copts "$RPM_OPT_FLAGS $COPTS %{?bigptrs}" \
--work-dir %{workdir}
%{__sed} 's/@DHCP_VERSION@/%{version}/' < %{SOURCE5} > libdhcp4client.pc
%{__make} %{?_smp_mflags} CC="%{__cc}"
%{__sed} 's/@DHCP_VERSION@/%{version}/' < %{SOURCE3} > libdhcp4client.pc
%install
%{__rm} -rf %{buildroot}
%{__mkdir} -p %{buildroot}%{_sysconfdir}/sysconfig
%{__make} install DESTDIR=%{buildroot}
%{__install} -p -m 0644 %{SOURCE12} %{buildroot}%{_includedir}/isc-dhcp/
# Remove files we don't want
%{__rm} -rf %{buildroot}%{_libdir}/libdhcp4client.a
%{__rm} -rf %{buildroot}%{_libdir}/libdhcp4client.la
%{__rm} %{buildroot}%{_sysconfdir}/dhclient.conf
# Install correct dhclient-script
%{__mkdir} -p %{buildroot}/sbin
%{__mv} %{buildroot}%{_sbindir}/dhclient %{buildroot}/sbin/dhclient
%{__install} -p -m 0755 client/scripts/linux %{buildroot}/sbin/dhclient-script
# Install pkg-config file
%{__install} -p -m 0644 %{SOURCE10} %{buildroot}%{_includedir}/isc-dhcp/
%{__install} -p -m 0644 -D libdhcp4client.pc %{buildroot}%{_libdir}/pkgconfig/libdhcp4client.pc
# Install headers for libdhcp4client-devel
%{__mkdir} -p %{buildroot}%{_includedir}/dhcp4client/minires
%{__install} -p -m 0644 %{SOURCE9} %{buildroot}%{_includedir}/dhcp4client
for hdr in cdefs.h ctrace.h dhcp.h dhcp6.h dhcpd.h dhctoken.h failover.h \
heap.h inet.h minires/minires.h minires/res_update.h \
minires/resolv.h osdep.h site.h statement.h tree.h ; do
%{__install} -p -m 0644 includes/${hdr} %{buildroot}%{_includedir}/dhcp4client/${hdr}
done
# Install init scripts
%{__mkdir} -p %{buildroot}%{_initrddir}
%{__install} -p -m 0755 %{SOURCE2} %{buildroot}%{_initrddir}/dhcpd
%{__install} -p -m 0755 %{SOURCE1} %{buildroot}%{_initrddir}/dhcpd
%{__install} -p -m 0755 %{SOURCE2} %{buildroot}%{_initrddir}/dhcrelay
# Start empty lease databases
%{__mkdir} -p %{buildroot}%{_localstatedir}/lib/dhcpd/
touch %{buildroot}%{_localstatedir}/lib/dhcpd/dhcpd.leases
%{__mkdir} -p %{buildroot}%{_localstatedir}/lib/dhclient/
%{__cat} <<EOF > %{buildroot}%{_sysconfdir}/sysconfig/dhcpd
# Command line options here
DHCPDARGS=
EOF
%{__install} -p -m 0755 %{SOURCE3} %{buildroot}%{_initrddir}/dhcrelay
# Create default sysconfig files for dhcpd and dhcrelay
%{__mkdir} -p %{buildroot}%{_sysconfdir}/sysconfig
%{__cat} <<EOF > %{buildroot}%{_sysconfdir}/sysconfig/dhcrelay
%{__cat} << EOF > %{buildroot}%{_sysconfdir}/sysconfig/dhcrelay
# Command line options here
INTERFACES=""
DHCPSERVERS=""
EOF
# Copy sample dhclient.conf file into position
%{__cat} <<EOF > %{buildroot}%{_sysconfdir}/sysconfig/dhcpd
# Command line options here
DHCPDARGS=
EOF
# Copy sample conf files into position (called by doc macro)
%{__cp} -p client/dhclient.conf dhclient.conf.sample
%{__chmod} 0755 %{buildroot}/sbin/dhclient-script
%{__cp} -p server/dhcpd.conf dhcpd.conf.sample
# Install default (empty) dhcpd.conf:
%{__cp} -fp %{SOURCE4} %{buildroot}%{_sysconfdir}
%{__cat} << EOF > %{buildroot}%{_sysconfdir}/dhcpd.conf
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
# see 'man 5 dhcpd.conf'
#
EOF
# Install dhcp.schema for LDAP configuration
%{__mkdir} -p %{buildroot}%{_sysconfdir}/openldap/schema
%{__install} -p -m 0644 -D %{SOURCE13} %{buildroot}%{_sysconfdir}/openldap/schema
%{__install} -p -m 0644 -D libdhcp4client.pc %{buildroot}%{_libdir}/pkgconfig/libdhcp4client.pc
# Sources files can't be symlinks for debuginfo package generation
find %{workdir} -type l |
while read f; do
%{__rm} -f linkderef
%{__cp} $f linkderef
%{__rm} -f $f
%{__mv} linkderef $f
done
%{__install} -p -m 0644 -D %{SOURCE11} %{buildroot}%{_sysconfdir}/openldap/schema
%clean
%{__rm} -rf %{buildroot}
@ -387,7 +346,7 @@ fi
%files
%defattr(-,root,root,-)
%doc README README.ldap RELNOTES dhcpd.conf.sample doc/IANA-arp-parameters
%doc LICENSE README README.ldap RELNOTES dhcpd.conf.sample
%doc doc/IANA-arp-parameters doc/api+protocol doc/*.txt __fedora_contrib/*
%dir %{_localstatedir}/lib/dhcpd
%verify(not size md5 mtime) %config(noreplace) %{_localstatedir}/lib/dhcpd/dhcpd.leases
@ -423,18 +382,18 @@ fi
%files devel
%defattr(-,root,root,-)
%{_includedir}/dhcpctl.h
%{_includedir}/dhcpctl
%{_includedir}/isc-dhcp
%{_includedir}/omapip
%{_libdir}/libdhcpctl.a
%{_libdir}/libomapi.a
%attr(0644,root,root) %{_mandir}/man3/omshell.3.gz
%{_libdir}/libdst.a
%attr(0644,root,root) %{_mandir}/man3/dhcpctl.3.gz
%attr(0644,root,root) %{_mandir}/man3/omapi.3.gz
%files -n libdhcp4client
%defattr(0755,root,root,0755)
%{_libdir}/libdhcp4client-%{version}.so.*
%{_libdir}/libdhcp4client-*.*.so.*
%files -n libdhcp4client-devel
%defattr(0644,root,root,0755)
@ -442,11 +401,13 @@ fi
%{_libdir}/pkgconfig/libdhcp4client.pc
%{_libdir}/libdhcp4client.so
%files -n libdhcp4client-static
%defattr(0644,root,root,0755)
%{_libdir}/libdhcp4client.a
%changelog
* Sun Jan 13 2008 David Cantrell <dcantrell@redhat.com> - 12:4.0.0-1
- Upgrade to ISC dhcp-4.0.0 (#426634)
- first ISC release to incorporate DHCPv6 protocol support
- source tree now uses GNU autoconf/automake
- Removed the libdhcp4client-static package
* Tue Dec 04 2007 David Cantrell <dcantrell@redhat.com> - 12:3.1.0-12
- Requires line fixes

488
dhcpctl.3
View File

@ -1,488 +0,0 @@
.\" -*- 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.

View File

@ -1,4 +0,0 @@
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
#

File diff suppressed because it is too large Load Diff

View File

@ -1,31 +0,0 @@
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;
}
}

View File

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