From owner-freebsd-ports-bugs@FreeBSD.ORG Wed Jul 7 21:40:22 2004 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 079BD16A4D1 for ; Wed, 7 Jul 2004 21:40:22 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id DE3F543D1D for ; Wed, 7 Jul 2004 21:40:21 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) i67LeL1u095185 for ; Wed, 7 Jul 2004 21:40:21 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.11/8.12.11/Submit) id i67LeLeE095184; Wed, 7 Jul 2004 21:40:21 GMT (envelope-from gnats) Resent-Date: Wed, 7 Jul 2004 21:40:21 GMT Resent-Message-Id: <200407072140.i67LeLeE095184@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Matthew George Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 86F7116A4CE for ; Wed, 7 Jul 2004 21:35:29 +0000 (GMT) Received: from mail.secureworks.net (mail.secureworks.net [209.101.212.155]) by mx1.FreeBSD.org (Postfix) with SMTP id 11FAD43D4C for ; Wed, 7 Jul 2004 21:35:29 +0000 (GMT) (envelope-from mdg@secureworks.net) Received: (qmail 26117 invoked from network); 7 Jul 2004 21:35:18 -0000 Received: from unknown (HELO HOST-192-168-8-243.internal.secureworks.net) (63.239.86.253) by mail.secureworks.net with SMTP; 7 Jul 2004 21:35:18 -0000 Message-Id: <20040707172400.I2363@localhost> Date: Wed, 7 Jul 2004 17:35:28 -0400 (EDT) From: Matthew George To: FreeBSD-gnats-submit@FreeBSD.org Subject: ports/68787: [MAINTAINER] net-mgmt/arpwatch-devel: RC_SUBR-ize X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2004 21:40:22 -0000 >Number: 68787 >Category: ports >Synopsis: [MAINTAINER] net-mgmt/arpwatch-devel: RC_SUBR-ize >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: maintainer-update >Submitter-Id: current-users >Arrival-Date: Wed Jul 07 21:40:21 GMT 2004 >Closed-Date: >Last-Modified: >Originator: Matthew George >Release: FreeBSD 5.2-CURRENT i386 >Organization: SecureWorks >Environment: System: FreeBSD mdg.secureworks.net 5.2-CURRENT FreeBSD 5.2-CURRENT #2: Mon Mar 29 12:02:58 EST 2004 mdg@mdg.secureworks.net:/usr/obj/usr/src/sys/GENERIC i386 >Description: add support for rc_subr mechanism. this includes a change to properly daemon()ize arpwatch. >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: # # pkg-message # echo x - pkg-message sed 's/^X//' >pkg-message << 'END-of-pkg-message' X X*** ATTENTION *** X XTo run arpwatch from startup, add Xarpwatch_enable="YES" to /etc/rc.conf X XAvailable variables you add/set to /etc/rc.conf. X- arpwatch_enable (bool): Set to "NO" by default. X Set it to "YES" to enable arpwatch. X- arpwatch_flags (str): Set to "-N" by default. X Extra flags passed to start command. X END-of-pkg-message exit --- Makefile.orig Wed Jul 7 17:31:28 2004 +++ Makefile Wed Jul 7 17:32:36 2004 @@ -2,12 +2,12 @@ # Date created: 11 November 2003 # Whom: Matthew George # -# $FreeBSD: ports/net-mgmt/arpwatch-devel/Makefile,v 1.36 2004/06/11 18:30:10 krion Exp $ +# $FreeBSD: ports/net-mgmt/arpwatch-devel/Makefile,v 1.35 2004/04/14 21:30:24 krion Exp $ # PORTNAME= arpwatch PORTVERSION= 2.1.a11 -PORTREVISION= 3 +PORTREVISION= 4 CATEGORIES= net-mgmt MASTER_SITES= http://www.Awfulhak.org/arpwatch/ \ ftp://ftp.ee.lbl.gov/ @@ -25,8 +25,15 @@ INSTALL_TARGET= install install-man MAN8= arpwatch.8 arpsnmp.8 +USE_RC_SUBR= yes +RC_SCRIPTS_SUB= PREFIX=${PREFIX} RC_SUBR=${RC_SUBR} + MAKE_ENV= PTHREAD_CFLAGS="${PTHREAD_CFLAGS}" PTHREAD_LIBS="${PTHREAD_LIBS}" +post-patch: + @${SED} ${RC_SCRIPTS_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \ + ${FILESDIR}/arpwatch.sh > ${WRKDIR}/arpwatch.sh + post-install: if [ ! -d ${PREFIX}/arpwatch ]; then \ ${MKDIR} ${PREFIX}/arpwatch; \ @@ -41,6 +48,7 @@ ${INSTALL_DATA} ${WRKSRC}/$$file ${PREFIX}/arpwatch/.; \ done ${INSTALL_SCRIPT} ${WRKSRC}/arp2ethers ${PREFIX}/arpwatch/. - ${INSTALL_SCRIPT} ${FILESDIR}/arpwatch.sh ${PREFIX}/etc/rc.d/arpwatch.sh.sample + ${INSTALL_SCRIPT} ${WRKDIR}/arpwatch.sh ${PREFIX}/etc/rc.d/arpwatch.sh + @${CAT} ${PKGMESSAGE} .include --- pkg-plist.orig Wed Jul 7 17:06:10 2004 +++ pkg-plist Wed Jul 7 17:06:16 2004 @@ -5,7 +5,7 @@ arpwatch/d.awk arpwatch/e.awk arpwatch/p.awk -etc/rc.d/arpwatch.sh.sample +etc/rc.d/arpwatch.sh @unexec test -f %D/arpwatch/arp.dat && test -s %D/arpwatch/arp.dat || rm -f %D/arpwatch/arp.dat @unexec test -f %D/arpwatch/ether.dat && test -s %D/arpwatch/ether.dat || rm -f %D/arpwatch/ether.dat @exec test -f %D/arpwatch/arp.dat || touch %D/arpwatch/arp.dat --- files/arpwatch.sh.orig Mon Jan 19 18:34:48 2004 +++ files/arpwatch.sh Wed Jul 7 17:07:18 2004 @@ -1,60 +1,31 @@ #!/bin/sh +# +# $FreeBSD$ +# + +# PROVIDE: arpwatch +# REQUIRE: NETWORKING SERVERS +# BEFORE: DAEMON +# KEYWORD: FreeBSD shutdown + +# +# Add the following lines to /etc/rc.conf to enable arpwatch: +# arpwatch_enable (bool): Set to "NO" by default. +# Set it to "YES" to enable arpwatch +# arpwatch_flags (str): Set to "-N" by default. +# Extra flags passed to start command +# +. %%RC_SUBR%% + +name="arpwatch" +rcvar=`set_rcvar` -if [ -r /etc/defaults/rc.conf ]; then - . /etc/defaults/rc.conf - source_rc_confs -elif [ -r /etc/rc.conf ]; then - . /etc/rc.conf -fi - -prog=$(realpath $0) || exit 1 -dir=${prog%/*} -PREFIX=${dir%/etc/rc.d} - -if [ ."$dir" = ."$prog" -o ."$PREFIX" = ."$dir" ] -then - echo "$0: Cannot determine the PREFIX" >&2 - exit 1 -fi - -case $1 in -start) - if [ ! -e "$PREFIX"/arpwatch/arp.dat ]; then - if [ -e "$PREFIX"/arpwatch/arp.dat- ]; then - cp "$PREFIX"/arpwatch/arp.dat- "$PREFIX"/arpwatch/arp.dat - else - touch "$PREFIX"/arpwatch/arp.dat - fi - fi - - if [ ! -e "$PREFIX"/arpwatch/ether.dat ]; then - if [ -e "$PREFIX"/arpwatch/ether.dat- ]; then - cp "$PREFIX"/arpwatch/ether.dat- "$PREFIX"/arpwatch/ether.dat - else - touch "$PREFIX"/arpwatch/ether.dat - fi - fi - - case ${arpwatch_interfaces} in - '') - if [ -x "$PREFIX"/sbin/arpwatch -a -d "$PREFIX"/arpwatch ]; then - "$PREFIX"/sbin/arpwatch ${arpwatch_flags} && echo -n ' arpwatch' - fi - ;; - *) - for interface in ${arpwatch_interfaces}; do - "$PREFIX"/sbin/arpwatch -i "${interface}" && echo -n " arpwatch(${interface})" - done - ;; - esac - ;; -stop) - killall arpwatch && echo -n ' arpwatch' - ;; -*) - echo "Usage: `basename $0` {start|stop}" >&2 - exit 64 - ;; -esac +command="%%PREFIX%%/sbin/arpwatch" + +[ -z "$arpwatch_enable" ] && arpwatch_enable="NO" +[ -z "$arpwatch_flags" ] && arpwatch_flags="-N" + +load_rc_config $name + +run_rc_command "$1" -exit 0 --- files/patch-ae.orig Wed Jul 7 17:11:09 2004 +++ files/patch-ae Wed Jul 7 17:11:15 2004 @@ -1,5 +1,5 @@ ---- arpwatch.c.orig Sat Oct 14 04:07:35 2000 -+++ arpwatch.c Tue Jan 20 00:22:23 2004 +--- arpwatch.c.orig Fri Oct 13 22:07:35 2000 ++++ arpwatch.c Wed Jul 7 17:08:21 2004 @@ -36,6 +36,7 @@ #include #include @@ -85,7 +85,7 @@ default: usage(); } -@@ -213,19 +230,23 @@ +@@ -213,50 +230,107 @@ net = 0; netmask = 0; } else { @@ -121,16 +121,26 @@ } /* Drop into the background if not debugging */ -@@ -238,7 +259,7 @@ - exit(0); - (void)close(fileno(stdin)); - (void)close(fileno(stdout)); + if (!debug) { +- pid = fork(); +- if (pid < 0) { +- syslog(LOG_ERR, "main fork(): %m"); +- exit(1); +- } else if (pid != 0) +- exit(0); +- (void)close(fileno(stdin)); +- (void)close(fileno(stdout)); - (void)close(fileno(stderr)); -+ - #ifdef TIOCNOTTY - fd = open("/dev/tty", O_RDWR); - if (fd >= 0) { -@@ -251,12 +272,82 @@ +-#ifdef TIOCNOTTY +- fd = open("/dev/tty", O_RDWR); +- if (fd >= 0) { +- (void)ioctl(fd, TIOCNOTTY, 0); +- (void)close(fd); +- } +-#else +- (void) setsid(); +-#endif ++ daemon(1, 0); } } @@ -214,7 +224,7 @@ if (rfilename != NULL) { pd = pcap_open_offline(rfilename, errbuf); -@@ -306,27 +397,7 @@ +@@ -306,27 +380,7 @@ if (rfilename == NULL) syslog(LOG_INFO, "listening on %s", interface); @@ -242,7 +252,7 @@ switch (linktype) { -@@ -347,9 +418,7 @@ +@@ -347,9 +401,7 @@ exit(1); } pcap_close(pd); @@ -253,7 +263,7 @@ } /* Process an ethernet arp/rarp packet */ -@@ -362,6 +431,8 @@ +@@ -362,6 +414,8 @@ register u_char *sea, *sha; register time_t t; u_int32_t sia; @@ -262,7 +272,7 @@ eh = (struct ether_header *)p; ea = (struct ether_arp *)(eh + 1); -@@ -400,9 +471,16 @@ +@@ -400,9 +454,16 @@ /* Got a live one */ t = h->ts.tv_sec; can_checkpoint = 0; @@ -280,7 +290,7 @@ can_checkpoint = 1; } -@@ -507,6 +585,8 @@ +@@ -507,6 +568,8 @@ register u_char *sea, *sha; register time_t t; u_int32_t sia; @@ -289,7 +299,7 @@ fh = (struct fddi_header *)p; ea = (struct ether_arp *)(fh + 1); -@@ -549,7 +629,13 @@ +@@ -549,7 +612,13 @@ /* Got a live one */ t = h->ts.tv_sec; can_checkpoint = 0; @@ -304,7 +314,7 @@ syslog(LOG_ERR, "ent_add(%s, %s, %ld) failed", intoa(sia), e2str(sea), t); can_checkpoint = 1; -@@ -750,7 +836,7 @@ +@@ -750,7 +819,7 @@ extern char version[]; (void)fprintf(stderr, "Version %s\n", version); -- Matthew George SecureWorks Technical Operations >Release-Note: >Audit-Trail: >Unformatted: