summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2001-08-24 19:48:38 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2001-08-24 19:48:38 +0000
commit7879f173be1d77a063023021ea7676bd5cacae8c (patch)
tree266bf58fc5d3c8474b2220cd5818c7f4da1da0fe
parent3ef1e30945b69827c2add5d2f05b07647109b3fe (diff)
move back to requested snaplen after SIGHUP; canacar@eee.metu.edu.tr
-rw-r--r--sbin/pflogd/pflogd.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/sbin/pflogd/pflogd.c b/sbin/pflogd/pflogd.c
index 156f0aeba06..e9eda8a6654 100644
--- a/sbin/pflogd/pflogd.c
+++ b/sbin/pflogd/pflogd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pflogd.c,v 1.5 2001/08/24 19:46:32 deraadt Exp $ */
+/* $OpenBSD: pflogd.c,v 1.6 2001/08/24 19:48:37 deraadt Exp $ */
/*
* Copyright (c) 2001 Theo de Raadt
@@ -181,6 +181,7 @@ reset_dump(void)
{
struct pcap_file_header hdr;
struct stat st;
+ int tmpsnap;
FILE *fp;
if (hpcap == NULL)
@@ -213,6 +214,14 @@ reset_dump(void)
#define TCPDUMP_MAGIC 0xa1b2c3d4
if (st.st_size == 0) {
+ if (snaplen != pcap_snapshot(hpcap)) {
+ logmsg(LOG_NOTICE, "Using snaplen %d\n", snaplen);
+ if (init_pcap()) {
+ logmsg(LOG_ERR, "Failed to initialize\n");
+ if (hpcap == NULL) return (-1);
+ logmsg(LOG_NOTICE, "Using old settings\n");
+ }
+ }
hdr.magic = TCPDUMP_MAGIC;
hdr.version_major = PCAP_VERSION_MAJOR;
hdr.version_minor = PCAP_VERSION_MINOR;
@@ -243,6 +252,7 @@ reset_dump(void)
logmsg(LOG_WARNING,
"Existing file specifies a snaplen of %d, using it",
hdr.snaplen);
+ tmpsnap = snaplen;
snaplen = hdr.snaplen;
if (init_pcap()) {
logmsg(LOG_ERR, "Failed to re-initialize\n");
@@ -252,6 +262,7 @@ reset_dump(void)
"Using old settings, offset: %d\n",
st.st_size);
}
+ snaplen = tmpsnap;
}
}