ports/116829: New port: net/isc-dhcp31-(client|devel|relay|server)

Attila Nagy bra at fsn.hu
Tue Oct 2 14:50:10 UTC 2007


>Number:         116829
>Category:       ports
>Synopsis:       New port: net/isc-dhcp31-(client|devel|relay|server)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Tue Oct 02 14:50:09 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator:     Attila Nagy
>Release:        FreeBSD 6-STABLE
>Organization:
FSN
>Environment:
>Description:
This is a direct copy of isc-dhcp3-* ports (currently at 3.0.5, while the current ISC version is 3.0.6) for the 3.1 version, but without the LDAP and LQ patches, which seem to be abandoned (not updated to current dhcpd versions) by the author.

Version 3.1.x of the ISC DHCP Distribution includes the following major
new features compared to its 3.0.x derivative:

  * A significantly enhanced Failover protocol implementation, which:
         * Implements MAC Address Affinity to reduce the frequency of
           clients being assigned new IP addresses;
         * Supports the assignment of failover-protected addresses to
           legacy BOOTP clients;
         * Implements a dynamic lease reservation system that provides
           improved accounting of the use of fixed address assignments,
           by allocating fixed addresses out of the pool of dynamic
           leases; and
         * Further improves tools and reduces operator oversight
           necessary for maintaining a functioning system.
   * Support for DHCP Leasequery, and the VIVCO/VIVSO options, which
         makes easy and comfortable integration with DOCSIS devices and
         the environment in which they are used.
   * Management of class and subclass statements via OMAPI.
   * Several server configuration options related to dynamic DNS
         behavior
   * Other new configuration functions, including "execute()",
        which runs a shell command from within a dhcpd or dhclient
        configuration file

>How-To-Repeat:

>Fix:
# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	isc-dhcp31-client
#	isc-dhcp31-client/Makefile
#	isc-dhcp31-client/pkg-descr
#	isc-dhcp31-client/pkg-message
#	isc-dhcp31-client/pkg-plist
#	isc-dhcp31-devel
#	isc-dhcp31-devel/Makefile
#	isc-dhcp31-devel/pkg-descr
#	isc-dhcp31-devel/pkg-plist
#	isc-dhcp31-relay
#	isc-dhcp31-relay/Makefile
#	isc-dhcp31-relay/pkg-descr
#	isc-dhcp31-relay/pkg-message
#	isc-dhcp31-relay/pkg-plist
#	isc-dhcp31-server
#	isc-dhcp31-server/files
#	isc-dhcp31-server/files/patch-site.conf
#	isc-dhcp31-server/files/isc-dhcpd.in
#	isc-dhcp31-server/files/isc-dhcrelay.in
#	isc-dhcp31-server/files/omshell::Makefile.dist
#	isc-dhcp31-server/files/patch-Makefile
#	isc-dhcp31-server/files/patch-Makefile.dist
#	isc-dhcp31-server/files/patch-client::clparse.c
#	isc-dhcp31-server/files/patch-client::dhclient.8
#	isc-dhcp31-server/files/patch-client::dhclient.c
#	isc-dhcp31-server/files/patch-client::dhclient.conf
#	isc-dhcp31-server/files/patch-common::dhcp-options.5
#	isc-dhcp31-server/files/patch-common::discover.c
#	isc-dhcp31-server/files/patch-common::dispatch.c
#	isc-dhcp31-server/files/patch-configure
#	isc-dhcp31-server/files/patch-dhcpctl::Makefile.dist
#	isc-dhcp31-server/files/patch-dhcpd.conf
#	isc-dhcp31-server/files/patch-dst::Makefile.dist
#	isc-dhcp31-server/files/patch-includes::cf::freebsd.h
#	isc-dhcp31-server/files/patch-includes::dhcpd.h
#	isc-dhcp31-server/files/patch-server::dhcpd.c
#	isc-dhcp31-server/files/client::scripts::freebsd
#	isc-dhcp31-server/pkg-descr
#	isc-dhcp31-server/pkg-install
#	isc-dhcp31-server/Makefile
#	isc-dhcp31-server/pkg-plist
#	isc-dhcp31-server/pkg-message
#	isc-dhcp31-server/distinfo
#
echo c - isc-dhcp31-client
mkdir -p isc-dhcp31-client > /dev/null 2>&1
echo x - isc-dhcp31-client/Makefile
sed 's/^X//' >isc-dhcp31-client/Makefile << 'END-of-isc-dhcp31-client/Makefile'
X# ex:ts=8
X# Ports collection makefile for:    dhcp
X# Date created:         28 April 2003
X# Whom:                 cyrille.lefevre at laposte.net
X#
X# $FreeBSD: ports/net/isc-dhcp3-client/Makefile,v 1.2 2005/06/09 18:56:58 sem Exp $
X#
X
XCOMMENT=	The ISC Dynamic Host Configuration Protocol client
X
X# Local variables
X#
X
XSUBSYS=		client
X
X# Local overrides
X#
X
XMASTERDIR=	${.CURDIR}/../isc-dhcp31-server
X
X.include "${MASTERDIR}/Makefile"
END-of-isc-dhcp31-client/Makefile
echo x - isc-dhcp31-client/pkg-descr
sed 's/^X//' >isc-dhcp31-client/pkg-descr << 'END-of-isc-dhcp31-client/pkg-descr'
XThe ISC Dynamic Host Configuration Protocol Distribution provides a
Xfreely redistributable reference implementation of all aspects of the
XDHCP protocol, through a suite of DHCP tools:
X
X  * A DHCP server
X  * A DHCP client (this port)
X  * A DHCP relay agent
X
XVersion 3.1.x of the ISC DHCP Distribution includes the following major
Xnew features compared to its 3.0.x derivative:
X
X  * A significantly enhanced Failover protocol implementation, which:
X         * Implements MAC Address Affinity to reduce the frequency of
X           clients being assigned new IP addresses;
X         * Supports the assignment of failover-protected addresses to
X           legacy BOOTP clients;
X         * Implements a dynamic lease reservation system that provides
X           improved accounting of the use of fixed address assignments,
X           by allocating fixed addresses out of the pool of dynamic
X           leases; and
X         * Further improves tools and reduces operator oversight
X           necessary for maintaining a functioning system.
X   * Support for DHCP Leasequery, and the VIVCO/VIVSO options, which
X         makes easy and comfortable integration with DOCSIS devices and
X         the environment in which they are used.
X   * Management of class and subclass statements via OMAPI.
X   * Several server configuration options related to dynamic DNS
X         behavior
X   * Other new configuration functions, including "execute()",
X        which runs a shell command from within a dhcpd or dhclient
X        configuration file
X
XWWW: http://www.isc.org/products/DHCP/
END-of-isc-dhcp31-client/pkg-descr
echo x - isc-dhcp31-client/pkg-message
sed 's/^X//' >isc-dhcp31-client/pkg-message << 'END-of-isc-dhcp31-client/pkg-message'
X****  To setup dhclient, you may need to edit /etc/rc.conf to replace the
X      base system dhclient, such as :
X
X	    dhcp_program="%%PREFIX%%/sbin/dhclient"
X	    dhcp_flags="-q"
X
X      See dhclient(8), using the following command, for details about other
X      possible options:
X
X	    MANPATH=%%MAN1PREFIX%%/man man 8 dhclient
END-of-isc-dhcp31-client/pkg-message
echo x - isc-dhcp31-client/pkg-plist
sed 's/^X//' >isc-dhcp31-client/pkg-plist << 'END-of-isc-dhcp31-client/pkg-plist'
X at comment $FreeBSD: ports/net/isc-dhcp3-client/pkg-plist,v 1.3 2004/06/26 08:46:05 eik Exp $
Xetc/dhclient.conf.sample
X at exec [ -f %D/etc/dhclient.conf ] || touch %D/etc/dhclient.conf
X at unexec [ -L %D/etc/dhclient.conf -o -s %D/etc/dhclient.conf ] || rm -f %D/etc/dhclient.conf
Xsbin/dhclient
Xsbin/dhclient-script
X at exec [ -f /var/run/dhclient.leases ] || touch /var/run/dhclient.leases
X at unexec [ -s /var/run/dhclient.leases ] || rm -f /var/run/dhclient.leases
END-of-isc-dhcp31-client/pkg-plist
echo c - isc-dhcp31-devel
mkdir -p isc-dhcp31-devel > /dev/null 2>&1
echo x - isc-dhcp31-devel/Makefile
sed 's/^X//' >isc-dhcp31-devel/Makefile << 'END-of-isc-dhcp31-devel/Makefile'
X# ex:ts=8
X# Ports collection makefile for:    dhcp
X# Date created:         28 April 2003
X# Whom:                 cyrille.lefevre at laposte.net
X#
X# $FreeBSD: ports/net/isc-dhcp3-devel/Makefile,v 1.2 2005/06/09 18:56:58 sem Exp $
X#
X
XCOMMENT=	The ISC Dynamic Host Configuration Protocol API
X
X# Local variables
X#
X
XSUBSYS=		devel
X
X# Local overrides
X#
X
XMASTERDIR=	${.CURDIR}/../isc-dhcp3-server
X
X.include "${MASTERDIR}/Makefile"
END-of-isc-dhcp31-devel/Makefile
echo x - isc-dhcp31-devel/pkg-descr
sed 's/^X//' >isc-dhcp31-devel/pkg-descr << 'END-of-isc-dhcp31-devel/pkg-descr'
XThe ISC Dynamic Host Configuration Protocol Distribution provides a
Xfreely redistributable reference implementation of all aspects of the
XDHCP protocol, through a suite of DHCP tools:
X
X  * A DHCP server
X  * A DHCP client
X  * A DHCP relay agent
X
XVersion 3.1.x of the ISC DHCP Distribution includes the following major
Xnew features compared to its 3.0.x derivative:
X
X  * A significantly enhanced Failover protocol implementation, which:
X         * Implements MAC Address Affinity to reduce the frequency of
X           clients being assigned new IP addresses;
X         * Supports the assignment of failover-protected addresses to
X           legacy BOOTP clients;
X         * Implements a dynamic lease reservation system that provides
X           improved accounting of the use of fixed address assignments,
X           by allocating fixed addresses out of the pool of dynamic
X           leases; and
X         * Further improves tools and reduces operator oversight
X           necessary for maintaining a functioning system.
X   * Support for DHCP Leasequery, and the VIVCO/VIVSO options, which
X         makes easy and comfortable integration with DOCSIS devices and
X         the environment in which they are used.
X   * Management of class and subclass statements via OMAPI.
X   * Several server configuration options related to dynamic DNS
X         behavior
X   * Other new configuration functions, including "execute()",
X        which runs a shell command from within a dhcpd or dhclient
X        configuration file
X
XWWW: http://www.isc.org/products/DHCP/
END-of-isc-dhcp31-devel/pkg-descr
echo x - isc-dhcp31-devel/pkg-plist
sed 's/^X//' >isc-dhcp31-devel/pkg-plist << 'END-of-isc-dhcp31-devel/pkg-plist'
X at comment $FreeBSD: ports/net/isc-dhcp3-devel/pkg-plist,v 1.4 2004/06/26 08:46:05 eik Exp $
Xinclude/dhcpctl.h
Xinclude/isc-dhcp/boolean.h
Xinclude/isc-dhcp/dst.h
Xinclude/isc-dhcp/int.h
Xinclude/isc-dhcp/lang.h
Xinclude/isc-dhcp/list.h
Xinclude/isc-dhcp/result.h
Xinclude/isc-dhcp/types.h
Xinclude/omapip/alloc.h
Xinclude/omapip/buffer.h
Xinclude/omapip/omapip.h
Xlib/libdhcpctl.a
Xlib/libomapi.a
Xlib/libdst.a
X at dirrm include/omapip
X at dirrm include/isc-dhcp
END-of-isc-dhcp31-devel/pkg-plist
echo c - isc-dhcp31-relay
mkdir -p isc-dhcp31-relay > /dev/null 2>&1
echo x - isc-dhcp31-relay/Makefile
sed 's/^X//' >isc-dhcp31-relay/Makefile << 'END-of-isc-dhcp31-relay/Makefile'
X# ex:ts=8
X# Ports collection makefile for:    dhcp
X# Date created:         28 April 2003
X# Whom:                 cyrille.lefevre at laposte.net
X#
X# $FreeBSD: ports/net/isc-dhcp3-relay/Makefile,v 1.2 2005/06/09 18:56:58 sem Exp $
X#
X
XCOMMENT=	The ISC Dynamic Host Configuration Protocol relay
X
X# Local variables
X#
X
XSUBSYS=		relay
X
X# Local overrides
X#
X
XMASTERDIR=	${.CURDIR}/../isc-dhcp31-server
X
X.include "${MASTERDIR}/Makefile"
END-of-isc-dhcp31-relay/Makefile
echo x - isc-dhcp31-relay/pkg-descr
sed 's/^X//' >isc-dhcp31-relay/pkg-descr << 'END-of-isc-dhcp31-relay/pkg-descr'
XThe ISC Dynamic Host Configuration Protocol Distribution provides a
Xfreely redistributable reference implementation of all aspects of the
XDHCP protocol, through a suite of DHCP tools:
X
X  * A DHCP server
X  * A DHCP client
X  * A DHCP relay agent (this port)
X
XVersion 3.1.x of the ISC DHCP Distribution includes the following major
Xnew features compared to its 3.0.x derivative:
X
X  * A significantly enhanced Failover protocol implementation, which:
X         * Implements MAC Address Affinity to reduce the frequency of
X           clients being assigned new IP addresses;
X         * Supports the assignment of failover-protected addresses to
X           legacy BOOTP clients;
X         * Implements a dynamic lease reservation system that provides
X           improved accounting of the use of fixed address assignments,
X           by allocating fixed addresses out of the pool of dynamic
X           leases; and
X         * Further improves tools and reduces operator oversight
X           necessary for maintaining a functioning system.
X   * Support for DHCP Leasequery, and the VIVCO/VIVSO options, which
X         makes easy and comfortable integration with DOCSIS devices and
X         the environment in which they are used.
X   * Management of class and subclass statements via OMAPI.
X   * Several server configuration options related to dynamic DNS
X         behavior
X   * Other new configuration functions, including "execute()",
X        which runs a shell command from within a dhcpd or dhclient
X        configuration file
X
XWWW: http://www.isc.org/products/DHCP/
END-of-isc-dhcp31-relay/pkg-descr
echo x - isc-dhcp31-relay/pkg-message
sed 's/^X//' >isc-dhcp31-relay/pkg-message << 'END-of-isc-dhcp31-relay/pkg-message'
X****  This port installs dhcp relay daemon, but don't invokes dhcrelay by
X      default. If you want to invoke dhcrelay at startup, put these lines
X      into /etc/rc.conf.
X
X	    dhcrelay_enable="YES"
X	    dhcrelay_flags=""		# command option(s)
X	    dhcrelay_servers=""		# dhcrelay server(s)
X	    dhcrelay_ifaces=""		# ethernet interface(s)
X
X****  For instance, rc.conf like variables are still read from
X      %%PREFIX%%/etc/rc.isc-dhcrelay.conf. They should be move
X      into /etc/rc.conf. Also, the dhcrelay_options variable
X      must be renamed dhcrelay_flags.
END-of-isc-dhcp31-relay/pkg-message
echo x - isc-dhcp31-relay/pkg-plist
sed 's/^X//' >isc-dhcp31-relay/pkg-plist << 'END-of-isc-dhcp31-relay/pkg-plist'
X at comment $FreeBSD: ports/net/isc-dhcp3-relay/pkg-plist,v 1.5 2006/08/25 12:02:58 sem Exp $
X at unexec %D/etc/rc.d/isc-dhcrelay.sh forcestop 2>/dev/null || true
X at unexec %D/etc/rc.d/isc-dhcrelay forcestop 2>/dev/null || true
Xsbin/dhcrelay
END-of-isc-dhcp31-relay/pkg-plist
echo c - isc-dhcp31-server
mkdir -p isc-dhcp31-server > /dev/null 2>&1
echo c - isc-dhcp31-server/files
mkdir -p isc-dhcp31-server/files > /dev/null 2>&1
echo x - isc-dhcp31-server/files/patch-site.conf
sed 's/^X//' >isc-dhcp31-server/files/patch-site.conf << 'END-of-isc-dhcp31-server/files/patch-site.conf'
X--- site.conf.orig	Wed Jul  7 17:20:10 1999
X+++ site.conf	Wed Mar  3 14:00:14 2004
X@@ -1,2 +1,39 @@
X # Put local site configuration stuff here to override the default
X # settings in Makefile.conf
X+
X+PREFIX ?=	/usr/local
X+
X+USERBINDIR =	$(PREFIX)/bin
X+BINDIR =	$(PREFIX)/sbin
X+CLIENTBINDIR =	$(PREFIX)/sbin
X+ADMMANDIR =	$(PREFIX)/man/man8
X+ADMMANEXT =	.8
X+FFMANDIR =	$(PREFIX)/man/man5
X+FFMANEXT =	.5
X+LIBMANDIR =	$(PREFIX)/man/man3
X+LIBMANEXT =	.3
X+USRMANDIR =	$(PREFIX)/man/man1
X+USRMANEXT =	.1
X+MANCAT =	man
X+# INSTALL =	${INSTALL_DATA}
X+# MANINSTALL =	${INSTALL_MAN}
X+ETC =		$(PREFIX)/etc
X+LIBDIR =	${PREFIX}/lib
X+INCDIR =	${PREFIX}/include
X+CLIENT_PATH =	\"PATH=/sbin:/bin:/usr/sbin:/usr/bin:${PREFIX}/sbin:${PREFIX}/bin\"
X+
X+DEBUG ?=	#none
X+
X+CFLAGS +=	-D_PATH_DHCPD_CONF=\"$(ETC)/dhcpd.conf\"
X+CFLAGS +=	-D_PATH_DHCPD_DB=\"$(VARDB)/dhcpd.leases\"
X+CFLAGS +=	-D_PATH_DHCPD_PID=\"$(VARRUN)/dhcpd.pid\"
X+
X+CFLAGS +=	-D_PATH_DHCRELAY_PID=\"$(VARRUN)/dhcrelay.pid\"
X+
X+CFLAGS +=	-D_PATH_DHCLIENT_CONF=\"$(ETC)/dhclient.conf\"
X+CFLAGS +=	-D_PATH_DHCLIENT_SCRIPT=\"$(CLIENTBINDIR)/dhclient-script\"
X+CFLAGS +=	-D_PATH_DHCLIENT_DB=\"$(VARDB)/dhclient.leases\"
X+CFLAGS +=	-D_PATH_DHCLIENT_PID=\"$(VARRUN)/dhclient.pid\"
X+
X+CFLAGS +=	-Dwarn=dhcp_warn
X+CFLAGS +=	-DNOMINUM
END-of-isc-dhcp31-server/files/patch-site.conf
echo x - isc-dhcp31-server/files/isc-dhcpd.in
sed 's/^X//' >isc-dhcp31-server/files/isc-dhcpd.in << 'END-of-isc-dhcp31-server/files/isc-dhcpd.in'
X#! /bin/sh
X#
X# $FreeBSD: ports/net/isc-dhcp3-server/files/isc-dhcpd.in,v 1.2 2006/11/05 11:27:01 dinoex Exp $
X#
X# PROVIDE: dhcpd
X# REQUIRE: DAEMON
X# BEFORE: LOGIN
X# KEYWORD: shutdown
X#
X# Add the following line to /etc/rc.conf to enable dhcpd:
X#
X# dhcpd_enable="YES"
X#
X
X. %%RC_SUBR%%
X
Xname=dhcpd
Xparanoia=%%PARANOIA%%				# compiled in paranoia?
Xjail=%%JAIL%%				# compiled in jail?
X
Xload_rc_config ${name}
X
X# override these variables in /etc/rc.conf
Xdhcpd_enable=${dhcpd_enable:-"NO"}
Xdhcpd_flags=${dhcpd_flags:-} # -q -early_chroot		# command option(s)
Xdhcpd_conf=${dhcpd_conf:-%%PREFIX%%/etc/${name}.conf}	# configuration file
Xdhcpd_ifaces=${dhcpd_ifaces:-}				# ethernet interface(s)
Xdhcpd_withumask=${dhcpd_withumask:-022}			# file creation mask
X
Xdhcpd_chuser_enable=${dhcpd_chuser_enable:-"%%PARANOIA%%"}	# runs w/o privileges?
Xdhcpd_withuser=${dhcpd_withuser:-${name}}		# user name to run as
Xdhcpd_withgroup=${dhcpd_withgroup:-${name}}		# group name to run as
X
Xdhcpd_chroot_enable=${dhcpd_chroot_enable:-"NO"}	# runs chrooted?
Xdhcpd_devfs_enable=${dhcpd_devfs_enable:-"YES"}		# devfs if available?
Xdhcpd_makedev_enable=${dhcpd_makedev_enable:-"NO"}	# MAKEDEV instead of devfs?
Xdhcpd_rootdir=${dhcpd_rootdir:-/var/db/${name}}		# directory to run in
Xdhcpd_includedir=${dhcpd_includedir:-}			# directory for included config files
X
X# untested
Xdhcpd_jail_enable=${dhcpd_jail_enable:-"NO"}		# runs imprisoned?
Xdhcpd_hostname=${dhcpd_hostname:-}			# jail hostname
Xdhcpd_ipaddress=${dhcpd_ipaddress:-}			# jail ip address
X
Xsafe_run ()	# rc command [args...]
X{
X	local _rc
X
X	_rc=$1
X	shift
X
X	if [ "${_rc}" -eq 0 ]; then
X		debug safe_run: "$@"
X		"$@" || _rc=1
X	else
X		warn safe_run: "$@"
X	fi
X	return ${_rc}
X}
X
Xprecious ()	# entry...
X{
X	local _entry _rc
X
X	_rc=0
X	for _entry; do
X		# do nothing if /dev, /var/run or /var/db
X		echo ${_entry} | egrep -q '^//*(dev|var//*(run|db))?/*$' || _rc=1
X	done
X	debug precious: "$@" rc=${_rc}
X	return ${_rc}
X}
X
Xlsmod ()	# user group file...
X{
X	local _entry _user _group _rc
X
X	_user=$1 _group=$2
X	shift 2
X
X	_rc=0
X	for _entry; do
X		ls -ld ${_entry} 2> /dev/null |
X		awk -v u=${_user} -v g=${_group} '{
X		    exit ((u && $3 != u) || (g && $4 != g))
X		}' || _rc=1
X	done
X	debug lsmod: "$@" rc=${_rc}
X	return ${_rc}
X}
X
Xsafe_chmog ()	# entry...
X{
X	local _entry _user _group _usergroup _rc
X
X	_user=${dhcpd_withuser}
X	_group=${dhcpd_withgroup}
X
X	_rc=0
X	if [ -n "${_user}" -o -n "${_group}" ]; then
X		_usergroup=${_user}${_group:+:${_group}}
X		for _entry; do
X			if [ -d ${_entry} ] && mounted ${_entry}; then
X				continue
X			fi
X			if [ -e ${_entry} ] &&
X			   ! precious ${_entry} &&
X			   ! lsmod ${_user} ${_group} ${_entry} &&
X			   ! safe_run ${_rc} chown ${_usergroup} ${_entry}; then
X				warn "unable to change permissions of ${_entry}"
X				_rc=1
X			fi
X		done
X	fi
X	return ${_rc}
X}
X
Xsafe_mkdir ()	# dir...
X{
X	local _dir _rc
X
X	_rc=0
X	for _dir; do
X		if [ ! -d ${_dir} ] &&
X		   ! precious ${_dir} &&
X		   ! safe_run ${_rc} mkdir -p ${_dir}; then
X			err 1 "unable to create directory ${_dir}"
X			_rc=1
X		fi
X	done
X	safe_run ${_rc} safe_chmog "$@" || _rc=1
X	return ${_rc}
X}
X
Xsafe_rmdir ()	# dir...
X{
X	local _dir _rc
X
X	_rc=0
X	for _dir; do
X		if [ -d ${_dir} ] &&
X		   ! precious ${_dir} &&
X		   ! mounted ${_dir}; then
X			if safe_run ${_rc} rmdir ${_dir}; then
X				safe_run ${_rc} safe_rmdir ${_dir%/*} || _rc=1
X			else
X				warn "unable to remove directory ${_dir}"
X				_rc=1
X			fi
X		fi
X	done
X	return ${_rc}
X}
X
Xsafe_touch ()	# file...
X{
X	local _file _rc
X
X	_rc=0
X	for _file; do
X		if [ ! -e ${_file} ] &&
X		   ! safe_run ${_rc} touch ${_file}; then
X			err 1 "unable to create file ${_file}"
X			_rc=1
X		fi
X	done
X	safe_run ${_rc} safe_chmog "$@" || _rc=1
X	return ${_rc}
X}
X
Xsafe_remove ()	# entry...
X{
X	local _entry _rc
X
X	_rc=0
X	for _entry; do
X		if [ -f ${_entry} ]; then
X			if ! safe_run ${_rc} rm -f ${_entry}; then
X				warn "unable to remove file ${_entry}"
X				_rc=1
X			fi
X		elif [ -d ${_entry} ] &&
X		     ! precious ${_entry} &&
X		     ! mounted ${_entry}; then
X			if ! safe_run ${_rc} rm -rf ${_entry}; then
X				warn "unable to remove directory ${_entry}"
X				_rc=1
X			fi
X		fi
X	done
X	return ${_rc}
X}
X
Xsafe_copy ()	# src dst
X{
X	local _src _dst _rc
X
X	_src=$1 _dst=$2
X
X	_rc=0
X	if [ -f ${_src} ]; then
X		if ! safe_run ${_rc} safe_remove ${_dst} ||
X		   ! safe_run ${_rc} cp -p ${_src} ${_dst}; then
X			err 1 "unable to copy file ${_src} to ${_dst}"
X			_rc=1
X		fi
X		safe_run ${_rc} safe_chmog ${_dst} || _rc=1
X	elif [ -d ${_src} ] &&
X	     ! precious ${_dst} &&
X	     ! mounted ${_dst}; then
X		if ! safe_run ${_rc} pax -rw -pe -ts "|^${_src}||" \
X		   ${_src} ${_dst}; then
X			err 1 "unable to copy directory ${_src} to ${_dst}"
X			_rc=1
X		fi
X	else
X		err 1 "unable to copy ${_src} to ${_dst}" \
X		      "-- not a file or a directory"
X		_rc=1
X	fi
X	return ${_rc}
X}
X
Xmounted ()	# dir...
X{
X	local _rc
X
X	_rc=1
X	if checkyesno dhcpd_devfs_enable ||
X	   checkyesno dhcpd_jail_enable; then
X		mount -t devfs | awk '
X		    BEGIN { n = ARGC; ARGC = 2 }
X		    { for (i = 2; i != n; i++) if ($3 == ARGV[i]) exit 1 }
X		' - "$@" || _rc=0
X	fi
X	debug mounted: "$@" rc=${_rc}
X	return ${_rc}
X}
X
Xsafe_mount ()	# dir
X{
X	local _dir _rc
X
X	_dir=$1
X
X	_rc=0
X	if checkyesno dhcpd_devfs_enable &&
X	   ! mounted ${_dir} &&
X	   ! safe_run ${_rc} mount -t devfs devfs ${_dir}; then
X		err 1 "unable to mount ${_dir}"
X		_rc=1
X	fi
X	return ${_rc}
X}
X
Xsafe_umount ()	# dir
X{
X	local _dir _rc
X
X	_dir=$1
X
X	_rc=0
X	if checkyesno dhcpd_devfs_enable &&
X	   mounted ${_dir} &&
X	   ! safe_run ${_rc} umount ${_dir}; then
X		warn "unable to unmount ${_dir}"
X		_rc=1
X	fi
X	return ${_rc}
X}
X
Xsafe_useradd ()
X{
X	local _user _group _home _shell _gecos
X
X	_user=$1 _group=$2 _gecos=${3:-"& daemon"}
X	_home=${4:-/nonexistent} _shell=${5:-%%NOLOGIN%%}
X
X	if [ -n "${_group}" ]; then
X		if pw group show ${_group} 2>/dev/null; then
X			echo "You already have a group \"${_group}\"," \
X			     "so I will use it."
X		elif pw groupadd ${_group} -h -; then
X			echo "Added group \"${_group}\"."
X		else
X			echo "Adding group \"${_group}\" failed..."
X			echo "Please create it, and try again."
X			exit 1
X		fi
X	fi
X	if [ -n "${_user}" ]; then
X		if pw user show ${_user} 2>/dev/null; then
X			echo "You already have a user \"${_user}\"," \
X			     "so I will use it."
X		elif pw useradd ${_user} -g ${_group} -h - \
X			-d ${_home} -s ${_shell} -c "${_gecos}"; then
X			echo "Added user \"${_user}\"."
X		else
X			echo "Adding user \"${_user}\" failed..."
X			echo "Please create it, and try again."
X			exit 1
X		fi
X	fi
X}
X
Xcheck_chuser ()
X{
X	if checkyesno paranoia; then
X		if checkyesno dhcpd_chuser_enable &&
X		   [ -z "${dhcpd_withuser}" -a -z "${dhcpd_withgroup}" ]; then
X			err 1 "one of dhcpd_withuser and dhcpd_withgroup" \
X			      "must be set if dhcpd_chuser_enable is enabled"
X		fi
X	else
X		if checkyesno dhcpd_chuser_enable; then
X			warn "dhcpd_chuser_enable disabled -- not compiled in"
X			dhcpd_chuser_enable=NO
X		fi
X	fi
X}
X
Xcheck_jail ()
X{
X	if checkyesno paranoia && checkyesno jail; then
X		if checkyesno dhcpd_jail_enable &&
X		   ! checkyesno dhcpd_chroot_enable; then
X			warn "dhcpd_chroot_enable implied by dhcpd_jail_enable"
X			dhcpd_chroot_enable=YES
X		fi
X		if checkyesno dhcpd_jail_enable &&
X		   [ -n "${dhcpd_hostname}" -a -z "${dhcpd_ipaddress}" ] ||
X		   [ -z "${dhcpd_hostname}" -a -n "${dhcpd_ipaddress}" ]; then
X			err 1 "both dhcpd_hostname and dhcpd_ipaddress" \
X			      "must be set if dhcpd_jail_enable is enabled"
X		fi
X	else
X		if checkyesno dhcpd_jail_enable; then
X			warn "dhcpd_jail_enable disabled -- not compiled in"
X			dhcpd_jail_enable=NO
X		fi
X	fi
X}
X
Xcheck_chroot ()
X{
X	if checkyesno paranoia; then
X		if checkyesno dhcpd_chroot_enable; then
X			if [ -z "${dhcpd_rootdir}" ]; then
X				err 1 "dhcpd_rootdir must be set" \
X				      "if dhcpd_chroot_enable is enabled"
X			fi
X			if checkyesno dhcpd_devfs_enable &&
X			   checkyesno dhcpd_makedev_enable; then
X				err 1 "dhcpd_devfs_enable and dhcpd_makedev_enable" \
X				      "are mutually exclusive. enable only one!"
X			fi
X			if checkyesno dhcpd_devfs_enable &&
X			   ! ( type mount_devfs ) > /dev/null 2>&1; then
X				warn "dhcpd_devfs_enable disabled" \
X				     "-- not available"
X				dhcpd_devfs_enable=NO
X			fi
X			if checkyesno dhcpd_makedev_enable &&
X			   ! [ -x ${__dhcpd_devdir}/MAKEDEV ]; then
X				warn "dhcpd_makedev_enable disabled" \
X				     "-- not available"
X				dhcpd_makedev_enable=NO
X			fi
X		else
X			dhcpd_devfs_enable=NO
X			dhcpd_makedev_enable=NO
X		fi
X	else
X		if checkyesno dhcpd_chroot_enable; then
X			warn "dhcpd_chroot_enable disabled -- not compiled in"
X			dhcpd_chroot_enable=NO
X		fi
X		dhcpd_devfs_enable=NO
X		dhcpd_makedev_enable=NO
X	fi
X}
X
Xrcvar_chuser ()
X{
X	if checkyesno paranoia && checkyesno dhcpd_chuser_enable; then
X		dhcpd_piddir=${__dhcpd_piddir}/${name}
X		dhcpd_leasesdir=${__dhcpd_leasesdir}/${name}
X	else
X		dhcpd_withuser= dhcpd_withgroup=
X	fi
X}
X
Xrcvar_jail ()
X{
X	if ! checkyesno paranoia || ! checkyesno jail ||
X	   ! checkyesno dhcpd_jail_enable; then
X		dhcpd_hostname= dhcpd_ipaddress=
X	fi
X}
X
Xrcvar_chroot ()
X{
X	if ! checkyesno paranoia || ! checkyesno dhcpd_chroot_enable; then
X		dhcpd_rootdir=
X	elif checkyesno paranoia && checkyesno dhcpd_chroot_enable; then
X		dhcpd_devdir=${__dhcpd_devdir}
X		dhcpd_etcdir=${__dhcpd_etcdir}
X	fi
X}
X
Xrcvar_pidnleases ()
X{
X	if ! checkyesno dhcpd_chuser_enable; then
X		dhcpd_piddir=${__dhcpd_piddir}
X		dhcpd_leasesdir=${__dhcpd_leasesdir}
X	fi
X	dhcpd_pidfile=${dhcpd_piddir}/${name}.pid
X	dhcpd_leasesfile=${dhcpd_leasesdir}/${name}.leases
X	dhcpd_conffile=${dhcpd_conf}	# for convenience only
X	dhcpd_confdir=$(dirname ${dhcpd_conffile})
X}
X
Xrcvar_rooted ()
X{
X	_dhcpd_rootdir=${dhcpd_rootdir}
X	_dhcpd_devdir=${dhcpd_rootdir}${dhcpd_devdir}
X	_dhcpd_etcdir=${dhcpd_rootdir}${dhcpd_etcdir}
X	_dhcpd_confdir=${dhcpd_rootdir}${dhcpd_confdir}
X	_dhcpd_includedir=${dhcpd_rootdir}${dhcpd_includedir}
X	_dhcpd_piddir=${dhcpd_rootdir}${dhcpd_piddir}
X	_dhcpd_leasesdir=${dhcpd_rootdir}${dhcpd_leasesdir}
X	_dhcpd_conffile=${dhcpd_rootdir}${dhcpd_conffile}
X	_dhcpd_pidfile=${dhcpd_rootdir}${dhcpd_pidfile}
X	_dhcpd_leasesfile=${dhcpd_rootdir}${dhcpd_leasesfile}
X}
X
Xsetup_compat ()
X{
X	local dhcpd_rcconf
X
X	# suck in old configuration file and variables
X	#
X	dhcpd_rcconf=${dhcpd_confdir}/rc.isc-dhcpd.conf
X
X	if [ -f ${dhcpd_rcconf} ]; then
X		warn "${dhcpd_rcconf} is obsolete, use /etc/rc.conf and/or" \
X		     "/etc/rc.conf.d/${name} instead."
X		. ${dhcpd_rcconf}
X
X		if [ -n "${dhcpd_options}" -a -z "${rc_flags}" ]; then
X			warn "dhcpd_options is obsolete," \
X			     "use dhcpd_flags instead."
X			rc_flags=${dhcpd_options}
X		fi
X	fi
X}
X
Xsetup_umask ()
X{
X	if [ -n "${dhcpd_withumask}" ]; then
X		umask ${dhcpd_withumask}
X	fi
X}
X
Xsetup_chroot ()
X{
X	local _mdev _hconf _hosts _ltime _rconf
X
X	_mdev=MAKEDEV
X	_hconf=host.conf
X	_hosts=hosts
X	_ltime=localtime
X	_rconf=resolv.conf
X
X	if checkyesno paranoia && checkyesno dhcpd_chroot_enable; then
X		if ! mounted ${_dhcpd_devdir}; then
X			safe_mkdir ${_dhcpd_devdir}/_
X			# XXX /_ hack! so, .../dev is root owned.
X		fi
X		safe_mkdir ${_dhcpd_rootdir} ${_dhcpd_etcdir}/_ ${_dhcpd_confdir}
X		# XXX /_ hack! so, .../etc is root owned.
X		if checkyesno dhcpd_devfs_enable; then
X			safe_mount ${_dhcpd_devdir}
X		elif checkyesno dhcpd_makedev_enable; then
X			safe_copy ${dhcpd_devdir}/$_mdev ${_dhcpd_devdir}/$_mdev
X			safe_run 0 sh -c "cd ${_dhcpd_devdir} && ./$_mdev jail bpf4"
X		else
X			safe_copy ${dhcpd_devdir} ${_dhcpd_devdir}
X		fi
X		safe_copy ${dhcpd_conffile} ${_dhcpd_conffile}
X		safe_copy ${dhcpd_etcdir}/$_hconf ${_dhcpd_etcdir}/$_hconf
X		safe_copy ${dhcpd_etcdir}/$_hosts ${_dhcpd_etcdir}/$_hosts
X		safe_copy ${dhcpd_etcdir}/$_ltime ${_dhcpd_etcdir}/$_ltime
X		safe_copy ${dhcpd_etcdir}/$_rconf ${_dhcpd_etcdir}/$_rconf
X		# copy dhcpd_includedir if defined and available
X		if [ -d "${dhcpd_includedir}" ]; then
X			safe_mkdir ${_dhcpd_includedir}
X			safe_copy ${dhcpd_includedir} ${_dhcpd_includedir}
X		fi
X	fi
X}
X
Xsetup_chuser ()
X{
X	if checkyesno paranoia && {
X	   checkyesno dhcpd_chuser_enable || checkyesno dhcpd_chroot_enable
X	}; then
X		safe_mkdir ${_dhcpd_piddir} ${_dhcpd_leasesdir}
X	fi
X}
X
Xsetup_leases ()
X{
X	safe_touch ${_dhcpd_leasesfile}
X}
X
Xsetup_flags ()
X{
X	if [ -n "${dhcpd_conf}" ]; then
X		rc_flags="${rc_flags} -cf ${dhcpd_conf}"
X	fi
X	if [ -n "${dhcpd_leasesfile}" ]; then
X		rc_flags="${rc_flags} -lf ${dhcpd_leasesfile}"
X	fi
X	if [ -n "${dhcpd_pidfile}" ]; then
X		rc_flags="${rc_flags} -pf ${dhcpd_pidfile}"
X	fi
X	if [ -n "${dhcpd_withuser}" ]; then
X		rc_flags="${rc_flags} -user ${dhcpd_withuser}"
X	fi
X	if [ -n "${dhcpd_withgroup}" ]; then
X		rc_flags="${rc_flags} -group ${dhcpd_withgroup}"
X	fi
X	if [ -n "${dhcpd_rootdir}" ]; then
X		rc_flags="${rc_flags} -chroot ${dhcpd_rootdir}"
X	fi
X	if [ -n "${dhcpd_hostname}" -a -n "${dhcpd_ipaddress}" ]; then
X		rc_flags="${rc_flags} -jail ${dhcpd_hostname} ${dhcpd_ipaddress}"
X	fi
X	rc_flags="${rc_flags} ${dhcpd_ifaces}"
X}
X
Xcleanup_chroot ()
X{
X	if checkyesno paranoia && checkyesno dhcpd_chroot_enable; then
X		safe_umount ${_dhcpd_devdir}
X	fi
X}
X
Xdhcpd_stop ()
X{
X	if sh $0 forcestatus; then
X		sh $0 forcestop
X	fi
X}
X
Xremove_pid ()
X{
X	if [ -e ${_dhcpd_pidfile} ]; then
X		warn "${_dhcpd_pidfile} still exists! -- removing anyway"
X	fi
X	safe_remove ${_dhcpd_pidfile}
X}
X
Xremove_leases ()
X{
X	if [ -s ${_dhcpd_leasesfile} ]; then
X		warn "${_dhcpd_leasesfile} not empty -- not removed --" \
X		     "futher warning messages expected, don't care."
X	else
X		safe_remove ${_dhcpd_leasesfile} ${_dhcpd_leasesfile}~
X	fi
X}
X
Xremove_chuser ()
X{
X	if checkyesno paranoia && {
X	   checkyesno dhcpd_chuser_enable || checkyesno dhcpd_chroot_enable
X	}; then
X		safe_rmdir ${_dhcpd_piddir} ${_dhcpd_leasesdir}
X	fi
X}
X
Xremove_chroot ()
X{
X	if checkyesno paranoia && checkyesno dhcpd_chroot_enable; then
X		safe_remove ${_dhcpd_conffile} ${_dhcpd_includedir} \
X			${_dhcpd_etcdir}
X		if checkyesno dhcpd_devfs_enable; then
X			safe_umount ${_dhcpd_devdir}
X			safe_rmdir ${_dhcpd_devdir}/_ # XXX /_ hack!
X		elif checkyesno dhcpd_jail_enable; then
X			if ! mounted ${_dhcpd_devdir}; then
X				safe_remove ${_dhcpd_devdir}
X			fi
X		else
X			safe_remove ${_dhcpd_devdir}
X		fi
X		safe_rmdir ${_dhcpd_confdir} ${_dhcpd_rootdir} # XXX /_ hack!
X	fi
X}
X
Xdhcpd_check ()
X{
X	check_chuser
X	check_jail
X	check_chroot
X}
X
Xdhcpd_rcvar ()
X{
X	rcvar_chuser
X	rcvar_jail
X	rcvar_chroot
X	rcvar_pidnleases
X	rcvar_rooted
X}
X
Xdhcpd_precmd ()
X{
X	setup_compat
X	setup_umask
X	setup_chroot
X	setup_chuser
X	setup_leases
X	setup_flags
X}
X
Xdhcpd_postcmd ()
X{
X	cleanup_chroot
X}
X
Xdhcpd_install ()
X{
X	if checkyesno paranoia; then
X		safe_useradd "${dhcpd_withuser}" "${dhcpd_withgroup}" \
X			     "DHCP Daemon"
X	fi
X}
X
X_dhcpd_uninstall ()	# user group root
X{
X	local _user _group _root
X
X	_user=$1 _group=$2 _root=$3
X
X	if [ -n "${_user}" -o -n "${_group}" ]; then
X		dhcpd_chuser_enable=YES
X		dhcpd_withuser=${_user}
X		dhcpd_withgroup=${_group}
X	else
X		dhcpd_chuser_enable=NO
X	fi
X	if [ -n "${_root}" ]; then
X		dhcpd_chroot_enable=YES
X		dhcpd_rootdir=${_root}
X	else
X		dhcpd_chroot_enable=NO
X	fi
X	dhcpd_check
X	dhcpd_rcvar
X	dhcpd_uninstall
X}
X
Xdhcpd_uninstall ()
X{
X	if checkyesno __dhcpd_uninstall; then
X		dhcpd_stop
X		remove_pid
X		remove_leases
X		remove_chuser
X		remove_chroot
X	else
X		local _user _group _root
X
X		__dhcpd_uninstall=YES
X
X		_user=${dhcpd_withuser}
X		_group=${dhcpd_withgroup}
X		_root=${dhcpd_rootdir}
X
X		_dhcpd_uninstall "" "" ""
X
X		if checkyesno paranoia; then
X			if [ -n "${_user}" -o -n "${_group}" ]; then
X				_dhcpd_uninstall "${_user}" "${_group}" ""
X			fi
X			if [ -n "${_root}" ]; then
X				_dhcpd_uninstall "" "" "${_root}"
X			fi
X			if [ -n "${_user}" -o -n "${_group}" ] &&
X			   [ -n "${_root}" ]; then
X				_dhcpd_uninstall "${_user}" "${_group}" "${_root}"
X			fi
X		fi
X	fi
X}
X
Xrcvar=${name}_enable
Xload_rc_config ${name}
X
X__dhcpd_uninstall="NO"			# internal use only
X__dhcpd_devdir=/dev			# devices directory
X__dhcpd_etcdir=/etc			# etc directory
X__dhcpd_piddir=/var/run			# pid file directory
X__dhcpd_leasesdir=/var/db		# leases file directory
X#__dhcpd_rootdir=/var/db/${name}	# root directory
X
Xdhcpd_check
Xdhcpd_rcvar
X
Xcommand=%%PREFIX%%/sbin/${name}
Xpidfile=${_dhcpd_pidfile}
Xrequired_files=${dhcpd_conf}
Xstart_precmd=${name}_precmd
Xstop_postcmd=${name}_postcmd
Xinstall_cmd=dhcpd_install
Xuninstall_cmd=dhcpd_uninstall
Xextra_commands="install uninstall"
X
X# Override /etc/rc.subr JID determiniation, because it doesn't
X# work when we launch dhcpd in a jail.
Xif checkyesno dhcpd_jail_enable ; then
X	read pid junk < $pidfile 2>/dev/null
X	[ -n "$pid" ] && JID=`ps -o jid= -p $pid`
Xfi
X
Xrun_rc_command "$1"
END-of-isc-dhcp31-server/files/isc-dhcpd.in
echo x - isc-dhcp31-server/files/isc-dhcrelay.in
sed 's/^X//' >isc-dhcp31-server/files/isc-dhcrelay.in << 'END-of-isc-dhcp31-server/files/isc-dhcrelay.in'
X#! /bin/sh
X#
X# $FreeBSD: ports/net/isc-dhcp3-server/files/isc-dhcrelay.in,v 1.1 2006/08/25 12:02:58 sem Exp $
X#
X# PROVIDE: dhcrelay
X# REQUIRE: DAEMON
X#
X# Add the following line to /etc/rc.conf to enable dhcrelay:
X#
X# dhcrelay_enable="YES"
X#
X
X# override these variables in /etc/rc.conf
Xdhcrelay_enable=${dhcrelay_enable:-"NO"}
Xdhcrelay_flags=${dhcrelay_flags:-}			# command option(s)
Xdhcrelay_servers=${dhcrelay_servers:-}			# dhcrelay server(s)
Xdhcrelay_ifaces=${dhcrelay_ifaces:-}			# ethernet interface(s)
X
Xdhcrelay_precmd ()
X{
X	local ifaces
X
X	dhcrelay_rcconf=%%PREFIX%%/etc/rc.isc-dhcrelay.conf
X
X	if [ -f ${dhcrelay_rcconf} ]; then
X		warn "${dhcrelay_rcconf} is obsolete, use /etc/rc.conf instead."
X		. ${dhcrelay_rcconf}
X
X		if [ -n "${dhcrelay_options}" -a -z "${rc_flags}" ]; then
X			warn "dhcrelay_options is obsolete, use dhcrelay_flags instead."
X			rc_flags=${dhcrelay_options}
X		fi
X	fi
X
X	if [ -z "${dhcrelay_servers}" ]; then
X		err 1 "no dhcrelay server(s) configured."
X	fi
X
X	ifaces=
X	for iface in ${dhcrelay_ifaces}; do
X		ifaces="${ifaces} -i ${iface}"
X	done
X
X	rc_flags="${rc_flags} ${ifaces} ${dhcrelay_servers}"
X}
X
X. %%RC_SUBR%%
X
Xname=dhcrelay
Xrcvar=${name}_enable
X
Xcommand=%%PREFIX%%/sbin/${name}
Xpidfile=/var/run/${name}.pid
Xstart_precmd=${name}_precmd
X
Xload_rc_config ${name}
Xrun_rc_command "$1"
END-of-isc-dhcp31-server/files/isc-dhcrelay.in
echo x - isc-dhcp31-server/files/omshell::Makefile.dist
sed 's/^X//' >isc-dhcp31-server/files/omshell::Makefile.dist << 'END-of-isc-dhcp31-server/files/omshell::Makefile.dist'
X# Makefile.dist
X#
X# Copyright (c) 1996-2002 Internet Software Consortium.
X# Use is subject to license terms which appear in the file named
X# ISC-LICENSE that should have accompanied this file when you
X# received it.   If a file named ISC-LICENSE did not accompany this
X# file, or you are not sure the one you have is correct, you may
X# obtain an applicable copy of the license at:
X#
X#             http://www.isc.org/isc-license-1.0.html. 
X#
X# This file is part of the ISC DHCP distribution.   The documentation
X# associated with this file is listed in the file DOCUMENTATION,
X# included in the top-level directory of this release.
X#
X# Support and other services are available for ISC products - see
X# http://www.isc.org for more information.
X#
X
XCATMANPAGES = omshell.cat1
XSEDMANPAGES = omshell.man1
XSRCS   = omshell.c
XOBJS   = omshell.o
XPROG   = omshell
XMAN    = omshell.1
X
XINCLUDES = -I$(TOP)/dhcpctl $(BINDINC) -I$(TOP)/includes
XCFLAGS = $(DEBUG) $(PREDEFINES) $(INCLUDES) $(COPTS)
XDHCPCTLLIBS = ../dhcpctl/libdhcpctl.a ../common/libdhcp.a $(BINDLIB) \
X		../omapip/libomapi.a ../dst/libdst.a
X
Xall:	$(PROG) $(CATMANPAGES)
X
X$(PROG):	$(OBJS) $(DHCPCTLLIBS)
X	$(CC) $(DEBUG) $(LFLAGS) -o $(PROG) $(OBJS) $(DHCPCTLLIBS) $(LIBS)
X
Xinstall: all $(CATMANPAGES)
X	for dir in $(USRMANDIR) $(USERBINDIR); do \
X	  foo=""; \
X	  for bar in `echo $(DESTDIR)$${dir} |tr / ' '`; do \
X	    foo=$${foo}/$$bar; \
X	    if [ ! -d $$foo ]; then \
X	      mkdir $$foo; \
X	      chmod 755 $$foo; \
X	    fi; \
X	  done; \
X	done
X	$(INSTALL) omshell $(DESTDIR)$(USERBINDIR)
X	$(CHMOD) 755 $(DESTDIR)$(USERBINDIR)/omshell
X	$(MANINSTALL) $(MANFROM) omshell.$(MANCAT)1 $(MANTO) \
X				$(DESTDIR)$(USRMANDIR)/omshell$(USRMANEXT)
X
Xdepend:
X	$(MKDEP) $(INCLUDES) $(PREDEFINES) $(SRCS)
X
Xclean:
X	-rm -f $(OBJS)
X
Xrealclean: clean
X	-rm -f $(PROG) *~ $(CATMANPAGES) $(SEDMANPAGES) #*
X
Xdistclean: realclean
X	-rm -f Makefile
X
Xlinks:
X	@for foo in $(SRCS) $(MAN); do \
X	  if [ ! -b $$foo ]; then \
X	    rm -f $$foo; \
X	  fi; \
X	  ln -s $(TOP)/omshell/$$foo $$foo; \
X	done
X
Xomshell.cat1:	omshell.man1
X	nroff -man omshell.man1 >omshell.cat1
X
Xomshell.man1:	omshell.1
X	sed -e "s#ETCDIR#$(ETC)#g" -e "s#DBDIR#$(VARDB)#g" \
X		-e "s#RUNDIR#$(VARRUN)#g" < omshell.1 >omshell.man1
X
X# Dependencies (semi-automatically-generated)
END-of-isc-dhcp31-server/files/omshell::Makefile.dist
echo x - isc-dhcp31-server/files/patch-Makefile
sed 's/^X//' >isc-dhcp31-server/files/patch-Makefile << 'END-of-isc-dhcp31-server/files/patch-Makefile'
X--- Makefile.orig	Fri Nov  8 00:10:07 2002
X+++ Makefile	Mon Apr 28 15:04:50 2003
X@@ -38,59 +38,59 @@
X # ``http://www.nominum.com''.
X #
X 
X-all:
X+all all.devel all.server all.relay all.client:
X 	@sysname=`./configure --print-sysname`; \
X 	 if [ ! -d work.$$sysname ]; then \
X 	   echo No build directory for $$sysname - please run ./configure.; \
X 	else \
X-	   (cd work.$$sysname; make all); \
X+	   (cd work.$$sysname; make $@); \
X 	fi
X 
X-install:
X+install install.devel install.server install.relay install.client:
X 	@sysname=`./configure --print-sysname`; \
X 	 if [ ! -d work.$$sysname ]; then \
X 	   echo No build directory for $$sysname - please run ./configure.; \
X 	else \
X-	   (cd work.$$sysname; make install); \
X+	   (cd work.$$sysname; make $@); \
X 	fi
X 
X-depend:
X+depend depend.devel depend.server depend.relay depend.client:
X 	@sysname=`./configure --print-sysname`; \
X 	 if [ ! -d work.$$sysname ]; then \
X 	   echo No build directory for $$sysname - please run ./configure.; \
X 	else \
X-	   (cd work.$$sysname; make depend); \
X+	   (cd work.$$sysname; make $@); \
X 	fi
X 
X-clean:
X+clean clean.devel clean.server clean.relay clean.client:
X 	@sysname=`./configure --print-sysname`; \
X 	 if [ ! -d work.$$sysname ]; then \
X 	   echo No build directory for $$sysname - please run ./configure.; \
X 	else \
X-	   (cd work.$$sysname; make clean); \
X+	   (cd work.$$sysname; make $@); \
X 	fi
X 
X-realclean:
X+realclean realclean.devel realclean.server realclean.relay realclean.client:
X 	@sysname=`./configure --print-sysname`; \
X 	 if [ ! -d work.$$sysname ]; then \
X 	   echo No build directory for $$sysname - please run ./configure.; \
X 	else \
X-	   (cd work.$$sysname; make realclean); \
X+	   (cd work.$$sysname; make $@); \
X 	fi
X 
X-distclean:
X+distclean distclean.devel distclean.server distclean.relay distclean.client:
X 	@sysname=`./configure --print-sysname`; \
X 	 if [ ! -d work.$$sysname ]; then \
X 	   echo No build directory for $$sysname - please run ./configure.; \
X 	else \
X-	   (cd work.$$sysname; make distclean); \
X+	   (cd work.$$sysname; make $@); \
X 	fi
X 
X-links:
X+links links.devel links.server links.relay links.client:
X 	@sysname=`./configure --print-sysname`; \
X 	 if [ ! -d work.$$sysname ]; then \
X 	   echo No build directory for $$sysname - please run ./configure.; \
X 	else \
X-	   (cd work.$$sysname; make links); \
X+	   (cd work.$$sysname; make $@); \
X 	fi
X 
END-of-isc-dhcp31-server/files/patch-Makefile
echo x - isc-dhcp31-server/files/patch-Makefile.dist
sed 's/^X//' >isc-dhcp31-server/files/patch-Makefile.dist << 'END-of-isc-dhcp31-server/files/patch-Makefile.dist'
X--- Makefile.dist.orig	Fri Nov  8 00:10:08 2002
X+++ Makefile.dist	Tue Apr 29 00:07:43 2003
X@@ -17,47 +17,200 @@
X # http://www.isc.org for more information.
X #
X 
X-SUBDIRS=	common $(MINIRES) dst omapip server client relay dhcpctl
X+COMMON_SUBDIRS=	common
X+DEVEL_SUBDIRS=	$(MINIRES) dst omapip dhcpctl
X+SERVER_SUBDIRS=	omshell server
X+RELAY_SUBDIRS=	relay
X+CLIENT_SUBDIRS=	client
X+
X+DEVEL_BUILD_SUBDIRS=	${COMMON_SUBDIRS} ${DEVEL_SUBDIRS}
X+SERVER_BUILD_SUBDIRS=	${SERVER_SUBDIRS}
X+RELAY_BUILD_SUBDIRS=	${RELAY_SUBDIRS}
X+CLIENT_BUILD_SUBDIRS=	${CLIENT_SUBDIRS}
X+
X+DEVEL_INSTALL_SUBDIRS=	${COMMON_SUBDIRS} ${DEVEL_SUBDIRS}
X+SERVER_INSTALL_SUBDIRS=	${COMMON_SUBDIRS} ${SERVER_SUBDIRS}
X+RELAY_INSTALL_SUBDIRS=	${RELAY_SUBDIRS}
X+CLIENT_INSTALL_SUBDIRS=	${COMMON_SUBDIRS} ${CLIENT_SUBDIRS}
X 
X-all:
X-	@for dir in ${SUBDIRS}; do \
X+all: all.server all.relay all.client
X+
X+all.devel:
X+	@for dir in ${DEVEL_BUILD_SUBDIRS}; do \
X+		echo "Making all in $$dir"; \
X+		(cd $$dir; $(MAKE) all) || exit 1; \
X+	done
X+
X+all.server: all.devel
X+	@for dir in ${SERVER_BUILD_SUBDIRS}; do \
X+		echo "Making all in $$dir"; \
X+		(cd $$dir; $(MAKE) all) || exit 1; \
X+	done
X+
X+all.relay: all.devel
X+	@for dir in ${RELAY_BUILD_SUBDIRS}; do \
X+		echo "Making all in $$dir"; \
X+		(cd $$dir; $(MAKE) all) || exit 1; \
X+	done
X+
X+all.client: all.devel
X+	@for dir in ${CLIENT_BUILD_SUBDIRS}; do \
X 		echo "Making all in $$dir"; \
X 		(cd $$dir; $(MAKE) all) || exit 1; \
X-	 done
X+	done
X+
X+install: install.devel install.server install.relay install.client
X+
X+install.devel:
X+	@for dir in ${DEVEL_INSTALL_SUBDIRS}; do \
X+		echo "Installing in $$dir"; \
X+		(cd $$dir; $(MAKE) install) || exit 1; \
X+	done
X 
X-install:
X-	@for dir in ${SUBDIRS}; do \
X+install.server:
X+	@for dir in ${SERVER_INSTALL_SUBDIRS}; do \
X 		echo "Installing in $$dir"; \
X 		(cd $$dir; $(MAKE) install) || exit 1; \
X-	 done
X+	done
X 
X-depend:
X-	@for dir in ${SUBDIRS}; do \
X+install.relay:
X+	@for dir in ${RELAY_INSTALL_SUBDIRS}; do \
X+		echo "Installing in $$dir"; \
X+		(cd $$dir; $(MAKE) install) || exit 1; \
X+	done
X+
X+install.client:
X+	@for dir in ${CLIENT_INSTALL_SUBDIRS}; do \
X+		echo "Installing in $$dir"; \
X+		(cd $$dir; $(MAKE) install) || exit 1; \
X+	done
X+
X+depend: depend.server depend.relay depend.client
X+
X+depend.devel:
X+	@for dir in ${DEVEL_BUILD_SUBDIRS}; do \
X+		echo "Making dependencies in $$dir"; \
X+		(cd $$dir; $(MAKE) depend) || exit 1; \
X+	done
X+
X+depend.server: depend.devel
X+	@for dir in ${SERVER_BUILD_SUBDIRS}; do \
X+		echo "Making dependencies in $$dir"; \
X+		(cd $$dir; $(MAKE) depend) || exit 1; \
X+	done
X+
X+depend.relay: depend.devel
X+	@for dir in ${RELAY_BUILD_SUBDIRS}; do \
X 		echo "Making dependencies in $$dir"; \
X 		(cd $$dir; $(MAKE) depend) || exit 1; \
X-	 done
X+	done
X+
X+depend.client: depend.devel
X+	@for dir in ${CLIENT_BUILD_SUBDIRS}; do \
X+		echo "Making dependencies in $$dir"; \
X+		(cd $$dir; $(MAKE) depend) || exit 1; \
X+	done
X+
X+clean: clean.server clean.relay clean.client
X+
X+clean.devel:
X+	@for dir in ${DEVEL_BUILD_SUBDIRS}; do \
X+		echo "Cleaning in $$dir"; \
X+		(cd $$dir; $(MAKE) clean) || exit 1; \
X+	done
X+
X+clean.server: clean.devel
X+	@for dir in ${SERVER_BUILD_SUBDIRS}; do \
X+		echo "Cleaning in $$dir"; \
X+		(cd $$dir; $(MAKE) clean) || exit 1; \
X+	done
X+
X+clean.relay: clean.devel
X+	@for dir in ${RELAY_BUILD_SUBDIRS}; do \
X+		echo "Cleaning in $$dir"; \
X+		(cd $$dir; $(MAKE) clean) || exit 1; \
X+	done
X 
X-clean:
X-	@for dir in ${SUBDIRS}; do \
X+clean.client: clean.devel
X+	@for dir in ${CLIENT_BUILD_SUBDIRS}; do \
X 		echo "Cleaning in $$dir"; \
X 		(cd $$dir; $(MAKE) clean) || exit 1; \
X-	 done
X+	done
X+
X+realclean: realclean.server realclean.relay realclean.client
X+
X+realclean.devel:
X+	@for dir in ${DEVEL_BUILD_SUBDIRS}; do \
X+		echo "Really cleaning in $$dir"; \
X+		(cd $$dir; $(MAKE) realclean) || exit 1; \
X+	done
X 
X-realclean:
X-	@for dir in ${SUBDIRS}; do \
X+realclean.server: realclean.devel
X+	@for dir in ${SERVER_BUILD_SUBDIRS}; do \
X 		echo "Really cleaning in $$dir"; \
X 		(cd $$dir; $(MAKE) realclean) || exit 1; \
X-	 done
X+	done
X 
X-distclean:
X-	@for dir in ${SUBDIRS}; do \
X+realclean.relay: realclean.devel
X+	@for dir in ${RELAY_BUILD_SUBDIRS}; do \
X+		echo "Really cleaning in $$dir"; \
X+		(cd $$dir; $(MAKE) realclean) || exit 1; \
X+	done
X+
X+realclean.client: realclean.devel
X+	@for dir in ${CLIENT_BUILD_SUBDIRS}; do \
X+		echo "Really cleaning in $$dir"; \
X+		(cd $$dir; $(MAKE) realclean) || exit 1; \
X+	done
X+
X+distclean: distclean.server distclean.relay distclean.client
X+
X+distclean.devel:
X+	@for dir in ${DEVEL_BUILD_SUBDIRS}; do \
X 		echo "Really, really cleaning in $$dir"; \
X 		(cd $$dir; $(MAKE) distclean) || exit 1; \
X-	 done
X-	@rm -f Makefile
X+	done
X+
X+distclean.server: distclean.devel
X+	@for dir in ${SERVER_BUILD_SUBDIRS}; do \
X+		echo "Really, really cleaning in $$dir"; \
X+		(cd $$dir; $(MAKE) distclean) || exit 1; \
X+	done
X+
X+distclean.relay: distclean.devel
X+	@for dir in ${RELAY_BUILD_SUBDIRS}; do \
X+		echo "Really, really cleaning in $$dir"; \
X+		(cd $$dir; $(MAKE) distclean) || exit 1; \
X+	done
X+
X+distclean.client: distclean.devel
X+	@for dir in ${CLIENT_BUILD_SUBDIRS}; do \
X+		echo "Really, really cleaning in $$dir"; \
X+		(cd $$dir; $(MAKE) distclean) || exit 1; \
X+	done
X+
X+links: links.server links.relay links.client
X+
X+links.devel:
X+	@for dir in ${DEVEL_BUILD_SUBDIRS}; do \
X+		echo "Making links in $$dir"; \
X+		(cd $$dir; $(MAKE) links) || exit 1; \
X+	done
X+
X+links.server: links.devel
X+	@for dir in ${SERVER_BUILD_SUBDIRS}; do \
X+		echo "Making links in $$dir"; \
X+		(cd $$dir; $(MAKE) links) || exit 1; \
X+	done
X+
X+links.relay: links.devel
X+	@for dir in ${RELAY_BUILD_SUBDIRS}; do \
X+		echo "Making links in $$dir"; \
X+		(cd $$dir; $(MAKE) links) || exit 1; \
X+	done
X 
X-links:
X-	@for dir in ${SUBDIRS}; do \
X+links.client: links.devel
X+	@for dir in ${CLIENT_BUILD_SUBDIRS}; do \
X 		echo "Making links in $$dir"; \
X 		(cd $$dir; $(MAKE) links) || exit 1; \
X-	 done
X+	done
END-of-isc-dhcp31-server/files/patch-Makefile.dist
echo x - isc-dhcp31-server/files/patch-client::clparse.c
sed 's/^X//' >isc-dhcp31-server/files/patch-client::clparse.c << 'END-of-isc-dhcp31-server/files/patch-client::clparse.c'
X--- client/clparse.c.orig	Sat May  6 17:42:49 2006
X+++ client/clparse.c	Sat May  6 17:43:12 2006
X@@ -777,7 +777,7 @@
X 			interface_dereference(&ip, MDL);
X 			return 0;
X 		}
X-		strcpy(ip->name, name);
X+		strlcpy (ip -> name, name, IFNAMSIZ);
X 
X 		if (dummy_interfaces) {
X 			interface_reference (&ip -> next,
END-of-isc-dhcp31-server/files/patch-client::clparse.c
echo x - isc-dhcp31-server/files/patch-client::dhclient.8
sed 's/^X//' >isc-dhcp31-server/files/patch-client::dhclient.8 << 'END-of-isc-dhcp31-server/files/patch-client::dhclient.8'
X--- client/dhclient.8.orig	Wed Sep 14 18:03:33 2005
X+++ client/dhclient.8	Sat May  6 17:30:28 2006
X@@ -23,6 +23,10 @@
X .\"
X .\" $Id: dhclient.8,v 1.12.2.11 2005/09/14 16:03:33 dhankins Exp $
X .\"
X+.\" Portions copyright (c) 2000 David E. O'Brien.
X+.\" All rights reserved.
X+.\" $FreeBSD: ports/net/isc-dhcp3-server/files/patch-client::dhclient.8,v 1.5 2006/05/07 20:34:01 sem Exp $
X+.\"
X .TH dhclient 8
X .SH NAME
X dhclient - Dynamic Host Configuration Protocol Client
X@@ -33,6 +37,9 @@
X .I port
X ]
X [
X+.B -D
X+]
X+[
X .B -d
X ]
X [
X@@ -43,6 +50,9 @@
X .B -q
X ]
X [
X+.B -v
X+]
X+[
X .B -1
X ]
X [
X@@ -73,6 +83,10 @@
X relay
X ]
X [
X+.B -i
X+interval
X+]
X+[
X .B -n
X ]
X [
X@@ -157,6 +171,15 @@
X configuration file or on the command line, and will ignore all other
X interfaces.
X .PP
X+The
X+.B -D
X+flag causes
X+.B dhclient
X+to save the script it creates for use in conjunction with
X+.B dhclient-script
X+in
X+.IR /tmp.
X+.PP
X If the DHCP client should listen and transmit on a port other than the
X standard (port 68), the
X .B -p
X@@ -180,6 +203,12 @@
X flag, followed by the IP address to send.   This is only useful for testing,
X and should not be expected to work in any consistent or useful way.
X .PP
X+On FreeBSD, dhclient can be enabled to automatically handle the
X+link status of the network card. Normally polling is done every
X+five seconds. The polling interval can be set using the
X+.B -i
X+flag, followed by the numbers of seconds. Minimum is one second.
X+.PP
X The DHCP client will normally run in the foreground until it has
X configured an interface, and then will revert to running in the
X background.   To run force dhclient to always run as a foreground
X@@ -206,6 +235,10 @@
X .B -q
X flag prevents any messages other than errors from being printed to the
X standard error descriptor.
X+.B -v
X+flag turns on all messages.
X+Opposite of
X+.B -q .
X .PP
X The client normally doesn't release the current lease as it is not
X required by the DHCP protocol.  Some cable ISPs require their clients
END-of-isc-dhcp31-server/files/patch-client::dhclient.8
echo x - isc-dhcp31-server/files/patch-client::dhclient.c
sed 's/^X//' >isc-dhcp31-server/files/patch-client::dhclient.c << 'END-of-isc-dhcp31-server/files/patch-client::dhclient.c'
X--- client/dhclient.c.orig	Tue May 22 22:37:04 2007
X+++ client/dhclient.c	Tue Oct  2 15:41:02 2007
X@@ -38,6 +38,13 @@
X #include "dhcpd.h"
X #include "version.h"
X 
X+#if __FreeBSD_version > 502010
X+#include <sys/ioctl.h>
X+#include <net/if_media.h>
X+#include <net80211/ieee80211_ioctl.h>
X+#include <net80211/ieee80211.h>
X+#endif
X+
X TIME default_lease_time = 43200; /* 12 hours... */
X TIME max_lease_time = 86400; /* 24 hours... */
X 
X@@ -72,8 +79,11 @@
X struct string_list *client_env=NULL;
X int client_env_count=0;
X int onetry=0;
X-int quiet=0;
X+int quiet=1;
X int nowait=0;
X+#ifdef ENABLE_POLLING_MODE
X+int polling_interval = 5;
X+#endif
X 
X static void usage PROTO ((void));
X 
X@@ -181,6 +191,9 @@
X 		} else if (!strcmp (argv [i], "-q")) {
X 			quiet = 1;
X 			quiet_interface_discovery = 1;
X+		} else if (!strcmp (argv [i], "-v")) {
X+			quiet = 0;
X+			quiet_interface_discovery = 0;
X 		} else if (!strcmp (argv [i], "-s")) {
X 			if (++i == argc)
X 				usage ();
X@@ -194,6 +207,19 @@
X 		} else if (!strcmp (argv [i], "-n")) {
X 			/* do not start up any interfaces */
X 			interfaces_requested = 1;
X+#ifdef ENABLE_POLLING_MODE
X+		} else if (!strcmp (argv [i], "-i")) {
X+			if (++i == argc)
X+				usage ();
X+			polling_interval = (int)strtol (argv [i],
X+			    (char **)NULL, 10);
X+			if (polling_interval <= 0) {
X+				log_info ("Incorrect polling interval %d",
X+				    polling_interval);
X+				log_info ("Using a default of 5 seconds");
X+				polling_interval = 5;
X+			}
X+#endif
X 		} else if (!strcmp (argv [i], "-w")) {
X 			/* do not exit if there are no broadcast interfaces. */
X 			persist = 1;
X@@ -222,7 +248,16 @@
X 		    if (strlen(argv[i]) >= sizeof(tmp->name))
X 			    log_fatal("%s: interface name too long (is %ld)",
X 				       argv [i], (long)strlen(argv[i]));
X-		    strcpy(tmp->name, argv[i]);
X+		    strlcpy (tmp -> name, argv [i], IFNAMSIZ);
X+#if __FreeBSD_version > 502010
X+		    set_ieee80211 (tmp);
X+#endif
X+		    /* Init some interface vars, enable polling */
X+#ifdef ENABLE_POLLING_MODE
X+		    tmp -> forcediscover = 0;
X+		    tmp -> linkstate = HAVELINK;
X+		    tmp -> polling = 1;
X+#endif /* ifdef ENABLE_POLLING_MODE */
X 		    if (interfaces) {
X 			    interface_reference (&tmp -> next,
X 						 interfaces, MDL);
X@@ -382,6 +417,16 @@
X 					     INTERFACE_AUTOMATIC)) !=
X 			     INTERFACE_REQUESTED))
X 				continue;
X+#if __FreeBSD_version > 502010
X+			set_ieee80211 (ip);
X+#endif
X+#ifdef ENABLE_POLLING_MODE
X+			ip -> forcediscover = 0;
X+			if (ip -> client -> config -> media != NULL)
X+				ip -> havemedia = 1;
X+			else
X+				ip -> havemedia = 0;
X+#endif
X 			script_init (ip -> client,
X 				     "PREINIT", (struct string_list *)0);
X 			if (ip -> client -> alias)
X@@ -426,8 +471,13 @@
X 				client -> state = S_INIT;
X 				/* Set up a timeout to start the initialization
X 				   process. */
X+#ifdef ENABLE_POLLING_MODE
X+				add_timeout (cur_time + random () % 5 + 2,
X+					     state_polling, client, 0, 0);
X+#else
X 				add_timeout (cur_time + random () % 5,
X 					     state_reboot, client, 0, 0);
X+#endif
X 			}
X 		}
X 	}
X@@ -485,8 +535,8 @@
X 	log_info (arr);
X 	log_info (url);
X 
X-	log_error ("Usage: dhclient [-1dqrx] [-nw] [-p <port>] %s",
X-		   "[-s server]");
X+	log_error ("Usage: dhclient [-1Ddqrxv] [-i polling-interval] %s",
X+		   "[-nw] [-p <port>] [-s server]");
X 	log_error ("                [-cf config-file] [-lf lease-file]%s",
X 		   "[-pf pid-file] [-e VAR=val]");
X 	log_fatal ("                [-sf script-file] [interface]");
X@@ -888,6 +938,15 @@
X 	/* Write out the new lease. */
X 	write_client_lease (client, client -> new, 0, 0);
X 
X+	/*
X+	 * It's now possible that state_reboot can be called
X+	 * after a interface link went down and is up again.
X+	 * To prevent tons of equal leases saved on disk, we rewrite
X+	 * them.
X+	 */
X+	read_client_leases ();
X+	rewrite_client_leases ();
X+ 
X 	/* Replace the old active lease with the new one. */
X 	if (client -> active)
X 		destroy_client_lease (client -> active);
X@@ -902,6 +961,12 @@
X 	      piaddr (client -> active -> address),
X 	      (long)(client -> active -> renewal - cur_time));
X 	client -> state = S_BOUND;
X+#ifdef ENABLE_POLLING_MODE
X+	/* Init some interface vars, enable polling */
X+	client -> interface -> linkstate = HAVELINK;
X+	client -> interface -> forcediscover = 0;
X+	client -> interface -> polling = 1;
X+#endif /* ifdef ENABLE_POLLING_MODE */
X 	reinitialize_interfaces ();
X 	go_daemon ();
X 	if (client -> config -> do_forward_update) {
X@@ -1424,6 +1489,11 @@
X 	int interval;
X 	int increase = 1;
X 
X+#ifdef ENABLE_POLLING_MODE
X+	/* Disable polling for this interface */
X+	client -> interface -> polling = 0;
X+#endif
X+
X 	/* Figure out how long it's been since we started transmitting. */
X 	interval = cur_time - client -> first_sending;
X 
X@@ -1524,6 +1594,9 @@
X 	struct client_lease *loop;
X 	struct client_lease *lp;
X 
X+	if (client -> interface -> linkstate == NOLINK)
X+		return;
X+
X 	loop = lp = client -> active;
X 
X 	log_info ("No DHCPOFFERS received.");
X@@ -1556,6 +1629,10 @@
X 				log_info ("bound: renewal in %ld %s.",
X 					  (long)(client -> active -> renewal -
X 						 cur_time), "seconds");
X+#ifdef ENABLE_POLLING_MODE
X+				/* Enable polling for this interface */
X+				client -> interface -> polling = 1;
X+#endif
X 				add_timeout (client -> active -> renewal,
X 					     state_bound, client, 0, 0);
X 			    } else {
X@@ -1563,6 +1640,11 @@
X 				log_info ("bound: immediate renewal.");
X 				state_bound (client);
X 			    }
X+			    /*
X+			     * Set the link status back to nolink, even
X+			     * if we have media settings.
X+			     */
X+                            client -> interface -> linkstate = NOLINK;
X 			    reinitialize_interfaces ();
X 			    go_daemon ();
X 			    return;
X@@ -1608,6 +1690,12 @@
X 	}
X 
X 	log_info ("No working leases in persistent database - sleeping.");
X+
X+#ifdef ENABLE_POLLING_MODE
X+	/* Enable polling for this interface */
X+	client -> interface -> polling = 1;
X+#endif
X+
X 	script_init (client, "FAIL", (struct string_list *)0);
X 	if (client -> alias)
X 		script_write_params (client, "alias_", client -> alias);
X@@ -1749,6 +1837,18 @@
X 			client -> packet.secs = htons (65535);
X 	}
X 
X+	/*
X+	 * Only try the first ten seconds to renew a lease from a
X+	 * given dhcp-server adress. After that, fall back to use
X+	 * state_reboot with INADDR_BROADCAST.
X+	 */
X+	if (destination.sin_addr.s_addr != INADDR_BROADCAST &&
X+	   (client -> state == S_RENEWING || client -> state == S_REBINDING)) {
X+		if (client -> active && client -> active -> expiry > cur_time &&
X+			interval >= 10)
X+			goto cancel;
X+	}
X+
X 	log_info ("DHCPREQUEST on %s to %s port %d",
X 	      client -> name ? client -> name : client -> interface -> name,
X 	      inet_ntoa (destination.sin_addr),
X@@ -1770,6 +1870,16 @@
X 				      from, &destination,
X 				      (struct hardware *)0);
X 
X+	/*
X+	 * If sendto() for a direct request fails, fall back to use
X+	 * state_reboot with INADDR_BROADCAST.
X+	 */
X+	if (result == -1 && destination.sin_addr.s_addr != INADDR_BROADCAST &&
X+	   (client -> state == S_RENEWING || client -> state == S_REBINDING)) {
X+		if (client -> active && client -> active -> expiry > cur_time)
X+			goto cancel;
X+	}
X+
X 	add_timeout (cur_time + client -> interval,
X 		     send_request, client, 0, 0);
X }
X@@ -2656,6 +2766,13 @@
X 			wstatus = 0;
X 		}
X 	} else {
X+               if ((i = open(_PATH_DEVNULL, O_RDWR)) != -1) {
X+                       dup2(i, STDIN_FILENO);
X+                       dup2(i, STDOUT_FILENO);
X+                       dup2(i, STDERR_FILENO);
X+                       if (i > STDERR_FILENO)
X+                               close(i);
X+               }
X 		/* We don't want to pass an open file descriptor for
X 		 * dhclient.leases when executing dhclient-script.
X 		 */
X@@ -2842,8 +2959,10 @@
X 			      case S_STOPPED:
X 				break;
X 			}
X+#ifndef ENABLE_POLLING_MODE
X 			client -> state = S_INIT;
X 			state_reboot (client);
X+#endif
X 		}
X 	}
X }
X@@ -3071,7 +3190,9 @@
X 		    break;
X 
X 		  case server_awaken:
X+#ifndef ENABLE_POLLING_MODE
X 		    state_reboot (client);
X+#endif
X 		    break;
X 		}
X 	    }
X@@ -3209,3 +3330,265 @@
X 	data_string_forget (&ddns_dhcid, MDL);
X 	return rcode;
X }
X+ 
X+/* Check to see if there's a wire plugged in */
X+int
X+interface_active(struct interface_info *ip) {
X+#if __FreeBSD_version > 502010
X+	struct ifmediareq ifmr;
X+	int *media_list, i;
X+	char *ifname;
X+	int sock;
X+ 
X+	ifname = ip -> name;
X+ 
X+	if ((sock = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
X+		log_fatal ("Can't create interface_active socket");
X+ 
X+	(void) memset (&ifmr, 0, sizeof (ifmr));
X+	(void) strncpy (ifmr.ifm_name, ifname, sizeof (ifmr.ifm_name));
X+ 
X+	if (ioctl (sock, SIOCGIFMEDIA, (caddr_t)&ifmr) < 0) {
X+		/*
X+		 * Interface doesn't support SIOCGIFMEDIA, presume okay
X+		 */
X+		close (sock);
X+		return (HAVELINK);
X+	}
X+	close (sock);
X+ 
X+	if (ifmr.ifm_count == 0) {
X+		/*
X+		 * Assume that this means interface
X+		 * does not support SIOCGIFMEDIA
X+		 */
X+		log_fatal ("%s: no media types?", ifname);
X+		return (HAVELINK);
X+	}
X+ 
X+	if (ifmr.ifm_status & IFM_AVALID) {
X+		if (ip -> ieee80211) {
X+			/*
X+			 * Wavelan devices need to be checked if they are
X+			 * associated.
X+			 */
X+			if ((IFM_TYPE(ifmr.ifm_active) == IFM_IEEE80211) &&
X+			     (ifmr.ifm_status & IFM_ACTIVE)) {
X+				return (HAVELINK);
X+			}
X+		} else {
X+			if (ifmr.ifm_status & IFM_ACTIVE) {
X+				return (HAVELINK);
X+			}
X+		}
X+		/*
X+		 * We really have no link.
X+		 */
X+		return (NOLINK);
X+	}
X+	/*
X+	 * IFM_AVALID is not set. We cannot check
X+	 * the link state. Assume HAVELINK.
X+	 */
X+ 
X+#endif /* Other OSs */
X+	/*
X+	 * Always return a successful link if the OS
X+	 * is not supported.
X+	 */
X+	return (HAVELINK);
X+}
X+ 
X+#if __FreeBSD_version > 502010
X+void
X+set_ieee80211 (struct interface_info *ip) {
X+ 
X+	struct ieee80211req     ireq;
X+	u_int8_t                data[32];
X+	int                     associated = 0;
X+	int *media_list, i;
X+	char *ifname;
X+	int sock;
X+ 
X+	ifname = ip -> name;
X+ 
X+	if ((sock = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
X+		log_fatal ("Can't create interface_active socket");
X+ 
X+	(void) memset (&ireq, 0, sizeof (ireq));
X+	(void) strncpy (ireq.i_name, ifname, sizeof (ireq.i_name));
X+	ireq.i_data = &data;
X+	ireq.i_type = IEEE80211_IOC_SSID;
X+	ireq.i_val = -1;
X+	/*
X+	 * If we can't get the SSID,
X+	 * this isn't an 802.11 device.
X+	 */
X+	if (ioctl (sock, SIOCG80211, &ireq) < 0)
X+		ip -> ieee80211 = 0;
X+	else {
X+#ifdef DEBUG
X+		printf ("Device %s has 802.11\n", ifname);
X+#endif
X+		ip -> ieee80211 = 1;
X+	}
X+	close (sock);
X+ }
X+#endif /* __FreeBSD_version */
X+ 
X+#ifdef ENABLE_POLLING_MODE
X+/* Go to background after some time */
X+void state_background (cpp)
X+	void *cpp;
X+{
X+	go_daemon ();
X+}
X+
X+/* Check the state of the NICs if we have link */
X+void state_polling (cpp)
X+	 void *cpp;
X+{
X+	static int doinitcheck = 0;
X+	struct interface_info *ip;
X+	struct client_state *client;
X+	int result;
X+ 
X+	for (ip = interfaces; ip; ip = ip -> next) {
X+		if (! ip -> polling)
X+			continue;
X+#ifdef DEBUG
X+		printf ("%s: Polling interface state\n", ip -> name);
X+		for (client = ip -> client;
X+		     client; client = client -> next) {
X+			printf ("%s: client state of %d\n", ip -> name, ip -> client -> state);
X+			printf ("%s: link = %d\n", ip -> name, ip -> linkstate);
X+		}
X+#endif
X+ 
X+		result = interface_active (ip);
X+		/*
X+		 * If dhclient.conf contains media settings, we cannot
X+		 * abort if the interface is not set to active mode.
X+		 */
X+		if (ip -> havemedia && ip -> client -> state != S_BOUND) {
X+			if (result == HAVELINK)
X+				ip -> forcediscover = 1;
X+			result = HAVELINK;
X+		}
X+ 
X+		/*
X+		 * The last status of the interface tells us
X+		 * the we've got no link ...
X+		 */
X+		if (ip -> linkstate == NOLINK || ! doinitcheck) {
X+			/*
X+			 * ... but we have now link. Let's send
X+			 * requests.
X+			 */
X+			if (result == HAVELINK) {
X+#ifdef DEBUG
X+				if (ip -> havemedia)
X+					printf ("%s: Trying media settings on interface\n",
X+						ip -> name);
X+				else
X+					printf ("%s: Found Link on interface\n", ip -> name);
X+#endif
X+				/*
X+				 * Set the interface to state_bound. We assume that we have
X+				 * a working link. If we cannot reach the server directly,
X+				 * INADDR_BROADCAST is used.
X+				 */
X+				for (client = ip -> client;
X+				     client; client = client -> next) {
X+					cancel_timeout (state_init, client);
X+					cancel_timeout (state_reboot, client);
X+					cancel_timeout (state_selecting, client);
X+					if (client -> active) {
X+						add_timeout (cur_time + random () % 5,
X+						   state_bound, client, 0, 0);
X+					} else {
X+						add_timeout (cur_time + random () % 5,
X+						   state_reboot, client, 0, 0);
X+					}
X+				}
X+				ip -> linkstate = HAVELINK;
X+			} else {
X+#ifdef DEBUG
X+				printf ("%s: No link on interface\n", ip -> name);
X+#endif
X+				for (client = ip -> client;
X+				     client; client = client -> next) {
X+					/*
X+					 * Without this add_timout(), dhclient does
X+					 * not poll on a interface if there
X+					 * is no cable plugged in at startup
X+					 * time. Because we add one additional second
X+					 * to the time of a normal timeout, we always
X+					 * skip and block a running one. This prevents
X+					 * that polling is done twice at the same time.
X+					 */
X+					if (client -> state == S_INIT) {
X+						add_timeout (cur_time + (polling_interval + 1),
X+							     state_polling, client, 0, 0);
X+					}
X+				}
X+				ip -> linkstate = NOLINK;
X+				/*
X+				 * Automatically go into the background after
X+				 * some time. Do this only if there are no
X+				 * media options available for a interface.
X+				 */
X+				if (! ip -> havemedia && ! doinitcheck) {
X+					add_timeout (cur_time + (polling_interval * 2),
X+						    state_background, client, 0, 0);
X+				}
X+			}
X+		}
X+ 
X+		/*
X+		 * The last status of the interface tells us
X+		 * the we previously had link.
X+		 */
X+		if (ip -> linkstate == HAVELINK && doinitcheck) {
X+			if (result == NOLINK) {
X+				/*
X+				 * We lost link on the interface, or it isn't
X+				 * associated anymore.
X+				 */
X+#ifdef DEBUG
X+				printf ("%s: Lost Link on interface\n", ip -> name);
X+#endif
X+				/*
X+				 * After we lost link, cycle again through the
X+				 * different media settings if available. Else
X+				 * set NOLINK.
X+				 */
X+				if (ip -> havemedia)
X+					ip -> forcediscover = 1;
X+				else
X+					ip -> linkstate = NOLINK;
X+			}
X+			/*
X+			 * If we happen to have a real link, but no
X+			 * active lease, force the interface into
X+			 * state_reboot. Do the same if media settings
X+			 * are available.
X+			 */
X+			if (ip -> forcediscover) {
X+				for (client = ip -> client;
X+				     client; client = client -> next) {
X+					if (client -> state != S_REBOOTING &&
X+					    client -> state != S_SELECTING) {
X+						add_timeout (cur_time + random () % 5,
X+							    state_reboot, client, 0, 0);
X+					}
X+				}
X+				ip -> forcediscover = 0;
X+				ip -> linkstate = HAVELINK;
X+			}
X+			/* We still have link, do nothing. */
X+		}
X+	}
X+	doinitcheck = 1;
X+}
X+#endif /* ifdef ENABLE_POLLING_MODE */
END-of-isc-dhcp31-server/files/patch-client::dhclient.c
echo x - isc-dhcp31-server/files/patch-client::dhclient.conf
sed 's/^X//' >isc-dhcp31-server/files/patch-client::dhclient.conf << 'END-of-isc-dhcp31-server/files/patch-client::dhclient.conf'
X--- client/dhclient.conf.orig	Tue Jun  3 00:50:44 1997
X+++ client/dhclient.conf	Wed Mar  3 02:20:41 2004
X@@ -11,7 +11,7 @@
X reboot 10;
X select-timeout 5;
X initial-interval 2;
X-script "/etc/dhclient-script";
X+script "%%PREFIX%%/sbin/dhclient-script";
X media "-link0 -link1 -link2", "link0 link1";
X reject 192.33.137.209;
X 
END-of-isc-dhcp31-server/files/patch-client::dhclient.conf
echo x - isc-dhcp31-server/files/patch-common::dhcp-options.5
sed 's/^X//' >isc-dhcp31-server/files/patch-common::dhcp-options.5 << 'END-of-isc-dhcp31-server/files/patch-common::dhcp-options.5'
X--- common/dhcp-options.5.orig	Sun Feb 23 04:27:42 2003
X+++ common/dhcp-options.5	Wed Mar  3 02:12:13 2004
X@@ -431,7 +431,10 @@
X the domain-name option to specify the domain name).  See RFC 1035 for
X character set restrictions.  This option is only honored by
X .B dhclient-script(8)
X-if the hostname for the client machine is not set.
X+if the hostname for the client machine is not set (i.e., set to the empty
X+string in
X+.B rc.conf(5)
X+).
X .RE
X .PP
X .B option \fBieee802-3-encapsulation\fR \fIflag\fR\fB;\fR
X@@ -654,7 +657,7 @@
X This option specifies whether the client should configure its IP
X layer to allow forwarding of datagrams with non-local source routes
X (see Section 3.3.5 of [4] for a discussion of this topic).  A value
X-of false means disallow forwarding of such datagrams, and a value of true
X+of 0 means disallow forwarding of such datagrams, and a value of true
X means allow forwarding.
X .RE
X .PP
X@@ -948,7 +951,7 @@
X .PP
X This option specifies whether or not the client should negotiate the
X use of trailers (RFC 893 [14]) when using the ARP protocol.  A value
X-of false indicates that the client should not attempt to use trailers.  A
X+of 0 indicates that the client should not attempt to use trailers.  A
X value of true means that the client should attempt to use trailers.
X .RE
X .PP
END-of-isc-dhcp31-server/files/patch-common::dhcp-options.5
echo x - isc-dhcp31-server/files/patch-common::discover.c
sed 's/^X//' >isc-dhcp31-server/files/patch-common::discover.c << 'END-of-isc-dhcp31-server/files/patch-common::discover.c'
X--- common/discover.c.orig	Fri Jul 25 21:44:15 2003
X+++ common/discover.c	Fri Mar  5 23:33:04 2004
X@@ -47,6 +47,7 @@
X #endif /* not lint */
X 
X #include "dhcpd.h"
X+#include <ifaddrs.h>
X #include <sys/ioctl.h>
X 
X struct interface_info *interfaces, *dummy_interfaces, *fallback_interface;
X@@ -135,10 +136,7 @@
X {
X 	struct interface_info *tmp, *ip;
X 	struct interface_info *last, *next;
X-	char buf [2048];
X-	struct ifconf ic;
X-	struct ifreq ifr;
X-	int i;
X+	struct ifaddrs *ifap, *ifa;
X 	int sock;
X 	int address_count = 0;
X 	struct subnet *subnet;
X@@ -157,61 +155,6 @@
X 	if ((sock = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
X 		log_fatal ("Can't create addrlist socket");
X 
X-	/* Get the interface configuration information... */
X-
X-#ifdef SIOCGIFCONF_ZERO_PROBE
X-	/* linux will only tell us how long a buffer it wants if we give it
X-	 * a null buffer first. So, do a dry run to figure out the length.
X-	 * 
X-	 * XXX this code is duplicated from below because trying to fold
X-	 * the logic into the if statement and goto resulted in excesssive
X-	 * obfuscation. The intent is that unless you run Linux you shouldn't
X-	 * have to deal with this. */
X-
X-	ic.ifc_len = 0;
X-	ic.ifc_ifcu.ifcu_buf = (caddr_t)NULL;
X-#else
X-	/* otherwise, we just feed it a starting size, and it'll tell us if
X-	 * it needs more */
X-
X-	ic.ifc_len = sizeof buf;
X-	ic.ifc_ifcu.ifcu_buf = (caddr_t)buf;
X-#endif
X-
X-      gifconf_again:
X-	i = ioctl(sock, SIOCGIFCONF, &ic);
X-
X-	if (i < 0)
X-		log_fatal ("ioctl: SIOCGIFCONF: %m");
X-
X-#ifdef SIOCGIFCONF_ZERO_PROBE
X-	/* Workaround for SIOCGIFCONF bug on some Linux versions. */
X-	if (ic.ifc_ifcu.ifcu_buf == 0 && ic.ifc_len == 0) {
X-		ic.ifc_len = sizeof buf;
X-		ic.ifc_ifcu.ifcu_buf = (caddr_t)buf;
X-		goto gifconf_again;
X-	}
X-#endif
X-
X-	/* If the SIOCGIFCONF resulted in more data than would fit in
X-	   a buffer, allocate a bigger buffer. */
X-	if ((ic.ifc_ifcu.ifcu_buf == buf 
X-#ifdef SIOCGIFCONF_ZERO_PROBE
X-	     || ic.ifc_ifcu.ifcu_buf == 0
X-#endif
X-		) && ic.ifc_len > sizeof buf) {
X-		ic.ifc_ifcu.ifcu_buf = dmalloc ((size_t)ic.ifc_len, MDL);
X-		if (!ic.ifc_ifcu.ifcu_buf)
X-			log_fatal ("Can't allocate SIOCGIFCONF buffer.");
X-		goto gifconf_again;
X-#ifdef SIOCGIFCONF_ZERO_PROBE
X-	} else if (ic.ifc_ifcu.ifcu_buf == 0) {
X-		ic.ifc_ifcu.ifcu_buf = (caddr_t)buf;
X-		ic.ifc_len = sizeof buf;
X-		goto gifconf_again;
X-#endif
X-	}
X-
X 		
X 	/* If we already have a list of interfaces, and we're running as
X 	   a DHCP server, the interfaces were requested. */
X@@ -224,51 +167,38 @@
X 	else
X 		ir = INTERFACE_REQUESTED;
X 
X+	if (getifaddrs(&ifap) != 0)
X+		log_fatal ("getifaddrs failed");
X+
X 	/* Cycle through the list of interfaces looking for IP addresses. */
X-	for (i = 0; i < ic.ifc_len;) {
X-		struct ifreq *ifp = (struct ifreq *)((caddr_t)ic.ifc_req + i);
X-#ifdef HAVE_SA_LEN
X-		if (ifp -> ifr_addr.sa_len > sizeof (struct sockaddr))
X-			i += (sizeof ifp -> ifr_name) + ifp -> ifr_addr.sa_len;
X-		else
X-#endif
X-			i += sizeof *ifp;
X+	for (ifa = ifap; ifa != NULL; ifa = ifa->ifa_next) {
X 
X #ifdef ALIAS_NAMES_PERMUTED
X-		if ((s = strrchr (ifp -> ifr_name, ':'))) {
X+		if ((s = strrchr (ifa -> ifa_name, ':'))) {
X 			*s = 0;
X 		}
X #endif
X 
X #ifdef SKIP_DUMMY_INTERFACES
X-		if (!strncmp (ifp -> ifr_name, "dummy", 5))
X+		if (!strncmp (ifa -> ifa_name, "dummy", 5))
X 			continue;
X #endif
X 
X-
X-		/* See if this is the sort of interface we want to
X-		   deal with. */
X-		strcpy (ifr.ifr_name, ifp -> ifr_name);
X-		if (ioctl (sock, SIOCGIFFLAGS, &ifr) < 0)
X-			log_fatal ("Can't get interface flags for %s: %m",
X-			       ifr.ifr_name);
X-
X 		/* See if we've seen an interface that matches this one. */
X 		for (tmp = interfaces; tmp; tmp = tmp -> next)
X-			if (!strcmp (tmp -> name, ifp -> ifr_name))
X+			if (!strcmp (tmp -> name, ifa -> ifa_name))
X 				break;
X 
X-		/* Skip non broadcast interfaces (plus loopback and
X-		   point-to-point in case an OS incorrectly marks them
X-		   as broadcast). Also skip down interfaces unless we're
X+		/* See if this is the sort of interface we want to
X+		   deal with.  Skip loopback, point-to-point and down
X+		   interfaces, except don't skip down interfaces if we're
X 		   trying to get a list of configurable interfaces. */
X-		if (((!(ifr.ifr_flags & IFF_BROADCAST) ||
X-		      ifr.ifr_flags & IFF_LOOPBACK ||
X-		      ifr.ifr_flags & IFF_POINTOPOINT) && !tmp) ||
X-		    (!(ifr.ifr_flags & IFF_UP) &&
X+		if ((ifa->ifa_flags & IFF_LOOPBACK) ||
X+		     (ifa->ifa_flags & IFF_POINTOPOINT) ||
X+		     (!(ifa->ifa_flags & IFF_UP) &&
X 		     state != DISCOVER_UNCONFIGURED))
X 			continue;
X-		
X+
X 		/* If there isn't already an interface by this name,
X 		   allocate one. */
X 		if (!tmp) {
X@@ -276,9 +206,9 @@
X 			status = interface_allocate (&tmp, MDL);
X 			if (status != ISC_R_SUCCESS)
X 				log_fatal ("Error allocating interface %s: %s",
X-					   ifp -> ifr_name,
X+					   ifa -> ifa_name,
X 					   isc_result_totext (status));
X-			strcpy (tmp -> name, ifp -> ifr_name);
X+			strcpy (tmp -> name, ifa -> ifa_name);
X 			interface_snorf (tmp, ir);
X 			interface_dereference (&tmp, MDL);
X 			tmp = interfaces; /* XXX */
X@@ -290,9 +220,9 @@
X 		/* If we have the capability, extract link information
X 		   and record it in a linked list. */
X #ifdef HAVE_AF_LINK
X-		if (ifp -> ifr_addr.sa_family == AF_LINK) {
X+		if (ifa -> ifa_addr->sa_family == AF_LINK) {
X 			struct sockaddr_dl *foo = ((struct sockaddr_dl *)
X-						   (&ifp -> ifr_addr));
X+						   (ifa -> ifa_addr));
X #if defined (HAVE_SIN_LEN)
X 			tmp -> hw_address.hlen = foo -> sdl_alen;
X #else
X@@ -305,12 +235,11 @@
X 		} else
X #endif /* AF_LINK */
X 
X-		if (ifp -> ifr_addr.sa_family == AF_INET) {
X+		if (ifa -> ifa_addr->sa_family == AF_INET) {
X 			struct iaddr addr;
X 
X 			/* Get a pointer to the address... */
X-			memcpy (&foo, &ifp -> ifr_addr,
X-				sizeof ifp -> ifr_addr);
X+			bcopy(ifa->ifa_addr, &foo, sizeof(foo));
X 
X 			/* We don't want the loopback interface. */
X 			if (foo.sin_addr.s_addr == htonl (INADDR_LOOPBACK) &&
X@@ -323,16 +252,15 @@
X 			   found, keep a pointer to ifreq structure in
X 			   which we found it. */
X 			if (!tmp -> ifp) {
X-#ifdef HAVE_SA_LEN
X-				unsigned len = ((sizeof ifp -> ifr_name) +
X-						ifp -> ifr_addr.sa_len);
X-#else
X-				unsigned len = sizeof *ifp;
X-#endif
X+
X+				int len = (IFNAMSIZ +
X+					ifa -> ifa_addr->sa_len);
X 				tif = (struct ifreq *)dmalloc (len, MDL);
X 				if (!tif)
X 					log_fatal ("no space for ifp.");
X-				memcpy (tif, ifp, len);
X+				strlcpy(tif->ifr_name, ifa->ifa_name, IFNAMSIZ);
X+				memcpy(&tif->ifr_addr, ifa->ifa_addr,
X+					ifa->ifa_addr->sa_len);
X 				tmp -> ifp = tif;
X 				tmp -> primary_address = foo.sin_addr;
X 			}
X@@ -346,9 +274,6 @@
X 		}
X 	}
X 
X-	/* If we allocated a buffer, free it. */
X-	if (ic.ifc_ifcu.ifcu_buf != buf)
X-		dfree (ic.ifc_ifcu.ifcu_buf, MDL);
X 
X #if defined (LINUX_SLASHPROC_DISCOVERY)
X 	/* On Linux, interfaces that don't have IP addresses don't
X@@ -529,6 +454,7 @@
X 	   be able to configure, we can quit now. */
X 	if (state == DISCOVER_UNCONFIGURED) {
X 		close (sock);
X+		freeifaddrs(ifap);
X 		return;
X 	}
X 
X@@ -674,6 +600,7 @@
X 	}
X 
X 	close (sock);
X+	freeifaddrs(ifap);
X 
X 	if (state == DISCOVER_SERVER && wifcount == 0) {
X 		log_info ("%s", "");
END-of-isc-dhcp31-server/files/patch-common::discover.c
echo x - isc-dhcp31-server/files/patch-common::dispatch.c
sed 's/^X//' >isc-dhcp31-server/files/patch-common::dispatch.c << 'END-of-isc-dhcp31-server/files/patch-common::dispatch.c'
X--- common/dispatch.c.orig	Sun Nov 17 03:26:57 2002
X+++ common/dispatch.c	Wed Mar  3 16:20:15 2004
X@@ -95,11 +95,26 @@
X void dispatch ()
X {
X 	struct timeval tv, *tvp;
X+#ifdef ENABLE_POLLING_MODE
X+	struct timeval *tvp_new;
X+#endif
X 	isc_result_t status;
X+	TIME cur_time;
X 
X+	tvp = NULL;
X+#ifdef ENABLE_POLLING_MODE
X+	tvp_new = NULL;
X+#endif
X 	/* Wait for a packet or a timeout... XXX */
X 	do {
X 		tvp = process_outstanding_timeouts (&tv);
X+#ifdef ENABLE_POLLING_MODE
X+		GET_TIME (&cur_time);
X+		add_timeout(cur_time + polling_interval, state_polling, 0, 0, 0);
X+		tvp_new = process_outstanding_timeouts(&tv);
X+		if (tvp != NULL && (tvp -> tv_sec > tvp_new -> tv_sec))
X+			tvp = tvp_new;
X+#endif /* ENABLE_POLLING_MODE */
X 		status = omapi_one_dispatch (0, tvp);
X 	} while (status == ISC_R_TIMEDOUT || status == ISC_R_SUCCESS);
X 	log_fatal ("omapi_one_dispatch failed: %s -- exiting.",
END-of-isc-dhcp31-server/files/patch-common::dispatch.c
echo x - isc-dhcp31-server/files/patch-configure
sed 's/^X//' >isc-dhcp31-server/files/patch-configure << 'END-of-isc-dhcp31-server/files/patch-configure'
X--- configure.orig	Sat Apr 20 23:44:13 2002
X+++ configure	Mon Apr 28 23:02:10 2003
X@@ -13,6 +13,9 @@
X   elif [ x$1 = x--dirs ]; then
X     dirs=$2
X     shift
X+  elif [ x$1 = x--subsys ]; then
X+    subsys=$2
X+    shift
X   elif [ x$1 = x--no-links ]; then
X     nolinks=YES
X   elif [ x$1 = x--copts ]; then
X@@ -233,7 +236,14 @@
X fi
X 
X if [ x"$dirs" = x ]; then
X-  dirs=". client server relay common omapip dhcpctl minires dst"
X+  dirs=". common minires dst omapip dhcpctl"
X+  if [ x$subsys = x ]; then
X+    dirs="$dirs server omshell client relay"
X+  elif [ x$subsys = xserver ]; then
X+    dirs="$dirs server omshell"
X+  elif [ x$subsys = xclient -o x$subsys = xrelay ]; then
X+    dirs="$dirs $subsys"
X+  fi
X fi
X 
X for foo in $dirs; do
X@@ -253,7 +263,11 @@
X 
X # Make the link tree in which to actually build.
X if [ x$nolinks = x ]; then
X-  make links
X+  if [ x$subsys = x ]; then
X+    make links
X+  else
X+    make links.$subsys
X+  fi
X fi
X 
X exit 0
END-of-isc-dhcp31-server/files/patch-configure
echo x - isc-dhcp31-server/files/patch-dhcpctl::Makefile.dist
sed 's/^X//' >isc-dhcp31-server/files/patch-dhcpctl::Makefile.dist << 'END-of-isc-dhcp31-server/files/patch-dhcpctl::Makefile.dist'
X--- dhcpctl/Makefile.dist.orig	Thu Mar  3 17:55:23 2005
X+++ dhcpctl/Makefile.dist	Mon Jul 25 08:33:33 2005
X@@ -22,11 +22,11 @@
X #   http://www.isc.org/
X #
X 
X-CATMANPAGES = dhcpctl.cat3 omshell.cat1
X-SEDMANPAGES = dhcpctl.man3 omshell.man1
X+CATMANPAGES = dhcpctl.cat3
X+SEDMANPAGES = dhcpctl.man3
X SRC    = dhcpctl.c callback.c remote.c
X OBJ    = dhcpctl.o callback.o remote.o
X-MAN    = dhcpctl.3 omshell.1
X+MAN    = dhcpctl.3
X HDRS   = dhcpctl.h
X 
X INCLUDES = $(BINDINC) -I$(TOP)/includes
X@@ -34,10 +34,7 @@
X DHCPCTLLIBS = libdhcpctl.a ../common/libdhcp.a $(BINDLIB) \
X 		../omapip/libomapi.a ../dst/libdst.a
X 
X-all:	libdhcpctl.a omshell cltest $(CATMANPAGES)
X-
X-omshell:	omshell.o $(DHCPCTLLIBS)
X-	$(CC) $(DEBUG) $(LFLAGS) -o omshell omshell.o $(DHCPCTLLIBS) $(LIBS)
X+all:	libdhcpctl.a cltest $(CATMANPAGES)
X 
X cltest:	cltest.o $(DHCPCTLLIBS)
X 	$(CC) $(DEBUG) $(LFLAGS) -o cltest cltest.o $(DHCPCTLLIBS) $(LIBS)
X@@ -48,8 +45,7 @@
X 	$(RANLIB) libdhcpctl.a
X 
X install: all $(CATMANPAGES)
X-	for dir in $(LIBDIR) $(LIBMANDIR) $(INCDIR) $(USRMANDIR) \
X-		$(USERBINDIR); do \
X+	for dir in $(LIBDIR) $(LIBMANDIR) $(INCDIR); do \
X 	  foo=""; \
X 	  for bar in `echo $(DESTDIR)$${dir} |tr / ' '`; do \
X 	    foo=$${foo}/$$bar; \
X@@ -69,16 +65,12 @@
X 	  $(MANINSTALL) $(MANFROM) $${prefix}.$(MANCAT)$${suffix} $(MANTO) \
X 			$(DESTDIR)$(LIBMANDIR)/$${prefix}$(LIBMANEXT); \
X 	done
X-	$(INSTALL) omshell $(DESTDIR)$(USERBINDIR)
X-	$(CHMOD) 755 $(DESTDIR)$(USERBINDIR)/omshell
X-	$(MANINSTALL) $(MANFROM) omshell.$(MANCAT)1 $(MANTO) \
X-				$(DESTDIR)$(USRMANDIR)/omshell$(USRMANEXT)
X 
X depend:
X 	$(MKDEP) $(INCLUDES) $(PREDEFINES) $(SRC)
X 
X clean:
X-	-rm -f $(OBJ) omshell.o omshell cltest.o cltest
X+	-rm -f $(OBJ) cltest.o cltest
X 
X realclean: clean
X 	-rm -f libdhcpctl.a *~ $(CATMANPAGES) $(SEDMANPAGES)
X@@ -87,7 +79,7 @@
X 	-rm -f Makefile
X 
X links:
X-	@for foo in $(SRC) $(MAN) omshell.c cltest.c $(HDRS); do \
X+	@for foo in $(SRC) $(MAN) cltest.c $(HDRS); do \
X 	  if [ ! -b $$foo ]; then \
X 	    rm -f $$foo; \
X 	  fi; \
X@@ -100,12 +92,5 @@
X dhcpctl.man3:	dhcpctl.3
X 	sed -e "s#ETCDIR#$(ETC)#g" -e "s#DBDIR#$(VARDB)#g" \
X 		-e "s#RUNDIR#$(VARRUN)#g" < dhcpctl.3 >dhcpctl.man3
X-
X-omshell.cat1:	omshell.man1
X-	nroff -man omshell.man1 >omshell.cat1
X-
X-omshell.man1:	omshell.1
X-	sed -e "s#ETCDIR#$(ETC)#g" -e "s#DBDIR#$(VARDB)#g" \
X-		-e "s#RUNDIR#$(VARRUN)#g" < omshell.1 >omshell.man1
X 
X # Dependencies (semi-automatically-generated)
END-of-isc-dhcp31-server/files/patch-dhcpctl::Makefile.dist
echo x - isc-dhcp31-server/files/patch-dhcpd.conf
sed 's/^X//' >isc-dhcp31-server/files/patch-dhcpd.conf << 'END-of-isc-dhcp31-server/files/patch-dhcpd.conf'
X--- server/dhcpd.conf.orig	Thu Jan 25 03:33:11 2001
X+++ server/dhcpd.conf	Wed Jan 30 22:06:52 2002
X@@ -14,6 +14,9 @@
X # network, the authoritative directive should be uncommented.
X #authoritative;
X 
X+# ad-hoc DNS update scheme - set to "none" to disable dynamic DNS updates.
X+ddns-update-style ad-hoc;
X+
X # Use this to send dhcp log messages to a different log file (you also
X # have to hack syslog.conf to complete the redirection).
X log-facility local7;
END-of-isc-dhcp31-server/files/patch-dhcpd.conf
echo x - isc-dhcp31-server/files/patch-dst::Makefile.dist
sed 's/^X//' >isc-dhcp31-server/files/patch-dst::Makefile.dist << 'END-of-isc-dhcp31-server/files/patch-dst::Makefile.dist'
X--- dst/Makefile.dist.orig	Sun Nov 17 03:27:43 2002
X+++ dst/Makefile.dist	Fri Mar  5 23:40:45 2004
X@@ -26,12 +26,24 @@
X 
X all:	libdst.a
X 
X-install:
X-
X libdst.a:	$(OBJ)
X 	rm -f dst.a
X 	ar cruv libdst.a $(OBJ)
X 	$(RANLIB) libdst.a
X+
X+install: all
X+	for dir in $(LIBDIR);\
X+	 do \
X+	  foo=""; \
X+	  for bar in `echo $(DESTDIR)$${dir} |tr / ' '`; do \
X+	    foo=$${foo}/$$bar; \
X+	    if [ ! -d $$foo ]; then \
X+	      mkdir $$foo; \
X+	      chmod 755 $$foo; \
X+	    fi; \
X+	  done; \
X+	done
X+	$(INSTALL) libdst.a $(DESTDIR)$(LIBDIR)
X 
X depend:
X 	$(MKDEP) $(INCLUDES) $(PREDEFINES) $(SRC)
END-of-isc-dhcp31-server/files/patch-dst::Makefile.dist
echo x - isc-dhcp31-server/files/patch-includes::cf::freebsd.h
sed 's/^X//' >isc-dhcp31-server/files/patch-includes::cf::freebsd.h << 'END-of-isc-dhcp31-server/files/patch-includes::cf::freebsd.h'
X--- includes/cf/freebsd.h.orig	Wed Sep  1 19:06:36 2004
X+++ includes/cf/freebsd.h	Mon May 15 09:13:18 2006
X@@ -33,7 +33,7 @@
X  */
X 
X #include <syslog.h>
X-#include <sys/types.h>
X+#include <sys/param.h>
X #include <string.h>
X #include <paths.h>
X #include <errno.h>
X@@ -97,6 +97,10 @@
X #define SOCKLEN_T int
X #endif
X 
X+#ifdef RESCUE
X+#define _PATH_DHCLIENT_SCRIPT	"/rescue/dhclient-script"
X+#endif
X+
X #if defined (USE_DEFAULT_NETWORK)
X #  define USE_BPF
X #endif
X@@ -107,6 +111,9 @@
X  #endif /* HAVE_DEV_RANDOM */
X 
X const char *cmds[] = {
X+#ifndef RESCUE
X+	/* rescue environment can't rely on these ... */
X+	/* Actually, /sbin/dhclient shouldn't use these, either. */
X 	"/bin/ps -axlw 2>&1",
X 	"/usr/sbin/arp -an 2>&1",
X 	"/usr/bin/netstat -an 2>&1",
X@@ -117,10 +124,12 @@
X 	"/usr/sbin/iostat  2>&1",
X 	"/usr/bin/vmstat  2>&1",
X 	"/usr/bin/w  2>&1",
X+#endif
X 	NULL
X };
X 
X const char *dirs[] = {
X+#ifndef RESCUE
X 	"/tmp",
X 	"/usr/tmp",
X 	".",
X@@ -130,13 +139,16 @@
X 	"/var/mail",
X 	"/home",
X 	"/usr/home",
X+#endif
X 	NULL
X };
X 
X const char *files[] = {
X+#ifndef RESCUE
X 	"/var/log/messages",
X 	"/var/log/wtmp",
X 	"/var/log/lastlog",
X+#endif
X 	NULL
X };
X #endif /* NEED_PRAND_CONF */
END-of-isc-dhcp31-server/files/patch-includes::cf::freebsd.h
echo x - isc-dhcp31-server/files/patch-includes::dhcpd.h
sed 's/^X//' >isc-dhcp31-server/files/patch-includes::dhcpd.h << 'END-of-isc-dhcp31-server/files/patch-includes::dhcpd.h'
X--- includes/dhcpd.h.orig	Mon Feb 10 02:22:46 2003
X+++ includes/dhcpd.h	Wed Mar  3 16:20:09 2004
X@@ -99,6 +99,9 @@
X 	 (((x) >> OPTION_HASH_EXP) & \
X 	  (OPTION_HASH_PTWO - 1))) % OPTION_HASH_SIZE;
X 
X+#define NOLINK 0
X+#define HAVELINK 1
X+
X enum dhcp_shutdown_state {
X 	shutdown_listeners,
X 	shutdown_omapi_connections,
X@@ -783,6 +786,11 @@
X 	unsigned remote_id_len;		/* Length of Remote ID. */
X 
X 	char name [IFNAMSIZ];		/* Its name... */
X+	int ieee80211;                  /* True if media is ieee802.11 */
X+	int havemedia;                  /* True if we have a media table */
X+	int linkstate;                  /* True if we have link */
X+	int polling;                    /* True if polling is enabled */
X+	int forcediscover;              /* True if a discover is needed */
X 	int index;			/* Its index. */
X 	int rfdesc;			/* Its read file descriptor. */
X 	int wfdesc;			/* Its write file descriptor, if
X@@ -1845,6 +1853,9 @@
X extern const char *path_dhclient_pid;
X extern char *path_dhclient_script;
X extern int interfaces_requested;
X+#ifdef ENABLE_POLLING_MODE
X+extern int polling_interval;
X+#endif
X 
X extern struct client_config top_level_config;
X 
X@@ -1858,12 +1869,21 @@
X void send_decline PROTO ((void *));
X 
X void state_reboot PROTO ((void *));
X+#ifdef ENABLE_POLLING_MODE
X+void state_background PROTO ((void *));
X+void state_polling PROTO ((void *));
X+#endif
X void state_init PROTO ((void *));
X void state_selecting PROTO ((void *));
X void state_requesting PROTO ((void *));
X void state_bound PROTO ((void *));
X void state_stop PROTO ((void *));
X void state_panic PROTO ((void *));
X+
X+#if __FreeBSD_version > 502010
X+void set_ieee80211 PROTO ((struct interface_info *));
X+#endif
X+int interface_active PROTO ((struct interface_info *));
X 
X void bind_lease PROTO ((struct client_state *));
X 
END-of-isc-dhcp31-server/files/patch-includes::dhcpd.h
echo x - isc-dhcp31-server/files/patch-server::dhcpd.c
sed 's/^X//' >isc-dhcp31-server/files/patch-server::dhcpd.c << 'END-of-isc-dhcp31-server/files/patch-server::dhcpd.c'
X--- server/dhcpd.c.orig	Thu Jun 10 19:59:52 2004
X+++ server/dhcpd.c	Fri Jun 25 15:49:09 2004
X@@ -47,6 +47,22 @@
X #include "version.h"
X #include <omapip/omapip_p.h>
X 
X+#if defined (PARANOIA)
X+#include <sys/types.h>
X+#include <unistd.h>
X+#include <pwd.h>
X+/* get around the ISC declaration of group */
X+#define group real_group 
X+#include <grp.h>
X+#undef group
X+#endif /* PARANOIA */
X+#if defined (JAIL)
X+#include <sys/param.h>
X+#include <sys/jail.h>
X+#include <netinet/in.h>
X+#include <arpa/inet.h>
X+#endif /* JAIL */
X+
X static void usage PROTO ((void));
X 
X TIME cur_time;
X@@ -195,6 +211,35 @@
X 	omapi_object_dereference (&listener, MDL);
X }
X 
X+#if defined (PARANOIA)
X+/* to be used in one of two possible scenarios */
X+static void setup_chroot (char *chroot_dir)
X+{
X+	if (geteuid ())
X+		log_fatal ("you must be root to use chroot");
X+	if (chroot (chroot_dir))
X+		log_fatal ("chroot(\"%s\"): %m", chroot_dir);
X+	if (chdir ("/"))
X+		/* probably permission denied */
X+		log_fatal ("chdir(\"/\"): %m");
X+}
X+#endif /* PARANOIA */
X+
X+#if defined (JAIL)
X+static void setup_jail (char *chroot_dir, char *hostname, u_int32_t ip_number)
X+{
X+      struct jail j;
X+
X+      j.version = 0;
X+      j.path = chroot_dir;
X+      j.hostname = hostname;
X+      j.ip_number = ip_number;
X+
X+      if (jail (&j) < 0)
X+              log_fatal ("jail(%s, %s): %m", chroot_dir, hostname);
X+}
X+#endif /* JAIL */
X+
X int main (argc, argv, envp)
X 	int argc;
X 	char **argv, **envp;
X@@ -227,6 +272,25 @@
X 	char *traceinfile = (char *)0;
X 	char *traceoutfile = (char *)0;
X #endif
X+#if defined (PARANOIA)
X+	char *set_user   = 0;
X+	char *set_group  = 0;
X+	uid_t set_uid = 0;
X+	gid_t set_gid = 0;
X+	int early_chroot = 0;
X+	int no_dhcpd_user = 0;
X+	int no_dhcpd_group = 0;
X+#endif /* PARANOIA */
X+#if defined (PARANOIA) || defined (JAIL)
X+	char *set_chroot = 0;
X+	int no_dhcpd_chroot = 0;
X+#endif /* PARANOIA || JAIL */
X+#if defined (JAIL)
X+	char *set_jail = 0;
X+	u_int32_t jail_ip_address = 0; /* Good as long as it's IPv4 ... */
X+	int no_dhcpd_jail = 0;
X+	char *s2;
X+#endif /* JAIL */
X 
X 	/* Make sure we have stdin, stdout and stderr. */
X 	status = open ("/dev/null", O_RDWR);
X@@ -289,6 +353,39 @@
X 			if (++i == argc)
X 				usage ();
X 			server = argv [i];
X+#if defined (PARANOIA)
X+		} else if (!strcmp (argv [i], "-user")) {
X+			if (++i == argc)
X+				usage ();
X+			set_user = argv [i];
X+			no_dhcpd_user = 1;
X+		} else if (!strcmp (argv [i], "-group")) {
X+			if (++i == argc)
X+				usage ();
X+			set_group = argv [i];
X+			no_dhcpd_group = 1;
X+		} else if (!strcmp (argv [i], "-early_chroot")) {
X+			early_chroot = 1;
X+#endif /* PARANOIA */
X+#if defined (PARANOIA) || defined (JAIL)
X+		} else if (!strcmp (argv [i], "-chroot")) {
X+			if (++i == argc)
X+				usage ();
X+			set_chroot = argv [i];
X+			no_dhcpd_chroot = 1;
X+#endif /* PARANOIA || JAIL */
X+#if defined (JAIL)
X+		} else if (!strcmp (argv [i], "-jail")) {
X+			if (++i == argc)
X+				usage ();
X+			set_jail = argv [i];
X+			if (++i == argc)
X+				usage ();
X+			if (inet_pton (AF_INET, argv[i], &jail_ip_address) < 0)
X+				log_fatal ("invalid ip address: %s", argv[i]);
X+			jail_ip_address = ntohl (jail_ip_address);
X+			no_dhcpd_jail = 1;
X+#endif /* JAIL */
X 		} else if (!strcmp (argv [i], "-cf")) {
X 			if (++i == argc)
X 				usage ();
X@@ -366,6 +463,28 @@
X 	if (!no_dhcpd_pid && (s = getenv ("PATH_DHCPD_PID"))) {
X 		path_dhcpd_pid = s;
X 	}
X+#if defined (PARANOIA)
X+	if (!no_dhcpd_user && (s = getenv ("DHCPD_USER"))) {
X+		set_user = s;
X+	}
X+	if (!no_dhcpd_group && (s = getenv ("DHCPD_GROUP"))) {
X+		set_group = s;
X+	}
X+#endif /* PARANOIA */
X+#if defined (PARANOIA) || defined (JAIL)
X+	if (!no_dhcpd_chroot && (s = getenv ("PATH_DHCPD_CHROOT"))) {
X+		set_chroot = s;
X+	}
X+#endif /* PARANOIA || JAIL */
X+#if defined (JAIL)
X+	if (!no_dhcpd_jail && (s = getenv ("DHCPD_JAIL_HOSTNAME")) &&
X+	    (s2 = getenv ("DHCPD_JAIL_IPADDRESS"))) {
X+		set_jail = s;
X+		if (inet_pton (AF_INET, s2, &jail_ip_address) < 0)
X+			log_fatal ("invalid ip address: %s", s2);
X+		jail_ip_address = ntohl (jail_ip_address);
X+	}
X+#endif /* JAIL */
X 
X 	if (!quiet) {
X 		log_info ("%s %s", message, DHCP_VERSION);
X@@ -388,6 +507,57 @@
X 					     trace_seed_stop, MDL);
X #endif
X 
X+#if defined (PARANOIA)
X+	/* get user and group info if those options were given */
X+	if (set_user) {
X+		struct passwd *tmp_pwd;
X+
X+		if (geteuid ())
X+			log_fatal ("you must be root to set user");
X+
X+		if (!(tmp_pwd = getpwnam (set_user)))
X+			log_fatal ("no such user: %s", set_user);
X+
X+		set_uid = tmp_pwd->pw_uid;
X+
X+		/* use the user's group as the default gid */
X+		if (!set_group)
X+			set_gid = tmp_pwd->pw_gid;
X+	}
X+
X+	if (set_group) {
X+/* get around the ISC declaration of group */
X+#define group real_group
X+		struct group *tmp_grp;
X+
X+		if (geteuid ())
X+			log_fatal ("you must be root to set group");
X+
X+		if (!(tmp_grp = getgrnam (set_group)))
X+			log_fatal ("no such group: %s", set_group);
X+
X+		set_gid = tmp_grp->gr_gid;
X+#undef group
X+	}
X+#endif /* PARANOIA */
X+#if defined (JAIL)
X+	if (set_jail) {
X+		/* Initialize icmp support... */
X+		if (!cftest && !lftest)
X+			icmp_startup (1, lease_pinged);
X+		if(!set_chroot)
X+			set_chroot = "/";
X+		setup_jail (set_chroot, set_jail, jail_ip_address);
X+	}
X+#endif /* JAIL */
X+#if defined (PARANOIA) && defined (JAIL)
X+	else
X+#endif /* PARANOIA && JAIL */
X+#if defined (PARANOIA)
X+	if (early_chroot && set_chroot)
X+		setup_chroot (set_chroot);
X+#endif /* PARANOIA */
X+
X 	/* Default to the DHCP/BOOTP port. */
X 	if (!local_port)
X 	{
X@@ -462,6 +632,9 @@
X #endif
X 
X 	/* Initialize icmp support... */
X+#if defined (JAIL)
X+	if (!set_jail)
X+#endif /* JAIL */
X 	if (!cftest && !lftest)
X 		icmp_startup (1, lease_pinged);
X 
X@@ -491,6 +664,14 @@
X 
X 	postconf_initialization (quiet);
X 
X+#if defined (PARANOIA)
X+#if defined (JAIL)
X+	if (!set_jail)
X+#endif /* JAIL */
X+	if (!early_chroot && set_chroot)
X+		setup_chroot (set_chroot);
X+#endif /* PARANOIA */
X+
X         /* test option should cause an early exit */
X  	if (cftest && !lftest) 
X  		exit(0);
X@@ -533,7 +714,22 @@
X 		else if (pid)
X 			exit (0);
X 	}
X+  
X+#if defined (PARANOIA)
X+	/* change uid to the specified one */
X+	if (set_gid) {
X+		if (setgroups (0, (void *)0))
X+			log_fatal ("setgroups: %m");
X+		if (setgid (set_gid))
X+			log_fatal ("setgid(%d): %m", (int) set_gid);
X+	}
X 
X+	if (set_uid) {
X+		if (setuid (set_uid))
X+			log_fatal ("setuid(%d): %m", (int) set_uid);
X+	}
X+#endif /* PARANOIA */
X+  
X 	/* Read previous pid file. */
X 	if ((i = open (path_dhcpd_pid, O_RDONLY)) >= 0) {
X 		status = read (i, pbuf, (sizeof pbuf) - 1);
X@@ -877,8 +1073,24 @@
X 	log_info (copyright);
X 	log_info (arr);
X 
X-	log_fatal ("Usage: dhcpd [-p <UDP port #>] [-d] [-f]%s%s%s%s",
X+	log_fatal ("Usage: dhcpd [-p <UDP port #>] [-d] [-f]%s%s%s%s%s%s%s",
X 		   "\n             [-cf config-file] [-lf lease-file]",
X+
X+#if defined (PARANOIA)
X+		   /* meld into the following string */
X+		   "\n             [-user user] [-group group]",
X+		   "\n             [-chroot dir] [-early_chroot]",
X+#else /* PARANOIA */
X+		   "", "",
X+#endif /* PARANOIA */
X+
X+#if defined (JAIL)
X+		   /* then also these ones */
X+		   "\n             [-jail name ip]",
X+#else /* JAIL */
X+		   "",
X+#endif /* JAIL */
X+
X #if defined (TRACING)
X 		   "\n		   [-tf trace-output-file]",
X 		   "\n		   [-play trace-input-file]",
END-of-isc-dhcp31-server/files/patch-server::dhcpd.c
echo x - isc-dhcp31-server/files/client::scripts::freebsd
sed 's/^X//' >isc-dhcp31-server/files/client::scripts::freebsd << 'END-of-isc-dhcp31-server/files/client::scripts::freebsd'
X#!/bin/sh
X
X#############################################################################
X#
X# Copyright (c) 1999, MindStep Corporation
X# All rights reserved.
X#
X# Redistribution and use in source and binary forms, with or without
X# modification, are permitted provided that the following conditions
X# are met:
X# 1. Redistributions of source code must retain the above copyright
X#    notice, this list of conditions and the following disclaimer.
X# 2. Redistributions in binary form must reproduce the above copyright
X#    notice, this list of conditions and the following disclaimer in the
X#    documentation and/or other materials provided with the distribution.
X#
X# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
X# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
X# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
X# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
X# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
X# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
X# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
X# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
X# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
X# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
X# SUCH DAMAGE.
X#
X#
X#############################################################################
X#
X# This script was written by Patrick Bihan-Faou, patrick at mindstep.com,
X# Please contact us for bug reports, etc.
X#
X#############################################################################
X# $MindStep_Id: dhclient-script.sh,v 1.8 1999/12/07 22:11:08 patrick Exp $
X# $MindStep_Tag: CONTRIB_19991207 $
X# from FreeBSD: src/sbin/dhclient/dhclient-script.sh,v 1.2 2002/02/01 18:46:58 alfred Exp
X# $FreeBSD: ports/net/isc-dhcp3-server/files/client::scripts::freebsd,v 1.2 2004/06/26 14:32:41 eik Exp $
X#############################################################################
X
X
X#############################################################################
X# hook functions prototypes
X#
X# The "pre_state_XXX_hook" functions are called before the main
X# work is done for the state XXX
X#
X# The "post_state_XXX_hook" functions are called after the main
X# work is done for the state XXX
X#
X# These functions are meant to be overridden by the user's
X# dhclient-enter-hooks file
X#############################################################################
X
Xpre_state_MEDIUM_hook () { }
Xpre_state_PREINIT_hook () { }
Xpre_state_ARPCHECK_hook () { }
Xpre_state_ARPSEND_hook () { }
Xpre_state_RENEW_hook () { }
Xpre_state_REBIND_hook () { }
Xpre_state_BOUND_hook () { }
Xpre_state_REBOOT_hook () { }
Xpre_state_EXPIRE_hook () { }
Xpre_state_FAIL_hook () { }
Xpre_state_TIMEOUT_hook () { }
Xpost_state_MEDIUM_hook () { }
Xpost_state_PREINIT_hook () { }
Xpost_state_ARPCHECK_hook () { }
Xpost_state_ARPSEND_hook () { }
Xpost_state_RENEW_hook () { }
Xpost_state_REBIND_hook () { }
Xpost_state_BOUND_hook () { }
Xpost_state_REBOOT_hook () { }
Xpost_state_EXPIRE_hook () { }
Xpost_state_FAIL_hook () { }
Xpost_state_TIMEOUT_hook () { }
X
X#############################################################################
X# make_resolv_conf
X#
X# This function is called to update the information related to the
X# DNS configuration (the resolver part)
X#############################################################################
Xmake_resolv_conf () 
X{
X   if [ "x$new_domain_name" != x ] && [ "x$new_domain_name_servers" != x ]; then
X     echo search $new_domain_name >/etc/resolv.conf
X     for nameserver in $new_domain_name_servers; do
X       echo nameserver $nameserver >>/etc/resolv.conf
X     done
X   fi
X}
X
X#############################################################################
X# set_XXX
X# unset_XXX
X#
X# These function each deal with one particular setting.
X# They are OS dependent and may be overridden in the 
X# dhclient-enter-hooks file if needed.
X#
X# These functions are called with either "new" or "old" to indicate which
X# set of variables to use (new_ip_address or old_ip_address...)
X#
X#############################################################################
X
Xupdate_hostname ()
X{
X	local current_hostname=`/bin/hostname`
X
X  	if	[ "$current_hostname" = "" ] || \
X		[ "$current_hostname" = "$old_host_name" ]
X	then
X		if [ "$new_host_name" != "$old_host_name" ]
X		then
X			$LOGGER "New Hostname: $new_host_name"
X			hostname $new_host_name
X		fi
X	fi
X}
X
Xset_ip_address () 
X{
X	local ip
X	local mask
X	local bcast
X
X	if [ $# -lt 1 ]
X	then
X		return  1
X	fi
X
X	eval ip="\$${1}_ip_address"
X	eval mask="\$${1}_subnet_mask"
X	eval bcast="\$${1}_broadcast_address"
X
X	if [ "$ip" != "" ]
X	then
X		ifconfig $interface inet $ip netmask $mask broadcast $bcast $medium
X#		route add $ip 127.0.0.1 > /dev/null 2>&1
X	fi
X}
X
Xunset_ip_address () 
X{
X	local ip
X
X	if [ $# -lt 1 ]
X	then
X		return  1
X	fi
X
X	eval ip="\$${1}_ip_address"
X
X	if [ "$ip" != "" ]
X	then
X		ifconfig $interface inet -alias $ip $medium
X#		route delete $ip 127.0.0.1 > /dev/null 2>&1
X	fi
X}
X
Xset_ip_alias () 
X{
X	if [ "$alias_ip_address" != "" ]
X	then
X		ifconfig $interface inet alias $alias_ip_address netmask $alias_subnet_mask
X#		route add $alias_ip_address 127.0.0.1
X	fi
X}
X
Xunset_ip_alias () 
X{
X	if [ "$alias_ip_address" != "" ]
X	then
X		ifconfig $interface inet -alias $alias_ip_address > /dev/null 2>&1
X#		route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1
X	fi
X}
X
Xset_routers () 
X{
X	local router_list
X
X	if [ $# -lt 1 ]
X	then
X		return  1
X	fi
X
X	eval router_list="\$${1}_routers"
X
X	for router in $router_list
X	do
X		route add default $router >/dev/null 2>&1
X	done
X}
X
Xunset_routers () 
X{
X	local router_list
X
X	if [ $# -lt 1 ]
X	then
X		return  1
X	fi
X
X	eval router_list="\$${1}_routers"
X
X	for router in $router_list
X	do
X		route delete default $router >/dev/null 2>&1
X	done
X}
X
Xset_static_routes () 
X{
X	local static_routes
X
X	if [ $# -lt 1 ]
X	then
X		return  1
X	fi
X
X	eval static_routes="\$${1}_static_routes"
X
X	set static_routes
X
X	while [ $# -ge 2 ]
X	do
X		$LOGGER "New Static Route: $1 -> $2"
X		route add $1 $2
X		shift; shift
X	done
X}
X
Xunset_static_routes () 
X{
X	local static_routes
X
X	if [ $# -lt 1 ]
X	then
X		return  1
X	fi
X
X	eval static_routes="\$${1}_static_routes"
X
X	set static_routes
X
X	while [ $# -ge 2 ]
X	do
X		route delete $1 $2
X		shift; shift
X	done
X}
X
X#############################################################################
X#
X# utility functions grouping what needs to be done in logical units.
X#
X#############################################################################
X
Xset_all ()
X{
X	set_ip_address new
X	set_routers new
X	set_static_routes new
X
X	if	[ "$new_ip_address" != "$alias_ip_address" ]
X	then
X		set_ip_alias
X	fi
X}
X
Xset_others ()
X{
X	update_hostname
X	make_resolv_conf
X}
X
Xclear_arp_table () 
X{
X	arp -d -a
X}
X
Xunset_all ()
X{
X	if [ "$alias_ip_address" != "$old_ip_address" ]
X	then
X		unset_ip_alias
X	fi
X
X	if [ "$old_ip_address" != "" ] 
X	then
X		unset_ip_address old
X		unset_routers old
X		unset_static_routes old
X		clear_arp_table
X	fi
X}
X
Xtest_new_lease () 
X{
X	local rc
X
X	set $new_routers
X
X	if [ $# -ge 1 ]
X	then
X		set_ip_address new
X		if ping -q -c 1 $1
X		then
X			rc=0
X		else
X			rc=1
X		fi
X		unset_ip_address new
X	else
X		rc=1
X	fi
X	return  $rc
X}
X
X#############################################################################
X# Main State functions.
X#
X# There is a state function for each state of the DHCP client
X# These functions are OS specific and should be be tampered with.
X#############################################################################
X
Xin_state_MEDIUM () 
X{
X  ifconfig $interface $medium
X  ifconfig $interface inet -alias 0.0.0.0 $medium >/dev/null 2>&1
X  sleep 1
X  exit_status=0
X}
X
Xin_state_PREINIT () 
X{
X	unset_ip_alias
X
X	ifconfig $interface inet 0.0.0.0 netmask 0.0.0.0 \
X			broadcast 255.255.255.255 up
X	exit_status=0
X}
X
Xin_state_ARPCHECK () 
X{
X  exit_status=0
X}
X
Xin_state_ARPSEND () 
X{
X  exit_status=0
X}
X
Xin_state_RENEW () 
X{
X	if [ "$old_ip_address" != "$new_ip_address" ]
X	then
X		unset_all
X		set_all
X	fi
X
X	set_others
X}
X
Xin_state_REBIND () {
X	in_state_RENEW
X}
X
Xin_state_BOUND () {
X	unset_all
X	set_all
X	set_others
X}
X
Xin_state_REBOOT () {
X	in_state_BOUND
X}
X
Xin_state_EXPIRE () 
X{
X	unset_all
X	set_ip_alias
X	exit_status=0
X}
X
Xin_state_FAIL () {
X	in_state_EXPIRE
X}
X
Xin_state_TIMEOUT () 
X{
X	unset_all
X
X	if test_new_lease
X	then
X		set_all
X		set_others
X	else
X	 	$LOGGER "No good lease information in TIMEOUT state"	
X		set_ip_alias
X		exit_status=1
X	fi
X}
X
X#############################################################################
X# Main functions:
X#
X# dhclient_script_init() parses the optional "enter_hooks" script which can
X#   override any of the state functions
X#
X# This function also parses the variables and notifies the detected changes.
X#############################################################################
Xdhclient_script_init ()
X{
X	if [ "$new_network_number" != "" ]
X	then
X		$LOGGER "New Network Number: $new_network_number"
X	fi
X
X	if [ "$new_ip_address" != "" ]
X	then
X		$LOGGER "New IP Address: $new_ip_address"
X	fi
X
X	if [ "$new_broadcast_address" != "" ]
X	then
X		$LOGGER "New Broadcast Address: $new_broadcast_address"
X	fi
X
X	if [ "$new_subnet_mask" != "" ]
X	then
X		$LOGGER "New Subnet Mask for $interface: $new_subnet_mask"
X	fi
X
X	if [ "$alias_subnet_mask" != "" ]
X	then
X	fi
X}
X
X#############################################################################
X# dhclient_main() does the appropriate work depending on the state of
X# the dhcp client
X#############################################################################
Xdhclient_script_main ()
X{
X#	set -x
X	exit_status=0
X
X	case $reason in
X		MEDIUM|\
X		PREINIT|\
X		ARPCHECK|\
X		ARPSEND|\
X		RENEW|\
X		REBIND|\
X		BOUND|\
X		REBOOT|\
X		EXPIRE|\
X		FAIL|\
X		TIMEOUT)
X			pre_state_${reason}_hook
X			in_state_${reason}
X			post_state_${reason}_hook
X			;;
X		*)
X			$LOGGER "dhclient-script called with invalid reason $reason"
X			exit_status=1
X			;;
X	esac
X}
X
X#############################################################################
X# Let's do the work...
X#############################################################################
X
Xif [ -x /usr/bin/logger ]; then
X	LOGGER="/usr/bin/logger -s -p user.notice -t dhclient"
Xelse
X	LOGGER=echo
Xfi
X
X# Invoke the local dhcp client enter hooks, if they exist.
Xif [ -x %%PREFIX%%/etc/dhclient-enter-hooks ]
Xthen
X	exit_status=0
X	. %%PREFIX%%/etc/dhclient-enter-hooks
X	# allow the local script to abort processing of this state
X	# local script must set exit_status variable to nonzero.
X	if [ $exit_status -ne 0 ]
X	then
X		exit $exit_status
X	fi
Xfi
X
Xdhclient_script_init
Xdhclient_script_main
X
X# Invokes the local dhcp client exit hooks, if any.
Xif [ -x %%PREFIX%%/etc/dhclient-exit-hooks ]; then
X	. %%PREFIX%%/etc/dhclient-exit-hooks
Xfi
X
Xexit $exit_status
X
X#############################################################################
X# That's all folks
X#############################################################################
END-of-isc-dhcp31-server/files/client::scripts::freebsd
echo x - isc-dhcp31-server/pkg-descr
sed 's/^X//' >isc-dhcp31-server/pkg-descr << 'END-of-isc-dhcp31-server/pkg-descr'
XThe ISC Dynamic Host Configuration Protocol Distribution provides a
Xfreely redistributable reference implementation of all aspects of the
XDHCP protocol, through a suite of DHCP tools:
X
X  * A DHCP server (this port)
X  * A DHCP client
X  * A DHCP relay agent
X
XVersion 3.1.x of the ISC DHCP Distribution includes the following major
Xnew features compared to its 3.0.x derivative:
X
X  * A significantly enhanced Failover protocol implementation, which:
X         * Implements MAC Address Affinity to reduce the frequency of
X           clients being assigned new IP addresses;
X         * Supports the assignment of failover-protected addresses to
X           legacy BOOTP clients;
X         * Implements a dynamic lease reservation system that provides
X           improved accounting of the use of fixed address assignments,
X           by allocating fixed addresses out of the pool of dynamic
X           leases; and
X         * Further improves tools and reduces operator oversight
X           necessary for maintaining a functioning system.
X   * Support for DHCP Leasequery, and the VIVCO/VIVSO options, which
X         makes easy and comfortable integration with DOCSIS devices and
X         the environment in which they are used.
X   * Management of class and subclass statements via OMAPI.
X   * Several server configuration options related to dynamic DNS
X         behavior
X   * Other new configuration functions, including "execute()",
X        which runs a shell command from within a dhcpd or dhclient
X        configuration file
X
XWWW: http://www.isc.org/products/DHCP/
END-of-isc-dhcp31-server/pkg-descr
echo x - isc-dhcp31-server/pkg-install
sed 's/^X//' >isc-dhcp31-server/pkg-install << 'END-of-isc-dhcp31-server/pkg-install'
X#!/bin/sh
X#
X# $FreeBSD: ports/net/isc-dhcp3-server/pkg-install,v 1.3 2006/08/27 16:04:02 sem Exp $
X#
X
X[ $# != 2 ] && exit 1
X[ -z "${PKG_PREFIX}" ] && exit 1
X[ -n "${BATCH}" ] && exit 0
X
Xcase $2 in
XPOST-INSTALL)
X	if [ -x ${PKG_PREFIX}/etc/rc.d/isc-dhcpd ]; then
X		${PKG_PREFIX}/etc/rc.d/isc-dhcpd forceinstall
X	else
X		${PKG_PREFIX}/etc/rc.d/isc-dhcpd.sh forceinstall
X	fi
X	;;
XDEINSTALL)
X	if [ -x ${PKG_PREFIX}/etc/rc.d/isc-dhcpd ]; then
X		${PKG_PREFIX}/etc/rc.d/isc-dhcpd forceuninstall
X	else
X		${PKG_PREFIX}/etc/rc.d/isc-dhcpd.sh forceuninstall
X	fi
X	;;
XPOST-DEINSTALL|PRE-INSTALL)
X	;;
X*)
X	echo "usage: $0 <PKG_NAME> {PRE-INSTALL|POST-INSTALL|DEINSTALL|POST-DEINSTALL}" >&2
X	exit 1
X	;;
Xesac
END-of-isc-dhcp31-server/pkg-install
echo x - isc-dhcp31-server/Makefile
sed 's/^X//' >isc-dhcp31-server/Makefile << 'END-of-isc-dhcp31-server/Makefile'
X# ex:ts=8
X# Ports collection makefile for:    dhcp
X# Date created:         7 Mar 1996
X# Whom:                 se
X#
X# $FreeBSD: ports/net/isc-dhcp3-server/Makefile,v 1.121 2007/03/14 17:14:06 pav Exp $
X#
X
XPORTNAME=	dhcp
XPORTVERSION=	3.1.0
XPORTREVISION=	${DHCP_PORTREVISION}
XCATEGORIES=	net
XMASTER_SITES=	${MASTER_SITE_ISC}
XMASTER_SITE_SUBDIR=	dhcp dhcp/dhcp-3.1-history
XPKGNAMEPREFIX=	isc-
XPKGNAMESUFFIX=	3-${SUBSYS}
XDISTNAME=	${PORTNAME}-${RELEASE}${VERSION}${PATCHLEVEL}
X
XMAINTAINER=	bra at fsn.hu
XCOMMENT?=	The ISC Dynamic Host Configuration Protocol server
X
XPORTREVISION_SERVER=	0
XPORTREVISION_CLIENT=	0
XPORTREVISION_RELAY=	0
XPORTREVISION_DEVEL=	0
X
XSUBSYS?=	server
X
XUNIQUENAME=	${PKGNAMEPREFIX}${PORTNAME}${PKGNAMESUFFIX}
X.if ${SUBSYS} == client
XOPTIONS=	INTERFACE_POLLING "interface polling support" on
X.endif
X.if ${SUBSYS} == server
XOPTIONS=	DHCP_PARANOIA "add -user, -group and -chroot options" on \
X		DHCP_JAIL "add -chroot and -jail options" on \
X		DHCP_SOCKETS "use sockets instead of /dev/bpf (jail-only)" off
X.endif
X
X# PORTREVISION handling
X.if ${SUBSYS} == client
XDHCP_PORTREVISION=	${PORTREVISION_CLIENT}
X.elif ${SUBSYS} == relay
XDHCP_PORTREVISION=	${PORTREVISION_RELAY}
X.elif ${SUBSYS} == devel
XDHCP_PORTREVISION=	${PORTREVISION_DEVEL}
X.else
XDHCP_PORTREVISION=	${PORTREVISION_SERVER}
X.endif
X
X.include <bsd.port.pre.mk>
X
X# Global variables
X#
X
XHAS_CONFIGURE=	yes
XCONFIGURE_ARGS=	--subsys ${SUBSYS}
XALL_TARGET=	all.${SUBSYS}
XINSTALL_TARGET=	install.${SUBSYS}
XSCRIPTS_ENV+=	PKG_PREFIX=${PREFIX}
X
X.if ${SUBSYS} == client
XMAN5=		dhclient.conf.5 dhclient.leases.5
XMAN8=		dhclient.8 dhclient-script.8
X.elif ${SUBSYS} == server
XMAN1=		omshell.1
XMAN5=		dhcpd.conf.5 dhcpd.leases.5
XMAN8=		dhcpd.8
X.elif ${SUBSYS} == relay
XMAN8=		dhcrelay.8
X.else
XMAN3=		dhcpctl.3 omapi.3
X.endif
X.if ${SUBSYS} != relay
XMAN5+=		dhcp-eval.5 dhcp-options.5
X.endif
X
XMSG_FILE=	${.CURDIR}/pkg-message
XDESCR=		${.CURDIR}/pkg-descr
XPKGINSTALL=	${.CURDIR}/pkg-install
XPKGDEINSTALL=	${PKGINSTALL}
XPKGMESSAGE=	${WRKDIR}/pkg-message
XPLIST=		${.CURDIR}/pkg-plist
X
X# Local variables
X#
X
X# for instance, possible versions are:
X#	1.2.r3.4 (or 1.2.b3.4), 1.2.r3 (or 1.2.b3), 1.2.3, 1.2
X# which have to become:
X#	1.2rc3pl4 (or 1.2beta3pl4), 1.2rc3 (or 1.2beta3), 1.2.3, 1.2
X# so, the magic things are:
XVERSION=
XPATCHLEVEL=
X.if ${PORTVERSION:R:E:M[br]*} != ""
XRELEASE=	${PORTVERSION:R:R}
XVERSION=	${PORTVERSION:R:E:S/b/beta/:S/r/rc/}
XPATCHLEVEL=	pl${PORTVERSION:E}
X.elif ${PORTVERSION:E:M[br]*} != ""
XRELEASE=	${PORTVERSION:R}
XVERSION=	${PORTVERSION:E:S/b/beta/:S/r/rc/}
X#.elif ${PORTVERSION:R:E} != ""
X#RELEASE=	${PORTVERSION:R}
X#PATCHLEVEL=	pl${PORTVERSION:E}
X.else
XRELEASE=	${PORTVERSION}
X.endif
X
XPATCH_SUBDIRS=	common minires dst omapip
X.if ${SUBSYS} == server || ${SUBSYS} == devel
XPATCH_SUBDIRS+=	dhcpctl
X.endif
X.if ${SUBSYS} != devel
XPATCH_SUBDIRS+=	${SUBSYS}
X.endif
X.if ${SUBSYS} == server
XPATCH_SUBDIRS+=	omshell
X.endif
X
X.if !defined(NOPORTDOCS)
XPORTDOCS=	LICENSE README RELNOTES
X.endif
X.if ${SUBSYS} == client
XBIN_FILES=	dhclient
XLOCAL_CONF_FILES=	dhclient.conf
XSAMP_FILES=	client/dhclient.conf
XDATA_FILES=	dhclient.leases
X.elif ${SUBSYS} == server
XBIN_FILES=	dhcpd omshell
XUSE_RC_SUBR=	isc-dhcpd
XSAMP_FILES=	server/dhcpd.conf
XDATA_FILES=	dhcpd.leases
X.elif ${SUBSYS} == relay
XBIN_FILES=	dhcrelay
XUSE_RC_SUBR=	isc-dhcrelay
X.endif
X
XSAMP_SUFX=	.sample
X
XCONF_DIR=	${PREFIX}/etc
XDOCSDIR=	${PREFIX}/share/doc/${PKGBASE}
XDATADIR=	/var/db
X
XREINPLACE_SUB=	PREFIX=${PREFIX}
X.if ${OSVERSION} >= 502100
XSUB_LIST+=	NOLOGIN=/usr/sbin/nologin
X.else
XSUB_LIST+=	NOLOGIN=/sbin/nologin
X.endif
X.if !defined(WITHOUT_DHCP_PARANOIA)
XSUB_LIST+=	PARANOIA=YES
X.else
XSUB_LIST+=	PARANOIA=NO
X.endif
X.if !defined(WITHOUT_DHCP_JAIL)
XSUB_LIST+=	JAIL=YES
X.else
XSUB_LIST+=	JAIL=NO
X.endif
XPKGMESSAGE_SUB=	PREFIX="${PREFIX}" MAN1PREFIX="${MAN1PREFIX}" \
X		DOCSDIR="${DOCSDIR}"
X
X# Post-extract
X#
X
Xpost-extract: extract-omshell extract-script
X
Xextract-omshell:
X	@${MKDIR} ${WRKSRC}/omshell
X	@${MV} ${WRKSRC}/dhcpctl/omshell.? ${WRKSRC}/omshell
X	@${CP} ${FILESDIR}/omshell::Makefile.dist \
X		${WRKSRC}/omshell/Makefile.dist
X
Xextract-script:
X	@${CP} ${FILESDIR}/client::scripts::freebsd ${WRKSRC}/client/scripts/freebsd
X
X# Post-patch
X#
X
Xpost-patch: patch-scripts patch-makefile-conf \
X	    patch-makefiles-dist patch-man-pages \
X	    patch-pkgmessage patch-site-conf
X
Xpatch-scripts:
X	@${REINPLACE_CMD} ${REINPLACE_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
X		${WRKSRC}/client/dhclient.conf \
X		${WRKSRC}/client/scripts/freebsd
X
Xpatch-site-conf:
X.if ${SUBSYS} == client && !defined(WITHOUT_INTERFACE_POLLING)
X	@${ECHO_CMD} CFLAGS += -DENABLE_POLLING_MODE >> ${WRKSRC}/site.conf
X.endif
X.if ${SUBSYS} == server
X.if !defined(WITHOUT_DHCP_PARANOIA)
X	@${ECHO_CMD} CFLAGS += -DPARANOIA >> ${WRKSRC}/site.conf
X.endif
X.if !defined(WITHOUT_DHCP_JAIL)
X	@${ECHO_CMD} CFLAGS += -DJAIL >> ${WRKSRC}/site.conf
X.if defined(WITH_DHCP_SOCKETS)
X	@${ECHO_CMD} CFLAGS += -DUSE_SOCKETS >> ${WRKSRC}/site.conf
X.endif
X.endif
X.endif
X
Xpatch-makefile-conf:
X	@${REINPLACE_CMD} -e 's|^DEBUG[ 	]*=|# DEBUG ?=|g' \
X		${WRKSRC}/Makefile.conf
X
Xpatch-makefiles-dist:
X.for subdir in ${PATCH_SUBDIRS}
X	@${REINPLACE_CMD} -e 's|^CFLAGS[ 	]*=|CFLAGS +=|g' \
X		${WRKSRC}/${subdir}/Makefile.dist
X.endfor
X
X# temporary hack - no patch file needed for this typo.
Xpatch-man-pages:
X	@${REINPLACE_CMD} -e '/^\.Fd$$/d' ${WRKSRC}/dhcpctl/dhcpctl.3
X
Xpatch-pkgmessage:
X.if ${SUBSYS} != devel
X	@${SED} ${PKGMESSAGE_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
X		${MSG_FILE} > ${PKGMESSAGE}
X.endif
X
X# Post-install
X#
X
XPOST-INSTALL=	parallel-post-install install-rc-script configure-package \
X		display-message
X.ORDER: ${POST-INSTALL}
Xpost-install: ${POST-INSTALL}
X
Xparallel-post-install: \
X	strip-binary-files \
X	install-doc-files install-sample-files create-conf-files \
X	create-data-files
X
Xstrip-binary-files:
X.for f in ${BIN_FILES}
X.if exists(${PREFIX}/bin/${f})
X	@${STRIP_CMD} ${PREFIX}/bin/${f}
X.endif
X.if exists(${PREFIX}/sbin/${f})
X	@${STRIP_CMD} ${PREFIX}/sbin/${f}
X.endif
X.endfor
X
Xinstall-doc-files:
X.if !defined(NOPORTDOCS)
X	@${MKDIR} ${DOCSDIR}
X.for f in ${PORTDOCS}
X	@${INSTALL_DATA} ${WRKSRC}/${f} ${DOCSDIR}
X.endfor
X.endif
X
Xinstall-sample-files:
X.for f in ${SAMP_FILES}
X	@${INSTALL_DATA} ${WRKSRC}/${f} ${CONF_DIR}/${f:T}${SAMP_SUFX}
X.endfor
X
Xcreate-conf-files:
X.for f in ${LOCAL_CONF_FILES}
X.if !exists(${CONF_DIR}/${f})
X	@${TOUCH} ${CONF_DIR}/${f}
X.endif
X.endfor
X
Xcreate-data-files:
X.for f in ${DATA_FILES}
X.if !exists(${DATADIR}/${f})
X	@${TOUCH} ${DATADIR}/${f}
X.endif
X.endfor
X
Xconfigure-package:
X.if ${SUBSYS} == server
X	@${SETENV} ${SCRIPTS_ENV} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
X.endif
X
Xdisplay-message:
X.if ${SUBSYS} != devel
X	@${ECHO_MSG}
X	@${CAT} ${PKGMESSAGE}
X	@${ECHO_MSG}
X.endif
X
X.include <bsd.port.post.mk>
END-of-isc-dhcp31-server/Makefile
echo x - isc-dhcp31-server/pkg-plist
sed 's/^X//' >isc-dhcp31-server/pkg-plist << 'END-of-isc-dhcp31-server/pkg-plist'
X at comment $FreeBSD: ports/net/isc-dhcp3-server/pkg-plist,v 1.31 2006/08/25 12:02:58 sem Exp $
X at unexec %D/etc/rc.d/isc-dhcpd.sh forcestop 2>/dev/null || true
X at unexec %D/etc/rc.d/isc-dhcpd forcestop 2>/dev/null || true
Xbin/omshell
Xetc/dhcpd.conf.sample
Xsbin/dhcpd
END-of-isc-dhcp31-server/pkg-plist
echo x - isc-dhcp31-server/pkg-message
sed 's/^X//' >isc-dhcp31-server/pkg-message << 'END-of-isc-dhcp31-server/pkg-message'
X****  To setup dhcpd, you may have to copy %%PREFIX%%/etc/dhcpd.conf.sample
X      to %%PREFIX%%/etc/dhcpd.conf for editing.
X
X****  This port installs dhcp daemon, but don't invokes dhcpd by default. If
X      you want to invoke dhcpd at startup, put these lines into /etc/rc.conf.
X
X	    dhcpd_enable="YES"				# dhcpd enabled?
X	    dhcpd_flags="-q"				# command option(s)
X	    dhcpd_conf="%%PREFIX%%/etc/dhcpd.conf"	# configuration file
X	    dhcpd_ifaces=""				# ethernet interface(s)
X	    dhcpd_withumask="022"			# file creation mask
X
X****  If compiled with paranoia support (the default), the following lines
X      are also supported:
X
X	    dhcpd_chuser_enable="YES"			# runs w/o privileges?
X	    dhcpd_withuser="dhcpd"			# user name to run as
X	    dhcpd_withgroup="dhcpd"			# group name to run as
X	    dhcpd_chroot_enable="YES"			# runs chrooted?
X	    dhcpd_devfs_enable="YES"		      # use devfs if available?
X	    dhcpd_makedev_enable="YES"		      # use MAKEDEV instead?
X	    dhcpd_rootdir="/var/db/dhcpd"		# directory to run in
X	    dhcpd_includedir="<some_dir>"		# directory with config-
X							  files to include
X	    dhcpd_flags="-early_chroot"			# needs full root
X
X      WARNING: -early_chroot requires a jail(8) like environment to work.
X
X      WARNING: dhcpd_devfs_enable and dhcpd_makedev_enable are mutually
X               exclusive 
X               dhcpd_makedev_enable make NO sense on FreeBSD 5.x and up!
X
X****  If compiled with jail support (the default), the following lines are
X      also supported (-early_chroot and dhcpd_chroot_enable=YES are implied):
X
X	    dhcpd_jail_enable="YES"			# runs imprisoned?
X            dhcpd_hostname="<hostname>"			# jail hostname
X            dhcpd_ipaddress="<ip address>"		# jail ip address
X
X      WARNING: dhcpd_rootdir needs to point to a full jail(8) environment.
X
X****  WARNING: never edit the chrooted or jailed dhcpd.conf file but
X      %%PREFIX%%/etc/dhcpd.conf instead which is always copied where
X      needed upon startup.
X
X****  WARNING: %%PREFIX%%/etc/rc.isc-dhcpd.conf is obsolete.  rc.conf like
X      variables are still read there but should be moved /etc/rc.conf or
X      /etc/rc.conf.d/dhcpd instead.  Also, the dhcpd_options variable must
X      be renamed dhcpd_flags if any.
END-of-isc-dhcp31-server/pkg-message
echo x - isc-dhcp31-server/distinfo
sed 's/^X//' >isc-dhcp31-server/distinfo << 'END-of-isc-dhcp31-server/distinfo'
XMD5 (dhcp-3.1.0.tar.gz) = 27d179a3c3fbef576566b456a1168246
XSHA256 (dhcp-3.1.0.tar.gz) = 26d02217f53e40ab7c7140cf58d99b55a64979c8501481b28da9c432f0f92243
XSIZE (dhcp-3.1.0.tar.gz) = 797100
END-of-isc-dhcp31-server/distinfo
exit



>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list