ports/64906: [Maintainer Update] net/arpwatch-devel build fails under -CURRENT
Matthew George
mdg at secureworks.net
Mon Mar 29 20:00:40 UTC 2004
>Number: 64906
>Category: ports
>Synopsis: [Maintainer Update] net/arpwatch-devel build fails under -CURRENT
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: maintainer-update
>Submitter-Id: current-users
>Arrival-Date: Mon Mar 29 12:00:39 PST 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 at mdg.secureworks.net:/usr/obj/usr/src/sys/GENERIC i386
>Description:
Build of net/arpwatch-devel fails under -CURRENT due to bad NULL
usage. No other branches / releases affected.
>How-To-Repeat:
make the port on a new enough -CURRENT build
>Fix:
--- Makefile.orig Mon Mar 29 14:41:33 2004
+++ Makefile Mon Mar 29 14:41:14 2004
@@ -7,6 +7,7 @@
PORTNAME= arpwatch
PORTVERSION= 2.1.a11
+PORTREVISION= 1
CATEGORIES= net-mgmt
MASTER_SITES= http://www.Awfulhak.org/arpwatch/ \
ftp://ftp.ee.lbl.gov/
--- patch-ai.orig Mon Mar 29 14:28:12 2004
+++ patch-ai Mon Mar 29 14:28:22 2004
@@ -1,22 +1,22 @@
---- ../arpwatch.orig/db.c Sat Sep 30 19:39:58 2000
-+++ ./db.c Mon Sep 15 13:17:07 2003
+--- db.c.orig Sat Sep 30 19:39:58 2000
++++ db.c Mon Mar 29 14:26:14 2004
@@ -41,6 +41,7 @@
#include <string.h>
#include <syslog.h>
#include <unistd.h>
+#include <pthread.h>
-
+
#include "gnuc.h"
#ifdef HAVE_OS_PROTO_H
@@ -54,18 +55,9 @@
#include "report.h"
#include "util.h"
-
+
-#define HASHSIZE (2 << 15)
-
#define NEWACTIVITY_DELTA (6*30*24*60*60) /* 6 months in seconds */
#define FLIPFLIP_DELTA (24*60*60) /* 24 hours in seconds */
-
+
-/* Ethernet info */
-struct einfo {
- u_char e[6]; /* ether address */
@@ -30,7 +30,7 @@
@@ -78,22 +70,69 @@
/* Address hash table */
static struct ainfo ainfo_table[HASHSIZE];
-
+
+
+/* Ethernet hash table */
+struct einfo einfo_table[HASHSIZE];
@@ -44,7 +44,7 @@
+static struct einfo *einfo_find(u_char *);
static void check_hname(struct ainfo *);
struct ainfo *newainfo(void);
-
+
+pthread_mutex_t mtx_einfo, mtx_ainfo;
+
int
@@ -58,7 +58,7 @@
register u_int len;
u_char *e2;
time_t t2;
-+ register evt_type event = NULL;
++ register evt_type event = 0;
+ char *if2 = NULL;
+
+ pthread_mutex_lock(&mtx_einfo);
@@ -81,7 +81,7 @@
+ strncpy(ep->iface, interface, sizeof(ep->iface));
+ event |= ETHER_NEW;
+ e2 = NULL;
-+ t2 = NULL;
++ t2 = 0;
+ }
+ } else if (! initializing) {
+ if (strncmp(ep->iface, interface, sizeof(ep->iface)) != 0) {
@@ -97,7 +97,7 @@
+
+ pthread_mutex_unlock(&mtx_einfo);
+ pthread_mutex_lock(&mtx_ainfo);
-
+
/* Lookup ip address */
ap = ainfo_find(a);
@@ -101,28 +140,30 @@
@@ -117,7 +117,7 @@
- return (1);
}
}
-
+
/* Check for a virgin ainfo record */
if (ap->ecount == 0) {
ap->ecount = 1;
@@ -127,9 +127,9 @@
+ ap->elist[0] = elist_alloc(a, e, t, h, interface);
+ event |= IP_NEW;
+ e2 = NULL;
-+ t2 = NULL;
++ t2 = 0;
}
-
+
/* Check for a flip-flop */
if (ap->ecount > 1) {
ep = ap->elist[1];
@@ -160,7 +160,7 @@
- return (1);
}
}
-
+
for (i = 2; i < ap->ecount; ++i) {
ep = ap->elist[i];
- if (MEMCMP(e, ep->e, 6) == 0) {
@@ -180,7 +180,7 @@
- return (1);
}
}
-
+
- /* New ether address */
- e2 = ap->elist[0]->e;
- t2 = ap->elist[0]->t;
@@ -230,7 +230,7 @@
+
+ return(NULL);
}
-
+
static struct ainfo *
@@ -259,7 +328,7 @@
/* Allocate and initialize a elist struct */
@@ -242,7 +242,7 @@
register struct einfo *ep;
register u_int size;
@@ -280,12 +349,16 @@
-
+
ep = elist++;
--eleft;
- BCOPY(e, ep->e, 6);
@@ -259,7 +259,7 @@
+
return (ep);
}
-
+
@@ -304,7 +377,7 @@
if (!isdigit((int)*h) && strcmp(h, ep->h) != 0) {
syslog(LOG_INFO, "hostname changed %s %s %s -> %s",
@@ -268,4 +268,4 @@
+ strncpy(ep->h, h, sizeof(ep->h));
}
}
-
+
--- patch-an.orig Mon Mar 29 14:31:48 2004
+++ patch-an Mon Mar 29 14:32:12 2004
@@ -1,7 +1,7 @@
---- ../arpwatch.orig/report.c Sat Sep 30 19:41:10 2000
-+++ ./report.c Fri Sep 12 18:57:04 2003
+--- report.c.orig Sat Sep 30 19:41:10 2000
++++ report.c Mon Mar 29 14:24:36 2004
@@ -45,6 +45,8 @@
-
+
#include <ctype.h>
#include <errno.h>
+#include <fcntl.h>
@@ -10,17 +10,17 @@
#include <stdio.h>
#include <stdlib.h>
@@ -70,6 +72,8 @@
-
+
#define PLURAL(n) ((n) == 1 || (n) == -1 ? "" : "s")
-
+
+extern char *Watcher;
+
static int cdepth; /* number of outstanding children */
-
+
static char *fmtdate(time_t);
@@ -232,15 +236,16 @@
}
-
+
void
-report(register char *title, register u_int32_t a, register u_char *e1,
- register u_char *e2, register time_t *t1p, register time_t *t2p)
@@ -41,11 +41,11 @@
@@ -251,9 +256,15 @@
if (initializing)
return;
-
+
+ /* these types are sent to syslog instead of reported on.
+ * only continue if there are other events as well
+ */
-+ if (event == NULL || (event & ~(IP_ETHER_REUSE | FLIPFLOP_DECNET) == 0))
++ if (event == 0 || (event & ~(IP_ETHER_REUSE | FLIPFLOP_DECNET) == 0))
+ return;
+
if (debug) {
@@ -57,11 +57,11 @@
f = stdout;
@@ -270,7 +281,7 @@
}
-
+
/* Syslog this event too */
- dosyslog(LOG_NOTICE, title, a, e1, e2);
+ dosyslog(LOG_NOTICE, "event", a, e1, e2);
-
+
/* Update child depth */
++cdepth;
@@ -304,12 +315,31 @@
--
Matthew George
SecureWorks Technical Operations
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list