aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/commview.c
diff options
context:
space:
mode:
authorGuy Harris <gharris@sonic.net>2021-03-10 11:09:57 -0800
committerGuy Harris <gharris@sonic.net>2021-03-10 11:09:57 -0800
commit598e32f933565959542c6891e1202a4fca98649c (patch)
treee38a6e3b8aef5b441bc085659ffa5bc06edfb02f /wiretap/commview.c
parent686f141e2c51c01391c2ff4821537bf99d1182a5 (diff)
commview: use the data rate to determine the modulation.
The band field of the header doesn't necessarily indicate the modulation of the packet; use the data rate to determine the modulation.
Diffstat (limited to 'wiretap/commview.c')
-rw-r--r--wiretap/commview.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/wiretap/commview.c b/wiretap/commview.c
index b7ebcf3ae3..f6aae5be91 100644
--- a/wiretap/commview.c
+++ b/wiretap/commview.c
@@ -167,6 +167,7 @@ commview_read_packet(FILE_T fh, wtap_rec *rec, Buffer *buf,
case BAND_11A:
rec->rec_header.packet_header.pseudo_header.ieee_802_11.phy = PHDR_802_11_PHY_11A;
+ rec->rec_header.packet_header.pseudo_header.ieee_802_11.phy_info.info_11a.has_channel_type = FALSE;
rec->rec_header.packet_header.pseudo_header.ieee_802_11.phy_info.info_11a.has_turbo_type = TRUE;
rec->rec_header.packet_header.pseudo_header.ieee_802_11.phy_info.info_11a.turbo_type =
PHDR_802_11A_TURBO_TYPE_NORMAL;
@@ -175,6 +176,7 @@ commview_read_packet(FILE_T fh, wtap_rec *rec, Buffer *buf,
case BAND_11B:
rec->rec_header.packet_header.pseudo_header.ieee_802_11.phy = PHDR_802_11_PHY_11B;
+ rec->rec_header.packet_header.pseudo_header.ieee_802_11.phy_info.info_11b.has_short_preamble = FALSE;
frequency = ieee80211_chan_to_mhz(cv_hdr.channel, TRUE);
break;
@@ -257,6 +259,35 @@ commview_read_packet(FILE_T fh, wtap_rec *rec, Buffer *buf,
rec->rec_header.packet_header.pseudo_header.ieee_802_11.noise_dbm = -cv_hdr.noise_level;
rec->rec_header.packet_header.pseudo_header.ieee_802_11.has_noise_dbm = TRUE;
}
+ if (rec->rec_header.packet_header.pseudo_header.ieee_802_11.phy == PHDR_802_11_PHY_UNKNOWN) {
+ /*
+ * We don't know they PHY, but we do have the
+ * data rate; try to guess it based on the
+ * data rate and center frequency.
+ */
+ if (RATE_IS_DSSS(rec->rec_header.packet_header.pseudo_header.ieee_802_11.data_rate)) {
+ /* 11b */
+ rec->rec_header.packet_header.pseudo_header.ieee_802_11.phy = PHDR_802_11_PHY_11B;
+ rec->rec_header.packet_header.pseudo_header.ieee_802_11.phy_info.info_11b.has_short_preamble = FALSE;
+ } else if (RATE_IS_OFDM(rec->rec_header.packet_header.pseudo_header.ieee_802_11.data_rate)) {
+ /* 11a or 11g, depending on the band. */
+ if (rec->rec_header.packet_header.pseudo_header.ieee_802_11.has_frequency) {
+ if (FREQ_IS_BG(rec->rec_header.packet_header.pseudo_header.ieee_802_11.frequency)) {
+ /* 11g */
+ rec->rec_header.packet_header.pseudo_header.ieee_802_11.phy = PHDR_802_11_PHY_11G;
+ } else {
+ /* 11a */
+ rec->rec_header.packet_header.pseudo_header.ieee_802_11.phy = PHDR_802_11_PHY_11A;
+ }
+ }
+ }
+ } else if (rec->rec_header.packet_header.pseudo_header.ieee_802_11.phy == PHDR_802_11_PHY_11G) {
+ if (RATE_IS_DSSS(rec->rec_header.packet_header.pseudo_header.ieee_802_11.data_rate)) {
+ /* DSSS, so 11b. */
+ rec->rec_header.packet_header.pseudo_header.ieee_802_11.phy = PHDR_802_11_PHY_11B;
+ rec->rec_header.packet_header.pseudo_header.ieee_802_11.phy_info.info_11b.has_short_preamble = FALSE;
+ }
+ }
break;
case MEDIUM_TOKEN_RING :