diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2005-03-07 16:13:39 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2005-03-07 16:13:39 +0000 |
commit | 7c827187f2c6eb5177fe7b0de5b1b642f0eb5275 (patch) | |
tree | ecb171ef4a1cfc84f704ee8bf68a3af749cf1e53 /usr.sbin/tcpdump/tcpdump.c | |
parent | d061cdbee42eb1da2c081d154b23a77670baf7e3 (diff) |
add a printer for 802.11 and for additional radiotap headers,
use -y IEEE802_11 or IEEE802_11_RADIO if supported by the driver.
ok canacar@
Diffstat (limited to 'usr.sbin/tcpdump/tcpdump.c')
-rw-r--r-- | usr.sbin/tcpdump/tcpdump.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/usr.sbin/tcpdump/tcpdump.c b/usr.sbin/tcpdump/tcpdump.c index c7a3b8c413a..473d7acb582 100644 --- a/usr.sbin/tcpdump/tcpdump.c +++ b/usr.sbin/tcpdump/tcpdump.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcpdump.c,v 1.41 2005/03/06 21:05:49 jmc Exp $ */ +/* $OpenBSD: tcpdump.c,v 1.42 2005/03/07 16:13:38 reyk Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 @@ -26,7 +26,7 @@ static const char copyright[] = "@(#) Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997\n\ The Regents of the University of California. All rights reserved.\n"; static const char rcsid[] = - "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/tcpdump.c,v 1.41 2005/03/06 21:05:49 jmc Exp $ (LBL)"; + "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/tcpdump.c,v 1.42 2005/03/07 16:13:38 reyk Exp $ (LBL)"; #endif /* @@ -98,7 +98,7 @@ RETSIGTYPE cleanup(int); extern __dead void usage(void); /* Length of saved portion of packet. */ -int snaplen = DEFAULT_SNAPLEN; +int snaplen = 0; struct printer { pcap_handler f; @@ -126,6 +126,8 @@ static struct printer printers[] = { { pflog_old_if_print, DLT_OLD_PFLOG }, { pfsync_if_print, DLT_PFSYNC }, { ppp_ether_if_print, DLT_PPP_ETHER }, + { ieee802_11_if_print, DLT_IEEE802_11 }, + { ieee802_11_radio_if_print, DLT_IEEE802_11_RADIO }, { NULL, 0 }, }; @@ -185,7 +187,9 @@ const struct pcap_linktype { { DLT_OLD_PFLOG, "OLD_PFLOG" }, { DLT_PFSYNC, "PFSYNC" }, { DLT_PPP_ETHER, "PPP_ETHER" }, + { DLT_IEEE802_11, "IEEE802_11" }, { DLT_PFLOG, "PFLOG" }, + { DLT_IEEE802_11_RADIO, "IEEE802_11_RADIO" }, { 0, NULL } }; @@ -440,6 +444,17 @@ main(int argc, char **argv) /* NOTREACHED */ } + if (snaplen == 0) { + switch (dlt) { + case DLT_IEEE802_11_RADIO: + snaplen = RADIOTAP_SNAPLEN; + break; + default: + snaplen = DEFAULT_SNAPLEN; + break; + } + } + if (aflag && nflag) error("-a and -n options are incompatible"); |