From owner-svn-ports-head@freebsd.org Tue Jan 9 20:51:42 2018 Return-Path: Delivered-To: svn-ports-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 13BC6E71B7B; Tue, 9 Jan 2018 20:51:42 +0000 (UTC) (envelope-from zi@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A571F70533; Tue, 9 Jan 2018 20:51:41 +0000 (UTC) (envelope-from zi@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C92271C190; Tue, 9 Jan 2018 20:51:40 +0000 (UTC) (envelope-from zi@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w09KpeOB095178; Tue, 9 Jan 2018 20:51:40 GMT (envelope-from zi@FreeBSD.org) Received: (from zi@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w09KpdrG095158; Tue, 9 Jan 2018 20:51:39 GMT (envelope-from zi@FreeBSD.org) Message-Id: <201801092051.w09KpdrG095158@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: zi set sender to zi@FreeBSD.org using -f From: Ryan Steinmetz Date: Tue, 9 Jan 2018 20:51:39 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r458570 - in head/net: . isc-dhcp44-client isc-dhcp44-relay isc-dhcp44-server isc-dhcp44-server/files X-SVN-Group: ports-head X-SVN-Commit-Author: zi X-SVN-Commit-Paths: in head/net: . isc-dhcp44-client isc-dhcp44-relay isc-dhcp44-server isc-dhcp44-server/files X-SVN-Commit-Revision: 458570 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jan 2018 20:51:42 -0000 Author: zi Date: Tue Jan 9 20:51:38 2018 New Revision: 458570 URL: https://svnweb.freebsd.org/changeset/ports/458570 Log: New ports: net/isc-dhcp44-server, net/isc-dhcp44-client, net/isc-dhcp44-relay: The ISC Dynamic Host Configuration Protocol Distribution provides a freely redistributable reference implementation of all aspects of the DHCP protocol, through a suite of DHCP tools: * A DHCP server (this port) * A DHCP client * A DHCP relay agent WWW: https://www.isc.org/products/DHCP/ Added: head/net/isc-dhcp44-client/ head/net/isc-dhcp44-client/Makefile (contents, props changed) head/net/isc-dhcp44-client/pkg-descr (contents, props changed) head/net/isc-dhcp44-client/pkg-message (contents, props changed) head/net/isc-dhcp44-client/pkg-plist (contents, props changed) head/net/isc-dhcp44-relay/ head/net/isc-dhcp44-relay/Makefile (contents, props changed) head/net/isc-dhcp44-relay/pkg-descr (contents, props changed) head/net/isc-dhcp44-relay/pkg-message (contents, props changed) head/net/isc-dhcp44-relay/pkg-plist (contents, props changed) head/net/isc-dhcp44-server/ head/net/isc-dhcp44-server/Makefile (contents, props changed) head/net/isc-dhcp44-server/distinfo (contents, props changed) head/net/isc-dhcp44-server/files/ head/net/isc-dhcp44-server/files/extra-patch-bind_Makefile.in (contents, props changed) head/net/isc-dhcp44-server/files/isc-dhcpd.in (contents, props changed) head/net/isc-dhcp44-server/files/isc-dhcrelay.in (contents, props changed) head/net/isc-dhcp44-server/files/patch-client__dhclient.conf.example (contents, props changed) head/net/isc-dhcp44-server/pkg-descr (contents, props changed) head/net/isc-dhcp44-server/pkg-message (contents, props changed) head/net/isc-dhcp44-server/pkg-plist (contents, props changed) Modified: head/net/Makefile Modified: head/net/Makefile ============================================================================== --- head/net/Makefile Tue Jan 9 20:41:44 2018 (r458569) +++ head/net/Makefile Tue Jan 9 20:51:38 2018 (r458570) @@ -284,6 +284,9 @@ SUBDIR += isc-dhcp43-client SUBDIR += isc-dhcp43-relay SUBDIR += isc-dhcp43-server + SUBDIR += isc-dhcp44-client + SUBDIR += isc-dhcp44-relay + SUBDIR += isc-dhcp44-server SUBDIR += istgt SUBDIR += jags SUBDIR += jakarta-commons-net Added: head/net/isc-dhcp44-client/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/isc-dhcp44-client/Makefile Tue Jan 9 20:51:38 2018 (r458570) @@ -0,0 +1,9 @@ +# Created by: Ryan Steinmetz +# $FreeBSD$ + +COMMENT= The ISC Dynamic Host Configuration Protocol client + +SUBSYS= client +MASTERDIR= ${.CURDIR}/../isc-dhcp44-server + +.include "${MASTERDIR}/Makefile" Added: head/net/isc-dhcp44-client/pkg-descr ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/isc-dhcp44-client/pkg-descr Tue Jan 9 20:51:38 2018 (r458570) @@ -0,0 +1,9 @@ +The ISC Dynamic Host Configuration Protocol Distribution provides a +freely redistributable reference implementation of all aspects of the +DHCP protocol, through a suite of DHCP tools: + + * A DHCP server + * A DHCP client (this port) + * A DHCP relay agent + +WWW: https://www.isc.org/products/DHCP/ Added: head/net/isc-dhcp44-client/pkg-message ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/isc-dhcp44-client/pkg-message Tue Jan 9 20:51:38 2018 (r458570) @@ -0,0 +1,10 @@ +**** To setup dhclient, you may need to edit /etc/rc.conf to replace the + base system dhclient as follows: + + dhclient_program="%%PREFIX%%/sbin/dhclient" + dhclient_flags="-q" + + See dhclient(8), using the following command, for details about other + possible options: + + MANPATH=%%MAN1PREFIX%%/man man 8 dhclient Added: head/net/isc-dhcp44-client/pkg-plist ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/isc-dhcp44-client/pkg-plist Tue Jan 9 20:51:38 2018 (r458570) @@ -0,0 +1,11 @@ +sbin/dhclient +sbin/dhclient-script +man/man5/dhclient.conf.5.gz +man/man5/dhclient.leases.5.gz +man/man8/dhclient.8.gz +man/man8/dhclient-script.8.gz +@unexec if cmp -s %D/etc/dhclient.conf.example %D/etc/dhclient.conf; then rm -f %D/etc/dhclient.conf; fi +etc/dhclient.conf.example +@exec if [ ! -f %D/etc/dhclient.conf ] ; then cp -p %D/%F %B/dhclient.conf; fi +@exec [ -f /var/run/dhclient.leases ] || touch /var/run/dhclient.leases +@unexec [ -s /var/run/dhclient.leases ] || rm -f /var/run/dhclient.leases Added: head/net/isc-dhcp44-relay/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/isc-dhcp44-relay/Makefile Tue Jan 9 20:51:38 2018 (r458570) @@ -0,0 +1,9 @@ +# Created by: Ryan Steinmetz +# $FreeBSD$ + +COMMENT= The ISC Dynamic Host Configuration Protocol relay + +SUBSYS= relay +MASTERDIR= ${.CURDIR}/../isc-dhcp44-server + +.include "${MASTERDIR}/Makefile" Added: head/net/isc-dhcp44-relay/pkg-descr ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/isc-dhcp44-relay/pkg-descr Tue Jan 9 20:51:38 2018 (r458570) @@ -0,0 +1,9 @@ +The ISC Dynamic Host Configuration Protocol Distribution provides a +freely redistributable reference implementation of all aspects of the +DHCP protocol, through a suite of DHCP tools: + + * A DHCP server + * A DHCP client + * A DHCP relay agent (this port) + +WWW: https://www.isc.org/products/DHCP/ Added: head/net/isc-dhcp44-relay/pkg-message ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/isc-dhcp44-relay/pkg-message Tue Jan 9 20:51:38 2018 (r458570) @@ -0,0 +1,8 @@ +**** This port installs the dhcp relay daemon, but doesn't invoke dhcrelay by + default. If you want to invoke dhcrelay at startup, add the following + lines to /etc/rc.conf: + + dhcrelay_enable="YES" + dhcrelay_flags="" # command option(s) + dhcrelay_servers="" # dhcrelay server(s) + dhcrelay_ifaces="" # ethernet interface(s) Added: head/net/isc-dhcp44-relay/pkg-plist ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/isc-dhcp44-relay/pkg-plist Tue Jan 9 20:51:38 2018 (r458570) @@ -0,0 +1,6 @@ +@unexec %D/etc/rc.d/isc-dhcrelay.sh forcestop 2>/dev/null || true +@unexec %D/etc/rc.d/isc-dhcrelay forcestop 2>/dev/null || true +%%IPV6%%@unexec %D/etc/rc.d/isc-dhcrelay6 forcestop 2>/dev/null || true +%%IPV6%%etc/rc.d/isc-dhcrelay6 +sbin/dhcrelay +man/man8/dhcrelay.8.gz Added: head/net/isc-dhcp44-server/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/isc-dhcp44-server/Makefile Tue Jan 9 20:51:38 2018 (r458570) @@ -0,0 +1,185 @@ +# Created by: Ryan Steinmetz +# $FreeBSD$ + +PORTNAME= dhcp +PORTVERSION= 4.4.0b1 +PORTREVISION= ${DHCP_PORTREVISION} +CATEGORIES= net +MASTER_SITES= ISC/${PORTNAME}/${PORTVERSION:S/P/-P/g} \ + ZI +PKGNAMEPREFIX= isc- +PKGNAMESUFFIX= 44-${SUBSYS} +DISTNAME= ${PORTNAME}-${PORTVERSION:S/P/-P/g} + +MAINTAINER= zi@FreeBSD.org +COMMENT?= ISC Dynamic Host Configuration Protocol server + +LICENSE= ISCL + +USES= gmake + +PORTREVISION_SERVER= 0 +PORTREVISION_CLIENT= 0 +PORTREVISION_RELAY= 0 + +SUBSYS?= server + +OPTIONS_DEFINE= IPV6 + +.if ${SUBSYS} == server +OPTIONS_DEFINE+= PARANOIA LDAP LDAP_SSL BIND_SYMBOLS DHCP4O6 +OPTIONS_DEFAULT+= PARANOIA LDAP_SSL +DHCP4O6_DESC= Enable DHCPv4-over-DHCPv6 (TSV) +PARANOIA_DESC= Enable support for chroot +LDAP_SSL_DESC= Support LDAP over SSL/TLS +BIND_SYMBOLS_DESC= Enable BIND internal symbol table +.endif + +# PORTREVISION and CONFLICTS handling +.if ${SUBSYS} == client +CONFLICTS= isc-dhcp3?-client-[0-9]* isc-dhcp4[123]-client-[0-9]* +DHCP_PORTREVISION= ${PORTREVISION_CLIENT} +.elif ${SUBSYS} == relay +CONFLICTS= isc-dhcp3?-relay-[0-9]* isc-dhcp4[123]-relay-[0-9]* +DHCP_PORTREVISION= ${PORTREVISION_RELAY} +.else +CONFLICTS= isc-dhcp3?-server-[0-9]* isc-dhcp4[123]-server-[0-9]* +DHCP_PORTREVISION= ${PORTREVISION_SERVER} +.endif +MAKE_JOBS_UNSAFE= yes + +.if ${SUBSYS} == server +USERS= dhcpd +GROUPS= dhcpd +.endif + +MAN_COMPRESSED= no +GNU_CONFIGURE= yes +CPPFLAGS+= -D_PATH_DHCLIENT_SCRIPT='\"${PREFIX}/sbin/dhclient-script\"' -D_PATH_DHCLIENT_CONF='\"${PREFIX}/etc/dhclient.conf\"' -D_PATH_DHCPD_CONF='\"${PREFIX}/etc/dhcpd.conf\"' +SCRIPTS_ENV+= PKG_PREFIX=${PREFIX} + +.include + +.if ${SUBSYS} == server +CONFIGURE_ARGS+=--localstatedir=/var +CFLAGS+= -fPIC +.endif + +DESCR= ${.CURDIR}/pkg-descr +PLIST= ${.CURDIR}/pkg-plist + +.if ${SUBSYS} == server +USE_RC_SUBR= isc-dhcpd +.elif ${SUBSYS} == relay +USE_RC_SUBR= isc-dhcrelay +.endif + +SCHEMA_DIR= ${PREFIX}/share/${PKGBASE} +DOCSDIR= ${PREFIX}/share/doc/${PKGBASE} +DATADIR= /var/db + +MSG_FILE= ${.CURDIR}/pkg-message +PKGMESSAGE= ${WRKDIR}/pkg-message + +REINPLACE_SUB= PREFIX="${PREFIX}" +PKGMESSAGE_SUB= PREFIX="${PREFIX}" MAN1PREFIX="${MAN1PREFIX}" \ + DOCSDIR="${DOCSDIR}" + +.if ${PORT_OPTIONS:MPARANOIA} +CONFIGURE_ARGS+=--enable-paranoia --enable-early-chroot +SUB_LIST+= PARANOIA="yes" +.else +SUB_LIST+= PARANOIA="no" +.endif + +.if ${PORT_OPTIONS:MLDAP} +CONFIGURE_ARGS+=--with-ldap --with-ldapcrypto +USE_OPENLDAP= yes +LDAP_SCRIPT= ${WRKSRC}/contrib/ldap/dhcpd-conf-to-ldap +LDAP_SCHEMA= ${WRKSRC}/contrib/ldap/dhcp.schema +LDAP_README= ${WRKSRC}/contrib/ldap/README.ldap +CPPFLAGS+= -I${LOCALBASE}/include -L${LOCALBASE}/lib +LIBS+= -L${LOCALBASE}/lib +PORTDOCS+= README.ldap +PLIST_SUB+= SCHEMA_DIR="${SCHEMA_DIR:S,^${PREFIX}/,,}" LDAP="" +USES+= shebangfix +SHEBANG_FILES= contrib/ldap/dhcpd-conf-to-ldap +.else +PLIST_SUB+= LDAP="@comment " +.endif + +.if ${PORT_OPTIONS:MLDAP_SSL} && ${PORT_OPTIONS:MLDAP} +USES+= ssl +CONFIGURE_ARGS+=--with-ldapcrypto +LIBS+= -lssl +.endif + +.if ${PORT_OPTIONS:MIPV6} +CONFIGURE_ARGS+=--enable-dhcpv6 +PLIST_SUB+= IPV6="" +.else +CONFIGURE_ARGS+=--disable-dhcpv6 +PLIST_SUB+= IPV6="@comment " +.endif + +.if ${PORT_OPTIONS:MDHCP4O6} +CONFIGURE_ARGS+=--enable-dhcpv4o6 +PLIST_SUB+= DHCP4O6="" +.else +CONFIGURE_ARGS+=--disable-dhcpv4o6 +PLIST_SUB+= DHCP4O6="@comment " +.endif + +.if ${PORT_OPTIONS:MBIND_SYMBOLS} +USES+= perl5 +.else +EXTRA_PATCHES+= ${PATCHDIR}/extra-patch-bind_Makefile.in +.endif + +post-patch: + @${SED} ${PKGMESSAGE_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \ + ${MSG_FILE} > ${PKGMESSAGE} + @${REINPLACE_CMD} -e 's|/usr/local||g' \ + ${WRKSRC}/doc/examples/dhcpd-dhcpv6.conf + @${REINPLACE_CMD} ${REINPLACE_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \ + ${WRKSRC}/client/dhclient.conf.example + +do-install: + ${SETENV} DESTDIR=${STAGEDIR} ${MAKE} -C ${WRKSRC}/${SUBSYS} install +.if ${SUBSYS} == server + ${SETENV} DESTDIR=${STAGEDIR} ${MAKE} -C ${WRKSRC}/dhcpctl install +#${SETENV} DESTDIR=${STAGEDIR} ${MAKE} -C ${WRKSRC}/dst install + ${SETENV} DESTDIR=${STAGEDIR} ${MAKE} -C ${WRKSRC}/omapip install + ${SETENV} DESTDIR=${STAGEDIR} ${MAKE} -C ${WRKSRC}/includes install + ${SETENV} DESTDIR=${STAGEDIR} ${MAKE} -C ${WRKSRC}/common install + ${INSTALL_DATA} ${WRKSRC}/dhcpctl/dhcpctl.h ${STAGEDIR}${PREFIX}/include + ${MV} ${STAGEDIR}${PREFIX}/etc/dhcpd.conf.example ${STAGEDIR}${PREFIX}/etc/dhcpd.conf.sample +.if ${PORT_OPTIONS:MIPV6} + ${INSTALL_DATA} ${WRKSRC}/doc/examples/dhcpd-dhcpv6.conf \ + ${STAGEDIR}${PREFIX}/etc/dhcpd6.conf.sample +.endif +.if ${PORT_OPTIONS:MLDAP} + @${MKDIR} ${STAGEDIR}${SCHEMA_DIR} + ${INSTALL_DATA} ${LDAP_SCHEMA} ${STAGEDIR}${SCHEMA_DIR} + ${INSTALL_SCRIPT} ${LDAP_SCRIPT} ${STAGEDIR}${PREFIX}/bin +.endif +.if ${PORT_OPTIONS:MLDAP} + ${MKDIR} ${STAGEDIR}${DOCSDIR} + ${INSTALL_MAN} ${LDAP_README} ${STAGEDIR}${DOCSDIR} +.endif +.endif +.if ${SUBSYS} == client + ${INSTALL_SCRIPT} ${WRKSRC}/client/scripts/freebsd ${STAGEDIR}${PREFIX}/sbin/dhclient-script +.elif ${SUBSYS} == server +.if ${PORT_OPTIONS:MIPV6} + @${LN} -sf isc-dhcpd ${STAGEDIR}${PREFIX}/etc/rc.d/isc-dhcpd6 +.endif +.elif ${SUBSYS} == relay +.if ${PORT_OPTIONS:MIPV6} + @${LN} -sf isc-dhcrelay ${STAGEDIR}${PREFIX}/etc/rc.d/isc-dhcrelay6 +.endif +.endif + @${SED} ${PKGMESSAGE_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \ + ${MSG_FILE} > ${PKGMESSAGE} + +.include Added: head/net/isc-dhcp44-server/distinfo ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/isc-dhcp44-server/distinfo Tue Jan 9 20:51:38 2018 (r458570) @@ -0,0 +1,3 @@ +TIMESTAMP = 1515530294 +SHA256 (dhcp-4.4.0b1.tar.gz) = 9bb9fcef57e31660d43c83481d60cfa16fd2ad99fd7bbe7f0ae2ca81406a80c2 +SIZE (dhcp-4.4.0b1.tar.gz) = 11151721 Added: head/net/isc-dhcp44-server/files/extra-patch-bind_Makefile.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/isc-dhcp44-server/files/extra-patch-bind_Makefile.in Tue Jan 9 20:51:38 2018 (r458570) @@ -0,0 +1,11 @@ +--- bind/Makefile.in.orig 2018-01-05 14:28:00 UTC ++++ bind/Makefile.in +@@ -21,7 +21,7 @@ bindsrcdir=@BINDSRCDIR@ + prefix = @prefix@ + exec_prefix = @exec_prefix@ + +-bindconfig = --without-openssl --without-libxml2 --without-libjson \ ++bindconfig = --disable-symtable --without-openssl --without-libxml2 --without-libjson \ + --without-gssapi --disable-threads --without-lmdb \ + --includedir=@includedir@ --libdir=@libdir@ \ + @BINDLT@ @BINDIOMUX@ @BINDCONFIG@ --enable-full-report Added: head/net/isc-dhcp44-server/files/isc-dhcpd.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/isc-dhcp44-server/files/isc-dhcpd.in Tue Jan 9 20:51:38 2018 (r458570) @@ -0,0 +1,536 @@ +#! /bin/sh + +# $FreeBSD$ +# +# PROVIDE: dhcpd +# REQUIRE: DAEMON +# BEFORE: LOGIN +# KEYWORD: shutdown +# +# Add the following line to /etc/rc.conf to enable dhcpd: +# +# dhcpd_enable="YES" + +. /etc/rc.subr + +# service(8) does not create an authentic environment, try to guess, +# and as of 10.3-RELEASE-p0, it will not find the indented name= +# assignments below. So give it a default. +# Trailing semicolon also for service(8)'s benefit: +name="$file" ; + +case $0 in +/etc/rc*) + # during boot (shutdown) $0 is /etc/rc (/etc/rc.shutdown), + # so get the name of the script from $_file + name=$_file + ;; +*) + name=$0 + ;; +esac + +# default name to "dhcpd" if guessing failed +# Trailing semicolon also for service(8)'s benefit: +name="${name:-dhcpd}" ; +name=${name##*/isc-} + +paranoia=%%PARANOIA%% # compiled in paranoia? + +load_rc_config ${name} + +# override these variables in /etc/rc.conf +eval ": \${${name}_enable:=\"NO\"}" +# dhcpd_flags="" # -q -early_chroot # command option(s) +# dhcpd_ifaces="" # ethernet interface(s) +eval ": \${${name}_conf:=%%PREFIX%%/etc/${name}.conf}" # configuration file +eval ": \${${name}_withumask:=022}" # file creation mask + +eval ": \${${name}_chuser_enable:=\"%%PARANOIA%%\"}" # runs w/o privileges? +eval ": \${${name}_withuser:=dhcpd}" # user name to run as +eval ": \${${name}_withgroup:=dhcpd}" # group name to run as + +eval ": \${${name}_chroot_enable:=\"NO\"}" # runs chrooted? +eval ": \${${name}_devfs_enable:=\"YES\"}" # devfs if available? +eval ": \${${name}_chrootdir:=/var/db/${name}}" # directory to run in +# dhcpd_includedir="" # directory for included config files + +safe_run () # rc command [args...] +{ + local _rc + + _rc=$1 + shift + + if [ "${_rc}" -eq 0 ]; then + debug safe_run: "$@" + "$@" || _rc=1 + else + warn safe_run: "$@" + fi + return ${_rc} +} + +precious () # entry... +{ + local _entry _rc + + _rc=0 + for _entry; do + # do nothing if /dev, /var/run or /var/db + echo ${_entry} | egrep -q '^//*(dev|var//*(run|db))?/*$' || _rc=1 + done + debug precious: "$@" rc=${_rc} + return ${_rc} +} + +lsmod () # user group file... +{ + local _entry _user _group _rc + + _user=$1 _group=$2 + shift 2 + + _rc=0 + for _entry; do + ls -ld ${_entry} 2> /dev/null | + awk -v u=${_user} -v g=${_group} '{ + exit ((u && $3 != u) || (g && $4 != g)) + }' || _rc=1 + done + debug lsmod: "$@" rc=${_rc} + return ${_rc} +} + +safe_chmog () # entry... +{ + local _entry _user _group _usergroup _rc + + eval "_user=\${${name}_withuser}" + eval "_group=\${${name}_withgroup}" + + _rc=0 + if [ -n "${_user}" -o -n "${_group}" ]; then + _usergroup=${_user}${_group:+:${_group}} + for _entry; do + if [ -d ${_entry} ] && mounted ${_entry}; then + continue + fi + if [ -e ${_entry} ] && + ! precious ${_entry} && + ! lsmod ${_user} ${_group} ${_entry} && + ! safe_run ${_rc} chown ${_usergroup} ${_entry}; then + warn "unable to change permissions of ${_entry}" + _rc=1 + fi + done + fi + return ${_rc} +} + +safe_mkdir () # dir... +{ + local _dir _rc + + _rc=0 + for _dir; do + if [ ! -d ${_dir} ] && + ! precious ${_dir} && + ! safe_run ${_rc} mkdir -p ${_dir}; then + err 1 "unable to create directory ${_dir}" + _rc=1 + fi + done + safe_run ${_rc} safe_chmog "$@" || _rc=1 + return ${_rc} +} + +safe_rmdir () # dir... +{ + local _dir _rc + + _rc=0 + for _dir; do + if [ -d ${_dir} ] && + ! precious ${_dir} && + ! mounted ${_dir}; then + if safe_run ${_rc} rmdir ${_dir}; then + safe_run ${_rc} safe_rmdir ${_dir%/*} || _rc=1 + else + warn "unable to remove directory ${_dir}" + _rc=1 + fi + fi + done + return ${_rc} +} + +safe_touch () # file... +{ + local _file _rc + + _rc=0 + for _file; do + if [ ! -e ${_file} ] && + ! safe_run ${_rc} touch ${_file}; then + err 1 "unable to create file ${_file}" + _rc=1 + fi + done + safe_run ${_rc} safe_chmog "$@" || _rc=1 + return ${_rc} +} + +safe_remove () # entry... +{ + local _entry _rc + + _rc=0 + for _entry; do + if [ -f ${_entry} ]; then + if ! safe_run ${_rc} rm -f ${_entry}; then + warn "unable to remove file ${_entry}" + _rc=1 + fi + elif [ -d ${_entry} ] && + ! precious ${_entry} && + ! mounted ${_entry}; then + if ! safe_run ${_rc} rm -rf ${_entry}; then + warn "unable to remove directory ${_entry}" + _rc=1 + fi + fi + done + return ${_rc} +} + +safe_copy () # src dst +{ + local _src _dst _rc + + _src=$1 _dst=$2 + + _rc=0 + if [ -f ${_src} ]; then + if ! safe_run ${_rc} safe_remove ${_dst} || + ! safe_run ${_rc} cp -p ${_src} ${_dst}; then + err 1 "unable to copy file ${_src} to ${_dst}" + _rc=1 + fi + safe_run ${_rc} safe_chmog ${_dst} || _rc=1 + elif [ -d ${_src} ] && + ! precious ${_dst} && + ! mounted ${_dst}; then + if ! safe_run ${_rc} pax -rw -pe -ts "|^${_src}||" \ + ${_src} ${_dst}; then + err 1 "unable to copy directory ${_src} to ${_dst}" + _rc=1 + fi + else + err 1 "unable to copy ${_src} to ${_dst}" \ + "-- not a file or a directory" + _rc=1 + fi + return ${_rc} +} + +mounted () # dir... +{ + local _rc + + _rc=1 + if checkyesno ${name}_devfs_enable; then + mount -t devfs | awk ' + BEGIN { n = ARGC; ARGC = 2 } + { for (i = 2; i != n; i++) if ($3 == ARGV[i]) exit 1 } + ' - "$@" || _rc=0 + fi + debug mounted: "$@" rc=${_rc} + return ${_rc} +} + +safe_mount () # dir +{ + local _dir _rc + + _dir=$1 + + _rc=0 + if checkyesno ${name}_devfs_enable && + ! mounted ${_dir} && + ! safe_run ${_rc} mount -t devfs devfs ${_dir}; then + err 1 "unable to mount ${_dir}" + _rc=1 + fi + return ${_rc} +} + +safe_umount () # dir +{ + local _dir _rc + + _dir=$1 + + _rc=0 + if checkyesno ${name}_devfs_enable && + mounted ${_dir} && + ! safe_run ${_rc} umount ${_dir}; then + warn "unable to unmount ${_dir}" + _rc=1 + fi + return ${_rc} +} + +check_chuser () +{ + if checkyesno paranoia; then + if checkyesno ${name}_chuser_enable && + eval "[ -z \"\${${name}_withuser}\" -a -z \"\${${name}_withgroup}\" ]"; then + err 1 "one of ${name}_withuser and ${name}_withgroup" \ + "must be set if ${name}_chuser_enable is enabled" + fi + else + if checkyesno ${name}_chuser_enable; then + warn "${name}_chuser_enable disabled -- not compiled in" + eval "${name}_chuser_enable=NO" + fi + fi +} + +check_chroot () +{ + if checkyesno paranoia; then + if checkyesno ${name}_chroot_enable; then + if eval "[ -z \"\${${name}_chrootdir}\" ]"; then + err 1 "${name}_chrootdir must be set" \ + "if ${name}_chroot_enable is enabled" + fi + else + eval "${name}_devfs_enable=NO" + fi + else + if checkyesno ${name}_chroot_enable; then + warn "${name}_chroot_enable disabled -- not compiled in" + eval "${name}_chroot_enable=NO" + fi + eval "${name}_devfs_enable=NO" + fi +} + +_rcvar_chuser () +{ + if checkyesno paranoia && checkyesno ${name}_chuser_enable; then + eval "${name}_piddir=\${__dhcpd_piddir}/\${name}" + eval "${name}_leasesdir=\${__dhcpd_leasesdir}/\${name}" + else + eval unset "${name}_withuser= ${name}_withgroup=" + fi +} + +_rcvar_chroot () +{ + if ! checkyesno paranoia || ! checkyesno ${name}_chroot_enable; then + eval "${name}_chrootdir=" + elif checkyesno paranoia && checkyesno ${name}_chroot_enable; then + eval "${name}_devdir=\${__dhcpd_devdir}" + eval "${name}_etcdir=\${__dhcpd_etcdir}" + fi +} + +_rcvar_pidnleases () +{ + if ! checkyesno ${name}_chuser_enable; then + eval "${name}_piddir=\${__dhcpd_piddir}" + eval "${name}_leasesdir=\${__dhcpd_leasesdir}" + fi + eval "${name}_pidfile=\${${name}_piddir}/\${name}.pid" + eval "${name}_leasesfile=\${${name}_leasesdir}/\${name}.leases" + eval "${name}_conffile=\${${name}_conf}" # for convenience only + eval "${name}_confdir=\$(dirname \${${name}_conffile})" +} + +_rcvar_rooted () +{ + eval "_dhcpd_chrootdir=\${${name}_chrootdir}" + eval "_dhcpd_devdir=\${${name}_chrootdir}\${${name}_devdir}" + eval "_dhcpd_etcdir=\${${name}_chrootdir}\${${name}_etcdir}" + eval "_dhcpd_confdir=\${${name}_chrootdir}\${${name}_confdir}" + eval "_dhcpd_includedir=\${${name}_chrootdir}\${${name}_includedir}" + eval "_dhcpd_piddir=\${${name}_chrootdir}\${${name}_piddir}" + eval "_dhcpd_leasesdir=\${${name}_chrootdir}\${${name}_leasesdir}" + eval "_dhcpd_conffile=\${${name}_chrootdir}\${${name}_conffile}" + eval "_dhcpd_pidfile=\${${name}_chrootdir}\${${name}_pidfile}" + eval "_dhcpd_leasesfile=\${${name}_chrootdir}\${${name}_leasesfile}" +} + +setup_umask () +{ + if eval "[ -n \"\${${name}_withumask}\" ]"; then + eval "umask \${${name}_withumask}" + fi +} + +setup_chroot () +{ + local _hconf _hosts _ltime _rconf + + _hconf=host.conf + _hosts=hosts + _ltime=localtime + _rconf=resolv.conf + + if checkyesno paranoia && checkyesno ${name}_chroot_enable; then + if ! mounted ${_dhcpd_devdir}; then + safe_mkdir ${_dhcpd_devdir}/_ + # XXX /_ hack! so, .../dev is root owned. + fi + safe_mkdir ${_dhcpd_chrootdir} ${_dhcpd_etcdir}/_ ${_dhcpd_confdir} + # XXX /_ hack! so, .../etc is root owned. + if checkyesno ${name}_devfs_enable; then + safe_mount ${_dhcpd_devdir} + else + eval "safe_copy \${${name}_devdir} \${_dhcpd_devdir}" + fi + eval "safe_copy \${${name}_conffile} \${_dhcpd_conffile}" + eval "safe_copy \${${name}_etcdir}/\$_hconf \${_dhcpd_etcdir}/\$_hconf" + eval "safe_copy \${${name}_etcdir}/\$_hosts \${_dhcpd_etcdir}/\$_hosts" + # copy localtime only if it exists + if eval "[ -f \"\${${name}_etcdir}/\$_ltime\" ]"; then + eval "safe_copy \${${name}_etcdir}/\$_ltime \${_dhcpd_etcdir}/\$_ltime" + fi + eval "safe_copy \${${name}_etcdir}/\$_rconf \${_dhcpd_etcdir}/\$_rconf" + # copy dhcpd_includedir if defined and available + if eval "[ -d \"\${${name}_includedir}\" ]"; then + safe_mkdir ${_dhcpd_includedir} + eval "safe_copy \${${name}_includedir} \${_dhcpd_includedir}" + fi + fi +} + +setup_chuser () +{ + if checkyesno paranoia && { + checkyesno ${name}_chuser_enable || checkyesno ${name}_chroot_enable + }; then + safe_mkdir ${_dhcpd_piddir} ${_dhcpd_leasesdir} + fi +} + +setup_leases () +{ + safe_touch ${_dhcpd_leasesfile} +} + +setup_flags () +{ + if [ "${name}" = "dhcpd6" ]; then + rc_flags="${rc_flags} -6" + fi + if eval "[ -n \"\${${name}_conf}\" ]"; then + eval "rc_flags=\"\${rc_flags} -cf \${${name}_conf}\"" + fi + if eval "[ -n \"\${${name}_leasesfile}\" ]"; then + eval "rc_flags=\"\${rc_flags} -lf \${${name}_leasesfile}\"" + fi + if eval "[ -n \"\${${name}_pidfile}\" ]"; then + eval "rc_flags=\"\${rc_flags} -pf \${${name}_pidfile}\"" + fi + if eval "[ -n \"\${${name}_withuser}\" ]"; then + eval "rc_flags=\"\${rc_flags} -user \${${name}_withuser}\"" + fi + if eval "[ -n \"\${${name}_withgroup}\" ]"; then + eval "rc_flags=\"\${rc_flags} -group \${${name}_withgroup}\"" + fi + if eval "[ -n \"\${${name}_chrootdir}\" ]"; then + eval "rc_flags=\"\${rc_flags} -chroot \${${name}_chrootdir}\"" + fi + eval "rc_flags=\"\${rc_flags} \${${name}_ifaces}\"" +} + +cleanup_chroot () +{ + if checkyesno paranoia && checkyesno ${name}_chroot_enable; then + safe_umount ${_dhcpd_devdir} + fi +} + +dhcpd_stop () +{ + if sh $0 forcestatus; then + sh $0 forcestop + fi +} + +dhcpd_check () +{ + check_chuser + check_chroot +} + +dhcpd_rcvar () +{ + _rcvar_chuser + _rcvar_chroot + _rcvar_pidnleases + _rcvar_rooted +} + +dhcpd_precmd () +{ + setup_umask + setup_chroot + setup_chuser + setup_leases + setup_flags +} + +dhcpd_postcmd () +{ + cleanup_chroot +} + +dhcpd_restartprecmd () +{ + setup_chroot + setup_flags + dhcpd_checkconfig +} + +dhcpd_checkconfig () +{ + local rc_flags_mod + setup_flags + rc_flags_mod="$rc_flags" + # Eliminate '-q' flag if it is present + case "$rc_flags" in + *-q*) rc_flags_mod=`echo "${rc_flags}" | sed -Ee 's/(^-q | -q | -q$)//'` ;; + esac + if ! ${command} -t -q ${rc_flags_mod}; then + err 1 "`${command} -t ${rc_flags_mod}` Configuration file sanity check failed" + fi +} + +rcvar=${name}_enable +load_rc_config ${name} + +__dhcpd_uninstall="NO" # internal use only +__dhcpd_devdir=/dev # devices directory +__dhcpd_etcdir=/etc # etc directory +__dhcpd_piddir=/var/run # pid file directory +__dhcpd_leasesdir=/var/db # leases file directory +#__dhcpd_chrootdir=/var/db/${name} # root directory + +dhcpd_check +dhcpd_rcvar + +command=%%PREFIX%%/sbin/dhcpd +pidfile=${_dhcpd_pidfile} +eval "required_files=\${${name}_conf}" +start_precmd=dhcpd_precmd +stop_postcmd=dhcpd_postcmd +restart_precmd="dhcpd_restartprecmd" +uninstall_cmd=dhcpd_uninstall +configtest_cmd="dhcpd_restartprecmd" +extra_commands="uninstall configtest" + +run_rc_command "$1" Added: head/net/isc-dhcp44-server/files/isc-dhcrelay.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/isc-dhcp44-server/files/isc-dhcrelay.in Tue Jan 9 20:51:38 2018 (r458570) @@ -0,0 +1,101 @@ +#!/bin/sh + +# $FreeBSD$ +# +# PROVIDE: dhcrelay +# REQUIRE: DAEMON +# KEYWORD: shutdown +# +# Add the following line to /etc/rc.conf to enable dhcrelay: +# +# dhcrelay_enable="YES" + +# override these variables in /etc/rc.conf +dhcrelay_enable=${dhcrelay_enable:-"NO"} +dhcrelay6_enable=${dhcrelay6_enable:-"NO"} +# dhcrelay_flags="" # command option(s) +# dhcrelay_servers="" # v4 dhcrelay server(s) +# dhcrelay_ifaces="" # v4 ethernet interface(s) +# dhcrelay6_lowers="" # v6 "lower" network interface(s) +# dhcrelay6_uppers="" # v6 "upper" network interface(s) + + +case $0 in +/etc/rc*) + # during boot (shutdown) $0 is /etc/rc (/etc/rc.shutdown), + # so get the name of the script from $_file + name=$_file + ;; +*) + name=$0 + ;; +esac + +name=${name##*/isc-} + +case ${name} in +*6) + ipversion=-6 + ;; +*) + ipversion=-4 + ;; +esac + +dhcrelay_precmd () +{ + local ifaces _servers _ifaces + + eval "_servers=\${${name}_servers}" + eval "_ifaces=\${${name}_ifaces}" + + if [ -z "${_servers}" ]; then + err 1 "no ${name} server(s) configured." + fi + + ifaces= + for iface in ${_ifaces}; do + ifaces="${ifaces} -i ${iface}" + done + + rc_flags="${rc_flags} ${ipversion} ${ifaces} ${_servers}" +} + +dhcrelay6_precmd () +{ + local lowers _lowers uppers _uppers + + eval "_lowers=\${${name}_lowers}" + eval "_uppers=\${${name}_uppers}" + + if [ -z "${_lowers}" ]; then + err 1 "no ${name} lower(s) configured." + fi + + if [ -z "${_uppers}" ]; then + err 1 "no ${name} upper(s) configured." + fi + + lowers= + for lower in ${_lowers}; do + lowers="${lowers} -l ${lower}" + done + + uppers= + for upper in ${_uppers}; do + uppers="${uppers} -u ${upper}" + done + + rc_flags="${rc_flags} ${ipversion} ${lowers} ${uppers}" +} + +. /etc/rc.subr + +rcvar=${name}_enable + +command=%%PREFIX%%/sbin/dhcrelay +pidfile=/var/run/${name}.pid +start_precmd=${name}_precmd + +load_rc_config ${name} +run_rc_command "$1" Added: head/net/isc-dhcp44-server/files/patch-client__dhclient.conf.example ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/isc-dhcp44-server/files/patch-client__dhclient.conf.example Tue Jan 9 20:51:38 2018 (r458570) @@ -0,0 +1,11 @@ +--- client/dhclient.conf.example.orig 2015-09-11 20:11:21 UTC ++++ client/dhclient.conf.example +@@ -11,7 +11,7 @@ retry 60; + reboot 10; + select-timeout 5; + initial-interval 2; +-script "/etc/dhclient-script"; ++script "%%PREFIX%%/sbin/dhclient-script"; + media "-link0 -link1 -link2", "link0 link1"; + reject 192.33.137.209; + Added: head/net/isc-dhcp44-server/pkg-descr ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/isc-dhcp44-server/pkg-descr Tue Jan 9 20:51:38 2018 (r458570) @@ -0,0 +1,9 @@ +The ISC Dynamic Host Configuration Protocol Distribution provides a +freely redistributable reference implementation of all aspects of the +DHCP protocol, through a suite of DHCP tools: + + * A DHCP server (this port) + * A DHCP client + * A DHCP relay agent + +WWW: https://www.isc.org/products/DHCP/ Added: head/net/isc-dhcp44-server/pkg-message ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/isc-dhcp44-server/pkg-message Tue Jan 9 20:51:38 2018 (r458570) @@ -0,0 +1,26 @@ +**** To setup dhcpd, please edit %%PREFIX%%/etc/dhcpd.conf. + +**** This port installs the dhcp daemon, but doesn't invoke dhcpd by default. + If you want to invoke dhcpd at startup, add these lines to /etc/rc.conf: + + dhcpd_enable="YES" # dhcpd enabled? + dhcpd_flags="-q" # command option(s) + dhcpd_conf="%%PREFIX%%/etc/dhcpd.conf" # configuration file + dhcpd_ifaces="" # ethernet interface(s) + dhcpd_withumask="022" # file creation mask + +**** If compiled with paranoia support (the default), the following rc.conf + options are also supported: *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***