1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-01 01:17:02 +00:00

Remove net/isc-dhcp30-* as they have been deprecated upstream

since March 2009.
This commit is contained in:
Wesley Shields 2010-06-09 00:14:51 +00:00
parent 4fffbe6658
commit 9f49324149
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=256156
37 changed files with 0 additions and 3929 deletions

View File

@ -1,21 +0,0 @@
# ex:ts=8
# Ports collection makefile for: dhcp
# Date created: 28 April 2003
# Whom: cyrille.lefevre@laposte.net
#
# $FreeBSD$
#
COMMENT= The ISC Dynamic Host Configuration Protocol client
# Local variables
#
SUBSYS= client
# Local overrides
#
MASTERDIR= ${.CURDIR}/../isc-dhcp30-server
.include "${MASTERDIR}/Makefile"

View File

@ -1,24 +0,0 @@
The ISC Dynamic Host Configuration Protocol Distribution provides a
freely redistributable reference implementation of all aspects of the
DHCP protocol, through a suite of DHCP tools:
* A DHCP server
* A DHCP client (this port)
* A DHCP relay agent
Version 3 of the ISC DHCP Distribution includes the following features
that are new since version 2.0:
* DHCP Failover Protocol support
* OMAPI, an API for accessing and modifying the DHCP server and client state
* Conditional behaviour
* Storing arbitrary information on leases
* Address pools with access control
* Client classing
* Address allocation restriction by class
* Relay agent information option support
* Dynamic DNS updates
* Many bug fixes, performance enhancements, and minor new DHCP protocol
features.
WWW: http://www.isc.org/products/DHCP/

View File

@ -1,10 +0,0 @@
**** To setup dhclient, you may need to edit /etc/rc.conf to replace the
base system dhclient, such as :
dhcp_program="%%PREFIX%%/sbin/dhclient"
dhcp_flags="-q"
See dhclient(8), using the following command, for details about other
possible options:
MANPATH=%%MAN1PREFIX%%/man man 8 dhclient

View File

@ -1,8 +0,0 @@
@comment $FreeBSD: /tmp/pcvs/ports/net/isc-dhcp30-client/Attic/pkg-plist,v 1.4 2008-10-13 10:55:31 edwin Exp $
etc/dhclient.conf.sample
@exec [ -f %D/etc/dhclient.conf ] || touch %D/etc/dhclient.conf
@unexec [ -L %D/etc/dhclient.conf -o -s %D/etc/dhclient.conf ] || rm -f %D/etc/dhclient.conf
sbin/dhclient
sbin/dhclient-script
@exec [ -f /var/run/dhclient.leases ] || touch /var/run/dhclient.leases
@unexec [ -s /var/run/dhclient.leases ] || rm -f /var/run/dhclient.leases

View File

@ -1,21 +0,0 @@
# ex:ts=8
# Ports collection makefile for: dhcp
# Date created: 28 April 2003
# Whom: cyrille.lefevre@laposte.net
#
# $FreeBSD$
#
COMMENT= The ISC Dynamic Host Configuration Protocol relay
# Local variables
#
SUBSYS= relay
# Local overrides
#
MASTERDIR= ${.CURDIR}/../isc-dhcp30-server
.include "${MASTERDIR}/Makefile"

View File

@ -1,24 +0,0 @@
The ISC Dynamic Host Configuration Protocol Distribution provides a
freely redistributable reference implementation of all aspects of the
DHCP protocol, through a suite of DHCP tools:
* A DHCP server
* A DHCP client
* A DHCP relay agent (this port)
Version 3 of the ISC DHCP Distribution includes the following features
that are new since version 2.0:
* DHCP Failover Protocol support
* OMAPI, an API for accessing and modifying the DHCP server and client state
* Conditional behaviour
* Storing arbitrary information on leases
* Address pools with access control
* Client classing
* Address allocation restriction by class
* Relay agent information option support
* Dynamic DNS updates
* Many bug fixes, performance enhancements, and minor new DHCP protocol
features.
WWW: http://www.isc.org/products/DHCP/

View File

@ -1,13 +0,0 @@
**** This port installs dhcp relay daemon, but doesn't invoke dhcrelay by
default. If you want to invoke dhcrelay at startup, put these lines
into /etc/rc.conf.
dhcrelay_enable="YES"
dhcrelay_flags="" # command option(s)
dhcrelay_servers="" # dhcrelay server(s)
dhcrelay_ifaces="" # ethernet interface(s)
**** For instance, rc.conf like variables are still read from
%%PREFIX%%/etc/rc.isc-dhcrelay.conf. They should be move
into /etc/rc.conf. Also, the dhcrelay_options variable
must be renamed dhcrelay_flags.

View File

@ -1,4 +0,0 @@
@comment $FreeBSD: /tmp/pcvs/ports/net/isc-dhcp30-relay/Attic/pkg-plist,v 1.6 2008-10-13 10:55:32 edwin Exp $
@unexec %D/etc/rc.d/isc-dhcrelay.sh forcestop 2>/dev/null || true
@unexec %D/etc/rc.d/isc-dhcrelay forcestop 2>/dev/null || true
sbin/dhcrelay

View File

@ -1,368 +0,0 @@
# ex:ts=8
# Ports collection makefile for: dhcp
# Date created: 7 Mar 1996
# Whom: se
#
# $FreeBSD$
#
PORTNAME= dhcp
PORTVERSION= 3.0.7
PORTREVISION= ${DHCP_PORTREVISION}
CATEGORIES= net
MASTER_SITES= ${MASTER_SITE_ISC}
MASTER_SITE_SUBDIR= dhcp dhcp/dhcp-3.0-history
PKGNAMEPREFIX= isc-
PKGNAMESUFFIX= 30-${SUBSYS}
DISTNAME= ${PORTNAME}-${RELEASE}${VERSION}${PATCHLEVEL}
MAINTAINER= jpaetzel@FreeBSD.org
COMMENT?= The ISC Dynamic Host Configuration Protocol server
DEPRECATED= End-of-life by authors. Please use one of the other DHCP ports
EXPIRATION_DATE= 2010-06-03
PORTREVISION_SERVER= 6
PORTREVISION_CLIENT= 2
PORTREVISION_RELAY= 1
PORTREVISION_DEVEL= 1
SUBSYS?= server
UNIQUENAME= ${PKGNAMEPREFIX}${PORTNAME}${PKGNAMESUFFIX}
.if ${SUBSYS} == client
OPTIONS= INTERFACE_POLLING "interface polling support" on
.endif
.if ${SUBSYS} == server
OPTIONS= DHCP_PARANOIA "add -user, -group and -chroot options" on \
DHCP_JAIL "add -chroot and -jail options" on \
DHCP_SOCKETS "use sockets instead of /dev/bpf (jail-only)" off \
DHCP_LDAP "add experimental LDAP backend support" off \
DHCP_LDAP_SSL "support LDAP connection over SSL/TLS" on \
OPENSSL_BASE "use the base system OpenSSL (required by TLS)" on \
OPENSSL_PORT "use OpenSSL from ports (required by TLS)" off \
DHCP_LQ "DHCPLEASEQUERY support used by Cisco uBR's" off
.endif
# PORTREVISION handling
.if ${SUBSYS} == client
CONFLICTS= isc-dhcp31-client* isc-dhcp41-client*
DHCP_PORTREVISION= ${PORTREVISION_CLIENT}
.elif ${SUBSYS} == relay
CONFLICTS= isc-dhcp31-relay* isc-dhcp41-relay*
DHCP_PORTREVISION= ${PORTREVISION_RELAY}
.elif ${SUBSYS} == devel
DHCP_PORTREVISION= ${PORTREVISION_DEVEL}
.else
CONFLICTS= isc-dhcp31-server* isc-dhcp41-server*
DHCP_PORTREVISION= ${PORTREVISION_SERVER}
.endif
.include <bsd.port.pre.mk>
.if ${SUBSYS} == server && defined(WITH_DHCP_LDAP)
# Based on patch from Brian Masney :
PATCH_SITES= http://www.newwave.net/~masneyb/:ldap \
ftp://ftp.frm2.tum.de/pub/jpulz/FreeBSD/:ldap
PATCHFILES= ${PORTNAME}-${RELEASE}${VERSION}${PATCHLEVEL}-ldap-patch:ldap
PATCH_DIST_STRIP= -p1
USE_PERL5_RUN= yes
USE_OPENLDAP= yes
.if !defined(WITHOUT_DHCP_LDAP_SSL)
. if !defined(WITHOUT_OPENSSL_BASE)
. if defined(WITH_OPENSSL_PORT)
BROKEN= Multiple OpenSSL versions selected. Run 'make config' again!
. endif
. else
. if !defined(WITH_OPENSSL_PORT)
BROKEN= No OpenSSL versions selected. Run 'make config' again!
. endif
. endif
USE_OPENSSL= yes
# hack to get bsd.openssl.mk included at this late state
.include "${PORTSDIR}/Mk/bsd.openssl.mk"
.endif
.endif
.if ${SUBSYS} == server && defined(WITH_DHCP_LQ)
# Based on patch from Dmitry Sukhodoev :
PATCH_SITES+= http://bingo.ru/~raven/FreeBSD/patches/:dlq \
ftp://ftp.frm2.tum.de/pub/jpulz/FreeBSD/:dlq
PATCHFILES+= ${PORTNAME}-${RELEASE}${VERSION}${PATCHLEVEL}-dlq-patch:dlq
.endif
# Global variables
#
HAS_CONFIGURE= yes
CONFIGURE_ARGS= --subsys ${SUBSYS}
ALL_TARGET= all.${SUBSYS}
INSTALL_TARGET= install.${SUBSYS}
SCRIPTS_ENV+= PKG_PREFIX=${PREFIX}
.if ${SUBSYS} == client
MAN5= dhclient.conf.5 dhclient.leases.5
MAN8= dhclient.8 dhclient-script.8
.elif ${SUBSYS} == server
MAN1= omshell.1
MAN5= dhcpd.conf.5 dhcpd.leases.5
MAN8= dhcpd.8
.elif ${SUBSYS} == relay
MAN8= dhcrelay.8
.else
MAN3= dhcpctl.3 omapi.3
.endif
.if ${SUBSYS} != relay
MAN5+= dhcp-eval.5 dhcp-options.5
.endif
MSG_FILE= ${.CURDIR}/pkg-message
DESCR= ${.CURDIR}/pkg-descr
PKGINSTALL= ${.CURDIR}/pkg-install
PKGDEINSTALL= ${PKGINSTALL}
PKGMESSAGE= ${WRKDIR}/pkg-message
PLIST= ${.CURDIR}/pkg-plist
# Local variables
#
# for instance, possible versions are:
# 1.2.r3.4 (or 1.2.b3.4), 1.2.r3 (or 1.2.b3), 1.2.3, 1.2
# which have to become:
# 1.2rc3pl4 (or 1.2beta3pl4), 1.2rc3 (or 1.2beta3), 1.2.3, 1.2
# so, the magic things are:
VERSION=
PATCHLEVEL=
.if ${PORTVERSION:R:E:M[br]*} != ""
RELEASE= ${PORTVERSION:R:R}
VERSION= ${PORTVERSION:R:E:S/b/beta/:S/r/rc/}
PATCHLEVEL= pl${PORTVERSION:E}
.elif ${PORTVERSION:E:M[br]*} != ""
RELEASE= ${PORTVERSION:R}
VERSION= ${PORTVERSION:E:S/b/beta/:S/r/rc/}
#.elif ${PORTVERSION:R:E} != ""
#RELEASE= ${PORTVERSION:R}
#PATCHLEVEL= pl${PORTVERSION:E}
.else
RELEASE= ${PORTVERSION}
.endif
PATCH_SUBDIRS= common minires dst omapip
.if ${SUBSYS} == server || ${SUBSYS} == devel
PATCH_SUBDIRS+= dhcpctl
.endif
.if ${SUBSYS} != devel
PATCH_SUBDIRS+= ${SUBSYS}
.endif
.if ${SUBSYS} == server
PATCH_SUBDIRS+= omshell
.endif
.if !defined(NOPORTDOCS)
PORTDOCS= LICENSE README RELNOTES
.endif
.if ${SUBSYS} == client
BIN_FILES= dhclient
LOCAL_CONF_FILES= dhclient.conf
SAMP_FILES= client/dhclient.conf
DATA_FILES= dhclient.leases
.elif ${SUBSYS} == server
BIN_FILES= dhcpd omshell
USE_RC_SUBR= isc-dhcpd
SAMP_FILES= server/dhcpd.conf
DATA_FILES= dhcpd.leases
.if defined(WITH_DHCP_LDAP)
PORTDOCS+= README.ldap
LDAP_SCRIPT= contrib/dhcpd-conf-to-ldap.pl
LDAP_SCHEMA= contrib/dhcp.schema
.endif
.elif ${SUBSYS} == relay
BIN_FILES= dhcrelay
USE_RC_SUBR= isc-dhcrelay
.endif
SAMP_SUFX= .sample
CONF_DIR= ${PREFIX}/etc
SCHEMA_DIR= ${PREFIX}/share/${PKGBASE}
DOCSDIR= ${PREFIX}/share/doc/${PKGBASE}
DATADIR= /var/db
PLIST_SUB+= SCHEMA_DIR="${SCHEMA_DIR:S,^${PREFIX}/,,}"
.if defined(WITH_DHCP_LDAP)
PLIST_SUB+= LDAP=""
.else
PLIST_SUB+= LDAP="@comment "
.endif
REINPLACE_SUB= PREFIX=${PREFIX}
.if !defined(WITHOUT_DHCP_PARANOIA)
SUB_LIST+= PARANOIA=YES
.else
SUB_LIST+= PARANOIA=NO
.endif
.if !defined(WITHOUT_DHCP_JAIL)
SUB_LIST+= JAIL=YES
.else
SUB_LIST+= JAIL=NO
.endif
PKGMESSAGE_SUB= PREFIX="${PREFIX}" MAN1PREFIX="${MAN1PREFIX}" \
DOCSDIR="${DOCSDIR}" SCHEMA_DIR="${SCHEMA_DIR}"
# Post-extract
#
post-extract: extract-omshell extract-script
extract-omshell:
@${MKDIR} ${WRKSRC}/omshell
@${MV} ${WRKSRC}/dhcpctl/omshell.? ${WRKSRC}/omshell
@${CP} ${FILESDIR}/omshell::Makefile.dist \
${WRKSRC}/omshell/Makefile.dist
extract-script:
@${CP} ${FILESDIR}/client::scripts::freebsd ${WRKSRC}/client/scripts/freebsd
# Post-patch
#
post-patch: patch-scripts patch-makefile-conf \
patch-makefiles-dist patch-man-pages \
patch-pkgmessage patch-site-conf \
patch-dlq
patch-scripts:
@${REINPLACE_CMD} ${REINPLACE_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
${WRKSRC}/client/dhclient.conf \
${WRKSRC}/client/scripts/freebsd
patch-site-conf:
.if ${SUBSYS} == client && !defined(WITHOUT_INTERFACE_POLLING)
@${ECHO_CMD} CFLAGS += -DENABLE_POLLING_MODE >> ${WRKSRC}/site.conf
.endif
.if ${SUBSYS} == server
.if !defined(WITHOUT_DHCP_PARANOIA)
@${ECHO_CMD} CFLAGS += -DPARANOIA >> ${WRKSRC}/site.conf
.endif
.if !defined(WITHOUT_DHCP_JAIL)
@${ECHO_CMD} CFLAGS += -DJAIL >> ${WRKSRC}/site.conf
.if defined(WITH_DHCP_SOCKETS)
@${ECHO_CMD} CFLAGS += -DUSE_SOCKETS >> ${WRKSRC}/site.conf
.endif
.endif
.if defined(WITH_DHCP_LDAP)
@${ECHO_CMD} CFLAGS += -I${LOCALBASE}/include >> ${WRKSRC}/site.conf
@${ECHO_CMD} LIBS += -L${LOCALBASE}/lib >> ${WRKSRC}/site.conf
.if !defined(WITHOUT_DHCP_LDAP_SSL)
@${ECHO_CMD} CFLAGS += -DUSE_SSL -I${OPENSSLINC} >> ${WRKSRC}/site.conf
@${ECHO_CMD} LIBS += -L${OPENSSLLIB} >> ${WRKSRC}/site.conf
@${ECHO_CMD} LIBS += -lcrypto -lssl >> ${WRKSRC}/site.conf
.endif
.endif
.endif
patch-makefile-conf:
@${REINPLACE_CMD} -e 's|^DEBUG[ ]*=|# DEBUG ?=|g' \
${WRKSRC}/Makefile.conf
patch-makefiles-dist:
.for subdir in ${PATCH_SUBDIRS}
@${REINPLACE_CMD} -e 's|^CFLAGS[ ]*=|CFLAGS +=|g' \
${WRKSRC}/${subdir}/Makefile.dist
.endfor
# temporary hack - no patch file needed for this typo.
patch-man-pages:
@${REINPLACE_CMD} -e '/^\.Fd$$/d' ${WRKSRC}/dhcpctl/dhcpctl.3
patch-pkgmessage:
.if ${SUBSYS} != devel
@${SED} ${PKGMESSAGE_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
${MSG_FILE} > ${PKGMESSAGE}
.if defined(WITH_DHCP_LDAP)
@${REINPLACE_CMD} -e 's|^%%LDAP%%||g' ${PKGMESSAGE}
.else
@${REINPLACE_CMD} -e '/^%%LDAP%%/d' ${PKGMESSAGE}
.endif
.endif
patch-dlq:
.if ${SUBSYS} == server && defined(WITH_DHCP_LQ)
.if defined(WITH_DHCP_LDAP)
@${PATCH} ${PATCH_ARGS} < ${PATCHDIR}/extra-patch-dlq-ldap
.else
@${PATCH} ${PATCH_ARGS} < ${PATCHDIR}/extra-patch-dlq
.endif
.endif
# Post-install
#
POST-INSTALL= parallel-post-install install-rc-script configure-package \
display-message
.ORDER: ${POST-INSTALL}
post-install: ${POST-INSTALL}
parallel-post-install: \
strip-binary-files \
install-doc-files install-ldap-files install-sample-files \
create-conf-files create-data-files
strip-binary-files:
.for f in ${BIN_FILES}
.if exists(${PREFIX}/bin/${f})
@${STRIP_CMD} ${PREFIX}/bin/${f}
.endif
.if exists(${PREFIX}/sbin/${f})
@${STRIP_CMD} ${PREFIX}/sbin/${f}
.endif
.endfor
install-doc-files:
.if !defined(NOPORTDOCS)
@${MKDIR} ${DOCSDIR}
.for f in ${PORTDOCS}
@${INSTALL_DATA} ${WRKSRC}/${f} ${DOCSDIR}
.endfor
.endif
install-ldap-files:
.if ${SUBSYS} == server && defined(WITH_DHCP_LDAP)
@${INSTALL_SCRIPT} ${WRKSRC}/${LDAP_SCRIPT} ${PREFIX}/bin
@${MKDIR} ${SCHEMA_DIR}
@${INSTALL_DATA} ${WRKSRC}/${LDAP_SCHEMA} ${SCHEMA_DIR}
.endif
install-sample-files:
.for f in ${SAMP_FILES}
@${INSTALL_DATA} ${WRKSRC}/${f} ${CONF_DIR}/${f:T}${SAMP_SUFX}
.endfor
create-conf-files:
.for f in ${LOCAL_CONF_FILES}
.if !exists(${CONF_DIR}/${f})
@${TOUCH} ${CONF_DIR}/${f}
.endif
.endfor
create-data-files:
.for f in ${DATA_FILES}
.if !exists(${DATADIR}/${f})
@${TOUCH} ${DATADIR}/${f}
.endif
.endfor
configure-package:
.if ${SUBSYS} == server
@${SETENV} ${SCRIPTS_ENV} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
.endif
display-message:
.if ${SUBSYS} != devel
@${ECHO_MSG}
@${CAT} ${PKGMESSAGE}
@${ECHO_MSG}
.endif
.include <bsd.port.post.mk>

View File

@ -1,9 +0,0 @@
MD5 (dhcp-3.0.7.tar.gz) = 426bfa1712ababaff4be6dadee9c1982
SHA256 (dhcp-3.0.7.tar.gz) = 9ec6fbd37b4705fd8eed782b64790a246c56b5fd1d5e7de3109b6c23f41b9c50
SIZE (dhcp-3.0.7.tar.gz) = 888829
MD5 (dhcp-3.0.7-ldap-patch) = 41cde9e9a768bf12390288465ef30bbd
SHA256 (dhcp-3.0.7-ldap-patch) = e700472acb890b504ae5199500a0e87ca1da607946b2f3a8a8958f82d0a277c0
SIZE (dhcp-3.0.7-ldap-patch) = 192308
MD5 (dhcp-3.0.7-dlq-patch) = 0e071945cc986d7ecdfd9b41fc4a102b
SHA256 (dhcp-3.0.7-dlq-patch) = c3fd3200eaf00fa80cb37f19bd3b9edb89497c235b5fa594a0f6f60050f64108
SIZE (dhcp-3.0.7-dlq-patch) = 7655

View File

@ -1,510 +0,0 @@
#!/bin/sh
#############################################################################
#
# Copyright (c) 1999, MindStep Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
#
#############################################################################
#
# This script was written by Patrick Bihan-Faou, patrick@mindstep.com,
# Please contact us for bug reports, etc.
#
#############################################################################
# $MindStep_Id: dhclient-script.sh,v 1.8 1999/12/07 22:11:08 patrick Exp $
# $MindStep_Tag: CONTRIB_19991207 $
# from FreeBSD: src/sbin/dhclient/dhclient-script.sh,v 1.2 2002/02/01 18:46:58 alfred Exp
# $FreeBSD$
#############################################################################
#############################################################################
# hook functions prototypes
#
# The "pre_state_XXX_hook" functions are called before the main
# work is done for the state XXX
#
# The "post_state_XXX_hook" functions are called after the main
# work is done for the state XXX
#
# These functions are meant to be overridden by the user's
# dhclient-enter-hooks file
#############################################################################
pre_state_MEDIUM_hook () { }
pre_state_PREINIT_hook () { }
pre_state_ARPCHECK_hook () { }
pre_state_ARPSEND_hook () { }
pre_state_RENEW_hook () { }
pre_state_REBIND_hook () { }
pre_state_BOUND_hook () { }
pre_state_REBOOT_hook () { }
pre_state_EXPIRE_hook () { }
pre_state_FAIL_hook () { }
pre_state_TIMEOUT_hook () { }
post_state_MEDIUM_hook () { }
post_state_PREINIT_hook () { }
post_state_ARPCHECK_hook () { }
post_state_ARPSEND_hook () { }
post_state_RENEW_hook () { }
post_state_REBIND_hook () { }
post_state_BOUND_hook () { }
post_state_REBOOT_hook () { }
post_state_EXPIRE_hook () { }
post_state_FAIL_hook () { }
post_state_TIMEOUT_hook () { }
#############################################################################
# make_resolv_conf
#
# This function is called to update the information related to the
# DNS configuration (the resolver part)
#############################################################################
make_resolv_conf ()
{
if [ "x$new_domain_name" != x ] && [ "x$new_domain_name_servers" != x ]; then
echo search $new_domain_name >/etc/resolv.conf
for nameserver in $new_domain_name_servers; do
echo nameserver $nameserver >>/etc/resolv.conf
done
fi
}
#############################################################################
# set_XXX
# unset_XXX
#
# These function each deal with one particular setting.
# They are OS dependent and may be overridden in the
# dhclient-enter-hooks file if needed.
#
# These functions are called with either "new" or "old" to indicate which
# set of variables to use (new_ip_address or old_ip_address...)
#
#############################################################################
update_hostname ()
{
local current_hostname=`/bin/hostname`
if [ "$current_hostname" = "" ] || \
[ "$current_hostname" = "$old_host_name" ]
then
if [ "$new_host_name" != "$old_host_name" ]
then
$LOGGER "New Hostname: $new_host_name"
hostname $new_host_name
fi
fi
}
set_ip_address ()
{
local ip
local mask
local bcast
if [ $# -lt 1 ]
then
return 1
fi
eval ip="\$${1}_ip_address"
eval mask="\$${1}_subnet_mask"
eval bcast="\$${1}_broadcast_address"
if [ "$ip" != "" ]
then
ifconfig $interface inet $ip netmask $mask broadcast $bcast $medium
# route add $ip 127.0.0.1 > /dev/null 2>&1
fi
}
unset_ip_address ()
{
local ip
if [ $# -lt 1 ]
then
return 1
fi
eval ip="\$${1}_ip_address"
if [ "$ip" != "" ]
then
ifconfig $interface inet -alias $ip $medium
# route delete $ip 127.0.0.1 > /dev/null 2>&1
fi
}
set_ip_alias ()
{
if [ "$alias_ip_address" != "" ]
then
ifconfig $interface inet alias $alias_ip_address netmask $alias_subnet_mask
# route add $alias_ip_address 127.0.0.1
fi
}
unset_ip_alias ()
{
if [ "$alias_ip_address" != "" ]
then
ifconfig $interface inet -alias $alias_ip_address > /dev/null 2>&1
# route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1
fi
}
set_routers ()
{
local router_list
if [ $# -lt 1 ]
then
return 1
fi
eval router_list="\$${1}_routers"
for router in $router_list
do
route add default $router >/dev/null 2>&1
done
}
unset_routers ()
{
local router_list
if [ $# -lt 1 ]
then
return 1
fi
eval router_list="\$${1}_routers"
for router in $router_list
do
route delete default $router >/dev/null 2>&1
done
}
set_static_routes ()
{
local static_routes
if [ $# -lt 1 ]
then
return 1
fi
eval static_routes="\$${1}_static_routes"
set static_routes
while [ $# -ge 2 ]
do
$LOGGER "New Static Route: $1 -> $2"
route add $1 $2
shift; shift
done
}
unset_static_routes ()
{
local static_routes
if [ $# -lt 1 ]
then
return 1
fi
eval static_routes="\$${1}_static_routes"
set static_routes
while [ $# -ge 2 ]
do
route delete $1 $2
shift; shift
done
}
#############################################################################
#
# utility functions grouping what needs to be done in logical units.
#
#############################################################################
set_all ()
{
set_ip_address new
set_routers new
set_static_routes new
if [ "$new_ip_address" != "$alias_ip_address" ]
then
set_ip_alias
fi
}
set_others ()
{
update_hostname
make_resolv_conf
}
clear_arp_table ()
{
arp -d -a
}
unset_all ()
{
if [ "$alias_ip_address" != "$old_ip_address" ]
then
unset_ip_alias
fi
if [ "$old_ip_address" != "" ]
then
unset_ip_address old
unset_routers old
unset_static_routes old
clear_arp_table
fi
}
test_new_lease ()
{
local rc
set $new_routers
if [ $# -ge 1 ]
then
set_ip_address new
if ping -q -c 1 $1
then
rc=0
else
rc=1
fi
unset_ip_address new
else
rc=1
fi
return $rc
}
#############################################################################
# Main State functions.
#
# There is a state function for each state of the DHCP client
# These functions are OS specific and should be be tampered with.
#############################################################################
in_state_MEDIUM ()
{
ifconfig $interface $medium
ifconfig $interface inet -alias 0.0.0.0 $medium >/dev/null 2>&1
sleep 1
exit_status=0
}
in_state_PREINIT ()
{
unset_ip_alias
ifconfig $interface inet 0.0.0.0 netmask 0.0.0.0 \
broadcast 255.255.255.255 up
exit_status=0
}
in_state_ARPCHECK ()
{
exit_status=0
}
in_state_ARPSEND ()
{
exit_status=0
}
in_state_RENEW ()
{
if [ "$old_ip_address" != "$new_ip_address" ]
then
unset_all
set_all
fi
set_others
}
in_state_REBIND () {
in_state_RENEW
}
in_state_BOUND () {
unset_all
set_all
set_others
}
in_state_REBOOT () {
in_state_BOUND
}
in_state_EXPIRE ()
{
unset_all
set_ip_alias
exit_status=0
}
in_state_FAIL () {
in_state_EXPIRE
}
in_state_TIMEOUT ()
{
unset_all
if test_new_lease
then
set_all
set_others
else
$LOGGER "No good lease information in TIMEOUT state"
set_ip_alias
exit_status=1
fi
}
#############################################################################
# Main functions:
#
# dhclient_script_init() parses the optional "enter_hooks" script which can
# override any of the state functions
#
# This function also parses the variables and notifies the detected changes.
#############################################################################
dhclient_script_init ()
{
if [ "$new_network_number" != "" ]
then
$LOGGER "New Network Number: $new_network_number"
fi
if [ "$new_ip_address" != "" ]
then
$LOGGER "New IP Address: $new_ip_address"
fi
if [ "$new_broadcast_address" != "" ]
then
$LOGGER "New Broadcast Address: $new_broadcast_address"
fi
if [ "$new_subnet_mask" != "" ]
then
$LOGGER "New Subnet Mask for $interface: $new_subnet_mask"
fi
if [ "$alias_subnet_mask" != "" ]
then
fi
}
#############################################################################
# dhclient_main() does the appropriate work depending on the state of
# the dhcp client
#############################################################################
dhclient_script_main ()
{
# set -x
exit_status=0
case $reason in
MEDIUM|\
PREINIT|\
ARPCHECK|\
ARPSEND|\
RENEW|\
REBIND|\
BOUND|\
REBOOT|\
EXPIRE|\
FAIL|\
TIMEOUT)
pre_state_${reason}_hook
in_state_${reason}
post_state_${reason}_hook
;;
*)
$LOGGER "dhclient-script called with invalid reason $reason"
exit_status=1
;;
esac
}
#############################################################################
# Let's do the work...
#############################################################################
if [ -x /usr/bin/logger ]; then
LOGGER="/usr/bin/logger -s -p user.notice -t dhclient"
else
LOGGER=echo
fi
# Invoke the local dhcp client enter hooks, if they exist.
if [ -x %%PREFIX%%/etc/dhclient-enter-hooks ]
then
exit_status=0
. %%PREFIX%%/etc/dhclient-enter-hooks
# allow the local script to abort processing of this state
# local script must set exit_status variable to nonzero.
if [ $exit_status -ne 0 ]
then
exit $exit_status
fi
fi
dhclient_script_init
dhclient_script_main
# Invokes the local dhcp client exit hooks, if any.
if [ -x %%PREFIX%%/etc/dhclient-exit-hooks ]; then
. %%PREFIX%%/etc/dhclient-exit-hooks
fi
exit $exit_status
#############################################################################
# That's all folks
#############################################################################

View File

@ -1,14 +0,0 @@
--- server/Makefile.dist.orig Tue Jun 14 09:37:50 2005
+++ server/Makefile.dist Tue Jun 14 09:37:50 2005
@@ -25,9 +25,9 @@
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
+ omapi.c mdb.c stables.c salloc.c ddns.c dhcpleasequery.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
+ omapi.o mdb.o stables.o salloc.o ddns.o dhcpleasequery.o
PROG = dhcpd
MAN = dhcpd.8 dhcpd.conf.5 dhcpd.leases.5

View File

@ -1,14 +0,0 @@
--- server/Makefile.dist.orig Tue Jun 14 09:39:39 2005
+++ server/Makefile.dist Tue Jun 14 09:39:39 2005
@@ -25,9 +25,9 @@
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 \
- ldap.c ldap_casa.c omapi.c mdb.c stables.c salloc.c ddns.c
+ ldap.c ldap_casa.c omapi.c mdb.c stables.c salloc.c ddns.c dhcpleasequery.c
OBJS = dhcpd.o dhcp.o bootp.o confpars.o db.o class.o failover.o \
- ldap.o ldap_casa.o omapi.o mdb.o stables.o salloc.o ddns.o
+ ldap.o ldap_casa.o omapi.o mdb.o stables.o salloc.o ddns.o dhcpleasequery.o
PROG = dhcpd
MAN = dhcpd.8 dhcpd.conf.5 dhcpd.leases.5

View File

@ -1,753 +0,0 @@
#! /bin/sh
#
# $FreeBSD$
#
# PROVIDE: dhcpd
# REQUIRE: DAEMON
# BEFORE: LOGIN
# KEYWORD: shutdown
#
# Add the following line to /etc/rc.conf to enable dhcpd:
#
# dhcpd_enable="YES"
#
. /etc/rc.subr
name=dhcpd
paranoia=%%PARANOIA%% # compiled in paranoia?
jail=%%JAIL%% # compiled in jail?
load_rc_config ${name}
# override these variables in /etc/rc.conf
dhcpd_enable=${dhcpd_enable:-"NO"}
dhcpd_flags=${dhcpd_flags:-} # -q -early_chroot # command option(s)
dhcpd_conf=${dhcpd_conf:-%%PREFIX%%/etc/${name}.conf} # configuration file
dhcpd_ifaces=${dhcpd_ifaces:-} # ethernet interface(s)
dhcpd_withumask=${dhcpd_withumask:-022} # file creation mask
dhcpd_chuser_enable=${dhcpd_chuser_enable:-"%%PARANOIA%%"} # runs w/o privileges?
dhcpd_withuser=${dhcpd_withuser:-${name}} # user name to run as
dhcpd_withgroup=${dhcpd_withgroup:-${name}} # group name to run as
dhcpd_chroot_enable=${dhcpd_chroot_enable:-"NO"} # runs chrooted?
dhcpd_devfs_enable=${dhcpd_devfs_enable:-"YES"} # devfs if available?
dhcpd_makedev_enable=${dhcpd_makedev_enable:-"NO"} # MAKEDEV instead of devfs?
dhcpd_rootdir=${dhcpd_rootdir:-/var/db/${name}} # directory to run in
dhcpd_includedir=${dhcpd_includedir:-} # directory for included config files
# untested
dhcpd_jail_enable=${dhcpd_jail_enable:-"NO"} # runs imprisoned?
dhcpd_hostname=${dhcpd_hostname:-} # jail hostname
dhcpd_ipaddress=${dhcpd_ipaddress:-} # jail ip address
safe_run () # rc command [args...]
{
local _rc
_rc=$1
shift
if [ "${_rc}" -eq 0 ]; then
debug safe_run: "$@"
"$@" || _rc=1
else
warn safe_run: "$@"
fi
return ${_rc}
}
precious () # entry...
{
local _entry _rc
_rc=0
for _entry; do
# do nothing if /dev, /var/run or /var/db
echo ${_entry} | egrep -q '^//*(dev|var//*(run|db))?/*$' || _rc=1
done
debug precious: "$@" rc=${_rc}
return ${_rc}
}
lsmod () # user group file...
{
local _entry _user _group _rc
_user=$1 _group=$2
shift 2
_rc=0
for _entry; do
ls -ld ${_entry} 2> /dev/null |
awk -v u=${_user} -v g=${_group} '{
exit ((u && $3 != u) || (g && $4 != g))
}' || _rc=1
done
debug lsmod: "$@" rc=${_rc}
return ${_rc}
}
safe_chmog () # entry...
{
local _entry _user _group _usergroup _rc
_user=${dhcpd_withuser}
_group=${dhcpd_withgroup}
_rc=0
if [ -n "${_user}" -o -n "${_group}" ]; then
_usergroup=${_user}${_group:+:${_group}}
for _entry; do
if [ -d ${_entry} ] && mounted ${_entry}; then
continue
fi
if [ -e ${_entry} ] &&
! precious ${_entry} &&
! lsmod ${_user} ${_group} ${_entry} &&
! safe_run ${_rc} chown ${_usergroup} ${_entry}; then
warn "unable to change permissions of ${_entry}"
_rc=1
fi
done
fi
return ${_rc}
}
safe_mkdir () # dir...
{
local _dir _rc
_rc=0
for _dir; do
if [ ! -d ${_dir} ] &&
! precious ${_dir} &&
! safe_run ${_rc} mkdir -p ${_dir}; then
err 1 "unable to create directory ${_dir}"
_rc=1
fi
done
safe_run ${_rc} safe_chmog "$@" || _rc=1
return ${_rc}
}
safe_rmdir () # dir...
{
local _dir _rc
_rc=0
for _dir; do
if [ -d ${_dir} ] &&
! precious ${_dir} &&
! mounted ${_dir}; then
if safe_run ${_rc} rmdir ${_dir}; then
safe_run ${_rc} safe_rmdir ${_dir%/*} || _rc=1
else
warn "unable to remove directory ${_dir}"
_rc=1
fi
fi
done
return ${_rc}
}
safe_touch () # file...
{
local _file _rc
_rc=0
for _file; do
if [ ! -e ${_file} ] &&
! safe_run ${_rc} touch ${_file}; then
err 1 "unable to create file ${_file}"
_rc=1
fi
done
safe_run ${_rc} safe_chmog "$@" || _rc=1
return ${_rc}
}
safe_remove () # entry...
{
local _entry _rc
_rc=0
for _entry; do
if [ -f ${_entry} ]; then
if ! safe_run ${_rc} rm -f ${_entry}; then
warn "unable to remove file ${_entry}"
_rc=1
fi
elif [ -d ${_entry} ] &&
! precious ${_entry} &&
! mounted ${_entry}; then
if ! safe_run ${_rc} rm -rf ${_entry}; then
warn "unable to remove directory ${_entry}"
_rc=1
fi
fi
done
return ${_rc}
}
safe_copy () # src dst
{
local _src _dst _rc
_src=$1 _dst=$2
_rc=0
if [ -f ${_src} ]; then
if ! safe_run ${_rc} safe_remove ${_dst} ||
! safe_run ${_rc} cp -p ${_src} ${_dst}; then
err 1 "unable to copy file ${_src} to ${_dst}"
_rc=1
fi
safe_run ${_rc} safe_chmog ${_dst} || _rc=1
elif [ -d ${_src} ] &&
! precious ${_dst} &&
! mounted ${_dst}; then
if ! safe_run ${_rc} pax -rw -pe -ts "|^${_src}||" \
${_src} ${_dst}; then
err 1 "unable to copy directory ${_src} to ${_dst}"
_rc=1
fi
else
err 1 "unable to copy ${_src} to ${_dst}" \
"-- not a file or a directory"
_rc=1
fi
return ${_rc}
}
mounted () # dir...
{
local _rc
_rc=1
if checkyesno dhcpd_devfs_enable ||
checkyesno dhcpd_jail_enable; then
mount -t devfs | awk '
BEGIN { n = ARGC; ARGC = 2 }
{ for (i = 2; i != n; i++) if ($3 == ARGV[i]) exit 1 }
' - "$@" || _rc=0
fi
debug mounted: "$@" rc=${_rc}
return ${_rc}
}
safe_mount () # dir
{
local _dir _rc
_dir=$1
_rc=0
if checkyesno dhcpd_devfs_enable &&
! mounted ${_dir} &&
! safe_run ${_rc} mount -t devfs devfs ${_dir}; then
err 1 "unable to mount ${_dir}"
_rc=1
fi
return ${_rc}
}
safe_umount () # dir
{
local _dir _rc
_dir=$1
_rc=0
if checkyesno dhcpd_devfs_enable &&
mounted ${_dir} &&
! safe_run ${_rc} umount ${_dir}; then
warn "unable to unmount ${_dir}"
_rc=1
fi
return ${_rc}
}
safe_useradd ()
{
local _user _group _home _shell _gecos _gid _usr
_user=$1 _group=$2 _gecos=${3:-"& daemon"}
_uid=$4 _gid=$5
_home=${6:-/nonexistent} _shell=${7:-/usr/sbin/nologin}
if [ -n "${_group}" ]; then
if pw group show ${_group} 2>/dev/null; then
echo "You already have a group \"${_group}\"," \
"so I will use it."
elif pw groupadd ${_group} -g ${_gid} -h -; then
echo "Added group \"${_group}\"."
else
echo "Adding group \"${_group}\" failed..."
echo "Please create it, and try again."
exit 1
fi
fi
if [ -n "${_user}" ]; then
if pw user show ${_user} 2>/dev/null; then
echo "You already have a user \"${_user}\"," \
"so I will use it."
elif pw useradd ${_user} -u ${_uid} -g ${_group} -h - \
-d ${_home} -s ${_shell} -c "${_gecos}"; then
echo "Added user \"${_user}\"."
else
echo "Adding user \"${_user}\" failed..."
echo "Please create it, and try again."
exit 1
fi
fi
}
check_chuser ()
{
if checkyesno paranoia; then
if checkyesno dhcpd_chuser_enable &&
[ -z "${dhcpd_withuser}" -a -z "${dhcpd_withgroup}" ]; then
err 1 "one of dhcpd_withuser and dhcpd_withgroup" \
"must be set if dhcpd_chuser_enable is enabled"
fi
else
if checkyesno dhcpd_chuser_enable; then
warn "dhcpd_chuser_enable disabled -- not compiled in"
dhcpd_chuser_enable=NO
fi
fi
}
check_jail ()
{
if checkyesno paranoia && checkyesno jail; then
if checkyesno dhcpd_jail_enable &&
! checkyesno dhcpd_chroot_enable; then
warn "dhcpd_chroot_enable implied by dhcpd_jail_enable"
dhcpd_chroot_enable=YES
fi
if checkyesno dhcpd_jail_enable &&
[ -n "${dhcpd_hostname}" -a -z "${dhcpd_ipaddress}" ] ||
[ -z "${dhcpd_hostname}" -a -n "${dhcpd_ipaddress}" ]; then
err 1 "both dhcpd_hostname and dhcpd_ipaddress" \
"must be set if dhcpd_jail_enable is enabled"
fi
else
if checkyesno dhcpd_jail_enable; then
warn "dhcpd_jail_enable disabled -- not compiled in"
dhcpd_jail_enable=NO
fi
fi
}
check_chroot ()
{
if checkyesno paranoia; then
if checkyesno dhcpd_chroot_enable; then
if [ -z "${dhcpd_rootdir}" ]; then
err 1 "dhcpd_rootdir must be set" \
"if dhcpd_chroot_enable is enabled"
fi
if checkyesno dhcpd_devfs_enable &&
checkyesno dhcpd_makedev_enable; then
err 1 "dhcpd_devfs_enable and dhcpd_makedev_enable" \
"are mutually exclusive. enable only one!"
fi
if test `uname -r | cut -c 1` -le 6; then
if checkyesno dhcpd_devfs_enable &&
! ( type mount_devfs ) > /dev/null 2>&1;
then
warn "dhcpd_devfs_enable disabled" \
"-- not available"
dhcpd_devfs_enable=NO
fi
fi
if checkyesno dhcpd_makedev_enable &&
! [ -x ${__dhcpd_devdir}/MAKEDEV ]; then
warn "dhcpd_makedev_enable disabled" \
"-- not available"
dhcpd_makedev_enable=NO
fi
else
dhcpd_devfs_enable=NO
dhcpd_makedev_enable=NO
fi
else
if checkyesno dhcpd_chroot_enable; then
warn "dhcpd_chroot_enable disabled -- not compiled in"
dhcpd_chroot_enable=NO
fi
dhcpd_devfs_enable=NO
dhcpd_makedev_enable=NO
fi
}
rcvar_chuser ()
{
if checkyesno paranoia && checkyesno dhcpd_chuser_enable; then
dhcpd_piddir=${__dhcpd_piddir}/${name}
dhcpd_leasesdir=${__dhcpd_leasesdir}/${name}
else
dhcpd_withuser= dhcpd_withgroup=
fi
}
rcvar_jail ()
{
if ! checkyesno paranoia || ! checkyesno jail ||
! checkyesno dhcpd_jail_enable; then
dhcpd_hostname= dhcpd_ipaddress=
fi
}
rcvar_chroot ()
{
if ! checkyesno paranoia || ! checkyesno dhcpd_chroot_enable; then
dhcpd_rootdir=
elif checkyesno paranoia && checkyesno dhcpd_chroot_enable; then
dhcpd_devdir=${__dhcpd_devdir}
dhcpd_etcdir=${__dhcpd_etcdir}
fi
}
rcvar_pidnleases ()
{
if ! checkyesno dhcpd_chuser_enable; then
dhcpd_piddir=${__dhcpd_piddir}
dhcpd_leasesdir=${__dhcpd_leasesdir}
fi
dhcpd_pidfile=${dhcpd_piddir}/${name}.pid
dhcpd_leasesfile=${dhcpd_leasesdir}/${name}.leases
dhcpd_conffile=${dhcpd_conf} # for convenience only
dhcpd_confdir=$(dirname ${dhcpd_conffile})
}
rcvar_rooted ()
{
_dhcpd_rootdir=${dhcpd_rootdir}
_dhcpd_devdir=${dhcpd_rootdir}${dhcpd_devdir}
_dhcpd_etcdir=${dhcpd_rootdir}${dhcpd_etcdir}
_dhcpd_confdir=${dhcpd_rootdir}${dhcpd_confdir}
_dhcpd_includedir=${dhcpd_rootdir}${dhcpd_includedir}
_dhcpd_piddir=${dhcpd_rootdir}${dhcpd_piddir}
_dhcpd_leasesdir=${dhcpd_rootdir}${dhcpd_leasesdir}
_dhcpd_conffile=${dhcpd_rootdir}${dhcpd_conffile}
_dhcpd_pidfile=${dhcpd_rootdir}${dhcpd_pidfile}
_dhcpd_leasesfile=${dhcpd_rootdir}${dhcpd_leasesfile}
}
setup_compat ()
{
local dhcpd_rcconf
# suck in old configuration file and variables
#
dhcpd_rcconf=${dhcpd_confdir}/rc.isc-dhcpd.conf
if [ -f ${dhcpd_rcconf} ]; then
warn "${dhcpd_rcconf} is obsolete, use /etc/rc.conf and/or" \
"/etc/rc.conf.d/${name} instead."
. ${dhcpd_rcconf}
if [ -n "${dhcpd_options}" -a -z "${rc_flags}" ]; then
warn "dhcpd_options is obsolete," \
"use dhcpd_flags instead."
rc_flags=${dhcpd_options}
fi
fi
}
setup_umask ()
{
if [ -n "${dhcpd_withumask}" ]; then
umask ${dhcpd_withumask}
fi
}
setup_chroot ()
{
local _mdev _hconf _hosts _ltime _rconf
_mdev=MAKEDEV
_hconf=host.conf
_hosts=hosts
_ltime=localtime
_rconf=resolv.conf
if checkyesno paranoia && checkyesno dhcpd_chroot_enable; then
if ! mounted ${_dhcpd_devdir}; then
safe_mkdir ${_dhcpd_devdir}/_
# XXX /_ hack! so, .../dev is root owned.
fi
safe_mkdir ${_dhcpd_rootdir} ${_dhcpd_etcdir}/_ ${_dhcpd_confdir}
# XXX /_ hack! so, .../etc is root owned.
if checkyesno dhcpd_devfs_enable; then
safe_mount ${_dhcpd_devdir}
elif checkyesno dhcpd_makedev_enable; then
safe_copy ${dhcpd_devdir}/$_mdev ${_dhcpd_devdir}/$_mdev
safe_run 0 sh -c "cd ${_dhcpd_devdir} && ./$_mdev jail bpf4"
else
safe_copy ${dhcpd_devdir} ${_dhcpd_devdir}
fi
safe_copy ${dhcpd_conffile} ${_dhcpd_conffile}
safe_copy ${dhcpd_etcdir}/$_hconf ${_dhcpd_etcdir}/$_hconf
safe_copy ${dhcpd_etcdir}/$_hosts ${_dhcpd_etcdir}/$_hosts
safe_copy ${dhcpd_etcdir}/$_ltime ${_dhcpd_etcdir}/$_ltime
safe_copy ${dhcpd_etcdir}/$_rconf ${_dhcpd_etcdir}/$_rconf
# copy dhcpd_includedir if defined and available
if [ -d "${dhcpd_includedir}" ]; then
safe_mkdir ${_dhcpd_includedir}
safe_copy ${dhcpd_includedir} ${_dhcpd_includedir}
fi
fi
}
setup_chuser ()
{
if checkyesno paranoia && {
checkyesno dhcpd_chuser_enable || checkyesno dhcpd_chroot_enable
}; then
safe_mkdir ${_dhcpd_piddir} ${_dhcpd_leasesdir}
fi
}
setup_leases ()
{
safe_touch ${_dhcpd_leasesfile}
}
setup_flags ()
{
if [ -n "${dhcpd_conf}" ]; then
rc_flags="${rc_flags} -cf ${dhcpd_conf}"
fi
if [ -n "${dhcpd_leasesfile}" ]; then
rc_flags="${rc_flags} -lf ${dhcpd_leasesfile}"
fi
if [ -n "${dhcpd_pidfile}" ]; then
rc_flags="${rc_flags} -pf ${dhcpd_pidfile}"
fi
if [ -n "${dhcpd_withuser}" ]; then
rc_flags="${rc_flags} -user ${dhcpd_withuser}"
fi
if [ -n "${dhcpd_withgroup}" ]; then
rc_flags="${rc_flags} -group ${dhcpd_withgroup}"
fi
if [ -n "${dhcpd_rootdir}" ]; then
rc_flags="${rc_flags} -chroot ${dhcpd_rootdir}"
fi
if [ -n "${dhcpd_hostname}" -a -n "${dhcpd_ipaddress}" ]; then
rc_flags="${rc_flags} -jail ${dhcpd_hostname} ${dhcpd_ipaddress}"
fi
rc_flags="${rc_flags} ${dhcpd_ifaces}"
}
cleanup_chroot ()
{
if checkyesno paranoia && checkyesno dhcpd_chroot_enable; then
safe_umount ${_dhcpd_devdir}
fi
}
dhcpd_stop ()
{
if sh $0 forcestatus; then
sh $0 forcestop
fi
}
remove_pid ()
{
if [ -e ${_dhcpd_pidfile} ]; then
warn "${_dhcpd_pidfile} still exists! -- removing anyway"
fi
safe_remove ${_dhcpd_pidfile}
}
remove_leases ()
{
if [ -s ${_dhcpd_leasesfile} ]; then
warn "${_dhcpd_leasesfile} not empty -- not removed --" \
"futher warning messages expected, don't care."
else
safe_remove ${_dhcpd_leasesfile} ${_dhcpd_leasesfile}~
fi
}
remove_chuser ()
{
if checkyesno paranoia && {
checkyesno dhcpd_chuser_enable || checkyesno dhcpd_chroot_enable
}; then
safe_rmdir ${_dhcpd_piddir} ${_dhcpd_leasesdir}
fi
}
remove_chroot ()
{
if checkyesno paranoia && checkyesno dhcpd_chroot_enable; then
safe_remove ${_dhcpd_conffile} ${_dhcpd_includedir} \
${_dhcpd_etcdir}
if checkyesno dhcpd_devfs_enable; then
safe_umount ${_dhcpd_devdir}
safe_rmdir ${_dhcpd_devdir}/_ # XXX /_ hack!
elif checkyesno dhcpd_jail_enable; then
if ! mounted ${_dhcpd_devdir}; then
safe_remove ${_dhcpd_devdir}
fi
else
safe_remove ${_dhcpd_devdir}
fi
safe_rmdir ${_dhcpd_confdir} ${_dhcpd_rootdir} # XXX /_ hack!
fi
}
dhcpd_check ()
{
check_chuser
check_jail
check_chroot
}
dhcpd_rcvar ()
{
rcvar_chuser
rcvar_jail
rcvar_chroot
rcvar_pidnleases
rcvar_rooted
}
dhcpd_precmd ()
{
setup_compat
setup_umask
setup_chroot
setup_chuser
setup_leases
setup_flags
}
dhcpd_postcmd ()
{
cleanup_chroot
}
dhcpd_install ()
{
if checkyesno paranoia; then
safe_useradd "${dhcpd_withuser}" "${dhcpd_withgroup}" \
"DHCP Daemon" 136 136
fi
}
_dhcpd_uninstall () # user group root
{
local _user _group _root
_user=$1 _group=$2 _root=$3
if [ -n "${_user}" -o -n "${_group}" ]; then
dhcpd_chuser_enable=YES
dhcpd_withuser=${_user}
dhcpd_withgroup=${_group}
else
dhcpd_chuser_enable=NO
fi
if [ -n "${_root}" ]; then
dhcpd_chroot_enable=YES
dhcpd_rootdir=${_root}
else
dhcpd_chroot_enable=NO
fi
dhcpd_check
dhcpd_rcvar
dhcpd_uninstall
}
dhcpd_uninstall ()
{
if checkyesno __dhcpd_uninstall; then
dhcpd_stop
remove_pid
remove_leases
remove_chuser
remove_chroot
else
local _user _group _root
__dhcpd_uninstall=YES
_user=${dhcpd_withuser}
_group=${dhcpd_withgroup}
_root=${dhcpd_rootdir}
_dhcpd_uninstall "" "" ""
if checkyesno paranoia; then
if [ -n "${_user}" -o -n "${_group}" ]; then
_dhcpd_uninstall "${_user}" "${_group}" ""
fi
if [ -n "${_root}" ]; then
_dhcpd_uninstall "" "" "${_root}"
fi
if [ -n "${_user}" -o -n "${_group}" ] &&
[ -n "${_root}" ]; then
_dhcpd_uninstall "${_user}" "${_group}" "${_root}"
fi
fi
fi
}
dhcpd_checkconfig ()
{
local rc_flags_saved rc_flags_our
rc_flags_saved="$rc_flags"
setup_flags
# Eliminate '-q' flag if it is present
rc_flags_our=`echo "${rc_flags}" | sed -Ee's/(^-q | -q | -q$)'//`
rc_flags="${rc_flags_saved}"
if ${command} -t -q ${rc_flags_our}; then
true
else
echo "Configuration file sanity check failed:"
echo "======================================="
${command} -t ${rc_flags_our}
echo "======================================="
false
fi
}
rcvar=${name}_enable
load_rc_config ${name}
__dhcpd_uninstall="NO" # internal use only
__dhcpd_devdir=/dev # devices directory
__dhcpd_etcdir=/etc # etc directory
__dhcpd_piddir=/var/run # pid file directory
__dhcpd_leasesdir=/var/db # leases file directory
#__dhcpd_rootdir=/var/db/${name} # root directory
dhcpd_check
dhcpd_rcvar
command=%%PREFIX%%/sbin/${name}
pidfile=${_dhcpd_pidfile}
required_files=${dhcpd_conf}
start_precmd=${name}_precmd
stop_postcmd=${name}_postcmd
restart_precmd="dhcpd_checkconfig"
install_cmd=dhcpd_install
uninstall_cmd=dhcpd_uninstall
extra_commands="install uninstall"
# Override /etc/rc.subr JID determiniation, because it doesn't
# work when we launch dhcpd in a jail.
if checkyesno dhcpd_jail_enable ; then
read pid junk < $pidfile 2>/dev/null
[ -n "$pid" ] && JID=`ps -o jid= -p $pid`
fi
run_rc_command "$1"

View File

@ -1,57 +0,0 @@
#! /bin/sh
#
# $FreeBSD$
#
# PROVIDE: dhcrelay
# REQUIRE: DAEMON
#
# Add the following line to /etc/rc.conf to enable dhcrelay:
#
# dhcrelay_enable="YES"
#
# override these variables in /etc/rc.conf
dhcrelay_enable=${dhcrelay_enable:-"NO"}
# dhcrelay_flags=${dhcrelay_flags:-} # command option(s)
# dhcrelay_servers=${dhcrelay_servers:-} # dhcrelay server(s)
# dhcrelay_ifaces=${dhcrelay_ifaces:-} # ethernet interface(s)
dhcrelay_precmd ()
{
local ifaces
dhcrelay_rcconf=%%PREFIX%%/etc/rc.isc-dhcrelay.conf
if [ -f ${dhcrelay_rcconf} ]; then
warn "${dhcrelay_rcconf} is obsolete, use /etc/rc.conf instead."
. ${dhcrelay_rcconf}
if [ -n "${dhcrelay_options}" -a -z "${rc_flags}" ]; then
warn "dhcrelay_options is obsolete, use dhcrelay_flags instead."
rc_flags=${dhcrelay_options}
fi
fi
if [ -z "${dhcrelay_servers}" ]; then
err 1 "no dhcrelay server(s) configured."
fi
ifaces=
for iface in ${dhcrelay_ifaces}; do
ifaces="${ifaces} -i ${iface}"
done
rc_flags="${rc_flags} ${ifaces} ${dhcrelay_servers}"
}
. /etc/rc.subr
name=dhcrelay
rcvar=${name}_enable
command=%%PREFIX%%/sbin/${name}
pidfile=/var/run/${name}.pid
start_precmd=${name}_precmd
load_rc_config ${name}
run_rc_command "$1"

View File

@ -1,80 +0,0 @@
# Makefile.dist
#
# Copyright (c) 1996-2002 Internet Software Consortium.
# Use is subject to license terms which appear in the file named
# ISC-LICENSE that should have accompanied this file when you
# received it. If a file named ISC-LICENSE did not accompany this
# file, or you are not sure the one you have is correct, you may
# obtain an applicable copy of the license at:
#
# http://www.isc.org/isc-license-1.0.html.
#
# This file is part of the ISC DHCP distribution. The documentation
# associated with this file is listed in the file DOCUMENTATION,
# included in the top-level directory of this release.
#
# Support and other services are available for ISC products - see
# http://www.isc.org for more information.
#
CATMANPAGES = omshell.cat1
SEDMANPAGES = omshell.man1
SRCS = omshell.c
OBJS = omshell.o
PROG = omshell
MAN = omshell.1
INCLUDES = -I$(TOP)/dhcpctl $(BINDINC) -I$(TOP)/includes
CFLAGS = $(DEBUG) $(PREDEFINES) $(INCLUDES) $(COPTS)
DHCPCTLLIBS = ../dhcpctl/libdhcpctl.a ../common/libdhcp.a $(BINDLIB) \
../omapip/libomapi.a ../dst/libdst.a
all: $(PROG) $(CATMANPAGES)
$(PROG): $(OBJS) $(DHCPCTLLIBS)
$(CC) $(DEBUG) $(LFLAGS) -o $(PROG) $(OBJS) $(DHCPCTLLIBS) $(LIBS)
install: all $(CATMANPAGES)
for dir in $(USRMANDIR) $(USERBINDIR); do \
foo=""; \
for bar in `echo $(DESTDIR)$${dir} |tr / ' '`; do \
foo=$${foo}/$$bar; \
if [ ! -d $$foo ]; then \
mkdir $$foo; \
chmod 755 $$foo; \
fi; \
done; \
done
$(INSTALL) omshell $(DESTDIR)$(USERBINDIR)
$(CHMOD) 755 $(DESTDIR)$(USERBINDIR)/omshell
$(MANINSTALL) $(MANFROM) omshell.$(MANCAT)1 $(MANTO) \
$(DESTDIR)$(USRMANDIR)/omshell$(USRMANEXT)
depend:
$(MKDEP) $(INCLUDES) $(PREDEFINES) $(SRCS)
clean:
-rm -f $(OBJS)
realclean: clean
-rm -f $(PROG) *~ $(CATMANPAGES) $(SEDMANPAGES) #*
distclean: realclean
-rm -f Makefile
links:
@for foo in $(SRCS) $(MAN); do \
if [ ! -b $$foo ]; then \
rm -f $$foo; \
fi; \
ln -s $(TOP)/omshell/$$foo $$foo; \
done
omshell.cat1: omshell.man1
nroff -man omshell.man1 >omshell.cat1
omshell.man1: omshell.1
sed -e "s#ETCDIR#$(ETC)#g" -e "s#DBDIR#$(VARDB)#g" \
-e "s#RUNDIR#$(VARRUN)#g" < omshell.1 >omshell.man1
# Dependencies (semi-automatically-generated)

View File

@ -1,76 +0,0 @@
--- Makefile.orig Fri Nov 8 00:10:07 2002
+++ Makefile Mon Apr 28 15:04:50 2003
@@ -38,59 +38,59 @@
# ``http://www.nominum.com''.
#
-all:
+all all.devel all.server all.relay all.client:
@sysname=`./configure --print-sysname`; \
if [ ! -d work.$$sysname ]; then \
echo No build directory for $$sysname - please run ./configure.; \
else \
- (cd work.$$sysname; make all); \
+ (cd work.$$sysname; make $@); \
fi
-install:
+install install.devel install.server install.relay install.client:
@sysname=`./configure --print-sysname`; \
if [ ! -d work.$$sysname ]; then \
echo No build directory for $$sysname - please run ./configure.; \
else \
- (cd work.$$sysname; make install); \
+ (cd work.$$sysname; make $@); \
fi
-depend:
+depend depend.devel depend.server depend.relay depend.client:
@sysname=`./configure --print-sysname`; \
if [ ! -d work.$$sysname ]; then \
echo No build directory for $$sysname - please run ./configure.; \
else \
- (cd work.$$sysname; make depend); \
+ (cd work.$$sysname; make $@); \
fi
-clean:
+clean clean.devel clean.server clean.relay clean.client:
@sysname=`./configure --print-sysname`; \
if [ ! -d work.$$sysname ]; then \
echo No build directory for $$sysname - please run ./configure.; \
else \
- (cd work.$$sysname; make clean); \
+ (cd work.$$sysname; make $@); \
fi
-realclean:
+realclean realclean.devel realclean.server realclean.relay realclean.client:
@sysname=`./configure --print-sysname`; \
if [ ! -d work.$$sysname ]; then \
echo No build directory for $$sysname - please run ./configure.; \
else \
- (cd work.$$sysname; make realclean); \
+ (cd work.$$sysname; make $@); \
fi
-distclean:
+distclean distclean.devel distclean.server distclean.relay distclean.client:
@sysname=`./configure --print-sysname`; \
if [ ! -d work.$$sysname ]; then \
echo No build directory for $$sysname - please run ./configure.; \
else \
- (cd work.$$sysname; make distclean); \
+ (cd work.$$sysname; make $@); \
fi
-links:
+links links.devel links.server links.relay links.client:
@sysname=`./configure --print-sysname`; \
if [ ! -d work.$$sysname ]; then \
echo No build directory for $$sysname - please run ./configure.; \
else \
- (cd work.$$sysname; make links); \
+ (cd work.$$sysname; make $@); \
fi

View File

@ -1,226 +0,0 @@
--- Makefile.dist.orig Fri Nov 8 00:10:08 2002
+++ Makefile.dist Tue Apr 29 00:07:43 2003
@@ -17,47 +17,200 @@
# http://www.isc.org for more information.
#
-SUBDIRS= common $(MINIRES) dst omapip server client relay dhcpctl
+COMMON_SUBDIRS= common
+DEVEL_SUBDIRS= $(MINIRES) dst omapip dhcpctl
+SERVER_SUBDIRS= omshell server
+RELAY_SUBDIRS= relay
+CLIENT_SUBDIRS= client
+
+DEVEL_BUILD_SUBDIRS= ${COMMON_SUBDIRS} ${DEVEL_SUBDIRS}
+SERVER_BUILD_SUBDIRS= ${SERVER_SUBDIRS}
+RELAY_BUILD_SUBDIRS= ${RELAY_SUBDIRS}
+CLIENT_BUILD_SUBDIRS= ${CLIENT_SUBDIRS}
+
+DEVEL_INSTALL_SUBDIRS= ${COMMON_SUBDIRS} ${DEVEL_SUBDIRS}
+SERVER_INSTALL_SUBDIRS= ${COMMON_SUBDIRS} ${SERVER_SUBDIRS}
+RELAY_INSTALL_SUBDIRS= ${RELAY_SUBDIRS}
+CLIENT_INSTALL_SUBDIRS= ${COMMON_SUBDIRS} ${CLIENT_SUBDIRS}
-all:
- @for dir in ${SUBDIRS}; do \
+all: all.server all.relay all.client
+
+all.devel:
+ @for dir in ${DEVEL_BUILD_SUBDIRS}; do \
+ echo "Making all in $$dir"; \
+ (cd $$dir; $(MAKE) all) || exit 1; \
+ done
+
+all.server: all.devel
+ @for dir in ${SERVER_BUILD_SUBDIRS}; do \
+ echo "Making all in $$dir"; \
+ (cd $$dir; $(MAKE) all) || exit 1; \
+ done
+
+all.relay: all.devel
+ @for dir in ${RELAY_BUILD_SUBDIRS}; do \
+ echo "Making all in $$dir"; \
+ (cd $$dir; $(MAKE) all) || exit 1; \
+ done
+
+all.client: all.devel
+ @for dir in ${CLIENT_BUILD_SUBDIRS}; do \
echo "Making all in $$dir"; \
(cd $$dir; $(MAKE) all) || exit 1; \
- done
+ done
+
+install: install.devel install.server install.relay install.client
+
+install.devel:
+ @for dir in ${DEVEL_INSTALL_SUBDIRS}; do \
+ echo "Installing in $$dir"; \
+ (cd $$dir; $(MAKE) install) || exit 1; \
+ done
-install:
- @for dir in ${SUBDIRS}; do \
+install.server:
+ @for dir in ${SERVER_INSTALL_SUBDIRS}; do \
echo "Installing in $$dir"; \
(cd $$dir; $(MAKE) install) || exit 1; \
- done
+ done
-depend:
- @for dir in ${SUBDIRS}; do \
+install.relay:
+ @for dir in ${RELAY_INSTALL_SUBDIRS}; do \
+ echo "Installing in $$dir"; \
+ (cd $$dir; $(MAKE) install) || exit 1; \
+ done
+
+install.client:
+ @for dir in ${CLIENT_INSTALL_SUBDIRS}; do \
+ echo "Installing in $$dir"; \
+ (cd $$dir; $(MAKE) install) || exit 1; \
+ done
+
+depend: depend.server depend.relay depend.client
+
+depend.devel:
+ @for dir in ${DEVEL_BUILD_SUBDIRS}; do \
+ echo "Making dependencies in $$dir"; \
+ (cd $$dir; $(MAKE) depend) || exit 1; \
+ done
+
+depend.server: depend.devel
+ @for dir in ${SERVER_BUILD_SUBDIRS}; do \
+ echo "Making dependencies in $$dir"; \
+ (cd $$dir; $(MAKE) depend) || exit 1; \
+ done
+
+depend.relay: depend.devel
+ @for dir in ${RELAY_BUILD_SUBDIRS}; do \
echo "Making dependencies in $$dir"; \
(cd $$dir; $(MAKE) depend) || exit 1; \
- done
+ done
+
+depend.client: depend.devel
+ @for dir in ${CLIENT_BUILD_SUBDIRS}; do \
+ echo "Making dependencies in $$dir"; \
+ (cd $$dir; $(MAKE) depend) || exit 1; \
+ done
+
+clean: clean.server clean.relay clean.client
+
+clean.devel:
+ @for dir in ${DEVEL_BUILD_SUBDIRS}; do \
+ echo "Cleaning in $$dir"; \
+ (cd $$dir; $(MAKE) clean) || exit 1; \
+ done
+
+clean.server: clean.devel
+ @for dir in ${SERVER_BUILD_SUBDIRS}; do \
+ echo "Cleaning in $$dir"; \
+ (cd $$dir; $(MAKE) clean) || exit 1; \
+ done
+
+clean.relay: clean.devel
+ @for dir in ${RELAY_BUILD_SUBDIRS}; do \
+ echo "Cleaning in $$dir"; \
+ (cd $$dir; $(MAKE) clean) || exit 1; \
+ done
-clean:
- @for dir in ${SUBDIRS}; do \
+clean.client: clean.devel
+ @for dir in ${CLIENT_BUILD_SUBDIRS}; do \
echo "Cleaning in $$dir"; \
(cd $$dir; $(MAKE) clean) || exit 1; \
- done
+ done
+
+realclean: realclean.server realclean.relay realclean.client
+
+realclean.devel:
+ @for dir in ${DEVEL_BUILD_SUBDIRS}; do \
+ echo "Really cleaning in $$dir"; \
+ (cd $$dir; $(MAKE) realclean) || exit 1; \
+ done
-realclean:
- @for dir in ${SUBDIRS}; do \
+realclean.server: realclean.devel
+ @for dir in ${SERVER_BUILD_SUBDIRS}; do \
echo "Really cleaning in $$dir"; \
(cd $$dir; $(MAKE) realclean) || exit 1; \
- done
+ done
-distclean:
- @for dir in ${SUBDIRS}; do \
+realclean.relay: realclean.devel
+ @for dir in ${RELAY_BUILD_SUBDIRS}; do \
+ echo "Really cleaning in $$dir"; \
+ (cd $$dir; $(MAKE) realclean) || exit 1; \
+ done
+
+realclean.client: realclean.devel
+ @for dir in ${CLIENT_BUILD_SUBDIRS}; do \
+ echo "Really cleaning in $$dir"; \
+ (cd $$dir; $(MAKE) realclean) || exit 1; \
+ done
+
+distclean: distclean.server distclean.relay distclean.client
+
+distclean.devel:
+ @for dir in ${DEVEL_BUILD_SUBDIRS}; do \
echo "Really, really cleaning in $$dir"; \
(cd $$dir; $(MAKE) distclean) || exit 1; \
- done
- @rm -f Makefile
+ done
+
+distclean.server: distclean.devel
+ @for dir in ${SERVER_BUILD_SUBDIRS}; do \
+ echo "Really, really cleaning in $$dir"; \
+ (cd $$dir; $(MAKE) distclean) || exit 1; \
+ done
+
+distclean.relay: distclean.devel
+ @for dir in ${RELAY_BUILD_SUBDIRS}; do \
+ echo "Really, really cleaning in $$dir"; \
+ (cd $$dir; $(MAKE) distclean) || exit 1; \
+ done
+
+distclean.client: distclean.devel
+ @for dir in ${CLIENT_BUILD_SUBDIRS}; do \
+ echo "Really, really cleaning in $$dir"; \
+ (cd $$dir; $(MAKE) distclean) || exit 1; \
+ done
+
+links: links.server links.relay links.client
+
+links.devel:
+ @for dir in ${DEVEL_BUILD_SUBDIRS}; do \
+ echo "Making links in $$dir"; \
+ (cd $$dir; $(MAKE) links) || exit 1; \
+ done
+
+links.server: links.devel
+ @for dir in ${SERVER_BUILD_SUBDIRS}; do \
+ echo "Making links in $$dir"; \
+ (cd $$dir; $(MAKE) links) || exit 1; \
+ done
+
+links.relay: links.devel
+ @for dir in ${RELAY_BUILD_SUBDIRS}; do \
+ echo "Making links in $$dir"; \
+ (cd $$dir; $(MAKE) links) || exit 1; \
+ done
-links:
- @for dir in ${SUBDIRS}; do \
+links.client: links.devel
+ @for dir in ${CLIENT_BUILD_SUBDIRS}; do \
echo "Making links in $$dir"; \
(cd $$dir; $(MAKE) links) || exit 1; \
- done
+ done

View File

@ -1,11 +0,0 @@
--- client/clparse.c.orig Sat May 6 17:42:49 2006
+++ client/clparse.c Sat May 6 17:43:12 2006
@@ -777,7 +777,7 @@
interface_dereference(&ip, MDL);
return 0;
}
- strcpy(ip->name, name);
+ strlcpy (ip -> name, name, IFNAMSIZ);
if (dummy_interfaces) {
interface_reference (&ip -> next,

View File

@ -1,84 +0,0 @@
--- client/dhclient.8.orig Wed Sep 14 18:03:33 2005
+++ client/dhclient.8 Sat May 6 17:30:28 2006
@@ -23,6 +23,10 @@
.\"
.\" $Id: dhclient.8,v 1.12.2.11 2005/09/14 16:03:33 dhankins Exp $
.\"
+.\" Portions copyright (c) 2000 David E. O'Brien.
+.\" All rights reserved.
+.\" $FreeBSD$
+.\"
.TH dhclient 8
.SH NAME
dhclient - Dynamic Host Configuration Protocol Client
@@ -33,6 +37,9 @@
.I port
]
[
+.B -D
+]
+[
.B -d
]
[
@@ -43,6 +50,9 @@
.B -q
]
[
+.B -v
+]
+[
.B -1
]
[
@@ -73,6 +83,10 @@
relay
]
[
+.B -i
+interval
+]
+[
.B -n
]
[
@@ -157,6 +171,15 @@
configuration file or on the command line, and will ignore all other
interfaces.
.PP
+The
+.B -D
+flag causes
+.B dhclient
+to save the script it creates for use in conjunction with
+.B dhclient-script
+in
+.IR /tmp.
+.PP
If the DHCP client should listen and transmit on a port other than the
standard (port 68), the
.B -p
@@ -180,6 +203,12 @@
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
+On FreeBSD, dhclient can be enabled to automatically handle the
+link status of the network card. Normally polling is done every
+five seconds. The polling interval can be set using the
+.B -i
+flag, followed by the numbers of seconds. Minimum is one second.
+.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
@@ -206,6 +235,10 @@
.B -q
flag prevents any messages other than errors from being printed to the
standard error descriptor.
+.B -v
+flag turns on all messages.
+Opposite of
+.B -q .
.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

View File

@ -1,557 +0,0 @@
--- client/dhclient.c.orig 2008-01-22 12:28:23.000000000 -0500
+++ client/dhclient.c 2009-07-15 15:02:28.000000000 -0400
@@ -38,6 +38,13 @@
#include "dhcpd.h"
#include "version.h"
+#if __FreeBSD_version > 502010
+#include <sys/ioctl.h>
+#include <net/if_media.h>
+#include <net80211/ieee80211_ioctl.h>
+#include <net80211/ieee80211.h>
+#endif
+
TIME default_lease_time = 43200; /* 12 hours... */
TIME max_lease_time = 86400; /* 24 hours... */
@@ -72,8 +79,11 @@
struct string_list *client_env=NULL;
int client_env_count=0;
int onetry=0;
-int quiet=0;
+int quiet=1;
int nowait=0;
+#ifdef ENABLE_POLLING_MODE
+int polling_interval = 5;
+#endif
static void usage PROTO ((void));
@@ -174,6 +184,9 @@
} else if (!strcmp (argv [i], "-q")) {
quiet = 1;
quiet_interface_discovery = 1;
+ } else if (!strcmp (argv [i], "-v")) {
+ quiet = 0;
+ quiet_interface_discovery = 0;
} else if (!strcmp (argv [i], "-s")) {
if (++i == argc)
usage ();
@@ -187,6 +200,19 @@
} else if (!strcmp (argv [i], "-n")) {
/* do not start up any interfaces */
interfaces_requested = 1;
+#ifdef ENABLE_POLLING_MODE
+ } else if (!strcmp (argv [i], "-i")) {
+ if (++i == argc)
+ usage ();
+ polling_interval = (int)strtol (argv [i],
+ (char **)NULL, 10);
+ if (polling_interval <= 0) {
+ log_info ("Incorrect polling interval %d",
+ polling_interval);
+ log_info ("Using a default of 5 seconds");
+ polling_interval = 5;
+ }
+#endif
} else if (!strcmp (argv [i], "-w")) {
/* do not exit if there are no broadcast interfaces. */
persist = 1;
@@ -215,7 +241,16 @@
if (strlen(argv[i]) >= sizeof(tmp->name))
log_fatal("%s: interface name too long (is %ld)",
argv [i], (long)strlen(argv[i]));
- strcpy(tmp->name, argv[i]);
+ strlcpy (tmp -> name, argv [i], IFNAMSIZ);
+#if __FreeBSD_version > 502010
+ set_ieee80211 (tmp);
+#endif
+ /* Init some interface vars, enable polling */
+#ifdef ENABLE_POLLING_MODE
+ tmp -> forcediscover = 0;
+ tmp -> linkstate = HAVELINK;
+ tmp -> polling = 1;
+#endif /* ifdef ENABLE_POLLING_MODE */
if (interfaces) {
interface_reference (&tmp -> next,
interfaces, MDL);
@@ -373,6 +408,16 @@
INTERFACE_AUTOMATIC)) !=
INTERFACE_REQUESTED))
continue;
+#if __FreeBSD_version > 502010
+ set_ieee80211 (ip);
+#endif
+#ifdef ENABLE_POLLING_MODE
+ ip -> forcediscover = 0;
+ if (ip -> client -> config -> media != NULL)
+ ip -> havemedia = 1;
+ else
+ ip -> havemedia = 0;
+#endif
script_init (ip -> client,
"PREINIT", (struct string_list *)0);
if (ip -> client -> alias)
@@ -415,8 +460,13 @@
client -> state = S_INIT;
/* Set up a timeout to start the initialization
process. */
+#ifdef ENABLE_POLLING_MODE
+ add_timeout (cur_time + random () % 5 + 2,
+ state_polling, client, 0, 0);
+#else
add_timeout (cur_time + random () % 5,
state_reboot, client, 0, 0);
+#endif
}
}
}
@@ -474,9 +524,9 @@
log_info (arr);
log_info (url);
- log_error ("Usage: dhclient [-1dqr] [-nw] [-p <port>] %s",
- "[-s server]");
- log_error (" [-cf config-file] [-lf lease-file]%s",
+ log_error ("Usage: dhclient [-1Ddqrv] [-i polling-interval] %s",
+ "[-nw] [-p <port>] [-s server]");
+ log_error (" [-cf config-file] [-lf lease-file] %s",
"[-pf pid-file] [-e VAR=val]");
log_fatal (" [-sf script-file] [interface]");
}
@@ -877,6 +927,15 @@
/* Write out the new lease. */
write_client_lease (client, client -> new, 0, 0);
+ /*
+ * It's now possible that state_reboot can be called
+ * after a interface link went down and is up again.
+ * To prevent tons of equal leases saved on disk, we rewrite
+ * them.
+ */
+ read_client_leases ();
+ rewrite_client_leases ();
+
/* Replace the old active lease with the new one. */
if (client -> active)
destroy_client_lease (client -> active);
@@ -891,6 +950,12 @@
piaddr (client -> active -> address),
(long)(client -> active -> renewal - cur_time));
client -> state = S_BOUND;
+#ifdef ENABLE_POLLING_MODE
+ /* Init some interface vars, enable polling */
+ client -> interface -> linkstate = HAVELINK;
+ client -> interface -> forcediscover = 0;
+ client -> interface -> polling = 1;
+#endif /* ifdef ENABLE_POLLING_MODE */
reinitialize_interfaces ();
go_daemon ();
if (client -> config -> do_forward_update) {
@@ -1376,6 +1441,11 @@
int interval;
int increase = 1;
+#ifdef ENABLE_POLLING_MODE
+ /* Disable polling for this interface */
+ client -> interface -> polling = 0;
+#endif
+
/* Figure out how long it's been since we started transmitting. */
interval = cur_time - client -> first_sending;
@@ -1476,6 +1546,9 @@
struct client_lease *loop;
struct client_lease *lp;
+ if (client -> interface -> linkstate == NOLINK)
+ return;
+
loop = lp = client -> active;
log_info ("No DHCPOFFERS received.");
@@ -1508,6 +1581,10 @@
log_info ("bound: renewal in %ld %s.",
(long)(client -> active -> renewal -
cur_time), "seconds");
+#ifdef ENABLE_POLLING_MODE
+ /* Enable polling for this interface */
+ client -> interface -> polling = 1;
+#endif
add_timeout (client -> active -> renewal,
state_bound, client, 0, 0);
} else {
@@ -1515,6 +1592,11 @@
log_info ("bound: immediate renewal.");
state_bound (client);
}
+ /*
+ * Set the link status back to nolink, even
+ * if we have media settings.
+ */
+ client -> interface -> linkstate = NOLINK;
reinitialize_interfaces ();
go_daemon ();
return;
@@ -1560,6 +1642,12 @@
}
log_info ("No working leases in persistent database - sleeping.");
+
+#ifdef ENABLE_POLLING_MODE
+ /* Enable polling for this interface */
+ client -> interface -> polling = 1;
+#endif
+
script_init (client, "FAIL", (struct string_list *)0);
if (client -> alias)
script_write_params (client, "alias_", client -> alias);
@@ -1701,6 +1789,18 @@
client -> packet.secs = htons (65535);
}
+ /*
+ * Only try the first ten seconds to renew a lease from a
+ * given dhcp-server adress. After that, fall back to use
+ * state_reboot with INADDR_BROADCAST.
+ */
+ if (destination.sin_addr.s_addr != INADDR_BROADCAST &&
+ (client -> state == S_RENEWING || client -> state == S_REBINDING)) {
+ if (client -> active && client -> active -> expiry > cur_time &&
+ interval >= 10)
+ goto cancel;
+ }
+
log_info ("DHCPREQUEST on %s to %s port %d",
client -> name ? client -> name : client -> interface -> name,
inet_ntoa (destination.sin_addr),
@@ -1722,6 +1822,16 @@
from, &destination,
(struct hardware *)0);
+ /*
+ * If sendto() for a direct request fails, fall back to use
+ * state_reboot with INADDR_BROADCAST.
+ */
+ if (result == -1 && destination.sin_addr.s_addr != INADDR_BROADCAST &&
+ (client -> state == S_RENEWING || client -> state == S_REBINDING)) {
+ if (client -> active && client -> active -> expiry > cur_time)
+ goto cancel;
+ }
+
add_timeout (cur_time + client -> interval,
send_request, client, 0, 0);
}
@@ -2509,8 +2619,9 @@
(struct option_state *)0,
lease -> options,
&global_scope, oc, MDL)) {
- if (data.len > 3) {
- struct iaddr netmask, subnet, broadcast;
+ struct iaddr netmask;
+ if (data.len > 3 && data.len <= sizeof(netmask.iabuf)) {
+ struct iaddr subnet, broadcast;
memcpy (netmask.iabuf, data.data, data.len);
netmask.len = data.len;
@@ -2624,6 +2735,13 @@
*/
if (leaseFile != NULL)
fclose(leaseFile);
+ if ((i = open(_PATH_DEVNULL, O_RDWR)) != -1) {
+ dup2(i, STDIN_FILENO);
+ dup2(i, STDOUT_FILENO);
+ dup2(i, STDERR_FILENO);
+ if (i > STDERR_FILENO)
+ close(i);
+ }
execve (scriptName, argv, envp);
log_error ("execve (%s, ...): %m", scriptName);
exit (0);
@@ -2810,8 +2928,10 @@
case S_STOPPED:
break;
}
+#ifndef ENABLE_POLLING_MODE
client -> state = S_INIT;
state_reboot (client);
+#endif
}
}
}
@@ -3039,7 +3159,9 @@
break;
case server_awaken:
+#ifndef ENABLE_POLLING_MODE
state_reboot (client);
+#endif
break;
}
}
@@ -3177,3 +3299,265 @@
data_string_forget (&ddns_dhcid, MDL);
return rcode;
}
+
+/* Check to see if there's a wire plugged in */
+int
+interface_active(struct interface_info *ip) {
+#if __FreeBSD_version > 502010
+ struct ifmediareq ifmr;
+ int *media_list, i;
+ char *ifname;
+ int sock;
+
+ ifname = ip -> name;
+
+ if ((sock = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
+ log_fatal ("Can't create interface_active socket");
+
+ (void) memset (&ifmr, 0, sizeof (ifmr));
+ (void) strncpy (ifmr.ifm_name, ifname, sizeof (ifmr.ifm_name));
+
+ if (ioctl (sock, SIOCGIFMEDIA, (caddr_t)&ifmr) < 0) {
+ /*
+ * Interface doesn't support SIOCGIFMEDIA, presume okay
+ */
+ close (sock);
+ return (HAVELINK);
+ }
+ close (sock);
+
+ if (ifmr.ifm_count == 0) {
+ /*
+ * Assume that this means interface
+ * does not support SIOCGIFMEDIA
+ */
+ log_fatal ("%s: no media types?", ifname);
+ return (HAVELINK);
+ }
+
+ if (ifmr.ifm_status & IFM_AVALID) {
+ if (ip -> ieee80211) {
+ /*
+ * Wavelan devices need to be checked if they are
+ * associated.
+ */
+ if ((IFM_TYPE(ifmr.ifm_active) == IFM_IEEE80211) &&
+ (ifmr.ifm_status & IFM_ACTIVE)) {
+ return (HAVELINK);
+ }
+ } else {
+ if (ifmr.ifm_status & IFM_ACTIVE) {
+ return (HAVELINK);
+ }
+ }
+ /*
+ * We really have no link.
+ */
+ return (NOLINK);
+ }
+ /*
+ * IFM_AVALID is not set. We cannot check
+ * the link state. Assume HAVELINK.
+ */
+
+#endif /* Other OSs */
+ /*
+ * Always return a successful link if the OS
+ * is not supported.
+ */
+ return (HAVELINK);
+}
+
+#if __FreeBSD_version > 502010
+void
+set_ieee80211 (struct interface_info *ip) {
+
+ struct ieee80211req ireq;
+ u_int8_t data[32];
+ int associated = 0;
+ int *media_list, i;
+ char *ifname;
+ int sock;
+
+ ifname = ip -> name;
+
+ if ((sock = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
+ log_fatal ("Can't create interface_active socket");
+
+ (void) memset (&ireq, 0, sizeof (ireq));
+ (void) strncpy (ireq.i_name, ifname, sizeof (ireq.i_name));
+ ireq.i_data = &data;
+ ireq.i_type = IEEE80211_IOC_SSID;
+ ireq.i_val = -1;
+ /*
+ * If we can't get the SSID,
+ * this isn't an 802.11 device.
+ */
+ if (ioctl (sock, SIOCG80211, &ireq) < 0)
+ ip -> ieee80211 = 0;
+ else {
+#ifdef DEBUG
+ printf ("Device %s has 802.11\n", ifname);
+#endif
+ ip -> ieee80211 = 1;
+ }
+ close (sock);
+ }
+#endif /* __FreeBSD_version */
+
+#ifdef ENABLE_POLLING_MODE
+/* Go to background after some time */
+void state_background (cpp)
+ void *cpp;
+{
+ go_daemon ();
+}
+
+/* Check the state of the NICs if we have link */
+void state_polling (cpp)
+ void *cpp;
+{
+ static int doinitcheck = 0;
+ struct interface_info *ip;
+ struct client_state *client;
+ int result;
+
+ for (ip = interfaces; ip; ip = ip -> next) {
+ if (! ip -> polling)
+ continue;
+#ifdef DEBUG
+ printf ("%s: Polling interface state\n", ip -> name);
+ for (client = ip -> client;
+ client; client = client -> next) {
+ printf ("%s: client state of %d\n", ip -> name, ip -> client -> state);
+ printf ("%s: link = %d\n", ip -> name, ip -> linkstate);
+ }
+#endif
+
+ result = interface_active (ip);
+ /*
+ * If dhclient.conf contains media settings, we cannot
+ * abort if the interface is not set to active mode.
+ */
+ if (ip -> havemedia && ip -> client -> state != S_BOUND) {
+ if (result == HAVELINK)
+ ip -> forcediscover = 1;
+ result = HAVELINK;
+ }
+
+ /*
+ * The last status of the interface tells us
+ * the we've got no link ...
+ */
+ if (ip -> linkstate == NOLINK || ! doinitcheck) {
+ /*
+ * ... but we have now link. Let's send
+ * requests.
+ */
+ if (result == HAVELINK) {
+#ifdef DEBUG
+ if (ip -> havemedia)
+ printf ("%s: Trying media settings on interface\n",
+ ip -> name);
+ else
+ printf ("%s: Found Link on interface\n", ip -> name);
+#endif
+ /*
+ * Set the interface to state_bound. We assume that we have
+ * a working link. If we cannot reach the server directly,
+ * INADDR_BROADCAST is used.
+ */
+ for (client = ip -> client;
+ client; client = client -> next) {
+ cancel_timeout (state_init, client);
+ cancel_timeout (state_reboot, client);
+ cancel_timeout (state_selecting, client);
+ if (client -> active) {
+ add_timeout (cur_time + random () % 5,
+ state_bound, client, 0, 0);
+ } else {
+ add_timeout (cur_time + random () % 5,
+ state_reboot, client, 0, 0);
+ }
+ }
+ ip -> linkstate = HAVELINK;
+ } else {
+#ifdef DEBUG
+ printf ("%s: No link on interface\n", ip -> name);
+#endif
+ for (client = ip -> client;
+ client; client = client -> next) {
+ /*
+ * Without this add_timout(), dhclient does
+ * not poll on a interface if there
+ * is no cable plugged in at startup
+ * time. Because we add one additional second
+ * to the time of a normal timeout, we always
+ * skip and block a running one. This prevents
+ * that polling is done twice at the same time.
+ */
+ if (client -> state == S_INIT) {
+ add_timeout (cur_time + (polling_interval + 1),
+ state_polling, client, 0, 0);
+ }
+ }
+ ip -> linkstate = NOLINK;
+ /*
+ * Automatically go into the background after
+ * some time. Do this only if there are no
+ * media options available for a interface.
+ */
+ if (! ip -> havemedia && ! doinitcheck) {
+ add_timeout (cur_time + (polling_interval * 2),
+ state_background, client, 0, 0);
+ }
+ }
+ }
+
+ /*
+ * The last status of the interface tells us
+ * the we previously had link.
+ */
+ if (ip -> linkstate == HAVELINK && doinitcheck) {
+ if (result == NOLINK) {
+ /*
+ * We lost link on the interface, or it isn't
+ * associated anymore.
+ */
+#ifdef DEBUG
+ printf ("%s: Lost Link on interface\n", ip -> name);
+#endif
+ /*
+ * After we lost link, cycle again through the
+ * different media settings if available. Else
+ * set NOLINK.
+ */
+ if (ip -> havemedia)
+ ip -> forcediscover = 1;
+ else
+ ip -> linkstate = NOLINK;
+ }
+ /*
+ * If we happen to have a real link, but no
+ * active lease, force the interface into
+ * state_reboot. Do the same if media settings
+ * are available.
+ */
+ if (ip -> forcediscover) {
+ for (client = ip -> client;
+ client; client = client -> next) {
+ if (client -> state != S_REBOOTING &&
+ client -> state != S_SELECTING) {
+ add_timeout (cur_time + random () % 5,
+ state_reboot, client, 0, 0);
+ }
+ }
+ ip -> forcediscover = 0;
+ ip -> linkstate = HAVELINK;
+ }
+ /* We still have link, do nothing. */
+ }
+ }
+ doinitcheck = 1;
+}
+#endif /* ifdef ENABLE_POLLING_MODE */

View File

@ -1,11 +0,0 @@
--- client/dhclient.conf.orig Tue Jun 3 00:50:44 1997
+++ client/dhclient.conf Wed Mar 3 02:20:41 2004
@@ -11,7 +11,7 @@
reboot 10;
select-timeout 5;
initial-interval 2;
-script "/etc/dhclient-script";
+script "%%PREFIX%%/sbin/dhclient-script";
media "-link0 -link1 -link2", "link0 link1";
reject 192.33.137.209;

View File

@ -1,32 +0,0 @@
--- common/dhcp-options.5.orig Sun Feb 23 04:27:42 2003
+++ common/dhcp-options.5 Wed Mar 3 02:12:13 2004
@@ -431,7 +431,10 @@
the domain-name option to specify the domain name). See RFC 1035 for
character set restrictions. This option is only honored by
.B dhclient-script(8)
-if the hostname for the client machine is not set.
+if the hostname for the client machine is not set (i.e., set to the empty
+string in
+.B rc.conf(5)
+).
.RE
.PP
.B option \fBieee802-3-encapsulation\fR \fIflag\fR\fB;\fR
@@ -654,7 +657,7 @@
This option specifies whether the client should configure its IP
layer to allow forwarding of datagrams with non-local source routes
(see Section 3.3.5 of [4] for a discussion of this topic). A value
-of false means disallow forwarding of such datagrams, and a value of true
+of 0 means disallow forwarding of such datagrams, and a value of true
means allow forwarding.
.RE
.PP
@@ -948,7 +951,7 @@
.PP
This option specifies whether or not the client should negotiate the
use of trailers (RFC 893 [14]) when using the ARP protocol. A value
-of false indicates that the client should not attempt to use trailers. A
+of 0 indicates that the client should not attempt to use trailers. A
value of true means that the client should attempt to use trailers.
.RE
.PP

View File

@ -1,238 +0,0 @@
--- common/discover.c.orig Fri Jul 25 21:44:15 2003
+++ common/discover.c Fri Mar 5 23:33:04 2004
@@ -47,6 +47,7 @@
#endif /* not lint */
#include "dhcpd.h"
+#include <ifaddrs.h>
#include <sys/ioctl.h>
struct interface_info *interfaces, *dummy_interfaces, *fallback_interface;
@@ -135,10 +136,7 @@
{
struct interface_info *tmp, *ip;
struct interface_info *last, *next;
- char buf [2048];
- struct ifconf ic;
- struct ifreq ifr;
- int i;
+ struct ifaddrs *ifap, *ifa;
int sock;
int address_count = 0;
struct subnet *subnet;
@@ -157,61 +155,6 @@
if ((sock = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
log_fatal ("Can't create addrlist socket");
- /* Get the interface configuration information... */
-
-#ifdef SIOCGIFCONF_ZERO_PROBE
- /* linux will only tell us how long a buffer it wants if we give it
- * a null buffer first. So, do a dry run to figure out the length.
- *
- * XXX this code is duplicated from below because trying to fold
- * the logic into the if statement and goto resulted in excesssive
- * obfuscation. The intent is that unless you run Linux you shouldn't
- * have to deal with this. */
-
- ic.ifc_len = 0;
- ic.ifc_ifcu.ifcu_buf = (caddr_t)NULL;
-#else
- /* otherwise, we just feed it a starting size, and it'll tell us if
- * it needs more */
-
- ic.ifc_len = sizeof buf;
- ic.ifc_ifcu.ifcu_buf = (caddr_t)buf;
-#endif
-
- gifconf_again:
- i = ioctl(sock, SIOCGIFCONF, &ic);
-
- if (i < 0)
- log_fatal ("ioctl: SIOCGIFCONF: %m");
-
-#ifdef SIOCGIFCONF_ZERO_PROBE
- /* Workaround for SIOCGIFCONF bug on some Linux versions. */
- if (ic.ifc_ifcu.ifcu_buf == 0 && ic.ifc_len == 0) {
- ic.ifc_len = sizeof buf;
- ic.ifc_ifcu.ifcu_buf = (caddr_t)buf;
- goto gifconf_again;
- }
-#endif
-
- /* If the SIOCGIFCONF resulted in more data than would fit in
- a buffer, allocate a bigger buffer. */
- if ((ic.ifc_ifcu.ifcu_buf == buf
-#ifdef SIOCGIFCONF_ZERO_PROBE
- || ic.ifc_ifcu.ifcu_buf == 0
-#endif
- ) && ic.ifc_len > sizeof buf) {
- ic.ifc_ifcu.ifcu_buf = dmalloc ((size_t)ic.ifc_len, MDL);
- if (!ic.ifc_ifcu.ifcu_buf)
- log_fatal ("Can't allocate SIOCGIFCONF buffer.");
- goto gifconf_again;
-#ifdef SIOCGIFCONF_ZERO_PROBE
- } else if (ic.ifc_ifcu.ifcu_buf == 0) {
- ic.ifc_ifcu.ifcu_buf = (caddr_t)buf;
- ic.ifc_len = sizeof buf;
- goto gifconf_again;
-#endif
- }
-
/* If we already have a list of interfaces, and we're running as
a DHCP server, the interfaces were requested. */
@@ -224,51 +167,38 @@
else
ir = INTERFACE_REQUESTED;
+ if (getifaddrs(&ifap) != 0)
+ log_fatal ("getifaddrs failed");
+
/* Cycle through the list of interfaces looking for IP addresses. */
- for (i = 0; i < ic.ifc_len;) {
- struct ifreq *ifp = (struct ifreq *)((caddr_t)ic.ifc_req + i);
-#ifdef HAVE_SA_LEN
- if (ifp -> ifr_addr.sa_len > sizeof (struct sockaddr))
- i += (sizeof ifp -> ifr_name) + ifp -> ifr_addr.sa_len;
- else
-#endif
- i += sizeof *ifp;
+ for (ifa = ifap; ifa != NULL; ifa = ifa->ifa_next) {
#ifdef ALIAS_NAMES_PERMUTED
- if ((s = strrchr (ifp -> ifr_name, ':'))) {
+ if ((s = strrchr (ifa -> ifa_name, ':'))) {
*s = 0;
}
#endif
#ifdef SKIP_DUMMY_INTERFACES
- if (!strncmp (ifp -> ifr_name, "dummy", 5))
+ if (!strncmp (ifa -> ifa_name, "dummy", 5))
continue;
#endif
-
- /* See if this is the sort of interface we want to
- deal with. */
- strcpy (ifr.ifr_name, ifp -> ifr_name);
- if (ioctl (sock, SIOCGIFFLAGS, &ifr) < 0)
- log_fatal ("Can't get interface flags for %s: %m",
- ifr.ifr_name);
-
/* See if we've seen an interface that matches this one. */
for (tmp = interfaces; tmp; tmp = tmp -> next)
- if (!strcmp (tmp -> name, ifp -> ifr_name))
+ if (!strcmp (tmp -> name, ifa -> ifa_name))
break;
- /* Skip non broadcast interfaces (plus loopback and
- point-to-point in case an OS incorrectly marks them
- as broadcast). Also skip down interfaces unless we're
+ /* See if this is the sort of interface we want to
+ deal with. Skip loopback, point-to-point and down
+ interfaces, except don't skip down interfaces if we're
trying to get a list of configurable interfaces. */
- if (((!(ifr.ifr_flags & IFF_BROADCAST) ||
- ifr.ifr_flags & IFF_LOOPBACK ||
- ifr.ifr_flags & IFF_POINTOPOINT) && !tmp) ||
- (!(ifr.ifr_flags & IFF_UP) &&
+ if ((ifa->ifa_flags & IFF_LOOPBACK) ||
+ (ifa->ifa_flags & IFF_POINTOPOINT) ||
+ (!(ifa->ifa_flags & IFF_UP) &&
state != DISCOVER_UNCONFIGURED))
continue;
-
+
/* If there isn't already an interface by this name,
allocate one. */
if (!tmp) {
@@ -276,9 +206,9 @@
status = interface_allocate (&tmp, MDL);
if (status != ISC_R_SUCCESS)
log_fatal ("Error allocating interface %s: %s",
- ifp -> ifr_name,
+ ifa -> ifa_name,
isc_result_totext (status));
- strcpy (tmp -> name, ifp -> ifr_name);
+ strcpy (tmp -> name, ifa -> ifa_name);
interface_snorf (tmp, ir);
interface_dereference (&tmp, MDL);
tmp = interfaces; /* XXX */
@@ -290,9 +220,9 @@
/* If we have the capability, extract link information
and record it in a linked list. */
#ifdef HAVE_AF_LINK
- if (ifp -> ifr_addr.sa_family == AF_LINK) {
+ if (ifa -> ifa_addr->sa_family == AF_LINK) {
struct sockaddr_dl *foo = ((struct sockaddr_dl *)
- (&ifp -> ifr_addr));
+ (ifa -> ifa_addr));
#if defined (HAVE_SIN_LEN)
tmp -> hw_address.hlen = foo -> sdl_alen;
#else
@@ -305,12 +235,11 @@
} else
#endif /* AF_LINK */
- if (ifp -> ifr_addr.sa_family == AF_INET) {
+ if (ifa -> ifa_addr->sa_family == AF_INET) {
struct iaddr addr;
/* Get a pointer to the address... */
- memcpy (&foo, &ifp -> ifr_addr,
- sizeof ifp -> ifr_addr);
+ bcopy(ifa->ifa_addr, &foo, sizeof(foo));
/* We don't want the loopback interface. */
if (foo.sin_addr.s_addr == htonl (INADDR_LOOPBACK) &&
@@ -323,16 +252,15 @@
found, keep a pointer to ifreq structure in
which we found it. */
if (!tmp -> ifp) {
-#ifdef HAVE_SA_LEN
- unsigned len = ((sizeof ifp -> ifr_name) +
- ifp -> ifr_addr.sa_len);
-#else
- unsigned len = sizeof *ifp;
-#endif
+
+ int len = (IFNAMSIZ +
+ ifa -> ifa_addr->sa_len);
tif = (struct ifreq *)dmalloc (len, MDL);
if (!tif)
log_fatal ("no space for ifp.");
- memcpy (tif, ifp, len);
+ strlcpy(tif->ifr_name, ifa->ifa_name, IFNAMSIZ);
+ memcpy(&tif->ifr_addr, ifa->ifa_addr,
+ ifa->ifa_addr->sa_len);
tmp -> ifp = tif;
tmp -> primary_address = foo.sin_addr;
}
@@ -346,9 +274,6 @@
}
}
- /* If we allocated a buffer, free it. */
- if (ic.ifc_ifcu.ifcu_buf != buf)
- dfree (ic.ifc_ifcu.ifcu_buf, MDL);
#if defined (LINUX_SLASHPROC_DISCOVERY)
/* On Linux, interfaces that don't have IP addresses don't
@@ -529,6 +454,7 @@
be able to configure, we can quit now. */
if (state == DISCOVER_UNCONFIGURED) {
close (sock);
+ freeifaddrs(ifap);
return;
}
@@ -674,6 +600,7 @@
}
close (sock);
+ freeifaddrs(ifap);
if (state == DISCOVER_SERVER && wifcount == 0) {
log_info ("%s", "");

View File

@ -1,29 +0,0 @@
--- common/dispatch.c.orig Sun Nov 17 03:26:57 2002
+++ common/dispatch.c Wed Mar 3 16:20:15 2004
@@ -95,11 +95,26 @@
void dispatch ()
{
struct timeval tv, *tvp;
+#ifdef ENABLE_POLLING_MODE
+ struct timeval *tvp_new;
+#endif
isc_result_t status;
+ TIME cur_time;
+ tvp = NULL;
+#ifdef ENABLE_POLLING_MODE
+ tvp_new = NULL;
+#endif
/* Wait for a packet or a timeout... XXX */
do {
tvp = process_outstanding_timeouts (&tv);
+#ifdef ENABLE_POLLING_MODE
+ GET_TIME (&cur_time);
+ add_timeout(cur_time + polling_interval, state_polling, 0, 0, 0);
+ tvp_new = process_outstanding_timeouts(&tv);
+ if (tvp != NULL && (tvp -> tv_sec > tvp_new -> tv_sec))
+ tvp = tvp_new;
+#endif /* ENABLE_POLLING_MODE */
status = omapi_one_dispatch (0, tvp);
} while (status == ISC_R_TIMEDOUT || status == ISC_R_SUCCESS);
log_fatal ("omapi_one_dispatch failed: %s -- exiting.",

View File

@ -1,41 +0,0 @@
--- configure.orig Sat Apr 20 23:44:13 2002
+++ configure Mon Apr 28 23:02:10 2003
@@ -13,6 +13,9 @@
elif [ x$1 = x--dirs ]; then
dirs=$2
shift
+ elif [ x$1 = x--subsys ]; then
+ subsys=$2
+ shift
elif [ x$1 = x--no-links ]; then
nolinks=YES
elif [ x$1 = x--copts ]; then
@@ -233,7 +236,14 @@
fi
if [ x"$dirs" = x ]; then
- dirs=". client server relay common omapip dhcpctl minires dst"
+ dirs=". common minires dst omapip dhcpctl"
+ if [ x$subsys = x ]; then
+ dirs="$dirs server omshell client relay"
+ elif [ x$subsys = xserver ]; then
+ dirs="$dirs server omshell"
+ elif [ x$subsys = xclient -o x$subsys = xrelay ]; then
+ dirs="$dirs $subsys"
+ fi
fi
for foo in $dirs; do
@@ -253,7 +263,11 @@
# Make the link tree in which to actually build.
if [ x$nolinks = x ]; then
- make links
+ if [ x$subsys = x ]; then
+ make links
+ else
+ make links.$subsys
+ fi
fi
exit 0

View File

@ -1,79 +0,0 @@
--- dhcpctl/Makefile.dist.orig Thu Mar 3 17:55:23 2005
+++ dhcpctl/Makefile.dist Mon Jul 25 08:33:33 2005
@@ -22,11 +22,11 @@
# http://www.isc.org/
#
-CATMANPAGES = dhcpctl.cat3 omshell.cat1
-SEDMANPAGES = dhcpctl.man3 omshell.man1
+CATMANPAGES = dhcpctl.cat3
+SEDMANPAGES = dhcpctl.man3
SRC = dhcpctl.c callback.c remote.c
OBJ = dhcpctl.o callback.o remote.o
-MAN = dhcpctl.3 omshell.1
+MAN = dhcpctl.3
HDRS = dhcpctl.h
INCLUDES = $(BINDINC) -I$(TOP)/includes
@@ -34,10 +34,7 @@
DHCPCTLLIBS = libdhcpctl.a ../common/libdhcp.a $(BINDLIB) \
../omapip/libomapi.a ../dst/libdst.a
-all: libdhcpctl.a omshell cltest $(CATMANPAGES)
-
-omshell: omshell.o $(DHCPCTLLIBS)
- $(CC) $(DEBUG) $(LFLAGS) -o omshell omshell.o $(DHCPCTLLIBS) $(LIBS)
+all: libdhcpctl.a cltest $(CATMANPAGES)
cltest: cltest.o $(DHCPCTLLIBS)
$(CC) $(DEBUG) $(LFLAGS) -o cltest cltest.o $(DHCPCTLLIBS) $(LIBS)
@@ -48,8 +45,7 @@
$(RANLIB) libdhcpctl.a
install: all $(CATMANPAGES)
- for dir in $(LIBDIR) $(LIBMANDIR) $(INCDIR) $(USRMANDIR) \
- $(USERBINDIR); do \
+ for dir in $(LIBDIR) $(LIBMANDIR) $(INCDIR); do \
foo=""; \
for bar in `echo $(DESTDIR)$${dir} |tr / ' '`; do \
foo=$${foo}/$$bar; \
@@ -69,16 +65,12 @@
$(MANINSTALL) $(MANFROM) $${prefix}.$(MANCAT)$${suffix} $(MANTO) \
$(DESTDIR)$(LIBMANDIR)/$${prefix}$(LIBMANEXT); \
done
- $(INSTALL) omshell $(DESTDIR)$(USERBINDIR)
- $(CHMOD) 755 $(DESTDIR)$(USERBINDIR)/omshell
- $(MANINSTALL) $(MANFROM) omshell.$(MANCAT)1 $(MANTO) \
- $(DESTDIR)$(USRMANDIR)/omshell$(USRMANEXT)
depend:
$(MKDEP) $(INCLUDES) $(PREDEFINES) $(SRC)
clean:
- -rm -f $(OBJ) omshell.o omshell cltest.o cltest
+ -rm -f $(OBJ) cltest.o cltest
realclean: clean
-rm -f libdhcpctl.a *~ $(CATMANPAGES) $(SEDMANPAGES)
@@ -87,7 +79,7 @@
-rm -f Makefile
links:
- @for foo in $(SRC) $(MAN) omshell.c cltest.c $(HDRS); do \
+ @for foo in $(SRC) $(MAN) cltest.c $(HDRS); do \
if [ ! -b $$foo ]; then \
rm -f $$foo; \
fi; \
@@ -100,12 +92,5 @@
dhcpctl.man3: dhcpctl.3
sed -e "s#ETCDIR#$(ETC)#g" -e "s#DBDIR#$(VARDB)#g" \
-e "s#RUNDIR#$(VARRUN)#g" < dhcpctl.3 >dhcpctl.man3
-
-omshell.cat1: omshell.man1
- nroff -man omshell.man1 >omshell.cat1
-
-omshell.man1: omshell.1
- sed -e "s#ETCDIR#$(ETC)#g" -e "s#DBDIR#$(VARDB)#g" \
- -e "s#RUNDIR#$(VARRUN)#g" < omshell.1 >omshell.man1
# Dependencies (semi-automatically-generated)

View File

@ -1,12 +0,0 @@
--- server/dhcpd.conf.orig Thu Jan 25 03:33:11 2001
+++ server/dhcpd.conf Wed Jan 30 22:06:52 2002
@@ -14,6 +14,9 @@
# network, the authoritative directive should be uncommented.
#authoritative;
+# ad-hoc DNS update scheme - set to "none" to disable dynamic DNS updates.
+ddns-update-style ad-hoc;
+
# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
log-facility local7;

View File

@ -1,29 +0,0 @@
--- dst/Makefile.dist.orig Sun Nov 17 03:27:43 2002
+++ dst/Makefile.dist Fri Mar 5 23:40:45 2004
@@ -26,12 +26,24 @@
all: libdst.a
-install:
-
libdst.a: $(OBJ)
rm -f dst.a
ar cruv libdst.a $(OBJ)
$(RANLIB) libdst.a
+
+install: all
+ for dir in $(LIBDIR);\
+ do \
+ foo=""; \
+ for bar in `echo $(DESTDIR)$${dir} |tr / ' '`; do \
+ foo=$${foo}/$$bar; \
+ if [ ! -d $$foo ]; then \
+ mkdir $$foo; \
+ chmod 755 $$foo; \
+ fi; \
+ done; \
+ done
+ $(INSTALL) libdst.a $(DESTDIR)$(LIBDIR)
depend:
$(MKDEP) $(INCLUDES) $(PREDEFINES) $(SRC)

View File

@ -1,62 +0,0 @@
--- includes/cf/freebsd.h.orig Wed Sep 1 19:06:36 2004
+++ includes/cf/freebsd.h Mon May 15 09:13:18 2006
@@ -33,7 +33,7 @@
*/
#include <syslog.h>
-#include <sys/types.h>
+#include <sys/param.h>
#include <string.h>
#include <paths.h>
#include <errno.h>
@@ -97,6 +97,10 @@
#define SOCKLEN_T int
#endif
+#ifdef RESCUE
+#define _PATH_DHCLIENT_SCRIPT "/rescue/dhclient-script"
+#endif
+
#if defined (USE_DEFAULT_NETWORK)
# define USE_BPF
#endif
@@ -107,6 +111,9 @@
#endif /* HAVE_DEV_RANDOM */
const char *cmds[] = {
+#ifndef RESCUE
+ /* rescue environment can't rely on these ... */
+ /* Actually, /sbin/dhclient shouldn't use these, either. */
"/bin/ps -axlw 2>&1",
"/usr/sbin/arp -an 2>&1",
"/usr/bin/netstat -an 2>&1",
@@ -117,10 +124,12 @@
"/usr/sbin/iostat 2>&1",
"/usr/bin/vmstat 2>&1",
"/usr/bin/w 2>&1",
+#endif
NULL
};
const char *dirs[] = {
+#ifndef RESCUE
"/tmp",
"/usr/tmp",
".",
@@ -130,13 +139,16 @@
"/var/mail",
"/home",
"/usr/home",
+#endif
NULL
};
const char *files[] = {
+#ifndef RESCUE
"/var/log/messages",
"/var/log/wtmp",
"/var/log/lastlog",
+#endif
NULL
};
#endif /* NEED_PRAND_CONF */

View File

@ -1,56 +0,0 @@
--- includes/dhcpd.h.orig Mon Feb 10 02:22:46 2003
+++ includes/dhcpd.h Wed Mar 3 16:20:09 2004
@@ -99,6 +99,9 @@
(((x) >> OPTION_HASH_EXP) & \
(OPTION_HASH_PTWO - 1))) % OPTION_HASH_SIZE;
+#define NOLINK 0
+#define HAVELINK 1
+
enum dhcp_shutdown_state {
shutdown_listeners,
shutdown_omapi_connections,
@@ -783,6 +786,11 @@
unsigned remote_id_len; /* Length of Remote ID. */
char name [IFNAMSIZ]; /* Its name... */
+ int ieee80211; /* True if media is ieee802.11 */
+ int havemedia; /* True if we have a media table */
+ int linkstate; /* True if we have link */
+ int polling; /* True if polling is enabled */
+ int forcediscover; /* True if a discover is needed */
int index; /* Its index. */
int rfdesc; /* Its read file descriptor. */
int wfdesc; /* Its write file descriptor, if
@@ -1845,6 +1853,9 @@
extern const char *path_dhclient_pid;
extern char *path_dhclient_script;
extern int interfaces_requested;
+#ifdef ENABLE_POLLING_MODE
+extern int polling_interval;
+#endif
extern struct client_config top_level_config;
@@ -1858,12 +1869,21 @@
void send_decline PROTO ((void *));
void state_reboot PROTO ((void *));
+#ifdef ENABLE_POLLING_MODE
+void state_background PROTO ((void *));
+void state_polling PROTO ((void *));
+#endif
void state_init PROTO ((void *));
void state_selecting PROTO ((void *));
void state_requesting PROTO ((void *));
void state_bound PROTO ((void *));
void state_stop PROTO ((void *));
void state_panic PROTO ((void *));
+
+#if __FreeBSD_version > 502010
+void set_ieee80211 PROTO ((struct interface_info *));
+#endif
+int interface_active PROTO ((struct interface_info *));
void bind_lease PROTO ((struct client_state *));

View File

@ -1,297 +0,0 @@
--- server/dhcpd.c.orig 2008-05-14 16:54:24.000000000 -0400
+++ server/dhcpd.c 2009-05-06 15:31:04.296733090 -0400
@@ -47,6 +47,22 @@
#include "version.h"
#include <omapip/omapip_p.h>
+#if defined (PARANOIA)
+#include <sys/types.h>
+#include <unistd.h>
+#include <pwd.h>
+/* get around the ISC declaration of group */
+#define group real_group
+#include <grp.h>
+#undef group
+#endif /* PARANOIA */
+#if defined (JAIL)
+#include <sys/param.h>
+#include <sys/jail.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#endif /* JAIL */
+
static void usage PROTO ((void));
struct iaddr server_identifier;
@@ -193,6 +209,46 @@
omapi_object_dereference (&listener, MDL);
}
+#if defined (PARANOIA)
+/* to be used in one of two possible scenarios */
+static void setup_chroot (char *chroot_dir)
+{
+ if (geteuid ())
+ log_fatal ("you must be root to use chroot");
+ if (chroot (chroot_dir))
+ log_fatal ("chroot(\"%s\"): %m", chroot_dir);
+ if (chdir ("/"))
+ /* probably permission denied */
+ log_fatal ("chdir(\"/\"): %m");
+}
+#endif /* PARANOIA */
+
+#if defined (JAIL)
+#if !defined(JAIL_API_VERSION)
+#define JAIL_API_VERSION 0
+#endif
+static void setup_jail (char *chroot_dir, char *hostname, struct in_addr ip_addr)
+{
+ struct jail j;
+
+ memset(&j, 0, sizeof(j));
+ j.version = JAIL_API_VERSION;
+ j.path = chroot_dir;
+ j.hostname = hostname;
+#if JAIL_API_VERSION == 0
+ j.ip_number = ntohl(ip_addr.s_addr);
+#elif JAIL_API_VERSION == 2
+ j.ip4s = 1;
+ j.ip4 = &ip_addr;
+#else
+#error Unsupported jail API
+#endif
+
+ if (jail (&j) < 0)
+ log_fatal ("jail(%s, %s): %m", chroot_dir, hostname);
+}
+#endif /* JAIL */
+
int main (argc, argv, envp)
int argc;
char **argv, **envp;
@@ -224,6 +280,25 @@
char *traceinfile = (char *)0;
char *traceoutfile = (char *)0;
#endif
+#if defined (PARANOIA)
+ char *set_user = 0;
+ char *set_group = 0;
+ uid_t set_uid = 0;
+ gid_t set_gid = 0;
+ int early_chroot = 0;
+ int no_dhcpd_user = 0;
+ int no_dhcpd_group = 0;
+#endif /* PARANOIA */
+#if defined (PARANOIA) || defined (JAIL)
+ char *set_chroot = 0;
+ int no_dhcpd_chroot = 0;
+#endif /* PARANOIA || JAIL */
+#if defined (JAIL)
+ char *set_jail = 0;
+ struct in_addr jail_ip_address;
+ int no_dhcpd_jail = 0;
+ char *s2;
+#endif /* JAIL */
/* Make sure we have stdin, stdout and stderr. */
status = open ("/dev/null", O_RDWR);
@@ -286,6 +361,38 @@
if (++i == argc)
usage ();
server = argv [i];
+#if defined (PARANOIA)
+ } else if (!strcmp (argv [i], "-user")) {
+ if (++i == argc)
+ usage ();
+ set_user = argv [i];
+ no_dhcpd_user = 1;
+ } else if (!strcmp (argv [i], "-group")) {
+ if (++i == argc)
+ usage ();
+ set_group = argv [i];
+ no_dhcpd_group = 1;
+ } else if (!strcmp (argv [i], "-early_chroot")) {
+ early_chroot = 1;
+#endif /* PARANOIA */
+#if defined (PARANOIA) || defined (JAIL)
+ } else if (!strcmp (argv [i], "-chroot")) {
+ if (++i == argc)
+ usage ();
+ set_chroot = argv [i];
+ no_dhcpd_chroot = 1;
+#endif /* PARANOIA || JAIL */
+#if defined (JAIL)
+ } else if (!strcmp (argv [i], "-jail")) {
+ if (++i == argc)
+ usage ();
+ set_jail = argv [i];
+ if (++i == argc)
+ usage ();
+ if (inet_pton (AF_INET, argv[i], &jail_ip_address) < 0)
+ log_fatal ("invalid ip address: %s", argv[i]);
+ no_dhcpd_jail = 1;
+#endif /* JAIL */
} else if (!strcmp (argv [i], "-cf")) {
if (++i == argc)
usage ();
@@ -363,6 +470,27 @@
if (!no_dhcpd_pid && (s = getenv ("PATH_DHCPD_PID"))) {
path_dhcpd_pid = s;
}
+#if defined (PARANOIA)
+ if (!no_dhcpd_user && (s = getenv ("DHCPD_USER"))) {
+ set_user = s;
+ }
+ if (!no_dhcpd_group && (s = getenv ("DHCPD_GROUP"))) {
+ set_group = s;
+ }
+#endif /* PARANOIA */
+#if defined (PARANOIA) || defined (JAIL)
+ if (!no_dhcpd_chroot && (s = getenv ("PATH_DHCPD_CHROOT"))) {
+ set_chroot = s;
+ }
+#endif /* PARANOIA || JAIL */
+#if defined (JAIL)
+ if (!no_dhcpd_jail && (s = getenv ("DHCPD_JAIL_HOSTNAME")) &&
+ (s2 = getenv ("DHCPD_JAIL_IPADDRESS"))) {
+ set_jail = s;
+ if (inet_pton (AF_INET, s2, &jail_ip_address) < 0)
+ log_fatal ("invalid ip address: %s", s2);
+ }
+#endif /* JAIL */
if (!quiet) {
log_info ("%s %s", message, DHCP_VERSION);
@@ -389,6 +517,57 @@
trace_seed_stop, MDL);
#endif
+#if defined (PARANOIA)
+ /* get user and group info if those options were given */
+ if (set_user) {
+ struct passwd *tmp_pwd;
+
+ if (geteuid ())
+ log_fatal ("you must be root to set user");
+
+ if (!(tmp_pwd = getpwnam (set_user)))
+ log_fatal ("no such user: %s", set_user);
+
+ set_uid = tmp_pwd->pw_uid;
+
+ /* use the user's group as the default gid */
+ if (!set_group)
+ set_gid = tmp_pwd->pw_gid;
+ }
+
+ if (set_group) {
+/* get around the ISC declaration of group */
+#define group real_group
+ struct group *tmp_grp;
+
+ if (geteuid ())
+ log_fatal ("you must be root to set group");
+
+ if (!(tmp_grp = getgrnam (set_group)))
+ log_fatal ("no such group: %s", set_group);
+
+ set_gid = tmp_grp->gr_gid;
+#undef group
+ }
+#endif /* PARANOIA */
+#if defined (JAIL)
+ if (set_jail) {
+ /* Initialize icmp support... */
+ if (!cftest && !lftest)
+ icmp_startup (1, lease_pinged);
+ if(!set_chroot)
+ set_chroot = "/";
+ setup_jail (set_chroot, set_jail, jail_ip_address);
+ }
+#endif /* JAIL */
+#if defined (PARANOIA) && defined (JAIL)
+ else
+#endif /* PARANOIA && JAIL */
+#if defined (PARANOIA)
+ if (early_chroot && set_chroot)
+ setup_chroot (set_chroot);
+#endif /* PARANOIA */
+
/* Default to the DHCP/BOOTP port. */
if (!local_port)
{
@@ -463,6 +642,9 @@
#endif
/* Initialize icmp support... */
+#if defined (JAIL)
+ if (!set_jail)
+#endif /* JAIL */
if (!cftest && !lftest)
icmp_startup (1, lease_pinged);
@@ -492,6 +674,14 @@
postconf_initialization (quiet);
+#if defined (PARANOIA)
+#if defined (JAIL)
+ if (!set_jail)
+#endif /* JAIL */
+ if (!early_chroot && set_chroot)
+ setup_chroot (set_chroot);
+#endif /* PARANOIA */
+
/* test option should cause an early exit */
if (cftest && !lftest)
exit(0);
@@ -534,7 +724,22 @@
else if (pid)
exit (0);
}
+
+#if defined (PARANOIA)
+ /* change uid to the specified one */
+ if (set_gid) {
+ if (setgroups (0, (void *)0))
+ log_fatal ("setgroups: %m");
+ if (setgid (set_gid))
+ log_fatal ("setgid(%d): %m", (int) set_gid);
+ }
+ if (set_uid) {
+ if (setuid (set_uid))
+ log_fatal ("setuid(%d): %m", (int) set_uid);
+ }
+#endif /* PARANOIA */
+
/* Read previous pid file. */
if ((i = open (path_dhcpd_pid, O_RDONLY)) >= 0) {
status = read(i, pbuf, (sizeof pbuf) - 1);
@@ -865,8 +1070,24 @@
log_info (copyright);
log_info (arr);
- log_fatal ("Usage: dhcpd [-p <UDP port #>] [-d] [-f]%s%s%s%s",
+ log_fatal ("Usage: dhcpd [-p <UDP port #>] [-d] [-f]%s%s%s%s%s%s%s",
"\n [-cf config-file] [-lf lease-file]",
+
+#if defined (PARANOIA)
+ /* meld into the following string */
+ "\n [-user user] [-group group]",
+ "\n [-chroot dir] [-early_chroot]",
+#else /* PARANOIA */
+ "", "",
+#endif /* PARANOIA */
+
+#if defined (JAIL)
+ /* then also these ones */
+ "\n [-jail name ip]",
+#else /* JAIL */
+ "",
+#endif /* JAIL */
+
#if defined (TRACING)
"\n [-tf trace-output-file]",
"\n [-play trace-input-file]",

View File

@ -1,42 +0,0 @@
--- site.conf.orig Wed Jul 7 17:20:10 1999
+++ site.conf Wed Mar 3 14:00:14 2004
@@ -1,2 +1,39 @@
# Put local site configuration stuff here to override the default
# settings in Makefile.conf
+
+PREFIX ?= /usr/local
+
+USERBINDIR = $(PREFIX)/bin
+BINDIR = $(PREFIX)/sbin
+CLIENTBINDIR = $(PREFIX)/sbin
+ADMMANDIR = $(PREFIX)/man/man8
+ADMMANEXT = .8
+FFMANDIR = $(PREFIX)/man/man5
+FFMANEXT = .5
+LIBMANDIR = $(PREFIX)/man/man3
+LIBMANEXT = .3
+USRMANDIR = $(PREFIX)/man/man1
+USRMANEXT = .1
+MANCAT = man
+# INSTALL = ${INSTALL_DATA}
+# MANINSTALL = ${INSTALL_MAN}
+ETC = $(PREFIX)/etc
+LIBDIR = ${PREFIX}/lib
+INCDIR = ${PREFIX}/include
+CLIENT_PATH = \"PATH=/sbin:/bin:/usr/sbin:/usr/bin:${PREFIX}/sbin:${PREFIX}/bin\"
+
+DEBUG ?= #none
+
+CFLAGS += -D_PATH_DHCPD_CONF=\"$(ETC)/dhcpd.conf\"
+CFLAGS += -D_PATH_DHCPD_DB=\"$(VARDB)/dhcpd.leases\"
+CFLAGS += -D_PATH_DHCPD_PID=\"$(VARRUN)/dhcpd.pid\"
+
+CFLAGS += -D_PATH_DHCRELAY_PID=\"$(VARRUN)/dhcrelay.pid\"
+
+CFLAGS += -D_PATH_DHCLIENT_CONF=\"$(ETC)/dhclient.conf\"
+CFLAGS += -D_PATH_DHCLIENT_SCRIPT=\"$(CLIENTBINDIR)/dhclient-script\"
+CFLAGS += -D_PATH_DHCLIENT_DB=\"$(VARDB)/dhclient.leases\"
+CFLAGS += -D_PATH_DHCLIENT_PID=\"$(VARRUN)/dhclient.pid\"
+
+CFLAGS += -Dwarn=dhcp_warn
+CFLAGS += -DNOMINUM

View File

@ -1,24 +0,0 @@
The ISC Dynamic Host Configuration Protocol Distribution provides a
freely redistributable reference implementation of all aspects of the
DHCP protocol, through a suite of DHCP tools:
* A DHCP server (this port)
* A DHCP client
* A DHCP relay agent
Version 3 of the ISC DHCP Distribution includes the following features
that are new since version 2.0:
* DHCP Failover Protocol support
* OMAPI, an API for accessing and modifying the DHCP server and client state
* Conditional behaviour
* Storing arbitrary information on leases
* Address pools with access control
* Client classing
* Address allocation restriction by class
* Relay agent information option support
* Dynamic DNS updates
* Many bug fixes, performance enhancements, and minor new DHCP protocol
features.
WWW: http://www.isc.org/products/DHCP/

View File

@ -1,31 +0,0 @@
#!/bin/sh
#
# $FreeBSD$
#
[ $# != 2 ] && exit 1
[ -z "${PKG_PREFIX}" ] && exit 1
[ -n "${BATCH}" ] && exit 0
case $2 in
POST-INSTALL)
if [ -x ${PKG_PREFIX}/etc/rc.d/isc-dhcpd ]; then
${PKG_PREFIX}/etc/rc.d/isc-dhcpd forceinstall
else
${PKG_PREFIX}/etc/rc.d/isc-dhcpd.sh forceinstall
fi
;;
DEINSTALL)
if [ -x ${PKG_PREFIX}/etc/rc.d/isc-dhcpd ]; then
${PKG_PREFIX}/etc/rc.d/isc-dhcpd forceuninstall
else
${PKG_PREFIX}/etc/rc.d/isc-dhcpd.sh forceuninstall
fi
;;
POST-DEINSTALL|PRE-INSTALL)
;;
*)
echo "usage: $0 <PKG_NAME> {PRE-INSTALL|POST-INSTALL|DEINSTALL|POST-DEINSTALL}" >&2
exit 1
;;
esac

View File

@ -1,53 +0,0 @@
**** To setup dhcpd, you may have to copy %%PREFIX%%/etc/dhcpd.conf.sample
to %%PREFIX%%/etc/dhcpd.conf for editing.
**** This port installs dhcp daemon, but doesn't invoke dhcpd by default. If
you want to invoke dhcpd at startup, put these lines into /etc/rc.conf.
dhcpd_enable="YES" # dhcpd enabled?
dhcpd_flags="-q" # command option(s)
dhcpd_conf="%%PREFIX%%/etc/dhcpd.conf" # configuration file
dhcpd_ifaces="" # ethernet interface(s)
dhcpd_withumask="022" # file creation mask
**** If compiled with paranoia support (the default), the following lines
are also supported:
dhcpd_chuser_enable="YES" # runs w/o privileges?
dhcpd_withuser="dhcpd" # user name to run as
dhcpd_withgroup="dhcpd" # group name to run as
dhcpd_chroot_enable="YES" # runs chrooted?
dhcpd_devfs_enable="YES" # use devfs if available?
dhcpd_makedev_enable="YES" # use MAKEDEV instead?
dhcpd_rootdir="/var/db/dhcpd" # directory to run in
dhcpd_includedir="<some_dir>" # directory with config-
files to include
dhcpd_flags="-early_chroot" # needs full root
WARNING: -early_chroot requires a jail(8) like environment to work.
WARNING: dhcpd_devfs_enable and dhcpd_makedev_enable are mutually
exclusive
dhcpd_makedev_enable make NO sense on FreeBSD 5.x and up!
**** If compiled with jail support (the default), the following lines are
also supported (-early_chroot and dhcpd_chroot_enable=YES are implied):
dhcpd_jail_enable="YES" # runs imprisoned?
dhcpd_hostname="<hostname>" # jail hostname
dhcpd_ipaddress="<ip address>" # jail ip address
WARNING: dhcpd_rootdir needs to point to a full jail(8) environment.
**** WARNING: never edit the chrooted or jailed dhcpd.conf file but
%%PREFIX%%/etc/dhcpd.conf instead which is always copied where
needed upon startup.
**** WARNING: %%PREFIX%%/etc/rc.isc-dhcpd.conf is obsolete. rc.conf like
variables are still read there but should be moved /etc/rc.conf or
/etc/rc.conf.d/dhcpd instead. Also, the dhcpd_options variable must
be renamed dhcpd_flags if any.
%%LDAP%%
%%LDAP%%**** You have requested support for the LDAP configuration backend.
%%LDAP%% The OpenLDAP schema file is installed as %%SCHEMA_DIR%%/dhcp.schema.
%%LDAP%% See %%DOCSDIR%%/README.ldap for further LDAP configuration details.

View File

@ -1,9 +0,0 @@
@comment $FreeBSD$
@unexec %D/etc/rc.d/isc-dhcpd.sh forcestop 2>/dev/null || true
@unexec %D/etc/rc.d/isc-dhcpd forcestop 2>/dev/null || true
bin/omshell
%%LDAP%%bin/dhcpd-conf-to-ldap.pl
etc/dhcpd.conf.sample
sbin/dhcpd
%%LDAP%%%%SCHEMA_DIR%%/dhcp.schema
%%LDAP%%@dirrm %%SCHEMA_DIR%%