summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWesley Shields <wxs@FreeBSD.org>2010-05-06 20:24:01 +0000
committerWesley Shields <wxs@FreeBSD.org>2010-05-06 20:24:01 +0000
commit541cf69201db734d98c45cf5b9d3c00f09c74876 (patch)
tree90f8963c6cfd5eb0c127b7917f8876221fba93f6
parentFix stopping the server process via the port's rc.d script. (diff)
Welcome net/isc-dhcp41-server, net/isc-dhcp41-client and net/isc-dhcp41-relay
to the tree. There's still a small bit of work to do including adding conflicts for the existing DHCP ports (which should have been conflicting with each other already) and add a 41-devel port so people can use the headers and libraries.
Notes
Notes: svn path=/head/; revision=253843
-rw-r--r--net/Makefile3
-rw-r--r--net/isc-dhcp41-client/Makefile13
-rw-r--r--net/isc-dhcp41-client/pkg-descr9
-rw-r--r--net/isc-dhcp41-client/pkg-message10
-rw-r--r--net/isc-dhcp41-client/pkg-plist8
-rw-r--r--net/isc-dhcp41-relay/Makefile13
-rw-r--r--net/isc-dhcp41-relay/pkg-descr9
-rw-r--r--net/isc-dhcp41-relay/pkg-message8
-rw-r--r--net/isc-dhcp41-relay/pkg-plist4
-rw-r--r--net/isc-dhcp41-server/Makefile125
-rw-r--r--net/isc-dhcp41-server/distinfo3
-rw-r--r--net/isc-dhcp41-server/files/client::scripts::freebsd510
-rw-r--r--net/isc-dhcp41-server/files/isc-dhcpd.in611
-rw-r--r--net/isc-dhcp41-server/files/isc-dhcrelay.in45
-rw-r--r--net/isc-dhcp41-server/files/patch-client__Makefile.in13
-rw-r--r--net/isc-dhcp41-server/files/patch-client__dhclient.conf11
-rw-r--r--net/isc-dhcp41-server/files/patch-server__Makefile.in13
-rw-r--r--net/isc-dhcp41-server/pkg-deinstall22
-rw-r--r--net/isc-dhcp41-server/pkg-descr9
-rw-r--r--net/isc-dhcp41-server/pkg-message30
-rw-r--r--net/isc-dhcp41-server/pkg-plist6
21 files changed, 1475 insertions, 0 deletions
diff --git a/net/Makefile b/net/Makefile
index a94cb1ed7d12..4ba38d57d35c 100644
--- a/net/Makefile
+++ b/net/Makefile
@@ -260,6 +260,9 @@
SUBDIR += isc-dhcp31-client
SUBDIR += isc-dhcp31-relay
SUBDIR += isc-dhcp31-server
+ SUBDIR += isc-dhcp41-server
+ SUBDIR += isc-dhcp41-client
+ SUBDIR += isc-dhcp41-relay
SUBDIR += iscsi-target
SUBDIR += istgt
SUBDIR += iwi-firmware
diff --git a/net/isc-dhcp41-client/Makefile b/net/isc-dhcp41-client/Makefile
new file mode 100644
index 000000000000..afe6d36b5ae7
--- /dev/null
+++ b/net/isc-dhcp41-client/Makefile
@@ -0,0 +1,13 @@
+# Ports collection makefile for: isc-dhcp41-client
+# Date created: 28 March 2010
+# Whom: Wesley Shields <wxs@FreeBSD.org>
+#
+# $FreeBSD$
+#
+
+COMMENT= The ISC Dynamic Host Configuration Protocol client
+
+SUBSYS= client
+MASTERDIR= ${.CURDIR}/../isc-dhcp41-server
+
+.include "${MASTERDIR}/Makefile"
diff --git a/net/isc-dhcp41-client/pkg-descr b/net/isc-dhcp41-client/pkg-descr
new file mode 100644
index 000000000000..0ebf230cdc08
--- /dev/null
+++ b/net/isc-dhcp41-client/pkg-descr
@@ -0,0 +1,9 @@
+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
+
+WWW: http://www.isc.org/products/DHCP/
diff --git a/net/isc-dhcp41-client/pkg-message b/net/isc-dhcp41-client/pkg-message
new file mode 100644
index 000000000000..106035b3b8ff
--- /dev/null
+++ b/net/isc-dhcp41-client/pkg-message
@@ -0,0 +1,10 @@
+**** 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
diff --git a/net/isc-dhcp41-client/pkg-plist b/net/isc-dhcp41-client/pkg-plist
new file mode 100644
index 000000000000..06b9afd39ee3
--- /dev/null
+++ b/net/isc-dhcp41-client/pkg-plist
@@ -0,0 +1,8 @@
+@comment $FreeBSD$
+sbin/dhclient
+sbin/dhclient-script
+@unexec if cmp -s %D/etc/dhclient.conf.sample %D/etc/dhclient.conf; then rm -f %D/etc/dhclient.conf; fi
+etc/dhclient.conf.sample
+@exec if [ ! -f %D/etc/dhclient.conf ] ; then cp -p %D/%F %B/dhclient.conf; fi
+@exec [ -f /var/run/dhclient.leases ] || touch /var/run/dhclient.leases
+@unexec [ -s /var/run/dhclient.leases ] || rm -f /var/run/dhclient.leases
diff --git a/net/isc-dhcp41-relay/Makefile b/net/isc-dhcp41-relay/Makefile
new file mode 100644
index 000000000000..f2ddb472c33c
--- /dev/null
+++ b/net/isc-dhcp41-relay/Makefile
@@ -0,0 +1,13 @@
+# Ports collection makefile for: isc-dhcp41-relay
+# Date created: 28 March 2010
+# Whom: Wesley Shields <wxs@FreeBSD.org>
+#
+# $FreeBSD$
+#
+
+COMMENT= The ISC Dynamic Host Configuration Protocol relay
+
+SUBSYS= relay
+MASTERDIR= ${.CURDIR}/../isc-dhcp41-server
+
+.include "${MASTERDIR}/Makefile"
diff --git a/net/isc-dhcp41-relay/pkg-descr b/net/isc-dhcp41-relay/pkg-descr
new file mode 100644
index 000000000000..b48f75a807b2
--- /dev/null
+++ b/net/isc-dhcp41-relay/pkg-descr
@@ -0,0 +1,9 @@
+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)
+
+WWW: http://www.isc.org/products/DHCP/
diff --git a/net/isc-dhcp41-relay/pkg-message b/net/isc-dhcp41-relay/pkg-message
new file mode 100644
index 000000000000..161fed5348ed
--- /dev/null
+++ b/net/isc-dhcp41-relay/pkg-message
@@ -0,0 +1,8 @@
+**** 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)
diff --git a/net/isc-dhcp41-relay/pkg-plist b/net/isc-dhcp41-relay/pkg-plist
new file mode 100644
index 000000000000..769520a1f3f7
--- /dev/null
+++ b/net/isc-dhcp41-relay/pkg-plist
@@ -0,0 +1,4 @@
+@comment $FreeBSD$
+@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
diff --git a/net/isc-dhcp41-server/Makefile b/net/isc-dhcp41-server/Makefile
new file mode 100644
index 000000000000..3b9cfba7f9e4
--- /dev/null
+++ b/net/isc-dhcp41-server/Makefile
@@ -0,0 +1,125 @@
+# Ports collection makefile for: isc-dhcp41-server
+# Date created: 28 March 2010
+# Whom: Wesley Shields <wxs@FreeBSD.org>
+#
+# $FreeBSD$
+#
+
+PORTNAME= dhcp
+PORTVERSION= 4.1.1
+PORTREVISION= ${DHCP_PORTREVISION}
+CATEGORIES= net
+MASTER_SITES= ${MASTER_SITE_ISC}
+MASTER_SITE_SUBDIR= dhcp
+PKGNAMEPREFIX= isc-
+PKGNAMESUFFIX= 41-${SUBSYS}
+DISTFILES= ${PORTNAME}-${PORTVERSION}${EXTRACT_SUFX}
+
+MAINTAINER= wxs@FreeBSD.org
+COMMENT?= The ISC Dynamic Host Configuration Protocol server
+
+PORTREVISION_SERVER= 0
+PORTREVISION_CLIENT= 0
+PORTREVISION_RELAY= 0
+PORTREVISION_DEVEL= 0
+
+SUBSYS?= server
+
+UNIQUENAME= ${PKGNAMEPREFIX}${PORTNAME}${PKGNAMESUFFIX}
+
+.if ${SUBSYS} == server
+OPTIONS= DHCP_PARANOIA "Enable support for chroot" on
+.endif
+
+# PORTREVISION handling
+.if ${SUBSYS} == client
+CONFLICTS= isc-dhcp3?-client*
+DHCP_PORTREVISION= ${PORTREVISION_CLIENT}
+.elif ${SUBSYS} == relay
+CONFLICTS= isc-dhcp3?-relay*
+DHCP_PORTREVISION= ${PORTREVISION_RELAY}
+.else
+CONFLICTS= isc-dhcp3?-server*
+DHCP_PORTREVISION= ${PORTREVISION_SERVER}
+.endif
+
+.if ${SUBSYS} == server
+USERS= dhcpd
+GROUPS= dhcpd
+.endif
+
+.include <bsd.port.pre.mk>
+
+MAN_COMPRESSED= no
+GNU_CONFIGURE= yes
+SCRIPTS_ENV+= PKG_PREFIX=${PREFIX}
+
+.if ${SUBSYS} == client
+MAN5= dhclient.conf.5 dhclient.leases.5
+MAN8= dhclient.8 dhclient-script.8
+CONF_FILE= dhclient.conf
+.elif ${SUBSYS} == server
+CONFIGURE_ARGS+= --localstatedir=/var
+MAN5= dhcpd.conf.5 dhcpd.leases.5
+MAN8= dhcpd.8
+CONF_FILE= dhcpd.conf
+.elif ${SUBSYS} == relay
+MAN8= dhcrelay.8
+.else
+MAN3= dhcpctl.3 omapi.3
+.endif
+
+DESCR= ${.CURDIR}/pkg-descr
+PLIST= ${.CURDIR}/pkg-plist
+
+.if ${SUBSYS} == server
+USE_RC_SUBR= isc-dhcpd
+.elif ${SUBSYS} == relay
+USE_RC_SUBR= isc-dhcrelay
+.endif
+
+SCHEMA_DIR= ${PREFIX}/share/${PKGBASE}
+DOCSDIR= ${PREFIX}/share/doc/${PKGBASE}
+DATADIR= /var/db
+
+MSG_FILE= ${.CURDIR}/pkg-message
+PKGMESSAGE= ${WRKDIR}/pkg-message
+
+REINPLACE_SUB= PREFIX="${PREFIX}"
+PKGMESSAGE_SUB= PREFIX="${PREFIX}" MAN1PREFIX="${MAN1PREFIX}" \
+ DOCSDIR="${DOCSDIR}"
+
+.if defined(WITH_DHCP_PARANOIA)
+CONFIGURE_ARGS+= --enable-paranoia --enable-early-chroot
+SUB_LIST+= PARANOIA=yes
+.else
+SUB_LIST+= PARANOIA=no
+.endif
+
+post-extract:
+ @${CP} ${FILESDIR}/client::scripts::freebsd ${WRKSRC}/client/scripts/freebsd
+
+post-patch:
+ @${SED} ${PKGMESSAGE_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
+ ${MSG_FILE} > ${PKGMESSAGE}
+ @${REINPLACE_CMD} ${REINPLACE_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
+ ${WRKSRC}/client/dhclient.conf \
+ ${WRKSRC}/client/scripts/freebsd
+
+do-install:
+ ${MAKE} -C ${WRKSRC}/${SUBSYS} install
+
+post-install:
+.if defined(CONF_FILE)
+ if [ ! -f ${PREFIX}/etc/${CONF_FILE} ]; then \
+ ${CP} -p ${PREFIX}/etc/${CONF_FILE}.sample ${PREFIX}/etc/${CONF_FILE} ; \
+ fi
+.endif
+.if ${SUBSYS} == client
+ ${INSTALL_SCRIPT} ${WRKSRC}/client/scripts/freebsd ${PREFIX}/sbin/dhclient-script
+.endif
+ @${ECHO_MSG}
+ @${CAT} ${PKGMESSAGE}
+ @${ECHO_MSG}
+
+.include <bsd.port.post.mk>
diff --git a/net/isc-dhcp41-server/distinfo b/net/isc-dhcp41-server/distinfo
new file mode 100644
index 000000000000..7e6c7e1f2a8f
--- /dev/null
+++ b/net/isc-dhcp41-server/distinfo
@@ -0,0 +1,3 @@
+MD5 (dhcp-4.1.1.tar.gz) = 38a74c89d8913b9b5f33737047623c18
+SHA256 (dhcp-4.1.1.tar.gz) = 37058685bffbfeb793cfb0867f0b1911f8d238ea69fbaa6cbb165455ab803618
+SIZE (dhcp-4.1.1.tar.gz) = 1084368
diff --git a/net/isc-dhcp41-server/files/client::scripts::freebsd b/net/isc-dhcp41-server/files/client::scripts::freebsd
new file mode 100644
index 000000000000..9c4c3d3a6f24
--- /dev/null
+++ b/net/isc-dhcp41-server/files/client::scripts::freebsd
@@ -0,0 +1,510 @@
+#!/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
+#############################################################################
diff --git a/net/isc-dhcp41-server/files/isc-dhcpd.in b/net/isc-dhcp41-server/files/isc-dhcpd.in
new file mode 100644
index 000000000000..c17f60c502b9
--- /dev/null
+++ b/net/isc-dhcp41-server/files/isc-dhcpd.in
@@ -0,0 +1,611 @@
+#! /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?
+
+load_rc_config ${name}
+
+# override these variables in /etc/rc.conf
+dhcpd_enable=${dhcpd_enable:-"NO"}
+# dhcpd_flags="" # -q -early_chroot # command option(s)
+# dhcpd_ifaces="" # ethernet interface(s)
+dhcpd_conf=${dhcpd_conf:-%%PREFIX%%/etc/${name}.conf} # configuration file
+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_rootdir=${dhcpd_rootdir:-/var/db/${name}} # directory to run in
+# dhcpd_includedir="" # directory for included config files
+
+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; 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}
+}
+
+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_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 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
+ else
+ dhcpd_devfs_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
+ 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_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_umask ()
+{
+ if [ -n "${dhcpd_withumask}" ]; then
+ umask ${dhcpd_withumask}
+ fi
+}
+
+setup_chroot ()
+{
+ local _hconf _hosts _ltime _rconf
+
+ _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}
+ 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
+ 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!
+ else
+ safe_remove ${_dhcpd_devdir}
+ fi
+ safe_rmdir ${_dhcpd_confdir} ${_dhcpd_rootdir} # XXX /_ hack!
+ fi
+}
+
+dhcpd_check ()
+{
+ check_chuser
+ check_chroot
+}
+
+dhcpd_rcvar ()
+{
+ rcvar_chuser
+ rcvar_chroot
+ rcvar_pidnleases
+ rcvar_rooted
+}
+
+dhcpd_precmd ()
+{
+ setup_umask
+ setup_chroot
+ setup_chuser
+ setup_leases
+ setup_flags
+}
+
+dhcpd_postcmd ()
+{
+ cleanup_chroot
+}
+
+_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_mod
+ setup_flags
+ rc_flags_mod="$rc_flags"
+ # Eliminate '-q' flag if it is present
+ case "$rc_flags" in
+ *-q*) rc_flags_mod=`echo "${rc_flags}" | sed -Ee 's/(^-q | -q | -q$)//'` ;;
+ esac
+ if ! ${command} -t -q ${rc_flags_mod}; then
+ err 1 "`${command} -t ${rc_flags_mod}` Configuration file sanity check failed"
+ 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"
+uninstall_cmd=dhcpd_uninstall
+extra_commands="uninstall"
+
+run_rc_command "$1"
diff --git a/net/isc-dhcp41-server/files/isc-dhcrelay.in b/net/isc-dhcp41-server/files/isc-dhcrelay.in
new file mode 100644
index 000000000000..a12c72d3f2a7
--- /dev/null
+++ b/net/isc-dhcp41-server/files/isc-dhcrelay.in
@@ -0,0 +1,45 @@
+#! /bin/sh
+#
+# $FreeBSD: /tmp/pcvs/ports/net/isc-dhcp41-server/files/isc-dhcrelay.in,v 1.1 2010-05-06 20:24:01 wxs Exp $
+#
+# 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="" # command option(s)
+# dhcrelay_servers="" # dhcrelay server(s)
+# dhcrelay_ifaces="" # ethernet interface(s)
+
+dhcrelay_precmd ()
+{
+ local ifaces
+
+ 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"
diff --git a/net/isc-dhcp41-server/files/patch-client__Makefile.in b/net/isc-dhcp41-server/files/patch-client__Makefile.in
new file mode 100644
index 000000000000..9c9f72ebe548
--- /dev/null
+++ b/net/isc-dhcp41-server/files/patch-client__Makefile.in
@@ -0,0 +1,13 @@
+--- ./client/Makefile.in.orig 2010-01-07 19:47:06.000000000 -0500
++++ ./client/Makefile.in 2010-05-02 20:38:26.000000000 -0400
+@@ -351,8 +351,8 @@
+ @list='$(dist_sysconf_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+- echo " $(dist_sysconfDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(sysconfdir)/$$f'"; \
+- $(dist_sysconfDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(sysconfdir)/$$f"; \
++ echo " $(dist_sysconfDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(sysconfdir)/$$f.sample'"; \
++ $(dist_sysconfDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(sysconfdir)/$$f.sample"; \
+ done
+
+ uninstall-dist_sysconfDATA:
diff --git a/net/isc-dhcp41-server/files/patch-client__dhclient.conf b/net/isc-dhcp41-server/files/patch-client__dhclient.conf
new file mode 100644
index 000000000000..163beaee6394
--- /dev/null
+++ b/net/isc-dhcp41-server/files/patch-client__dhclient.conf
@@ -0,0 +1,11 @@
+--- ./client/dhclient.conf.orig 2010-05-02 20:39:06.000000000 -0400
++++ ./client/dhclient.conf 2010-05-02 20:39:16.000000000 -0400
+@@ -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;
+
diff --git a/net/isc-dhcp41-server/files/patch-server__Makefile.in b/net/isc-dhcp41-server/files/patch-server__Makefile.in
new file mode 100644
index 000000000000..6ae828933da5
--- /dev/null
+++ b/net/isc-dhcp41-server/files/patch-server__Makefile.in
@@ -0,0 +1,13 @@
+--- ./server/Makefile.in.orig 2010-01-07 19:47:06.000000000 -0500
++++ ./server/Makefile.in 2010-05-02 20:38:26.000000000 -0400
+@@ -370,8 +370,8 @@
+ @list='$(dist_sysconf_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+- echo " $(dist_sysconfDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(sysconfdir)/$$f'"; \
+- $(dist_sysconfDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(sysconfdir)/$$f"; \
++ echo " $(dist_sysconfDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(sysconfdir)/$$f.sample'"; \
++ $(dist_sysconfDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(sysconfdir)/$$f.sample"; \
+ done
+
+ uninstall-dist_sysconfDATA:
diff --git a/net/isc-dhcp41-server/pkg-deinstall b/net/isc-dhcp41-server/pkg-deinstall
new file mode 100644
index 000000000000..cc91547668ef
--- /dev/null
+++ b/net/isc-dhcp41-server/pkg-deinstall
@@ -0,0 +1,22 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+[ $# != 2 ] && exit 1
+[ -z "${PKG_PREFIX}" ] && exit 1
+[ -n "${BATCH}" ] && exit 0
+
+case $2 in
+DEINSTALL)
+ if [ -x ${PKG_PREFIX}/etc/rc.d/isc-dhcpd ]; then
+ ${PKG_PREFIX}/etc/rc.d/isc-dhcpd forceuninstall
+ fi
+ ;;
+POST-DEINSTALL)
+ ;;
+*)
+ echo "usage: $0 <PKG_NAME> {DEINSTALL|POST-DEINSTALL}" >&2
+ exit 1
+ ;;
+esac
diff --git a/net/isc-dhcp41-server/pkg-descr b/net/isc-dhcp41-server/pkg-descr
new file mode 100644
index 000000000000..e0974d75614d
--- /dev/null
+++ b/net/isc-dhcp41-server/pkg-descr
@@ -0,0 +1,9 @@
+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
+
+WWW: http://www.isc.org/products/DHCP/
diff --git a/net/isc-dhcp41-server/pkg-message b/net/isc-dhcp41-server/pkg-message
new file mode 100644
index 000000000000..ccfead6a5cb8
--- /dev/null
+++ b/net/isc-dhcp41-server/pkg-message
@@ -0,0 +1,30 @@
+**** To setup dhcpd, please edit %%PREFIX%%/etc/dhcpd.conf.
+
+**** 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_rootdir="/var/db/dhcpd" # directory to run in
+ dhcpd_includedir="<some_dir>" # directory with config-
+ files to include
+
+**** 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 no longer read from there. Also, the dhcpd_options
+ variable is obsolete. Use dhcpd_flags instead.
diff --git a/net/isc-dhcp41-server/pkg-plist b/net/isc-dhcp41-server/pkg-plist
new file mode 100644
index 000000000000..41ded80b23ed
--- /dev/null
+++ b/net/isc-dhcp41-server/pkg-plist
@@ -0,0 +1,6 @@
+@comment $FreeBSD$
+@unexec %D/etc/rc.d/isc-dhcpd forcestop 2>/dev/null || true
+@unexec if cmp -s %D/etc/dhcpd.conf.sample %D/etc/dhcpd.conf; then rm -f %D/etc/dhcpd.conf; fi
+etc/dhcpd.conf.sample
+@exec if [ ! -f %D/etc/dhcpd.conf ] ; then cp -p %D/%F %B/dhcpd.conf; fi
+sbin/dhcpd