summaryrefslogtreecommitdiff
path: root/usr.sbin/tcpdump/privsep.c
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2008-04-18 21:35:12 +0000
committerDamien Miller <djm@cvs.openbsd.org>2008-04-18 21:35:12 +0000
commitade8c4cfcd982e74d7424cee174e1dbee07b073f (patch)
tree6277f946f3ce2b2d81564e022ce99ad3efa972ae /usr.sbin/tcpdump/privsep.c
parent983ca28ce3a05bfdc4449230df279a94e44e81d5 (diff)
add filtering on direction; ok mpf@ deraadt@ feedback jmc@
Diffstat (limited to 'usr.sbin/tcpdump/privsep.c')
-rw-r--r--usr.sbin/tcpdump/privsep.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.sbin/tcpdump/privsep.c b/usr.sbin/tcpdump/privsep.c
index 8608f544161..bfafcca4197 100644
--- a/usr.sbin/tcpdump/privsep.c
+++ b/usr.sbin/tcpdump/privsep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: privsep.c,v 1.26 2007/11/27 16:22:14 martynas Exp $ */
+/* $OpenBSD: privsep.c,v 1.27 2008/04/18 21:35:11 djm Exp $ */
/*
* Copyright (c) 2003 Can Erkin Acar
@@ -200,7 +200,7 @@ priv_init(int argc, char **argv)
/* parse the arguments for required options */
opterr = 0;
while ((i = getopt(argc, argv,
- "ac:deE:fF:i:lLnNOopqr:s:StT:vw:xXy:Y")) != -1) {
+ "ac:D:deE:fF:i:lLnNOopqr:s:StT:vw:xXy:Y")) != -1) {
switch (i) {
case 'n':
nflag++;
@@ -319,7 +319,7 @@ static void
impl_open_bpf(int fd, int *bpfd)
{
int snaplen, promisc, err;
- u_int dlt;
+ u_int dlt, dirfilt;
char device[IFNAMSIZ];
size_t iflen;
@@ -328,10 +328,11 @@ impl_open_bpf(int fd, int *bpfd)
must_read(fd, &snaplen, sizeof(int));
must_read(fd, &promisc, sizeof(int));
must_read(fd, &dlt, sizeof(u_int));
+ must_read(fd, &dirfilt, sizeof(u_int));
iflen = read_string(fd, device, sizeof(device), __func__);
if (iflen == 0)
errx(1, "Invalid interface size specified");
- *bpfd = pcap_live(device, snaplen, promisc, dlt);
+ *bpfd = pcap_live(device, snaplen, promisc, dlt, dirfilt);
err = errno;
if (*bpfd < 0)
logmsg(LOG_DEBUG,