View | Details | Raw Unified | Return to bug 242346 | Differences between
and this patch

Collapse All | Expand All

(-)net-mgmt/arpwatch/Makefile (-12 / +38 lines)
Lines 2-12 Link Here
2
# $FreeBSD$
2
# $FreeBSD$
3
3
4
PORTNAME=	arpwatch
4
PORTNAME=	arpwatch
5
DISTVERSION=	2.1a15
5
PORTVERSION=	3.0
6
PORTREVISION=	10
7
CATEGORIES=	net-mgmt
6
CATEGORIES=	net-mgmt
8
MASTER_SITES=	ftp://ftp.ee.lbl.gov/ \
7
MASTER_SITES=	https://ee.lbl.gov/downloads/arpwatch/ \
9
		GENTOO
8
		LOCAL/leres/arpwatch
10
9
11
MAINTAINER=	pi@FreeBSD.org
10
MAINTAINER=	pi@FreeBSD.org
12
COMMENT=	Monitor arp & rarp requests
11
COMMENT=	Monitor arp & rarp requests
Lines 13-25 Link Here
13
12
14
LICENSE=	BSD3CLAUSE
13
LICENSE=	BSD3CLAUSE
15
14
15
BUILD_DEPENDS=	${LOCALBASE}/include/pcap.h:net/libpcap
16
RUN_DEPENDS=	${LOCALBASE}/include/pcap.h:net/libpcap
17
18
USES=		python:run
19
16
GNU_CONFIGURE=	yes
20
GNU_CONFIGURE=	yes
17
CONFIGURE_ARGS=	--quiet
18
INSTALL_TARGET=	install install-man
19
21
20
SUB_FILES=	pkg-message
22
SUB_FILES=      pkg-message
21
USE_RC_SUBR=	arpwatch
22
23
24
OPTIONS_DEFINE=	DEBUG ETHERCODES ZEROPAD
25
OPTIONS_DEFAULT=ETHERCODES ZEROPAD
26
OPTIONS_SUB=	yes
27
28
ETHERCODES_DESC=install ethercodes.dat
29
ZEROPAD_DESC=	zero pad displayed ethernet addresses by default
30
31
.include <bsd.port.options.mk>
32
33
.if ${PORT_OPTIONS:MDEBUG}
34
CONFIGURE_ARGS+=        --disable-optimization
35
.endif
36
37
.if ${PORT_OPTIONS:MZEROPAD}
38
CONFIGURE_ARGS+=        --enable-zeropad
39
.endif
40
23
.ifdef ARPDIR
41
.ifdef ARPDIR
24
MAKE_ARGS=	ARPDIR=${ARPDIR}
42
MAKE_ARGS=	ARPDIR=${ARPDIR}
25
.endif
43
.endif
Lines 26-35 Link Here
26
44
27
post-install:
45
post-install:
28
	${MKDIR} ${STAGEDIR}${PREFIX}/arpwatch
46
	${MKDIR} ${STAGEDIR}${PREFIX}/arpwatch
29
	for files in ethercodes.dat d.awk duplicates.awk euppertolower.awk e.awk p.awk; do \
47
.for F in ethercodes.dat d.awk duplicates.awk euppertolower.awk e.awk p.awk
30
		${INSTALL_DATA} ${WRKSRC}/$$files ${STAGEDIR}${PREFIX}/arpwatch;	\
48
	${INSTALL_DATA} ${WRKSRC}/${F} ${STAGEDIR}${PREFIX}/arpwatch
31
	done
49
.endfor
32
	${INSTALL_SCRIPT} ${WRKSRC}/arp2ethers ${STAGEDIR}${PREFIX}/arpwatch
50
	${INSTALL_SCRIPT} ${WRKSRC}/arp2ethers ${STAGEDIR}${PREFIX}/arpwatch
33
	${INSTALL_SCRIPT} ${WRKSRC}/massagevendor ${STAGEDIR}${PREFIX}/arpwatch
51
	${INSTALL_SCRIPT} ${WRKSRC}/massagevendor.py \
52
	    ${STAGEDIR}${PREFIX}/arpwatch/massagevendor
53
.if ${PORT_OPTIONS:METHERCODES}
54
	${INSTALL_DATA} ${WRKSRC}/ethercodes.dat ${STAGEDIR}${PREFIX}/arpwatch
55
.endif
34
56
57
post-configure:
58
	${REINPLACE_CMD} -e "/^LIBS *=/s,-lpcap,${LOCALBASE}/lib/libpcap.so.1," \
59
		${WRKSRC}/Makefile
60
35
.include <bsd.port.mk>
61
.include <bsd.port.mk>
(-)net-mgmt/arpwatch/distinfo (-2 / +3 lines)
Lines 1-2 Link Here
1
SHA256 (arpwatch-2.1a15.tar.gz) = c1df9737e208a96a61fa92ddad83f4b4d9be66f8992f3c917e9edf4b05ff5898
1
TIMESTAMP = 1575239752
2
SIZE (arpwatch-2.1a15.tar.gz) = 202729
2
SHA256 (arpwatch-3.0.tar.gz) = 82e137e104aca8b1280f5cca0ebe61b978f10eadcbb4c4802c181522ad02b25b
3
SIZE (arpwatch-3.0.tar.gz) = 407879
(-)net-mgmt/arpwatch/files/arpwatch.in (-80 lines)
Lines 1-80 Link Here
1
#!/bin/sh
2
#
3
# $FreeBSD$
4
#
5
6
# PROVIDE: arpwatch
7
# REQUIRE: NETWORKING
8
9
# Add the following lines to /etc/rc.conf to enable arpwatch:
10
#
11
#arpwatch_enable="YES"
12
#
13
arpwatch_enable=${arpwatch_enable:-"NO"}
14
arpwatch_dir=${arpwatch_dir:-"%%PREFIX%%/arpwatch/"}
15
16
. /etc/rc.subr
17
18
name=arpwatch
19
rcvar=arpwatch_enable
20
required_dirs=${arpwatch_dir}
21
22
load_rc_config ${name}
23
24
command="%%PREFIX%%/sbin/${name}"
25
start_precmd=${name}_precmd
26
27
arpwatch_precmd() {
28
    case ${arpwatch_interfaces} in
29
        '')
30
	    echo prcmd
31
	    if [ ! -e "${arpwatch_dir}/arp.dat" ]; then
32
		if [ -e "${arpwatch_dir}/arp.dat-" ]; then
33
		    cp "${arpwatch_dir}/arp.dat-" "${arpwatch_dir}/arp.dat"
34
		else
35
		    touch "${arpwatch_dir}/arp.dat"
36
		fi
37
	    fi
38
	;;
39
40
	*)
41
	    for interface in ${arpwatch_interfaces}; do
42
	        if [ ! -e "${arpwatch_dir}/arp.${interface}.dat" ]; then
43
		    if [ -e "${arpwatch_dir}/arp.${interface}.dat-" ]; then
44
		        cp "${arpwatch_dir}/arp.${interface}.dat-" "${arpwatch_dir}/arp.${interface}.dat"
45
		    else
46
		        touch "${arpwatch_dir}/arp.${interface}.dat"
47
		    fi
48
		fi
49
	    done
50
	;;
51
    esac
52
}
53
54
arpwatch_stop() {
55
    killall arpwatch
56
}
57
58
case ${arpwatch_interfaces} in
59
    '')  
60
	 echo 'meuh'
61
         run_rc_command "$1"
62
    ;;
63
64
    *)
65
	 case "$1" in
66
	  *start)
67
 	     for interface in ${arpwatch_interfaces}; do
68
		 rc_interface=`echo ${interface} | sed 's/\./_/g'`
69
		 eval options=\$arpwatch_${rc_interface}_options
70
		 command_args="-i ${interface} ${options} -f ${arpwatch_dir}/arp.${interface}.dat"
71
		 pidfile="/var/run/arpwatch-${interface}.pid"
72
		 run_rc_command "$1"
73
	     done
74
	     ;;
75
	  *)
76
             run_rc_command "$1"
77
	     ;;
78
	 esac
79
    ;;
80
esac
(-)net-mgmt/arpwatch/files/patch-Makefile.in (-38 lines)
Lines 1-38 Link Here
1
--- Makefile.in.orig	2000-06-15 00:39:55 UTC
2
+++ Makefile.in
3
@@ -31,7 +31,7 @@ BINDEST = @sbindir@
4
 # Pathname of directory to install the man page
5
 MANDEST = @mandir@
6
 # Pathname of directory to install database file
7
-ARPDIR = $(prefix)/arpwatch
8
+ARPDIR ?= $(prefix)/arpwatch
9
 
10
 # VPATH
11
 srcdir = @srcdir@
12
@@ -45,7 +45,7 @@ CC = @CC@
13
 PROG = arpwatch
14
 CCOPT = @V_CCOPT@
15
 INCLS = -I. @V_INCLS@
16
-DEFS = -DDEBUG @DEFS@ -DARPDIR=\"$(ARPDIR)\" -DPATH_SENDMAIL=\"$(SENDMAIL)\"
17
+DEFS = @DEFS@ -DARPDIR=\"$(ARPDIR)\" -DPATH_SENDMAIL=\"$(SENDMAIL)\"
18
 
19
 # Standard CFLAGS
20
 CFLAGS = $(CCOPT) $(DEFS) $(INCLS)
21
@@ -110,13 +110,13 @@ zap: zap.o intoa.o
22
 	$(CC) $(CFLAGS) -o $@ zap.o intoa.o -lutil
23
 
24
 install: force
25
-	$(INSTALL) -m 555 -o bin -g bin arpwatch $(DESTDIR)$(BINDEST)
26
-	$(INSTALL) -m 555 -o bin -g bin arpsnmp $(DESTDIR)$(BINDEST)
27
+	$(BSD_INSTALL_PROGRAM) arpwatch $(DESTDIR)$(BINDEST)
28
+	$(BSD_INSTALL_PROGRAM) arpsnmp $(DESTDIR)$(BINDEST)
29
 
30
 install-man: force
31
-	$(INSTALL) -m 444 -o bin -g bin $(srcdir)/arpwatch.8 \
32
+	$(BSD_INSTALL_MAN) $(srcdir)/arpwatch.8 \
33
 	    $(DESTDIR)$(MANDEST)/man8
34
-	$(INSTALL) -m 444 -o bin -g bin $(srcdir)/arpsnmp.8 \
35
+	$(BSD_INSTALL_MAN) $(srcdir)/arpsnmp.8 \
36
 	    $(DESTDIR)$(MANDEST)/man8
37
 
38
 lint:	$(GENSRC) force
(-)net-mgmt/arpwatch/files/patch-arpsnmp.8 (-34 lines)
Lines 1-34 Link Here
1
--- arpsnmp.8.orig	2000-09-17 20:34:48 UTC
2
+++ arpsnmp.8
3
@@ -30,6 +30,9 @@ arpsnmp - keep track of ethernet/ip addr
4
 ] [
5
 .B -f
6
 .I datafile
7
+] [
8
+.B -m
9
+.I email
10
 ]
11
 .I file
12
 [
13
@@ -55,6 +58,12 @@ flag is used to set the ethernet/ip addr
14
 The default is
15
 .IR arp.dat .
16
 .LP
17
+The
18
+.B -m
19
+flag specifies the address that will receive the emails.
20
+The default is
21
+.IR root .
22
+.LP
23
 Note that an empty
24
 .I arp.dat
25
 file must be created before the first time you run
26
@@ -69,7 +78,7 @@ man page for details on the report messa
27
 .na
28
 .nh
29
 .nf
30
-/usr/operator/arpwatch - default directory
31
+/usr/local/arpwatch - default directory
32
 arp.dat - ethernet/ip address database
33
 ethercodes.dat - vendor ethernet block list
34
 .ad
(-)net-mgmt/arpwatch/files/patch-arpsnmp.c (-30 / +13 lines)
Lines 1-39 Link Here
1
--- arpsnmp.c.orig	2004-01-22 22:25:17 UTC
1
--- arpsnmp.c.orig	2019-11-30 18:35:23 UTC
2
+++ arpsnmp.c
2
+++ arpsnmp.c
3
@@ -68,6 +68,8 @@ __dead	void usage(void) __attribute__((v
3
@@ -104,7 +104,7 @@ main(int argc, char **argv)
4
 
5
 char *prog;
6
 
7
+char *Watcher;
8
+
9
 extern int optind;
10
 extern int opterr;
11
 extern char *optarg;
12
@@ -90,7 +92,7 @@ main(int argc, char **argv)
13
 	}
4
 	}
14
 
5
 
15
 	opterr = 0;
6
 	opterr = 0;
16
-	while ((op = getopt(argc, argv, "df:")) != EOF)
7
-	while ((op = getopt(argc, argv, "CdD:f:qsw:W:Z")) != EOF)
17
+	while ((op = getopt(argc, argv, "df:m:")) != EOF)
8
+	while ((op = getopt(argc, argv, "CdD:f:m:qsw:W:Z")) != EOF)
18
 		switch (op) {
9
 		switch (op) {
19
 
10
 
20
 		case 'd':
11
 		case 'C':
21
@@ -105,6 +107,10 @@ main(int argc, char **argv)
12
@@ -135,6 +135,10 @@ main(int argc, char **argv)
22
 			arpfile = optarg;
13
 			++suppress;
23
 			break;
14
 			break;
24
 
15
 
25
+		case 'm':
16
+		case 'm':
26
+			Watcher = optarg;
17
+			fprintf(stderr, "%s: WARNING: -m is deprecated,"
27
+			break;
18
+			    " please use -w instead\n", prog);
28
+
19
+			/* fallthrough */
29
 		default:
20
 		case 'w':
30
 			usage();
21
 			watcher = optarg;
31
 		}
22
 			break;
32
@@ -185,6 +191,6 @@ usage(void)
33
 
34
 	(void)fprintf(stderr, "Version %s\n", version);
35
 	(void)fprintf(stderr,
36
-	    "usage: %s [-d] [-f datafile] file [...]\n", prog);
37
+	    "usage: %s [-d] [-f datafile] [-m email] file [...]\n", prog);
38
 	exit(1);
39
 }
(-)net-mgmt/arpwatch/files/patch-arpwatch.8 (-59 lines)
Lines 1-59 Link Here
1
--- arpwatch.8.orig	2000-10-08 20:31:28 UTC
2
+++ arpwatch.8
3
@@ -27,7 +27,7 @@ arpwatch - keep track of ethernet/ip add
4
 .na
5
 .B arpwatch
6
 [
7
-.B -dN
8
+.B -dNvz
9
 ] [
10
 .B -f
11
 .I datafile
12
@@ -38,6 +38,9 @@ arpwatch - keep track of ethernet/ip add
13
 .br
14
 .ti +8
15
 [
16
+.B -m
17
+.I email
18
+] [
19
 .B -n
20
 .IR net [/ width
21
 ]] [
22
@@ -71,6 +74,12 @@ The
23
 flag is used to override the default interface.
24
 .LP
25
 The
26
+.B -m
27
+flag specifies the address that will receive the emails.
28
+The default is
29
+.IR root .
30
+.LP
31
+The
32
 .B -n
33
 flag specifies additional local networks. This can be useful to
34
 avoid "bogon" warnings when there is more than one network running
35
@@ -83,6 +92,15 @@ The
36
 flag disables reporting any bogons.
37
 .LP
38
 The
39
+.B -v
40
+flag disables reporting on VRRP/CARP ethernet prefixes as described
41
+in RFC5798 (00:00:5e:00:01:xx).
42
+.LP
43
+The
44
+.B -z
45
+flag disables reporting 0.0.0.0 changes, helpful in busy DHCP networks.
46
+.LP
47
+The
48
 .B -r
49
 flag is used to specify a savefile
50
 (perhaps created by
51
@@ -152,7 +170,7 @@ addresses was a DECnet address.
52
 .na
53
 .nh
54
 .nf
55
-/usr/operator/arpwatch - default directory
56
+/usr/local/arpwatch - default directory
57
 arp.dat - ethernet/ip address database
58
 ethercodes.dat - vendor ethernet block list
59
 .ad
(-)net-mgmt/arpwatch/files/patch-arpwatch.c (-57 / +13 lines)
Lines 1-66 Link Here
1
--- arpwatch.c.orig	2004-01-22 22:18:20 UTC
1
--- arpwatch.c.orig	2019-11-30 18:35:23 UTC
2
+++ arpwatch.c
2
+++ arpwatch.c
3
@@ -107,6 +107,8 @@ struct rtentry;
3
@@ -198,7 +198,7 @@ main(int argc, char **argv)
4
 
5
 char *prog;
6
 
7
+char *Watcher = NULL;
8
+
9
 int can_checkpoint;
10
 int swapped;
11
 int nobogons;
12
@@ -170,7 +172,7 @@ main(int argc, char **argv)
13
 	interface = NULL;
4
 	interface = NULL;
14
 	rfilename = NULL;
5
 	rfilename = NULL;
15
 	pd = NULL;
6
 	pd = NULL;
16
-	while ((op = getopt(argc, argv, "df:i:n:Nr:")) != EOF)
7
-	while ((op = getopt(argc, argv, "CdD:Ff:i:n:NpP:qr:svw:W:x:zZ")) != EOF)
17
+	while ((op = getopt(argc, argv, "dvzf:i:m:n:Nr:")) != EOF)
8
+	while ((op = getopt(argc, argv, "CdD:Ff:i:m:n:NpP:qr:svw:W:x:zZ")) != EOF)
18
 		switch (op) {
9
 		switch (op) {
19
 
10
 
20
 		case 'd':
11
 		case 'C':
21
@@ -202,6 +204,16 @@ main(int argc, char **argv)
12
@@ -262,6 +262,10 @@ main(int argc, char **argv)
22
 			rfilename = optarg;
13
 			++vrrpflag;
23
 			break;
14
 			break;
24
 
15
 
25
+		case 'm':
16
+		case 'm':
26
+			Watcher = optarg;
17
+			fprintf(stderr, "%s: WARNING: -m is deprecated,"
27
+			break;
18
+			    " please use -w instead\n", prog);
28
+		case 'v':
19
+			/* fallthrough */
29
+			vrrpflag = 1;
20
 		case 'w':
30
+			break;
21
 			watcher = optarg;
31
+		case 'z':
22
 			break;
32
+			zeroflag = 1;
33
+			break;
34
+
35
 		default:
36
 			usage();
37
 		}
38
@@ -321,7 +333,6 @@ main(int argc, char **argv)
39
 
40
 	(void)setsignal(SIGINT, die);
41
 	(void)setsignal(SIGTERM, die);
42
-	(void)setsignal(SIGHUP, die);
43
 	if (rfilename == NULL) {
44
 		(void)setsignal(SIGQUIT, checkpoint);
45
 		(void)setsignal(SIGALRM, checkpoint);
46
@@ -391,6 +402,12 @@ process_ether(register u_char *u, regist
47
 		return;
48
 	}
49
 
50
+	/* Check for CARP-generated ARP replies and ignore them */
51
+	if (vrrpflag == 1 && MEMCMP(sha, vrrp_prefix, 5) == 0) {
52
+		/* do nothing */
53
+		return;
54
+	}
55
+
56
 	/* Double check ethernet addresses */
57
 	if (MEMCMP(sea, sha, 6) != 0) {
58
 		dosyslog(LOG_INFO, "ethernet mismatch", sia, sea, sha);
59
@@ -751,6 +768,6 @@ usage(void)
60
 
61
 	(void)fprintf(stderr, "Version %s\n", version);
62
 	(void)fprintf(stderr, "usage: %s [-dN] [-f datafile] [-i interface]"
63
-	    " [-n net[/width]] [-r file]\n", prog);
64
+	    " [-m email] [-n net[/width]] [-r file]\n", prog);
65
 	exit(1);
66
 }
(-)net-mgmt/arpwatch/files/patch-configure (-20 lines)
Lines 1-20 Link Here
1
--- configure.orig	2006-06-21 20:32:38 UTC
2
+++ configure
3
@@ -1419,7 +1419,7 @@ if test "${with_gcc+set}" = set; then
4
   withval="$with_gcc"
5
 
6
 fi;
7
-    V_CCOPT="-O"
8
+#    V_CCOPT="-O"
9
     V_INCLS=""
10
     if test "${srcdir}" != "." ; then
11
 	    V_INCLS="-I\$\(srcdir\)"
12
@@ -5299,7 +5299,7 @@ echo "${ECHO_T}$ac_cv_lbl_gcc_vers" >&6
13
 		    fi
14
 		    V_CCOPT="$V_CCOPT -Wall"
15
 		    if test "$ac_cv_lbl_gcc_vers" -gt 1 ; then
16
-			    V_CCOPT="$V_CCOPT -Wmissing-prototypes -Wstrict-prototypes"
17
+#			    V_CCOPT="$V_CCOPT -Wmissing-prototypes -Wstrict-prototypes"
18
 		    fi
19
 	    fi
20
     else
(-)net-mgmt/arpwatch/files/patch-db.c (-20 lines)
Lines 1-20 Link Here
1
--- db.c.orig	2000-09-30 23:39:58 UTC
2
+++ db.c
3
@@ -283,7 +283,7 @@ elist_alloc(register u_int32_t a, regist
4
 	BCOPY(e, ep->e, 6);
5
 	if (h == NULL && !initializing)
6
 		h = getsname(a);
7
-	if (h != NULL && !isdigit((int)*h))
8
+	if (h != NULL)
9
 		strcpy(ep->h, h);
10
 	ep->t = t;
11
 	return (ep);
12
@@ -301,7 +301,7 @@ check_hname(register struct ainfo *ap)
13
 		return;
14
 	ep = ap->elist[0];
15
 	h = getsname(ap->a);
16
-	if (!isdigit((int)*h) && strcmp(h, ep->h) != 0) {
17
+	if (h != NULL && strcmp(h, ep->h) != 0) {
18
 		syslog(LOG_INFO, "hostname changed %s %s %s -> %s",
19
 		    intoa(ap->a), e2str(ep->e), ep->h, h);
20
 		strcpy(ep->h, h);
(-)net-mgmt/arpwatch/files/patch-dns.c (-33 lines)
Lines 1-33 Link Here
1
--- dns.c.orig	2000-10-14 01:50:52 UTC
2
+++ dns.c
3
@@ -137,7 +137,7 @@ gethinfo(register char *hostname, regist
4
 	return (0);
5
 }
6
 
7
-/* Return the cannonical name of the host */
8
+/* Return the canonical name of the host (NULL if not found) */
9
 char *
10
 gethname(u_int32_t a)
11
 {
12
@@ -150,18 +150,18 @@ gethname(u_int32_t a)
13
 	hp = gethostbyaddr((char *)&a, sizeof(a), AF_INET);
14
 	_res.options = options;
15
 	if (hp == NULL)
16
-		return (intoa(a));
17
+		return NULL;
18
 	return (hp->h_name);
19
 }
20
 
21
-/* Return the simple name of the host */
22
+/* Return the simple name of the host (NULL if not found) */
23
 char *
24
 getsname(register u_int32_t a)
25
 {
26
 	register char *s, *cp;
27
 
28
 	s = gethname(a);
29
-	if (!isdigit((int)*s)) {
30
+	if (s != NULL) {
31
 		cp = strchr(s, '.');
32
 		if (cp != NULL)
33
 			*cp = '\0';
(-)net-mgmt/arpwatch/files/patch-report.c (-76 lines)
Lines 1-76 Link Here
1
--- report.c.orig	2000-09-30 23:41:10 UTC
2
+++ report.c
3
@@ -45,6 +45,8 @@ struct rtentry;
4
 
5
 #include <ctype.h>
6
 #include <errno.h>
7
+#include <fcntl.h>
8
+#include <paths.h>
9
 #include <signal.h>
10
 #include <stdio.h>
11
 #include <stdlib.h>
12
@@ -70,6 +72,8 @@ struct rtentry;
13
 
14
 #define PLURAL(n) ((n) == 1 || (n) == -1 ? "" : "s")
15
 
16
+extern char *Watcher;
17
+
18
 static int cdepth;	/* number of outstanding children */
19
 
20
 static char *fmtdate(time_t);
21
@@ -240,7 +244,7 @@ report(register char *title, register u_
22
 	register FILE *f;
23
 	char tempfile[64], cpu[64], os[64];
24
 	char *fmt = "%20s: %s\n";
25
-	char *watcher = WATCHER;
26
+	char *watcher = Watcher ? Watcher : WATCHER;
27
 	char *watchee = WATCHEE;
28
 	char *sendmail = PATH_SENDMAIL;
29
 	char *unknown = "<unknown>";
30
@@ -251,6 +255,11 @@ report(register char *title, register u_
31
 	if (initializing)
32
 		return;
33
 
34
+	/* No mail for 0.0.0.0 if -z */
35
+	if (zeroflag == 1 && strncmp("0.0.0.0",intoa(a),16) == 0 ) {
36
+		dosyslog(LOG_NOTICE, title, a, e1, e2);
37
+		return;
38
+	}
39
 	if (debug) {
40
 		if (debug > 1) {
41
 			dosyslog(LOG_NOTICE, title, a, e1, e2);
42
@@ -303,7 +312,7 @@ report(register char *title, register u_
43
 	(void)fprintf(f, "From: %s\n", watchee);
44
 	(void)fprintf(f, "To: %s\n", watcher);
45
 	hn = gethname(a);
46
-	if (!isdigit(*hn))
47
+	if (hn != NULL)
48
 		(void)fprintf(f, "Subject: %s (%s)\n", title, hn);
49
 	else {
50
 		(void)fprintf(f, "Subject: %s\n", title);
51
@@ -344,6 +353,25 @@ report(register char *title, register u_
52
 		exit(1);
53
 	}
54
 	/* XXX Need to freopen()? */
55
+
56
+	/*
57
+	 * Open /dev/null as stdout and stderr so that sendmail 8.12.1 (and
58
+	 * above ?) won't complain about missing file descriptors.
59
+	 */
60
+	if ((fd = open(_PATH_DEVNULL, O_RDWR)) == -1) {
61
+		syslog(LOG_ERR, "Cannot open %s: %m", _PATH_DEVNULL);
62
+		exit(1);
63
+	}
64
+	if (dup2(fd, STDOUT_FILENO) == -1) {
65
+		syslog(LOG_ERR, "Cannot dup2 %s to stdout: %m", _PATH_DEVNULL);
66
+		exit(1);
67
+	}
68
+	if (dup2(fd, STDERR_FILENO) == -1) {
69
+		syslog(LOG_ERR, "Cannot dup2 %s to stderr: %m", _PATH_DEVNULL);
70
+		exit(1);
71
+	}
72
+	close(fd);
73
+
74
 	/* Always Deliver interactively (pause when child depth gets large) */
75
 	execl(sendmail, "sendmail", "-odi", watcher, NULL);
76
 	syslog(LOG_ERR, "execl: %s: %m", sendmail);
(-)net-mgmt/arpwatch/files/patch-util.c (-15 lines)
Lines 1-15 Link Here
1
--- util.c.orig	2004-01-22 22:25:39 UTC
2
+++ util.c
3
@@ -59,7 +59,12 @@ char *ethercodes = ETHERCODES;
4
 u_char zero[6] = { 0, 0, 0, 0, 0, 0 };
5
 u_char allones[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
6
 
7
+/* VRRP/CARP ethernet prefix */
8
+u_char vrrp_prefix[5] = { 0x00, 0x00, 0x5e, 0x00, 0x01 };
9
+
10
 int debug = 0;
11
+int vrrpflag = 0;
12
+int zeroflag = 0;
13
 int initializing = 1;			/* true if initializing */
14
 
15
 /* syslog() helper routine */
(-)net-mgmt/arpwatch/files/patch-util.h (-12 lines)
Lines 1-12 Link Here
1
--- util.h.orig	1996-10-06 10:22:14 UTC
2
+++ util.h
3
@@ -14,6 +14,9 @@ extern char *ethercodes;
4
 
5
 extern u_char zero[6];
6
 extern u_char allones[6];
7
+extern u_char vrrp_prefix[5];
8
 
9
 extern int debug;
10
+extern int vrrpflag;
11
+extern int zeroflag;
12
 extern int initializing;
(-)net-mgmt/arpwatch/files/pkg-message.in (-5 / +11 lines)
Lines 1-12 Link Here
1
[
1
[
2
{ type: install
2
{ type: install
3
  message: <<EOM
3
  message: <<EOM
4
You can update the ethercodes.dat file executing the following steps
4
You can update the ethercodes.dat file executing the following steps:
5
5
6
cd %%PREFIX%%/arpwatch
6
    cd %%PREFIX%%/arpwatch
7
fetch -o- http://standards-oui.ieee.org//oui.txt | tr -d "\15" > oui.txt
7
    fetch http://standards-oui.ieee.org/oui/oui.csv
8
./massagevendor oui.txt > ethercodes.dat
8
    ./massagevendor oui.csv > ethercodes.dat
9
rm oui.txt
9
    rm oui.csv
10
11
You might also want to disable the ETHERCODES option when building
12
to avoid clobbering ethercodes.dat on update or reinstall.
13
14
The -m flag is deprecated. If you are using the -m watcher flag,
15
please switch to -w.
10
EOM
16
EOM
11
}
17
}
12
]
18
]
(-)net-mgmt/arpwatch/pkg-descr (-1 / +1 lines)
Lines 2-5 Link Here
2
maintains a database of ethernet/ip address pairings. It also reports
2
maintains a database of ethernet/ip address pairings. It also reports
3
certain changes via email.
3
certain changes via email.
4
4
5
WWW: http://ee.lbl.gov/
5
WWW: https://ee.lbl.gov/downloads/arpwatch/
(-)net-mgmt/arpwatch/pkg-plist (+1 lines)
Lines 6-11 Link Here
6
arpwatch/euppertolower.awk
6
arpwatch/euppertolower.awk
7
arpwatch/massagevendor
7
arpwatch/massagevendor
8
arpwatch/p.awk
8
arpwatch/p.awk
9
etc/rc.d/arpwatch
9
man/man8/arpsnmp.8.gz
10
man/man8/arpsnmp.8.gz
10
man/man8/arpwatch.8.gz
11
man/man8/arpwatch.8.gz
11
sbin/arpsnmp
12
sbin/arpsnmp

Return to bug 242346