aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--epan/dissectors/packet-ieee80211-prism.c30
-rw-r--r--epan/dissectors/packet-ieee80211-wlancap.c82
2 files changed, 102 insertions, 10 deletions
diff --git a/epan/dissectors/packet-ieee80211-prism.c b/epan/dissectors/packet-ieee80211-prism.c
index c953607035..3959f09571 100644
--- a/epan/dissectors/packet-ieee80211-prism.c
+++ b/epan/dissectors/packet-ieee80211-prism.c
@@ -36,6 +36,7 @@ void proto_reg_handoff_ieee80211_prism(void);
static dissector_handle_t wlancap_handle;
static dissector_handle_t ieee80211_handle;
+static dissector_handle_t ieee80211_radio_handle;
static int proto_prism = -1;
@@ -200,7 +201,8 @@ static const value_string prism_did_vals[] =
/*
* The header file mentioned above says 0 means "supplied" and 1 means
* "not supplied". I haven't seen a capture file with anything other
- * than 0 there.
+ * than 0 there, but there is at least one driver that appears to use
+ * 1 for values it doesn't supply (the Linux acx-20080210 driver).
*/
static const value_string prism_status_vals[] =
{
@@ -292,6 +294,9 @@ dissect_prism(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
guint byte_order;
guint16 status;
guint8 *devname_p;
+ guint32 channel;
+ guint32 rate;
+ struct ieee_802_11_phdr phdr;
offset = 0;
did = 0;
@@ -326,6 +331,12 @@ dissect_prism(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
return;
}
+ /* We don't have any 802.11 metadata yet. */
+ phdr.fcs_len = -1;
+ phdr.decrypted = FALSE;
+ phdr.datapad = FALSE;
+ phdr.presence_flags = 0;
+
col_set_str(pinfo->cinfo, COL_PROTOCOL, "Prism");
col_clear(pinfo->cinfo, COL_INFO);
@@ -405,11 +416,14 @@ dissect_prism(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case PRISM_TYPE1_CHANNEL:
case PRISM_TYPE2_CHANNEL:
+ channel = tvb_get_enctohl(tvb, offset, byte_order);
+ phdr.presence_flags |= PHDR_802_11_HAS_CHANNEL;
+ phdr.channel = channel;
if(tree){
proto_tree_add_item(prism_did_tree, hf_ieee80211_prism_did_channel, tvb, offset, 4, byte_order);
- proto_item_append_text(ti_did, " %d", tvb_get_enctohl(tvb, offset, byte_order) );
+ proto_item_append_text(ti_did, " %u", channel);
}
- col_add_fstr(pinfo->cinfo, COL_FREQ_CHAN, "%u", tvb_get_enctohl(tvb, offset, byte_order));
+ col_add_fstr(pinfo->cinfo, COL_FREQ_CHAN, "%u", channel);
break;
case PRISM_TYPE1_RSSI:
@@ -447,11 +461,14 @@ dissect_prism(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case PRISM_TYPE1_RATE:
case PRISM_TYPE2_RATE:
+ rate = tvb_get_enctohl(tvb, offset, byte_order);
+ phdr.presence_flags |= PHDR_802_11_HAS_DATA_RATE;
+ phdr.data_rate = rate;
if(tree){
proto_tree_add_item(prism_did_tree, hf_ieee80211_prism_did_rate, tvb, offset, 4, byte_order);
- proto_item_append_text(ti_did, " %s Mb/s", prism_rate_return(tvb_get_enctohl(tvb, offset, byte_order)) );
+ proto_item_append_text(ti_did, " %s Mb/s", prism_rate_return(rate));
}
- col_add_fstr(pinfo->cinfo, COL_TX_RATE, "%s", prism_rate_return(tvb_get_enctohl(tvb, offset, byte_order)) );
+ col_add_fstr(pinfo->cinfo, COL_TX_RATE, "%s", prism_rate_return(rate));
break;
case PRISM_TYPE1_ISTX:
@@ -482,7 +499,7 @@ dissect_prism(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* dissect the 802.11 header next */
next_tvb = tvb_new_subset_remaining(tvb, offset);
- call_dissector(ieee80211_handle, next_tvb, pinfo, tree);
+ call_dissector_with_data(ieee80211_radio_handle, next_tvb, pinfo, tree, (void *)&phdr);
}
static hf_register_info hf_prism[] = {
@@ -581,6 +598,7 @@ void proto_reg_handoff_ieee80211_prism(void)
prism_handle = create_dissector_handle(dissect_prism, proto_prism);
dissector_add_uint("wtap_encap", WTAP_ENCAP_IEEE_802_11_PRISM, prism_handle);
ieee80211_handle = find_dissector("wlan");
+ ieee80211_radio_handle = find_dissector("wlan_radio");
wlancap_handle = find_dissector("wlancap");
}
diff --git a/epan/dissectors/packet-ieee80211-wlancap.c b/epan/dissectors/packet-ieee80211-wlancap.c
index d02fe4c7d7..bd6675cf80 100644
--- a/epan/dissectors/packet-ieee80211-wlancap.c
+++ b/epan/dissectors/packet-ieee80211-wlancap.c
@@ -33,7 +33,7 @@
void proto_register_ieee80211_wlancap(void);
void proto_reg_handoff_ieee80211_wlancap(void);
-static dissector_handle_t ieee80211_handle;
+static dissector_handle_t ieee80211_radio_handle;
static int proto_wlancap = -1;
@@ -357,7 +357,15 @@ dissect_wlancap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
guint32 channel;
guint32 datarate;
guint32 ssi_type;
+ gint32 dbm;
guint32 antnoise;
+ struct ieee_802_11_phdr phdr;
+
+ /* We don't have any 802.11 metadata yet. */
+ phdr.fcs_len = -1;
+ phdr.decrypted = FALSE;
+ phdr.datapad = FALSE;
+ phdr.presence_flags = 0;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "WLAN");
col_clear(pinfo->cinfo, COL_INFO);
@@ -384,12 +392,57 @@ dissect_wlancap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (tree)
proto_tree_add_item(wlan_tree, hf_wlan_length, tvb, offset, 4, ENC_BIG_ENDIAN);
offset+=4;
+ phdr.presence_flags |= PHDR_802_11_HAS_TSF_TIMESTAMP;
+ phdr.tsf_timestamp = tvb_get_ntoh64(tvb, offset);
if (tree)
proto_tree_add_item(wlan_tree, hf_mactime, tvb, offset, 8, ENC_BIG_ENDIAN);
offset+=8;
if (tree)
proto_tree_add_item(wlan_tree, hf_hosttime, tvb, offset, 8, ENC_BIG_ENDIAN);
offset+=8;
+ switch (tvb_get_ntohl(tvb, offset)) {
+
+ case 1:
+ phdr.presence_flags |= PHDR_802_11_HAS_PHY_BAND;
+ phdr.phy_band = PHDR_802_11_PHY_BAND_11_FHSS;
+ break;
+
+ case 2:
+ /* Legacy 802.11 DHSS */
+ break;
+
+ case 3:
+ /* Legacy 802.11 IR */
+ break;
+
+ case 4:
+ phdr.presence_flags |= PHDR_802_11_HAS_PHY_BAND;
+ phdr.phy_band = PHDR_802_11_PHY_BAND_11B;
+ break;
+
+ case 5:
+ /* 11b PBCC? */
+ break;
+
+ case 6:
+ phdr.presence_flags |= PHDR_802_11_HAS_PHY_BAND;
+ phdr.phy_band = PHDR_802_11_PHY_BAND_11G_PURE;
+ break;
+
+ case 7:
+ /* 11a PBCC? */
+ break;
+
+ case 8:
+ phdr.presence_flags |= PHDR_802_11_HAS_PHY_BAND;
+ phdr.phy_band = PHDR_802_11_PHY_BAND_11A;
+ break;
+
+ case 9:
+ phdr.presence_flags |= PHDR_802_11_HAS_PHY_BAND;
+ phdr.phy_band = PHDR_802_11_PHY_BAND_11G_MIXED;
+ break;
+ }
if (tree)
proto_tree_add_item(wlan_tree, hf_wlan_phytype, tvb, offset, 4, ENC_BIG_ENDIAN);
offset+=4;
@@ -398,10 +451,14 @@ dissect_wlancap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
channel = tvb_get_ntohl(tvb, offset);
if (channel < 256) {
col_add_fstr(pinfo->cinfo, COL_FREQ_CHAN, "%u", channel);
+ phdr.presence_flags |= PHDR_802_11_HAS_CHANNEL;
+ phdr.channel = channel;
if (tree)
proto_tree_add_uint(wlan_tree, hf_channel, tvb, offset, 4, channel);
} else if (channel < 10000) {
col_add_fstr(pinfo->cinfo, COL_FREQ_CHAN, "%u MHz", channel);
+ phdr.presence_flags |= PHDR_802_11_HAS_FREQUENCY;
+ phdr.frequency = channel;
if (tree)
proto_tree_add_uint_format(wlan_tree, hf_channel_frequency, tvb, offset,
4, channel, "Frequency: %u MHz", channel);
@@ -421,6 +478,15 @@ dissect_wlancap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
col_add_fstr(pinfo->cinfo, COL_TX_RATE, "%u.%u",
datarate / 1000000,
((datarate % 1000000) > 500000) ? 5 : 0);
+ if (datarate != 0) {
+ /* 0 is obviously bogus; it may be used for "unknown" */
+ /* Can this be expressed in .5 MHz units? */
+ if ((datarate % 500000) == 0) {
+ /* Yes. */
+ phdr.presence_flags |= PHDR_802_11_HAS_DATA_RATE;
+ phdr.data_rate = datarate / 500000;
+ }
+ }
if (tree) {
proto_tree_add_uint64_format_value(wlan_tree, hf_data_rate, tvb, offset, 4,
datarate,
@@ -455,7 +521,10 @@ dissect_wlancap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case SSI_DBM:
/* dBm */
- col_add_fstr(pinfo->cinfo, COL_RSSI, "%d dBm", tvb_get_ntohl(tvb, offset));
+ dbm = tvb_get_ntohl(tvb, offset);
+ phdr.presence_flags |= PHDR_802_11_HAS_SIGNAL_DBM;
+ phdr.signal_dbm = dbm;
+ col_add_fstr(pinfo->cinfo, COL_RSSI, "%d dBm", dbm);
if (tree)
proto_tree_add_item(wlan_tree, hf_dbm_antsignal, tvb, offset, 4, ENC_BIG_ENDIAN);
break;
@@ -486,6 +555,11 @@ dissect_wlancap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case SSI_DBM:
/* dBm */
+ if (antnoise != 0) {
+ /* The spec says use 0xffffffff, but some drivers appear to use 0. */
+ phdr.presence_flags |= PHDR_802_11_HAS_NOISE_DBM;
+ phdr.noise_dbm = antnoise;
+ }
if (tree)
proto_tree_add_int(wlan_tree, hf_dbm_antnoise, tvb, offset, 4, antnoise);
break;
@@ -525,7 +599,7 @@ dissect_wlancap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* dissect the 802.11 header next */
next_tvb = tvb_new_subset_remaining(tvb, offset);
- call_dissector(ieee80211_handle, next_tvb, pinfo, tree);
+ call_dissector_with_data(ieee80211_radio_handle, next_tvb, pinfo, tree, (void *)&phdr);
}
static const value_string phy_type[] = {
@@ -663,7 +737,7 @@ void proto_register_ieee80211_wlancap(void)
void proto_reg_handoff_ieee80211_wlancap(void)
{
- ieee80211_handle = find_dissector("wlan");
+ ieee80211_radio_handle = find_dissector("wlan_radio");
}
/*