summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorCan Erkin Acar <canacar@cvs.openbsd.org>2005-09-29 18:45:33 +0000
committerCan Erkin Acar <canacar@cvs.openbsd.org>2005-09-29 18:45:33 +0000
commit9cd5ae185af3a80af35b29bb838e6bcd895ced77 (patch)
tree8d1832127d32b0c482efa166f0eb9d88cf0e49b4 /usr.sbin
parent74aa7363900d27b11720d73b6183d8e87921d407 (diff)
Change DLT earlier. Fixes the loss of promisc mode when a non-default
DLT is specified. looks sane deraadt@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/tcpdump/privsep_pcap.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.sbin/tcpdump/privsep_pcap.c b/usr.sbin/tcpdump/privsep_pcap.c
index 7074c58c8e3..375bd3984f9 100644
--- a/usr.sbin/tcpdump/privsep_pcap.c
+++ b/usr.sbin/tcpdump/privsep_pcap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: privsep_pcap.c,v 1.11 2005/09/27 18:31:17 otto Exp $ */
+/* $OpenBSD: privsep_pcap.c,v 1.12 2005/09/29 18:45:32 canacar Exp $ */
/*
* Copyright (c) 2004 Can Erkin Acar
@@ -201,13 +201,13 @@ pcap_live(const char *device, int snaplen, int promisc, u_int dlt)
if (ioctl(fd, BIOCSETIF, &ifr) < 0)
goto error;
+ if (dlt != (u_int) -1 && ioctl(fd, BIOCSDLT, &dlt))
+ goto error;
+
if (promisc)
/* this is allowed to fail */
ioctl(fd, BIOCPROMISC, NULL);
- if (dlt != (u_int) -1 && ioctl(fd, BIOCSDLT, &dlt))
- goto error;
-
/* lock the descriptor */
if (ioctl(fd, BIOCLOCK, NULL) < 0)
goto error;