From 6cd32e5cef8a89313f81f4fb3d58fbd2a6b1d0c9 Mon Sep 17 00:00:00 2001 From: guy Date: Sun, 10 Jun 2001 01:11:39 +0000 Subject: [PATCH] 802.11 support, from Javier Achirica . --- CREDITS | 1 + gencode.c | 20 +++++++++++++++++++- pcap-linux.c | 9 ++++++++- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/CREDITS b/CREDITS index 40f8a07..6156c76 100644 --- a/CREDITS +++ b/CREDITS @@ -23,6 +23,7 @@ Additional people who have contributed patches: Greg Troxel Igor Khristophorov Jason R. Thorpe + Javier Achirica Jefferson Ogata Juergen Schoenwaelder Klaus Klein diff --git a/gencode.c b/gencode.c index 69392a5..e567de1 100644 --- a/gencode.c +++ b/gencode.c @@ -21,7 +21,7 @@ */ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.153 2001-05-30 01:27:21 fenner Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.154 2001-06-10 01:11:40 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -654,6 +654,23 @@ init_linktype(type) off_nl = 22; return; + case DLT_IEEE802_11: + /* + * 802.11 doesn't really have a link-level type field. + * We set "off_linktype" to the offset of the LLC header. + * + * To check for Ethernet types, we assume that SSAP = SNAP + * is being used and pick out the encapsulated Ethernet type. + * XXX - should we generate code to check for SNAP? + * + * XXX - the header is actually variable-length. We + * assume a 24-byte link-layer header, as appears in + * data frames in networks with no bridges. + */ + off_linktype = 24; + off_nl = 30; + return; + case DLT_ATM_RFC1483: /* * assume routed, non-ISO PDUs @@ -901,6 +918,7 @@ gen_linktype(proto) } break; + case DLT_IEEE802_11: case DLT_FDDI: case DLT_IEEE802: case DLT_ATM_RFC1483: diff --git a/pcap-linux.c b/pcap-linux.c index 5f1c35b..adabec4 100644 --- a/pcap-linux.c +++ b/pcap-linux.c @@ -26,7 +26,7 @@ */ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/libpcap/pcap-linux.c,v 1.57 2001-04-09 05:55:40 guy Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/libpcap/pcap-linux.c,v 1.58 2001-06-10 01:11:41 guy Exp $ (LBL)"; #endif /* @@ -656,6 +656,13 @@ static int map_arphrd_to_dlt(pcap_t *handle, int arptype) handle->linktype = DLT_ATM_CLIP; break; +#ifndef ARPHRD_IEEE80211 /* From Linux 2.4.6 */ +#define ARPHRD_IEEE80211 801 +#endif + case ARPHRD_IEEE80211: + handle->linktype = DLT_IEEE802_11; + break; + case ARPHRD_PPP: /* * Some PPP code in the kernel supplies no link-layer