aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2015-06-20 15:57:57 -0700
committerGuy Harris <guy@alum.mit.edu>2015-06-20 23:02:21 +0000
commit2895d58dc38321a72c82e1bf77d165ef4acbc73a (patch)
tree1091e87a52bf3c266edeb282f7baa7deea13fbd6 /wiretap
parent77ed0387c6e03d9667a56ab5effca755bac78df2 (diff)
Call the "802.11 radio information" dissector for radio headers.
Have dissectors of various forms of radio information headers in the packets fill in a struct ieee_802_11_phdr with radio information as appropriate, and call the "802.11 radio information" dissector rather than the raw 802.11 dissector. This means that the radio information can be found in a protocol-independent and encapsulation-independent form when you're looking at the packet; that information can be presented in a form somewhat easier to read than the raw metadata header format. It also enables having a single "radio information" tap that allows statistics to handle all different sorts of radio information encapsulation. In addition, it lets us clean up some of the arguments passed to the common 802.11 dissector routine, by having it pull that information from the struct ieee_802_11_phdr. Ensure that the right structure gets passed to that routine, and that all the appropriate parts of that structure are filled in. Rename the 802.11 radio protocol to "wlan_radio", rather than just "radio", as it's 802.11-specific. Give all its fields "wlan_radio." names rather than "wlan." names. Change-Id: I78d79afece0ce0cf5fc17293c1e29596413b31c8 Reviewed-on: https://code.wireshark.org/review/8992 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wiretap')
-rw-r--r--wiretap/commview.c4
-rw-r--r--wiretap/netmon.c3
-rw-r--r--wiretap/network_instruments.c37
-rw-r--r--wiretap/netxray.c1
-rw-r--r--wiretap/pcap-common.c3
-rw-r--r--wiretap/peekclassic.c3
-rw-r--r--wiretap/peektagged.c1
-rw-r--r--wiretap/snoop.c4
-rw-r--r--wiretap/wtap.h5
9 files changed, 37 insertions, 24 deletions
diff --git a/wiretap/commview.c b/wiretap/commview.c
index 5ea9c95f32..57de7605cf 100644
--- a/wiretap/commview.c
+++ b/wiretap/commview.c
@@ -143,11 +143,13 @@ commview_read_packet(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
case MEDIUM_WIFI :
phdr->pkt_encap = WTAP_ENCAP_IEEE_802_11_WITH_RADIO;
+ phdr->pseudo_header.ieee_802_11.fcs_len = -1; /* Unknown */
+ phdr->pseudo_header.ieee_802_11.decrypted = FALSE;
+ phdr->pseudo_header.ieee_802_11.datapad = FALSE;
phdr->pseudo_header.ieee_802_11.presence_flags =
PHDR_802_11_HAS_CHANNEL |
PHDR_802_11_HAS_DATA_RATE |
PHDR_802_11_HAS_SIGNAL_PERCENT;
- phdr->pseudo_header.ieee_802_11.fcs_len = -1; /* Unknown */
phdr->pseudo_header.ieee_802_11.channel = cv_hdr.channel;
phdr->pseudo_header.ieee_802_11.data_rate =
cv_hdr.rate | (cv_hdr.direction << 8);
diff --git a/wiretap/netmon.c b/wiretap/netmon.c
index 73bc49259a..4c104cd46b 100644
--- a/wiretap/netmon.c
+++ b/wiretap/netmon.c
@@ -428,9 +428,10 @@ netmon_set_pseudo_header_info(struct wtap_pkthdr *phdr, Buffer *buf)
* do not have an FCS).
* An "FCS length" of -2 means "NetMon weirdness".
*/
- phdr->pseudo_header.ieee_802_11.presence_flags = 0; /* radio data is in the packet data */
phdr->pseudo_header.ieee_802_11.fcs_len = -2;
phdr->pseudo_header.ieee_802_11.decrypted = FALSE;
+ phdr->pseudo_header.ieee_802_11.datapad = FALSE;
+ phdr->pseudo_header.ieee_802_11.presence_flags = 0; /* radio data is in the packet data */
break;
}
}
diff --git a/wiretap/network_instruments.c b/wiretap/network_instruments.c
index 3d929cd4df..cbfbeb49a6 100644
--- a/wiretap/network_instruments.c
+++ b/wiretap/network_instruments.c
@@ -97,7 +97,7 @@ static gboolean observer_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset);
static gboolean observer_seek_read(wtap *wth, gint64 seek_off,
struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info);
-static int read_packet_header(FILE_T fh, union wtap_pseudo_header *pseudo_header,
+static int read_packet_header(wtap *wth, FILE_T fh, union wtap_pseudo_header *pseudo_header,
packet_entry_header *packet_header, int *err, gchar **err_info);
static gboolean process_packet_header(wtap *wth,
packet_entry_header *packet_header, struct wtap_pkthdr *phdr, int *err,
@@ -254,7 +254,7 @@ static gboolean observer_read(wtap *wth, int *err, gchar **err_info,
*data_offset = file_tell(wth->fh);
/* process the packet header, including TLVs */
- header_bytes_consumed = read_packet_header(wth->fh, &wth->phdr.pseudo_header, &packet_header, err,
+ header_bytes_consumed = read_packet_header(wth, wth->fh, &wth->phdr.pseudo_header, &packet_header, err,
err_info);
if (header_bytes_consumed <= 0)
return FALSE; /* EOF or error */
@@ -302,7 +302,7 @@ static gboolean observer_seek_read(wtap *wth, gint64 seek_off,
return FALSE;
/* process the packet header, including TLVs */
- offset = read_packet_header(wth->random_fh, pseudo_header, &packet_header, err,
+ offset = read_packet_header(wth, wth->random_fh, pseudo_header, &packet_header, err,
err_info);
if (offset <= 0)
return FALSE; /* EOF or error */
@@ -321,7 +321,7 @@ static gboolean observer_seek_read(wtap *wth, gint64 seek_off,
}
static int
-read_packet_header(FILE_T fh, union wtap_pseudo_header *pseudo_header,
+read_packet_header(wtap *wth, FILE_T fh, union wtap_pseudo_header *pseudo_header,
packet_entry_header *packet_header, int *err, gchar **err_info)
{
int offset;
@@ -367,6 +367,21 @@ read_packet_header(FILE_T fh, union wtap_pseudo_header *pseudo_header,
return -1;
}
+ /* initialize the pseudo header */
+ switch (wth->file_encap) {
+ case WTAP_ENCAP_ETHERNET:
+ /* There is no FCS in the frame */
+ pseudo_header->eth.fcs_len = 0;
+ break;
+ case WTAP_ENCAP_IEEE_802_11_WITH_RADIO:
+ pseudo_header->ieee_802_11.fcs_len = 0;
+ pseudo_header->ieee_802_11.decrypted = FALSE;
+ pseudo_header->ieee_802_11.datapad = FALSE;
+ pseudo_header->ieee_802_11.presence_flags = 0;
+ /* Updated below */
+ break;
+ }
+
/* process extra information */
for (i = 0; i < packet_header->number_of_information_elements; i++) {
/* read the TLV header */
@@ -389,11 +404,10 @@ read_packet_header(FILE_T fh, union wtap_pseudo_header *pseudo_header,
err, err_info))
return -1;
/* update the pseudo header */
- pseudo_header->ieee_802_11.presence_flags =
+ pseudo_header->ieee_802_11.presence_flags |=
PHDR_802_11_HAS_CHANNEL |
PHDR_802_11_HAS_DATA_RATE |
PHDR_802_11_HAS_SIGNAL_PERCENT;
- pseudo_header->ieee_802_11.fcs_len = 0;
/* set decryption status */
pseudo_header->ieee_802_11.decrypted = (wireless_header.conditions & WIRELESS_WEP_SUCCESS) != 0;
pseudo_header->ieee_802_11.channel = wireless_header.frequency;
@@ -484,17 +498,6 @@ process_packet_header(wtap *wth, packet_entry_header *packet_header,
}
}
- /* update the pseudo header */
- switch (wth->file_encap) {
- case WTAP_ENCAP_ETHERNET:
- /* There is no FCS in the frame */
- phdr->pseudo_header.eth.fcs_len = 0;
- break;
- case WTAP_ENCAP_IEEE_802_11_WITH_RADIO:
- /* Updated in read_packet_header */
- break;
- }
-
return TRUE;
}
diff --git a/wiretap/netxray.c b/wiretap/netxray.c
index 7721b2b909..483ec9b77b 100644
--- a/wiretap/netxray.c
+++ b/wiretap/netxray.c
@@ -1251,6 +1251,7 @@ netxray_process_rec_header(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
phdr->pseudo_header.ieee_802_11.fcs_len = 0;
phdr->pseudo_header.ieee_802_11.decrypted = FALSE;
+ phdr->pseudo_header.ieee_802_11.datapad = FALSE;
phdr->pseudo_header.ieee_802_11.channel =
hdr.hdr_2_x.xxx[12];
diff --git a/wiretap/pcap-common.c b/wiretap/pcap-common.c
index 0e187786ff..2dc5e56285 100644
--- a/wiretap/pcap-common.c
+++ b/wiretap/pcap-common.c
@@ -1604,9 +1604,10 @@ pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
* XXX - in pcap-ng, there *could* be a packet option
* indicating the FCS length.
*/
- phdr->pseudo_header.ieee_802_11.presence_flags = 0; /* absent or supplied in the packet data */
phdr->pseudo_header.ieee_802_11.fcs_len = -1;
phdr->pseudo_header.ieee_802_11.decrypted = FALSE;
+ phdr->pseudo_header.ieee_802_11.datapad = FALSE;
+ phdr->pseudo_header.ieee_802_11.presence_flags = 0; /* absent or supplied in the packet data */
break;
case WTAP_ENCAP_IRDA:
diff --git a/wiretap/peekclassic.c b/wiretap/peekclassic.c
index 44a960a896..3a880ed117 100644
--- a/wiretap/peekclassic.c
+++ b/wiretap/peekclassic.c
@@ -445,9 +445,10 @@ static int peekclassic_read_packet_v7(wtap *wth, FILE_T fh,
switch (wth->file_encap) {
case WTAP_ENCAP_IEEE_802_11_AIROPEEK:
- phdr->pseudo_header.ieee_802_11.presence_flags = 0; /* not present */
phdr->pseudo_header.ieee_802_11.fcs_len = 0; /* no FCS */
phdr->pseudo_header.ieee_802_11.decrypted = FALSE;
+ phdr->pseudo_header.ieee_802_11.datapad = FALSE;
+ phdr->pseudo_header.ieee_802_11.presence_flags = 0; /* not present */
/*
* The last 4 bytes appear to be random data - the length
diff --git a/wiretap/peektagged.c b/wiretap/peektagged.c
index 7b219603a0..153255ed39 100644
--- a/wiretap/peektagged.c
+++ b/wiretap/peektagged.c
@@ -751,6 +751,7 @@ peektagged_read_packet(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
skip_len = 4;
}
phdr->pseudo_header.ieee_802_11.decrypted = FALSE;
+ phdr->pseudo_header.ieee_802_11.datapad = FALSE;
break;
case WTAP_ENCAP_ETHERNET:
diff --git a/wiretap/snoop.c b/wiretap/snoop.c
index 005a5832a9..b50912da05 100644
--- a/wiretap/snoop.c
+++ b/wiretap/snoop.c
@@ -738,11 +738,13 @@ snoop_read_shomiti_wireless_pseudoheader(FILE_T fh,
if (file_seek(fh, rsize, SEEK_CUR, err) == -1)
return FALSE;
+ pseudo_header->ieee_802_11.fcs_len = 4;
+ pseudo_header->ieee_802_11.decrypted = FALSE;
+ pseudo_header->ieee_802_11.datapad = FALSE;
pseudo_header->ieee_802_11.presence_flags =
PHDR_802_11_HAS_CHANNEL |
PHDR_802_11_HAS_DATA_RATE |
PHDR_802_11_HAS_SIGNAL_PERCENT;
- pseudo_header->ieee_802_11.fcs_len = 4;
pseudo_header->ieee_802_11.channel = whdr.channel;
pseudo_header->ieee_802_11.data_rate = whdr.rate;
pseudo_header->ieee_802_11.signal_percent = whdr.signal;
diff --git a/wiretap/wtap.h b/wiretap/wtap.h
index 11aad45b9b..fbdd39933d 100644
--- a/wiretap/wtap.h
+++ b/wiretap/wtap.h
@@ -557,6 +557,7 @@ struct p2p_phdr {
struct ieee_802_11_phdr {
gint fcs_len; /* Number of bytes of FCS - -1 means "unknown" */
gboolean decrypted; /* TRUE if frame is decrypted even if "protected" bit is set */
+ gboolean datapad; /* TRUE if frame has padding between 802.11 header and payload */
guint32 presence_flags; /* Flags indicating presence of fields */
guint16 channel; /* Channel number */
guint16 data_rate; /* Data rate, in .5 Mb/s units */
@@ -564,9 +565,9 @@ struct ieee_802_11_phdr {
guint bandwidth:2; /* Bandwidth = 20 MHz, 40 MHz, 20+20L, 20+20U */
guint short_gi:1; /* True for short guard interval */
guint greenfield:1; /* True for greenfield, short for mixed */
- guint ldpc:1; /* Tue for LDPC FEC */
+ guint ldpc:1; /* True for LDPC FEC */
guint stbc_streams:2; /* Number of STBC streams */
- guint ness:1; /* Number of extension spatial streams */
+ guint ness; /* Number of extension spatial streams */
guint32 frequency; /* Channel center frequency */
guint8 signal_percent; /* Signal level, as a percentage */
guint8 noise_percent; /* Noise level, as a percentage */