From owner-svn-ports-all@freebsd.org Wed Jul 4 14:21:09 2018 Return-Path: Delivered-To: svn-ports-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 74C11103B67F; Wed, 4 Jul 2018 14:21:09 +0000 (UTC) (envelope-from swills@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 273C97E3A4; Wed, 4 Jul 2018 14:21:09 +0000 (UTC) (envelope-from swills@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 E261D43B9; Wed, 4 Jul 2018 14:21:08 +0000 (UTC) (envelope-from swills@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w64EL8Ej030793; Wed, 4 Jul 2018 14:21:08 GMT (envelope-from swills@FreeBSD.org) Received: (from swills@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w64EL88A030789; Wed, 4 Jul 2018 14:21:08 GMT (envelope-from swills@FreeBSD.org) Message-Id: <201807041421.w64EL88A030789@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: swills set sender to swills@FreeBSD.org using -f From: Steve Wills Date: Wed, 4 Jul 2018 14:21:07 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r473889 - in head/net/dhcpd: . files X-SVN-Group: ports-head X-SVN-Commit-Author: swills X-SVN-Commit-Paths: in head/net/dhcpd: . files X-SVN-Commit-Revision: 473889 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jul 2018 14:21:09 -0000 Author: swills Date: Wed Jul 4 14:21:07 2018 New Revision: 473889 URL: https://svnweb.freebsd.org/changeset/ports/473889 Log: net/dhcpd: Add option to disable PF support While here, remove unneeded USERS and GROUPS lines. PR: 229490 Submitted by: Nikola Kolev (maintainer) Added: head/net/dhcpd/files/extra-patch-dhcp.c (contents, props changed) head/net/dhcpd/files/extra-patch-dhcpd.c (contents, props changed) head/net/dhcpd/files/extra-patch-memory.c (contents, props changed) head/net/dhcpd/files/extra-patch-pfutils.c (contents, props changed) Modified: head/net/dhcpd/Makefile (contents, props changed) Modified: head/net/dhcpd/Makefile ============================================================================== --- head/net/dhcpd/Makefile Wed Jul 4 14:12:04 2018 (r473888) +++ head/net/dhcpd/Makefile Wed Jul 4 14:21:07 2018 (r473889) @@ -2,7 +2,7 @@ PORTNAME= dhcpd PORTVERSION= 6.0.20170207 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= net MAINTAINER= koue@chaosophia.net @@ -24,8 +24,17 @@ CFLAGS+= -Wall MAKE_ARGS+= BINDIR=${PREFIX}/sbin MANDIR=${PREFIX}/man/man -USERS= dhcpd -GROUPS= dhcpd +OPTIONS_DEFINE= NOPF + +NOPF_DESC= Disable PF support + +OPTIONS_SUB= yes + +NOPF_CFLAGS= -DNO_PF=1 +NOPF_EXTRA_PATCHES= ${PATCHDIR}/extra-patch-dhcp.c \ + ${PATCHDIR}/extra-patch-dhcpd.c \ + ${PATCHDIR}/extra-patch-memory.c \ + ${PATCHDIR}/extra-patch-pfutils.c post-patch: @${REINPLACE_CMD} -e "s|/etc/dhcpd.conf|${PREFIX}/etc/dhcpd.conf|" \ Added: head/net/dhcpd/files/extra-patch-dhcp.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/dhcpd/files/extra-patch-dhcp.c Wed Jul 4 14:21:07 2018 (r473889) @@ -0,0 +1,18 @@ +--- dhcp.c.orig 2018-06-06 09:10:04 UTC ++++ dhcp.c +@@ -154,6 +154,7 @@ dhcpdiscover(struct packet *packet) + * If we can't find an unabandoned lease, + * reclaim the abandoned lease. + */ ++#ifndef NO_PF + if ((lease->flags & ABANDONED_LEASE)) { + warning("Reclaiming abandoned IP address %s.", + piaddr(lease->ip_addr)); +@@ -161,6 +162,7 @@ dhcpdiscover(struct packet *packet) + + pfmsg('L', lease); /* unabandon address */ + } ++#endif /* NO_PF */ + } + + /* Try to find a host_decl that matches the client Added: head/net/dhcpd/files/extra-patch-dhcpd.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/dhcpd/files/extra-patch-dhcpd.c Wed Jul 4 14:21:07 2018 (r473889) @@ -0,0 +1,50 @@ +--- dhcpd.c.orig 2018-06-06 09:12:11 UTC ++++ dhcpd.c +@@ -74,11 +74,15 @@ u_int16_t client_port; + struct passwd *pw; + int log_priority; + int log_perror = 0; ++#ifndef NO_PF + int pfpipe[2]; ++#endif /* NO_PF */ + int gotpipe = 0; + int syncrecv; + int syncsend; ++#ifndef NO_PF + pid_t pfproc_pid = -1; ++#endif /* NO_PF */ + char *path_dhcpd_conf = _PATH_DHCPD_CONF; + char *path_dhcpd_db = _PATH_DHCPD_DB; + char *abandoned_tab = NULL; +@@ -225,6 +229,7 @@ main(int argc, char *argv[]) + if ((pw = getpwnam("_dhcp")) == NULL) + error("user \"_dhcp\" not found"); + ++#ifndef NO_PF + /* don't go near /dev/pf unless we actually intend to use it */ + if ((abandoned_tab != NULL) || + (changedmac_tab != NULL) || +@@ -248,6 +253,7 @@ main(int argc, char *argv[]) + break; + } + } ++#endif /* NO_PF */ + + if (udpsockmode) + udpsock_startup(udpaddr); +@@ -386,6 +392,7 @@ periodic_scan(void *p) + if (y < 1) + y = 1; + ++#ifndef NO_PF + /* walk across all leases to find the exired ones */ + for (n = subnets; n; n = n->next_subnet) + for (g = n->group; g; g = g->next) +@@ -394,6 +401,7 @@ periodic_scan(void *p) + if (cur_time >= l->ends) + if (l->ends > last_scan) + pfmsg('R', l); ++#endif /* NO_PF */ + + last_scan = cur_time; + add_timeout(cur_time + y, periodic_scan, NULL); Added: head/net/dhcpd/files/extra-patch-memory.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/dhcpd/files/extra-patch-memory.c Wed Jul 4 14:21:07 2018 (r473889) @@ -0,0 +1,34 @@ +--- memory.c.orig 2018-06-06 09:14:19 UTC ++++ memory.c +@@ -619,9 +619,11 @@ supersede_lease(struct lease *comp, stru + comp->ends = lease->ends; + } + ++#ifndef NO_PF + pfmsg('L', lease); /* address is leased. remove from purgatory */ + if (do_pftable) /* address changed hwaddr. remove from overload */ + pfmsg('C', lease); ++#endif /* NO_PF */ + + /* Return zero if we didn't commit the lease to permanent storage; + nonzero if we did. */ +@@ -641,7 +643,9 @@ release_lease(struct lease *lease) + supersede_lease(lease, <, 1); + note("Released lease for IP address %s", + piaddr(lease->ip_addr)); ++#ifndef NO_PF + pfmsg('R', lease); ++#endif /* NO_PF */ + } + } + +@@ -669,7 +673,9 @@ abandon_lease(struct lease *lease, char + lt.uid_len = 0; + supersede_lease(lease, <, 1); + ++#ifndef NO_PF + pfmsg('A', lease); /* address is abandoned. send to purgatory */ ++#endif /* NO_PF */ + return; + } + Added: head/net/dhcpd/files/extra-patch-pfutils.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/dhcpd/files/extra-patch-pfutils.c Wed Jul 4 14:21:07 2018 (r473889) @@ -0,0 +1,16 @@ +--- pfutils.c.orig 2018-06-06 08:53:18 UTC ++++ pfutils.c +@@ -15,6 +15,8 @@ + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + ++#ifndef NO_PF /* No need of PF support */ ++ + #include + #include + #include +@@ -254,3 +256,4 @@ pfmsg(char c, struct lease *lp) + break; + } + } ++#endif /* NO_PF */