diff options
author | Kenjiro Cho <kjc@cvs.openbsd.org> | 2003-03-11 02:35:35 +0000 |
---|---|---|
committer | Kenjiro Cho <kjc@cvs.openbsd.org> | 2003-03-11 02:35:35 +0000 |
commit | e15bba03dc747f171e264072a2305d7a7b9c5c99 (patch) | |
tree | 9b6f7c6fd80566154e7429aed0e477d89e4293d7 | |
parent | 8524f64196f2ba2661a0869c05109580b10ad62f (diff) |
always compile and set pcap filters even when filters are not specified.
bpf implements snaplen by filters and captures full packets when filters
are not set.
ok deraadt@, dhartmei@
-rw-r--r-- | sbin/pflogd/pflogd.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/sbin/pflogd/pflogd.c b/sbin/pflogd/pflogd.c index 52148c077cb..79fa7983fbc 100644 --- a/sbin/pflogd/pflogd.c +++ b/sbin/pflogd/pflogd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pflogd.c,v 1.17 2003/03/01 06:11:20 cloder Exp $ */ +/* $OpenBSD: pflogd.c,v 1.18 2003/03/11 02:35:34 kjc Exp $ */ /* * Copyright (c) 2001 Theo de Raadt @@ -161,13 +161,12 @@ init_pcap(void) return (-1); } - if (filter != NULL) { - if (pcap_compile(hpcap, &bprog, filter, PCAP_OPT_FIL, 0) < 0) - logmsg(LOG_WARNING, "%s", pcap_geterr(hpcap)); - else if (pcap_setfilter(hpcap, &bprog) < 0) - logmsg(LOG_WARNING, "%s", pcap_geterr(hpcap)); + if (pcap_compile(hpcap, &bprog, filter, PCAP_OPT_FIL, 0) < 0) + logmsg(LOG_WARNING, "%s", pcap_geterr(hpcap)); + else if (pcap_setfilter(hpcap, &bprog) < 0) + logmsg(LOG_WARNING, "%s", pcap_geterr(hpcap)); + if (filter != NULL) free(filter); - } if (pcap_datalink(hpcap) != DLT_PFLOG) { logmsg(LOG_ERR, "Invalid datalink type"); |