parent
aae9a9ade0
commit
6a22118b91
@ -0,0 +1,6 @@ |
||||
config BR2_PACKAGE_ARPWATCH |
||||
tristate "arpwatch" |
||||
default m |
||||
help |
||||
Ethernet monitor program for keeping track of ethernet/ip address pairings |
||||
|
@ -0,0 +1,69 @@ |
||||
# $Id$
|
||||
|
||||
include $(TOPDIR)/rules.mk |
||||
|
||||
PKG_NAME:=arpwatch
|
||||
PKG_VERSION:=2.1a11
|
||||
PKG_RELEASE:=1
|
||||
PKG_MD5SUM:=9ecd00db892737431b0e524f3e52e19e
|
||||
|
||||
PKG_SOURCE_URL:=http://nbd.vd-s.ath.cx/openwrt
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_CAT:=zcat
|
||||
PKG_IPK:=$(PACKAGE_DIR)/$(PKG_NAME)_$(PKG_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk
|
||||
PKG_IPK_DIR:=$(PKG_BUILD_DIR)/ipkg
|
||||
|
||||
$(DL_DIR)/$(PKG_SOURCE): |
||||
$(SCRIPT_DIR)/download.pl $(DL_DIR) $(PKG_SOURCE) $(PKG_MD5SUM) $(PKG_SOURCE_URL)
|
||||
|
||||
$(PKG_BUILD_DIR)/.unpacked: $(DL_DIR)/$(PKG_SOURCE) |
||||
$(PKG_CAT) $(DL_DIR)/$(PKG_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
|
||||
touch $(PKG_BUILD_DIR)/.unpacked
|
||||
|
||||
$(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.unpacked |
||||
(cd $(PKG_BUILD_DIR); rm -rf config.cache; \
|
||||
$(TARGET_CONFIGURE_OPTS) \
|
||||
CFLAGS="$(TARGET_CFLAGS)" \
|
||||
./configure \
|
||||
--target=$(GNU_TARGET_NAME) \
|
||||
--host=$(GNU_TARGET_NAME) \
|
||||
--build=$(GNU_HOST_NAME) \
|
||||
--prefix=/usr \
|
||||
--exec-prefix=/usr \
|
||||
--bindir=/usr/bin \
|
||||
--sbindir=/usr/sbin \
|
||||
--libexecdir=/usr/lib \
|
||||
--sysconfdir=/etc \
|
||||
--datadir=/usr/share \
|
||||
--localstatedir=/var \
|
||||
--mandir=/usr/man \
|
||||
--infodir=/usr/info \
|
||||
$(DISABLE_NLS) \
|
||||
$(DISABLE_LARGEFILE) \
|
||||
);
|
||||
touch $(PKG_BUILD_DIR)/.configured
|
||||
|
||||
$(PKG_BUILD_DIR)/$(PKG_NAME): $(PKG_BUILD_DIR)/.configured |
||||
$(MAKE) CC=$(TARGET_CC) -C $(PKG_BUILD_DIR)
|
||||
|
||||
$(PKG_IPK): $(PKG_BUILD_DIR)/$(PKG_NAME) |
||||
$(SCRIPT_DIR)/make-ipkg-dir.sh $(PKG_IPK_DIR) $(PKG_NAME).control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
|
||||
mkdir -p $(PKG_IPK_DIR)/usr/sbin
|
||||
cp $(PKG_BUILD_DIR)/arpwatch $(PKG_IPK_DIR)/usr/sbin/
|
||||
cp $(PKG_BUILD_DIR)/arpsnmp $(PKG_IPK_DIR)/usr/sbin/
|
||||
$(STRIP) $(PKG_IPK_DIR)/usr/sbin/*
|
||||
mkdir -p $(PACKAGE_DIR)
|
||||
$(IPKG_BUILD) $(PKG_IPK_DIR) $(PACKAGE_DIR)
|
||||
|
||||
$(IPKG_STATE_DIR)/info/$(PKG_NAME).list: $(PKG_IPK) |
||||
$(IPKG) install $(PKG_IPK)
|
||||
|
||||
source: $(DL_DIR)/$(PKG_SOURCE) |
||||
prepare: $(PKG_BUILD_DIR)/.unpacked |
||||
compile: $(PKG_IPK) |
||||
install: $(IPKG_STATE_DIR)/info/$(PKG_NAME).list |
||||
|
||||
clean: |
||||
rm -rf $(PKG_BUILD_DIR)
|
||||
rm -f $(PKG_IPK)
|
@ -0,0 +1,6 @@ |
||||
Package: arpwatch |
||||
Priority: optional |
||||
Section: net |
||||
Maintainer: Felix Fietkau <nbd@vd-s.ath.cx> |
||||
Source: buildroot internal |
||||
Description: Ethernet monitor program for keeping track of ethernet/ip address pairings |
@ -0,0 +1,103 @@ |
||||
Index: arpwatch/Makefile.in |
||||
diff -u arpwatch/Makefile.in:1.1.1.1 arpwatch/Makefile.in:1.1.1.1.10.1 |
||||
--- arpwatch/Makefile.in:1.1.1.1 Tue Apr 17 13:31:36 2001 |
||||
+++ arpwatch/Makefile.in Tue Apr 17 13:53:29 2001 |
||||
@@ -31,7 +31,8 @@ |
||||
# Pathname of directory to install the man page |
||||
MANDEST = @mandir@ |
||||
# Pathname of directory to install database file |
||||
-ARPDIR = $(prefix)/arpwatch |
||||
+ARPDIR = /var/lib/arpwatch |
||||
+ETHERCODES = /usr/share/arpwatch/ethercodes.dat |
||||
|
||||
# VPATH |
||||
srcdir = @srcdir@ |
||||
@@ -45,7 +46,8 @@ |
||||
PROG = arpwatch |
||||
CCOPT = @V_CCOPT@ |
||||
INCLS = -I. @V_INCLS@ |
||||
-DEFS = -DDEBUG @DEFS@ -DARPDIR=\"$(ARPDIR)\" -DPATH_SENDMAIL=\"$(SENDMAIL)\" |
||||
+DEFS = -DDEBUG @DEFS@ -DARPDIR=\"$(ARPDIR)\" -DPATH_SENDMAIL=\"$(SENDMAIL)\" \ |
||||
+ -DETHERCODES=\"$(ETHERCODES)\" |
||||
|
||||
# Standard CFLAGS |
||||
CFLAGS = $(CCOPT) $(DEFS) $(INCLS) |
||||
Index: arpwatch/arpsnmp.8 |
||||
diff -u arpwatch/arpsnmp.8:1.1.1.1 arpwatch/arpsnmp.8:1.1.1.1.10.1 |
||||
--- arpwatch/arpsnmp.8:1.1.1.1 Tue Apr 17 13:31:36 2001 |
||||
+++ arpwatch/arpsnmp.8 Tue Apr 17 13:53:29 2001 |
||||
@@ -1,4 +1,4 @@ |
||||
-.\" @(#) $Id$ (LBL) |
||||
+.\" @(#) $Id$ (LBL) |
||||
.\" |
||||
.\" Copyright (c) 1996, 1997, 1999, 2000 |
||||
.\" The Regents of the University of California. All rights reserved. |
||||
@@ -69,9 +69,9 @@ |
||||
.na |
||||
.nh |
||||
.nf |
||||
-/usr/operator/arpwatch - default directory |
||||
+/var/lib/arpwatch - default directory |
||||
arp.dat - ethernet/ip address database |
||||
-ethercodes.dat - vendor ethernet block list |
||||
+/usr/share/arpwatch/ethercodes.dat - vendor ethernet block list |
||||
.ad |
||||
.hy |
||||
.fi |
||||
Index: arpwatch/arpwatch.8 |
||||
diff -u arpwatch/arpwatch.8:1.1.1.1 arpwatch/arpwatch.8:1.1.1.1.10.1 |
||||
--- arpwatch/arpwatch.8:1.1.1.1 Tue Apr 17 13:31:36 2001 |
||||
+++ arpwatch/arpwatch.8 Tue Apr 17 13:53:29 2001 |
||||
@@ -1,4 +1,4 @@ |
||||
-.\" @(#) $Id$ (LBL) |
||||
+.\" @(#) $Id$ (LBL) |
||||
.\" |
||||
.\" Copyright (c) 1992, 1994, 1996, 1997, 2000 |
||||
.\" The Regents of the University of California. All rights reserved. |
||||
@@ -152,9 +152,9 @@ |
||||
.na |
||||
.nh |
||||
.nf |
||||
-/usr/operator/arpwatch - default directory |
||||
+/var/lib/arpwatch - default directory |
||||
arp.dat - ethernet/ip address database |
||||
-ethercodes.dat - vendor ethernet block list |
||||
+/usr/share/arpwatch/ethercodes.dat - vendor ethernet block list |
||||
.ad |
||||
.hy |
||||
.fi |
||||
Index: arpwatch/arpwatch.h |
||||
diff -u arpwatch/arpwatch.h:1.1.1.1 arpwatch/arpwatch.h:1.1.1.1.10.1 |
||||
--- arpwatch/arpwatch.h:1.1.1.1 Tue Apr 17 13:31:36 2001 |
||||
+++ arpwatch/arpwatch.h Tue Apr 17 13:53:29 2001 |
||||
@@ -1,7 +1,7 @@ |
||||
/* @(#) $Id$ (LBL) */ |
||||
|
||||
#define ARPFILE "arp.dat" |
||||
-#define ETHERCODES "ethercodes.dat" |
||||
+/* #define ETHERCODES "ethercodes.dat" */ |
||||
#define CHECKPOINT (15*60) /* Checkpoint time in seconds */ |
||||
|
||||
#define MEMCMP(a, b, n) memcmp((char *)a, (char *)b, n) |
||||
Index: arpwatch/bihourly |
||||
diff -u arpwatch/bihourly:1.1.1.1 arpwatch/bihourly:1.1.1.1.10.1 |
||||
--- arpwatch/bihourly:1.1.1.1 Tue Apr 17 13:31:36 2001 |
||||
+++ arpwatch/bihourly Tue Apr 17 13:53:29 2001 |
||||
@@ -6,7 +6,7 @@ |
||||
PATH=$PATH:/usr/local/sbin |
||||
export PATH |
||||
# |
||||
-cd /usr/operator/arpwatch |
||||
+cd /var/lib/arpwatch |
||||
# |
||||
list=`cat list` |
||||
cname=`cat cname` |
||||
@@ -14,7 +14,7 @@ |
||||
# |
||||
alist="" |
||||
for r in $list; do \ |
||||
- ./arpfetch $r $cname > $r 2> $errs |
||||
+ arpfetch $r $cname > $r 2> $errs |
||||
if test -s $errs; then |
||||
echo "arpfetch $r failed:" |
||||
sed -e 's/^/ /' $errs |
@ -0,0 +1,87 @@ |
||||
Index: arpwatch/arpsnmp.c |
||||
diff -u arpwatch/arpsnmp.c:1.1.1.1 arpwatch/arpsnmp.c:1.1.1.1.2.1 |
||||
--- arpwatch/arpsnmp.c:1.1.1.1 Tue Apr 17 13:31:36 2001 |
||||
+++ arpwatch/arpsnmp.c Tue Apr 17 13:47:57 2001 |
||||
@@ -78,6 +78,10 @@ |
||||
register char *cp; |
||||
register int op, i; |
||||
char errbuf[256]; |
||||
+ char options[] = |
||||
+ "d" |
||||
+ "f:" |
||||
+ ; |
||||
|
||||
if ((cp = strrchr(argv[0], '/')) != NULL) |
||||
prog = cp + 1; |
||||
@@ -90,7 +94,7 @@ |
||||
} |
||||
|
||||
opterr = 0; |
||||
- while ((op = getopt(argc, argv, "df:")) != EOF) |
||||
+ while ((op = getopt(argc, argv, options)) != EOF) |
||||
switch (op) { |
||||
|
||||
case 'd': |
||||
@@ -181,9 +185,14 @@ |
||||
usage(void) |
||||
{ |
||||
extern char version[]; |
||||
+ char usage[] = |
||||
+ "[-d] " |
||||
+ "[-f datafile] " |
||||
+ "file [...]\n" |
||||
+ ; |
||||
|
||||
(void)fprintf(stderr, "Version %s\n", version); |
||||
(void)fprintf(stderr, |
||||
- "usage: %s [-d] [-f datafile] file [...]\n", prog); |
||||
+ "usage: %s %s", prog, usage); |
||||
exit(1); |
||||
} |
||||
Index: arpwatch/arpwatch.c |
||||
diff -u arpwatch/arpwatch.c:1.1.1.1 arpwatch/arpwatch.c:1.1.1.1.2.1 |
||||
--- arpwatch/arpwatch.c:1.1.1.1 Tue Apr 17 13:31:36 2001 |
||||
+++ arpwatch/arpwatch.c Tue Apr 17 13:47:57 2001 |
||||
@@ -153,6 +153,14 @@ |
||||
register char *interface, *rfilename; |
||||
struct bpf_program code; |
||||
char errbuf[PCAP_ERRBUF_SIZE]; |
||||
+ char options[] = |
||||
+ "d" |
||||
+ "f:" |
||||
+ "i:" |
||||
+ "n:" |
||||
+ "N" |
||||
+ "r:" |
||||
+ ; |
||||
|
||||
if (argv[0] == NULL) |
||||
prog = "arpwatch"; |
||||
@@ -170,7 +178,7 @@ |
||||
interface = NULL; |
||||
rfilename = NULL; |
||||
pd = NULL; |
||||
- while ((op = getopt(argc, argv, "df:i:n:Nr:")) != EOF) |
||||
+ while ((op = getopt(argc, argv, options)) != EOF) |
||||
switch (op) { |
||||
|
||||
case 'd': |
||||
@@ -748,9 +756,16 @@ |
||||
usage(void) |
||||
{ |
||||
extern char version[]; |
||||
+ char usage[] = |
||||
+ "[-dN] " |
||||
+ "[-f datafile] " |
||||
+ "[-i interface] " |
||||
+ "[-n net[/width]] " |
||||
+ "[-r file] " |
||||
+ "\n" |
||||
+ ; |
||||
|
||||
(void)fprintf(stderr, "Version %s\n", version); |
||||
- (void)fprintf(stderr, "usage: %s [-dN] [-f datafile] [-i interface]" |
||||
- " [-n net[/width]] [-r file]\n", prog); |
||||
+ (void)fprintf(stderr, "usage: %s %s", prog, usage); |
||||
exit(1); |
||||
} |
@ -0,0 +1,163 @@ |
||||
Index: arpwatch/arpsnmp.8 |
||||
diff -u arpwatch/arpsnmp.8:1.1.1.1 arpwatch/arpsnmp.8:1.1.1.1.4.1 |
||||
--- arpwatch/arpsnmp.8:1.1.1.1 Tue Apr 17 13:31:36 2001 |
||||
+++ arpwatch/arpsnmp.8 Tue Apr 17 13:49:16 2001 |
||||
@@ -30,7 +30,12 @@ |
||||
] [ |
||||
.B -f |
||||
.I datafile |
||||
+] [ |
||||
+.B -s |
||||
+.I sendmail_path |
||||
] |
||||
+.br |
||||
+.ti +8 |
||||
.I file |
||||
[ |
||||
.I ... |
||||
@@ -54,6 +59,13 @@ |
||||
flag is used to set the ethernet/ip address database filename. |
||||
The default is |
||||
.IR arp.dat . |
||||
+.LP |
||||
+The |
||||
+.B -s |
||||
+flag is used to specify the path to the sendmail program. |
||||
+Any program that takes the option -odi and then text from stdin |
||||
+can be substituted. This is useful for redirecting reports |
||||
+to log files instead of mail. (Debian specific) |
||||
.LP |
||||
Note that an empty |
||||
.I arp.dat |
||||
Index: arpwatch/arpsnmp.c |
||||
diff -u arpwatch/arpsnmp.c:1.1.1.1.2.1 arpwatch/arpsnmp.c:1.1.1.1.2.1.2.1 |
||||
--- arpwatch/arpsnmp.c:1.1.1.1.2.1 Tue Apr 17 13:47:57 2001 |
||||
+++ arpwatch/arpsnmp.c Tue Apr 17 13:49:16 2001 |
||||
@@ -67,6 +67,7 @@ |
||||
__dead void usage(void) __attribute__((volatile)); |
||||
|
||||
char *prog; |
||||
+char *path_sendmail = PATH_SENDMAIL; |
||||
|
||||
extern int optind; |
||||
extern int opterr; |
||||
@@ -81,6 +82,7 @@ |
||||
char options[] = |
||||
"d" |
||||
"f:" |
||||
+ "s:" |
||||
; |
||||
|
||||
if ((cp = strrchr(argv[0], '/')) != NULL) |
||||
@@ -109,6 +111,10 @@ |
||||
arpfile = optarg; |
||||
break; |
||||
|
||||
+ case 's': |
||||
+ path_sendmail = optarg; |
||||
+ break; |
||||
+ |
||||
default: |
||||
usage(); |
||||
} |
||||
@@ -188,6 +194,7 @@ |
||||
char usage[] = |
||||
"[-d] " |
||||
"[-f datafile] " |
||||
+ "[-s sendmail_path] " |
||||
"file [...]\n" |
||||
; |
||||
|
||||
Index: arpwatch/arpwatch.8 |
||||
diff -u arpwatch/arpwatch.8:1.1.1.1 arpwatch/arpwatch.8:1.1.1.1.4.1 |
||||
--- arpwatch/arpwatch.8:1.1.1.1 Tue Apr 17 13:31:36 2001 |
||||
+++ arpwatch/arpwatch.8 Tue Apr 17 13:49:16 2001 |
||||
@@ -44,6 +44,12 @@ |
||||
.B -r |
||||
.I file |
||||
] |
||||
+.br |
||||
+.ti +8 |
||||
+[ |
||||
+.B -s |
||||
+.I sendmail_path |
||||
+] |
||||
.ad |
||||
.SH DESCRIPTION |
||||
.B Arpwatch |
||||
@@ -93,6 +99,13 @@ |
||||
of reading from the network. In this case, |
||||
.B arpwatch |
||||
does not fork. |
||||
+.LP |
||||
+The |
||||
+.B -s |
||||
+flag is used to specify the path to the sendmail program. |
||||
+Any program that takes the option -odi and then text from stdin |
||||
+can be substituted. This is useful for redirecting reports |
||||
+to log files instead of mail. (Debian specific) |
||||
.LP |
||||
Note that an empty |
||||
.I arp.dat |
||||
Index: arpwatch/arpwatch.c |
||||
diff -u arpwatch/arpwatch.c:1.1.1.1.2.1 arpwatch/arpwatch.c:1.1.1.1.2.1.2.1 |
||||
--- arpwatch/arpwatch.c:1.1.1.1.2.1 Tue Apr 17 13:47:57 2001 |
||||
+++ arpwatch/arpwatch.c Tue Apr 17 13:49:16 2001 |
||||
@@ -106,6 +106,7 @@ |
||||
#endif |
||||
|
||||
char *prog; |
||||
+char *path_sendmail = PATH_SENDMAIL; |
||||
|
||||
int can_checkpoint; |
||||
int swapped; |
||||
@@ -160,6 +161,7 @@ |
||||
"n:" |
||||
"N" |
||||
"r:" |
||||
+ "s:" |
||||
; |
||||
|
||||
if (argv[0] == NULL) |
||||
@@ -210,6 +212,10 @@ |
||||
rfilename = optarg; |
||||
break; |
||||
|
||||
+ case 's': |
||||
+ path_sendmail = optarg; |
||||
+ break; |
||||
+ |
||||
default: |
||||
usage(); |
||||
} |
||||
@@ -761,7 +767,8 @@ |
||||
"[-f datafile] " |
||||
"[-i interface] " |
||||
"[-n net[/width]] " |
||||
- "[-r file] " |
||||
+ "[-r file]\n\t" |
||||
+ "[-s sendmail_path] " |
||||
"\n" |
||||
; |
||||
|
||||
Index: arpwatch/report.c |
||||
diff -u arpwatch/report.c:1.1.1.1 arpwatch/report.c:1.1.1.1.4.1 |
||||
--- arpwatch/report.c:1.1.1.1 Tue Apr 17 13:31:37 2001 |
||||
+++ arpwatch/report.c Tue Apr 17 13:49:16 2001 |
||||
@@ -235,6 +235,7 @@ |
||||
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) |
||||
{ |
||||
+ extern char *path_sendmail; |
||||
register char *cp, *hn; |
||||
register int fd, pid; |
||||
register FILE *f; |
||||
@@ -242,7 +243,7 @@ |
||||
char *fmt = "%20s: %s\n"; |
||||
char *watcher = WATCHER; |
||||
char *watchee = WATCHEE; |
||||
- char *sendmail = PATH_SENDMAIL; |
||||
+ char *sendmail = path_sendmail; |
||||
char *unknown = "<unknown>"; |
||||
char buf[132]; |
||||
static int init = 0; |
@ -0,0 +1,90 @@ |
||||
Index: arpwatch/arpwatch.8 |
||||
diff -u arpwatch/arpwatch.8:1.1.1.1 arpwatch/arpwatch.8:1.1.1.1.6.1 |
||||
--- arpwatch/arpwatch.8:1.1.1.1 Tue Apr 17 13:31:36 2001 |
||||
+++ arpwatch/arpwatch.8 Tue Apr 17 13:50:23 2001 |
||||
@@ -29,6 +29,8 @@ |
||||
[ |
||||
.B -dN |
||||
] [ |
||||
+.B -p |
||||
+] [ |
||||
.B -f |
||||
.I datafile |
||||
] [ |
||||
@@ -81,6 +83,15 @@ |
||||
The |
||||
.B -N |
||||
flag disables reporting any bogons. |
||||
+.LP |
||||
+The |
||||
+.B -p |
||||
+flag disables promiscuous operation. ARP broadcasts get through hubs without |
||||
+having the interface in promiscuous mode, while saving considerable resources |
||||
+that would be wasted on processing gigabytes of non-broadcast traffic. OTOH, |
||||
+setting promiscuous mode does not mean getting 100% traffic that would concern |
||||
+.B arpwatch . |
||||
+YMMV. (Debian specific) |
||||
.LP |
||||
The |
||||
.B -r |
||||
Index: arpwatch/arpwatch.c |
||||
diff -u arpwatch/arpwatch.c:1.1.1.1.2.1 arpwatch/arpwatch.c:1.1.1.1.2.1.4.1 |
||||
--- arpwatch/arpwatch.c:1.1.1.1.2.1 Tue Apr 17 13:47:57 2001 |
||||
+++ arpwatch/arpwatch.c Tue Apr 17 13:50:23 2001 |
||||
@@ -159,6 +159,7 @@ |
||||
"i:" |
||||
"n:" |
||||
"N" |
||||
+ "p" |
||||
"r:" |
||||
; |
||||
|
||||
@@ -206,6 +207,10 @@ |
||||
++nobogons; |
||||
break; |
||||
|
||||
+ case 'p': |
||||
+ ++nopromisc; |
||||
+ break; |
||||
+ |
||||
case 'r': |
||||
rfilename = optarg; |
||||
break; |
||||
@@ -277,7 +282,7 @@ |
||||
snaplen = max(sizeof(struct ether_header), |
||||
sizeof(struct fddi_header)) + sizeof(struct ether_arp); |
||||
timeout = 1000; |
||||
- pd = pcap_open_live(interface, snaplen, 1, timeout, errbuf); |
||||
+ pd = pcap_open_live(interface, snaplen, !nopromisc, timeout, errbuf); |
||||
if (pd == NULL) { |
||||
syslog(LOG_ERR, "pcap open %s: %s", interface, errbuf); |
||||
exit(1); |
||||
@@ -758,6 +763,7 @@ |
||||
extern char version[]; |
||||
char usage[] = |
||||
"[-dN] " |
||||
+ "[-p] " |
||||
"[-f datafile] " |
||||
"[-i interface] " |
||||
"[-n net[/width]] " |
||||
Index: arpwatch/util.c |
||||
diff -u arpwatch/util.c:1.1.1.1 arpwatch/util.c:1.1.1.1.6.1 |
||||
--- arpwatch/util.c:1.1.1.1 Tue Apr 17 13:31:37 2001 |
||||
+++ arpwatch/util.c Tue Apr 17 13:50:23 2001 |
||||
@@ -61,6 +61,7 @@ |
||||
|
||||
int debug = 0; |
||||
int initializing = 1; /* true if initializing */ |
||||
+int nopromisc = 0; /* don't activate promisc mode */ |
||||
|
||||
/* syslog() helper routine */ |
||||
void |
||||
Index: arpwatch/util.h |
||||
diff -u arpwatch/util.h:1.1.1.1 arpwatch/util.h:1.1.1.1.6.1 |
||||
--- arpwatch/util.h:1.1.1.1 Tue Apr 17 13:31:37 2001 |
||||
+++ arpwatch/util.h Tue Apr 17 13:50:23 2001 |
||||
@@ -17,3 +17,4 @@ |
||||
|
||||
extern int debug; |
||||
extern int initializing; |
||||
+extern int nopromisc; |
@ -0,0 +1,103 @@ |
||||
Index: arpwatch/arpwatch.8 |
||||
diff -u arpwatch/arpwatch.8:1.1.1.1 arpwatch/arpwatch.8:1.1.1.1.8.1 |
||||
--- arpwatch/arpwatch.8:1.1.1.1 Tue Apr 17 13:31:36 2001 |
||||
+++ arpwatch/arpwatch.8 Tue Apr 17 13:51:23 2001 |
||||
@@ -27,6 +27,8 @@ |
||||
.na |
||||
.B arpwatch |
||||
[ |
||||
+.B -a |
||||
+] [ |
||||
.B -dN |
||||
] [ |
||||
.B -f |
||||
@@ -53,6 +55,17 @@ |
||||
uses |
||||
.BR pcap (3) |
||||
to listen for arp packets on a local ethernet interface. |
||||
+.LP |
||||
+.B -a |
||||
+By default, |
||||
+.B arpwatch |
||||
+reports bogons (unless |
||||
+.B -N |
||||
+is given) for IP addresses that are in the same subnet than the |
||||
+first IP address of the default interface. If this option is |
||||
+specified, |
||||
+.B arpwatch |
||||
+will report bogons about every IP addresses. (Debian specific) |
||||
.LP |
||||
The |
||||
.B -d |
||||
Index: arpwatch/arpwatch.c |
||||
diff -u arpwatch/arpwatch.c:1.1.1.1.2.1 arpwatch/arpwatch.c:1.1.1.1.2.1.6.1 |
||||
--- arpwatch/arpwatch.c:1.1.1.1.2.1 Tue Apr 17 13:47:57 2001 |
||||
+++ arpwatch/arpwatch.c Tue Apr 17 13:51:23 2001 |
||||
@@ -154,6 +154,7 @@ |
||||
struct bpf_program code; |
||||
char errbuf[PCAP_ERRBUF_SIZE]; |
||||
char options[] = |
||||
+ "a" |
||||
"d" |
||||
"f:" |
||||
"i:" |
||||
@@ -181,6 +182,10 @@ |
||||
while ((op = getopt(argc, argv, options)) != EOF) |
||||
switch (op) { |
||||
|
||||
+ case 'a': |
||||
+ ++allsubnets; |
||||
+ break; |
||||
+ |
||||
case 'd': |
||||
++debug; |
||||
#ifndef DEBUG |
||||
@@ -389,7 +394,7 @@ |
||||
/* Watch for bogons */ |
||||
if (isbogon(sia)) { |
||||
dosyslog(LOG_INFO, "bogon", sia, sea, sha); |
||||
- return; |
||||
+ if (!allsubnets) return; |
||||
} |
||||
|
||||
/* Watch for ethernet broadcast */ |
||||
@@ -538,7 +543,7 @@ |
||||
/* Watch for bogons */ |
||||
if (isbogon(sia)) { |
||||
dosyslog(LOG_INFO, "bogon", sia, sea, sha); |
||||
- return; |
||||
+ if (!allsubnets) return; |
||||
} |
||||
|
||||
/* Watch for ethernet broadcast */ |
||||
@@ -757,6 +762,7 @@ |
||||
{ |
||||
extern char version[]; |
||||
char usage[] = |
||||
+ "[-a] " |
||||
"[-dN] " |
||||
"[-f datafile] " |
||||
"[-i interface] " |
||||
Index: arpwatch/util.c |
||||
diff -u arpwatch/util.c:1.1.1.1 arpwatch/util.c:1.1.1.1.8.1 |
||||
--- arpwatch/util.c:1.1.1.1 Tue Apr 17 13:31:37 2001 |
||||
+++ arpwatch/util.c Tue Apr 17 13:51:24 2001 |
||||
@@ -59,6 +59,7 @@ |
||||
u_char zero[6] = { 0, 0, 0, 0, 0, 0 }; |
||||
u_char allones[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; |
||||
|
||||
+int allsubnets = 0; /* watch all attached subnets */ |
||||
int debug = 0; |
||||
int initializing = 1; /* true if initializing */ |
||||
|
||||
Index: arpwatch/util.h |
||||
diff -u arpwatch/util.h:1.1.1.1 arpwatch/util.h:1.1.1.1.8.1 |
||||
--- arpwatch/util.h:1.1.1.1 Tue Apr 17 13:31:37 2001 |
||||
+++ arpwatch/util.h Tue Apr 17 13:51:24 2001 |
||||
@@ -15,5 +15,6 @@ |
||||
extern u_char zero[6]; |
||||
extern u_char allones[6]; |
||||
|
||||
+extern int allsubnets; |
||||
extern int debug; |
||||
extern int initializing; |
@ -0,0 +1,161 @@ |
||||
Index: arpwatch/arpsnmp.8 |
||||
diff -u arpwatch/arpsnmp.8:1.1.1.1 arpwatch/arpsnmp.8:1.1.1.1.12.1 |
||||
--- arpwatch/arpsnmp.8:1.1.1.1 Tue Apr 17 13:31:36 2001 |
||||
+++ arpwatch/arpsnmp.8 Tue Apr 17 13:54:38 2001 |
||||
@@ -28,6 +28,9 @@ |
||||
[ |
||||
.B -d |
||||
] [ |
||||
+.B -m |
||||
+.I addr |
||||
+] [ |
||||
.B -f |
||||
.I datafile |
||||
] |
||||
@@ -48,6 +51,13 @@ |
||||
flag is used enable debugging. This also inhibits mailing the reports. |
||||
Instead, they are sent to |
||||
.IR stderr . |
||||
+.LP |
||||
+The |
||||
+.B -m |
||||
+option is used to specify the e-mail address to which reports will be |
||||
+sent. By default, reports are sent to |
||||
+.I root |
||||
+on the local machine. (Debian specific) |
||||
.LP |
||||
The |
||||
.B -f |
||||
Index: arpwatch/arpsnmp.c |
||||
diff -u arpwatch/arpsnmp.c:1.1.1.1.2.1 arpwatch/arpsnmp.c:1.1.1.1.2.1.8.1 |
||||
--- arpwatch/arpsnmp.c:1.1.1.1.2.1 Tue Apr 17 13:47:57 2001 |
||||
+++ arpwatch/arpsnmp.c Tue Apr 17 13:54:38 2001 |
||||
@@ -80,6 +80,7 @@ |
||||
char errbuf[256]; |
||||
char options[] = |
||||
"d" |
||||
+ "m:" |
||||
"f:" |
||||
; |
||||
|
||||
@@ -105,6 +106,10 @@ |
||||
#endif |
||||
break; |
||||
|
||||
+ case 'm': |
||||
+ mailaddress = optarg; |
||||
+ break; |
||||
+ |
||||
case 'f': |
||||
arpfile = optarg; |
||||
break; |
||||
@@ -187,6 +192,7 @@ |
||||
extern char version[]; |
||||
char usage[] = |
||||
"[-d] " |
||||
+ "[-m addr ] " |
||||
"[-f datafile] " |
||||
"file [...]\n" |
||||
; |
||||
Index: arpwatch/arpwatch.8 |
||||
diff -u arpwatch/arpwatch.8:1.1.1.1 arpwatch/arpwatch.8:1.1.1.1.12.1 |
||||
--- arpwatch/arpwatch.8:1.1.1.1 Tue Apr 17 13:31:36 2001 |
||||
+++ arpwatch/arpwatch.8 Tue Apr 17 13:54:38 2001 |
||||
@@ -38,6 +38,10 @@ |
||||
.br |
||||
.ti +8 |
||||
[ |
||||
+.B -m |
||||
+.I addr |
||||
+] |
||||
+[ |
||||
.B -n |
||||
.IR net [/ width |
||||
]] [ |
||||
@@ -69,6 +73,13 @@ |
||||
The |
||||
.B -i |
||||
flag is used to override the default interface. |
||||
+.LP |
||||
+The |
||||
+.B -m |
||||
+option is used to specify the e-mail address to which reports will be |
||||
+sent. By default, reports are sent to |
||||
+.I root |
||||
+on the local machine. (Debian specific) |
||||
.LP |
||||
The |
||||
.B -n |
||||
Index: arpwatch/arpwatch.c |
||||
diff -u arpwatch/arpwatch.c:1.1.1.1.2.1 arpwatch/arpwatch.c:1.1.1.1.2.1.8.1 |
||||
--- arpwatch/arpwatch.c:1.1.1.1.2.1 Tue Apr 17 13:47:57 2001 |
||||
+++ arpwatch/arpwatch.c Tue Apr 17 13:54:38 2001 |
||||
@@ -157,6 +157,7 @@ |
||||
"d" |
||||
"f:" |
||||
"i:" |
||||
+ "m:" |
||||
"n:" |
||||
"N" |
||||
"r:" |
||||
@@ -197,6 +198,10 @@ |
||||
interface = optarg; |
||||
break; |
||||
|
||||
+ case 'm': |
||||
+ mailaddress = optarg; |
||||
+ break; |
||||
+ |
||||
case 'n': |
||||
if (!addnet(optarg)) |
||||
usage(); |
||||
@@ -760,6 +765,7 @@ |
||||
"[-dN] " |
||||
"[-f datafile] " |
||||
"[-i interface] " |
||||
+ "[-m addr] " |
||||
"[-n net[/width]] " |
||||
"[-r file] " |
||||
"\n" |
||||
Index: arpwatch/report.c |
||||
diff -u arpwatch/report.c:1.1.1.1 arpwatch/report.c:1.1.1.1.12.1 |
||||
--- arpwatch/report.c:1.1.1.1 Tue Apr 17 13:31:37 2001 |
||||
+++ arpwatch/report.c Tue Apr 17 13:54:38 2001 |
||||
@@ -240,7 +240,7 @@ |
||||
register FILE *f; |
||||
char tempfile[64], cpu[64], os[64]; |
||||
char *fmt = "%20s: %s\n"; |
||||
- char *watcher = WATCHER; |
||||
+ char *watcher = mailaddress; |
||||
char *watchee = WATCHEE; |
||||
char *sendmail = PATH_SENDMAIL; |
||||
char *unknown = "<unknown>"; |
||||
Index: arpwatch/util.c |
||||
diff -u arpwatch/util.c:1.1.1.1 arpwatch/util.c:1.1.1.1.12.1 |
||||
--- arpwatch/util.c:1.1.1.1 Tue Apr 17 13:31:37 2001 |
||||
+++ arpwatch/util.c Tue Apr 17 13:54:38 2001 |
||||
@@ -50,10 +50,12 @@ |
||||
#include "ec.h" |
||||
#include "file.h" |
||||
#include "util.h" |
||||
+#include "addresses.h" |
||||
|
||||
char *arpdir = ARPDIR; |
||||
char *arpfile = ARPFILE; |
||||
char *ethercodes = ETHERCODES; |
||||
+char *mailaddress = WATCHER; |
||||
|
||||
/* Broadcast ethernet addresses */ |
||||
u_char zero[6] = { 0, 0, 0, 0, 0, 0 }; |
||||
Index: arpwatch/util.h |
||||
diff -u arpwatch/util.h:1.1.1.1 arpwatch/util.h:1.1.1.1.12.1 |
||||
--- arpwatch/util.h:1.1.1.1 Tue Apr 17 13:31:37 2001 |
||||
+++ arpwatch/util.h Tue Apr 17 13:54:38 2001 |
||||
@@ -11,6 +11,7 @@ |
||||
extern char *arpfile; |
||||
extern char *oldarpfile; |
||||
extern char *ethercodes; |
||||
+extern char *mailaddress; |
||||
|
||||
extern u_char zero[6]; |
||||
extern u_char allones[6]; |
@ -0,0 +1,90 @@ |
||||
Index: arpwatch/arp2ethers |
||||
diff -u arpwatch/arp2ethers:1.1.1.1 arpwatch/arp2ethers:1.1.1.1.14.1 |
||||
--- arpwatch/arp2ethers:1.1.1.1 Tue Apr 17 13:31:36 2001 |
||||
+++ arpwatch/arp2ethers Tue Apr 17 13:56:38 2001 |
||||
@@ -1,5 +1,5 @@ |
||||
-#!/bin/csh -f |
||||
-# @(#) $Id$ (LBL) |
||||
+#!/bin/sh |
||||
+# @(#) $Header$ (LBL) |
||||
# |
||||
# Convert arp.dat to ethers format |
||||
# |
||||
@@ -12,12 +12,74 @@ |
||||
# - append "-old", "-old1", etc. as necessary |
||||
# - sort |
||||
# |
||||
+# 1999-04-12 KELEMEN Peter <fuji@debian.org> |
||||
+# Use sh(1) instead of csh(1). |
||||
+# |
||||
+# 2000-03-21 Erik Warmelink <erik@selwerd.nl> |
||||
+# Use next instead of continue in included p.awk. |
||||
|
||||
sort +2rn arp.dat | \ |
||||
awk 'NF == 4 { print }' | \ |
||||
- awk -f p.awk | \ |
||||
+# 1999-04-12 KELEMEN Peter <fuji@debian.org> |
||||
+# awk -f p.awk | \ |
||||
+ awk ' |
||||
+# Only print the first ethernet address seen |
||||
+ |
||||
+{ |
||||
+ e = $1 |
||||
+ if (seen[e]) |
||||
+ next |
||||
+ seen[e] = 1 |
||||
+ print $0 |
||||
+} |
||||
+ ' | \ |
||||
egrep -v '\.[0-9][0-9]*$' | \ |
||||
sed -e 's/ .* / /' | \ |
||||
- awk -f d.awk | \ |
||||
- awk -f e.awk | \ |
||||
+# 1999-04-12 KELEMEN Peter <fuji@debian.org> |
||||
+# awk -f d.awk | \ |
||||
+ awk ' |
||||
+# DECnet hacking |
||||
+ |
||||
+BEGIN { |
||||
+ n = 0 |
||||
+ sdecnet = "aa:0:4:" |
||||
+ ldecnet = length(sdecnet) |
||||
+} |
||||
+ |
||||
+{ |
||||
+ ++n |
||||
+ e[n] = $1 |
||||
+ h[n] = $2 |
||||
+ if (sdecnet == substr($1, 1, ldecnet)) |
||||
+ decnet[$2] = 1 |
||||
+} |
||||
+ |
||||
+END { |
||||
+ for (i = 1; i <= n; ++i) { |
||||
+ if (decnet[h[i]] && sdecnet != substr(e[i], 1, ldecnet)) |
||||
+ h[i] = h[i] "-ip" |
||||
+ print e[i] "\t" h[i] |
||||
+ } |
||||
+} |
||||
+ ' | \ |
||||
+# 1999-04-12 KELEMEN Peter <fuji@debian.org> |
||||
+# awk -f e.awk | \ |
||||
+ awk ' |
||||
+# Add -old suffix to ethers file, as required. Assumed sorted input |
||||
+ |
||||
+{ |
||||
+ if (!seen[$2]) { |
||||
+ seen[$2] = 1 |
||||
+ print |
||||
+ next |
||||
+ } |
||||
+ h = $2 "-old" |
||||
+ s = h |
||||
+ for (n = 1; seen[h]; ++n) |
||||
+ h = s n |
||||
+ seen[h] = 1 |
||||
+ print $1 "\t" h |
||||
+ next |
||||
+} |
||||
+ ' | \ |
||||
sort |
@ -0,0 +1,10 @@ |
||||
config BR2_PACKAGE_NOCATSPLASH |
||||
tristate "NoCatSplash" |
||||
default m |
||||
help |
||||
NoCatSplash is an Open Public Network Gateway Daemon. |
||||
It performs as a [captive/open/active] portal. When run on a gateway/router |
||||
on a network, all web requests are redirected until the client either logs |
||||
in or clicks "I Accept" to an AUP. The gateway daemon then changes the |
||||
firewall rules on the gateway to pass traffic for that client (based on IP |
||||
address and MAC address). |
@ -0,0 +1,71 @@ |
||||
# $Id$
|
||||
|
||||
include $(TOPDIR)/rules.mk |
||||
|
||||
PKG_NAME:=nocatsplash
|
||||
PKG_VERSION:=0.92
|
||||
PKG_RELEASE:=1
|
||||
PKG_MD5SUM:=e0fcc0effe52e63bc31070d16d0b4a81
|
||||
|
||||
PKG_SOURCE_URL:=http://wifi.rulez.org/~josephus/
|
||||
PKG_SOURCE:=NoCatSplash-$(PKG_VERSION).tar.gz
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/NoCatSplash-$(PKG_VERSION)
|
||||
PKG_CAT:=zcat
|
||||
PKG_IPK:=$(PACKAGE_DIR)/$(PKG_NAME)_$(PKG_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk
|
||||
PKG_IPK_DIR:=$(PKG_BUILD_DIR)/ipkg
|
||||
|
||||
$(DL_DIR)/$(PKG_SOURCE): |
||||
$(SCRIPT_DIR)/download.pl $(DL_DIR) $(PKG_SOURCE) $(PKG_MD5SUM) $(PKG_SOURCE_URL)
|
||||
|
||||
$(PKG_BUILD_DIR)/.unpacked: $(DL_DIR)/$(PKG_SOURCE) |
||||
$(PKG_CAT) $(DL_DIR)/$(PKG_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
|
||||
touch $(PKG_BUILD_DIR)/.unpacked
|
||||
|
||||
$(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.unpacked |
||||
(cd $(PKG_BUILD_DIR); rm -rf config.cache; \
|
||||
$(TARGET_CONFIGURE_OPTS) \
|
||||
CFLAGS="$(TARGET_CFLAGS)" \
|
||||
./configure \
|
||||
--target=$(GNU_TARGET_NAME) \
|
||||
--host=$(GNU_TARGET_NAME) \
|
||||
--build=$(GNU_HOST_NAME) \
|
||||
--prefix=/usr \
|
||||
--exec-prefix=/usr \
|
||||
--bindir=/usr/bin \
|
||||
--sbindir=/usr/sbin \
|
||||
--libexecdir=/usr/lib \
|
||||
--sysconfdir=/etc \
|
||||
--datadir=/usr/share \
|
||||
--localstatedir=/var \
|
||||
--mandir=/usr/man \
|
||||
--infodir=/usr/info \
|
||||
$(DISABLE_NLS) \
|
||||
$(DISABLE_LARGEFILE) \
|
||||
);
|
||||
touch $(PKG_BUILD_DIR)/.configured
|
||||
|
||||
$(PKG_BUILD_DIR)/src/splashd: $(PKG_BUILD_DIR)/.configured |
||||
$(MAKE) -C $(PKG_BUILD_DIR) \
|
||||
CC=$(TARGET_CC) \
|
||||
GLIB_CFLAGS="-I$(STAGING_DIR)/usr/include/glib-1.2 -I$(STAGING_DIR)/usr/lib/glib/include" \
|
||||
GLIB_LIBS="-L$(STAGING_DIR)/usr/lib -lglib" \
|
||||
LIBS="-L$(STAGING_DIR)/usr/lib -lglib"
|
||||
|
||||
$(PKG_IPK): $(PKG_BUILD_DIR)/src/splashd |
||||
$(SCRIPT_DIR)/make-ipkg-dir.sh $(PKG_IPK_DIR) $(PKG_NAME).control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
|
||||
$(MAKE) -C $(PKG_BUILD_DIR) DESTDIR=$(PKG_IPK_DIR) install
|
||||
$(STRIP) $(PKG_IPK_DIR)/usr/sbin/splashd
|
||||
mkdir -p $(PACKAGE_DIR)
|
||||
$(IPKG_BUILD) $(PKG_IPK_DIR) $(PACKAGE_DIR)
|
||||
|
||||
$(IPKG_STATE_DIR)/info/$(PKG_NAME).list: $(PKG_IPK) |
||||
$(IPKG) install $(PKG_IPK)
|
||||
|
||||
source: $(DL_DIR)/$(PKG_SOURCE) |
||||
prepare: $(PKG_BUILD_DIR)/.unpacked |
||||
compile: $(PKG_IPK) |
||||
install: $(IPKG_STATE_DIR)/info/$(PKG_NAME).list |
||||
|
||||
clean: |
||||
rm -rf $(PKG_BUILD_DIR)
|
||||
rm -f $(PKG_IPK)
|
@ -0,0 +1,11 @@ |
||||
Package: nocatsplash |
||||
Priority: optional |
||||
Section: net |
||||
Maintainer: Felix Fietkau <nbd@vd-s.ath.cx> |
||||
Source: buildroot internal |
||||
Description: NoCatSplash is an Open Public Network Gateway Daemon. |
||||
It performs as a [captive/open/active] portal. When run on a gateway/router |
||||
on a network, all web requests are redirected until the client either logs |
||||
in or clicks "I Accept" to an AUP. The gateway daemon then changes the |
||||
firewall rules on the gateway to pass traffic for that client (based on IP |
||||
address and MAC address). |
Loading…
Reference in new issue