diff options
Diffstat (limited to 'epan/dissectors/packet-radiotap.c')
-rw-r--r-- | epan/dissectors/packet-radiotap.c | 131 |
1 files changed, 60 insertions, 71 deletions
diff --git a/epan/dissectors/packet-radiotap.c b/epan/dissectors/packet-radiotap.c index 0134e76cdb..e58cbbd2a2 100644 --- a/epan/dissectors/packet-radiotap.c +++ b/epan/dissectors/packet-radiotap.c @@ -839,10 +839,8 @@ dissect_radiotap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) radiotap_info = &rtp_info_arr[0]; - if(check_col(pinfo->cinfo, COL_PROTOCOL)) - col_set_str(pinfo->cinfo, COL_PROTOCOL, "WLAN"); - if(check_col(pinfo->cinfo, COL_INFO)) - col_clear(pinfo->cinfo, COL_INFO); + col_set_str(pinfo->cinfo, COL_PROTOCOL, "WLAN"); + col_clear(pinfo->cinfo, COL_INFO); offset = 0; version = tvb_get_guint8(tvb, offset); @@ -851,21 +849,20 @@ dissect_radiotap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) radiotap_info->radiotap_length = length; - if(check_col(pinfo->cinfo, COL_INFO)) col_add_fstr(pinfo->cinfo, COL_INFO, "Radiotap Capture v%u, Length %u", version, length); /* Dissect the packet */ if (tree) { - ti = proto_tree_add_protocol_format(tree, proto_radiotap, - tvb, 0, length, "Radiotap Header v%u, Length %u", version, length); - radiotap_tree = proto_item_add_subtree(ti, ett_radiotap); - proto_tree_add_uint(radiotap_tree, hf_radiotap_version, - tvb, offset, 1, version); - proto_tree_add_item(radiotap_tree, hf_radiotap_pad, - tvb, offset + 1, 1, FALSE); - ti = proto_tree_add_uint(radiotap_tree, hf_radiotap_length, - tvb, offset + 2, 2, length); + ti = proto_tree_add_protocol_format(tree, proto_radiotap, + tvb, 0, length, "Radiotap Header v%u, Length %u", version, length); + radiotap_tree = proto_item_add_subtree(ti, ett_radiotap); + proto_tree_add_uint(radiotap_tree, hf_radiotap_version, + tvb, offset, 1, version); + proto_tree_add_item(radiotap_tree, hf_radiotap_pad, + tvb, offset + 1, 1, FALSE); + ti = proto_tree_add_uint(radiotap_tree, hf_radiotap_length, + tvb, offset + 2, 2, length); } length_remaining = length; @@ -975,16 +972,14 @@ dissect_radiotap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; rate = tvb_get_guint8(tvb, offset); if (rate & 0x80) { - /* XXX adjust by CW and short GI like other sniffers? */ - rate = ieee80211_htrates[rate & 0xf]; + /* XXX adjust by CW and short GI like other sniffers? */ + rate = ieee80211_htrates[rate & 0xf]; } - if (check_col(pinfo->cinfo, COL_TX_RATE)) { col_add_fstr(pinfo->cinfo, COL_TX_RATE, "%d.%d", rate / 2, rate & 1 ? 5 : 0); - } if (tree) { proto_tree_add_uint_format(radiotap_tree, hf_radiotap_datarate, - tvb, offset, 1, tvb_get_guint8(tvb, offset), + tvb, offset, 1, tvb_get_guint8(tvb, offset)/2, "Data Rate: %d.%d Mb/s", rate / 2, rate & 1 ? 5 : 0); } offset++; @@ -995,14 +990,12 @@ dissect_radiotap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (length_remaining < 1) break; dbm = (gint8) tvb_get_guint8(tvb, offset); - if (check_col(pinfo->cinfo, COL_RSSI)) { col_add_fstr(pinfo->cinfo, COL_RSSI, "%d dBm", dbm); - } if (tree) { - proto_tree_add_int_format(radiotap_tree, - hf_radiotap_dbm_antsignal, - tvb, offset, 1, dbm, - "SSI Signal: %d dBm", dbm); + proto_tree_add_int_format(radiotap_tree, + hf_radiotap_dbm_antsignal, + tvb, offset, 1, dbm, + "SSI Signal: %d dBm", dbm); } offset++; length_remaining--; @@ -1012,14 +1005,12 @@ dissect_radiotap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (length_remaining < 1) break; db = tvb_get_guint8(tvb, offset); - if (check_col(pinfo->cinfo, COL_RSSI)) { col_add_fstr(pinfo->cinfo, COL_RSSI, "%u dB", db); - } if (tree) { - proto_tree_add_uint_format(radiotap_tree, - hf_radiotap_db_antsignal, - tvb, offset, 1, db, - "SSI Signal: %u dB", db); + proto_tree_add_uint_format(radiotap_tree, + hf_radiotap_db_antsignal, + tvb, offset, 1, db, + "SSI Signal: %u dB", db); } offset++; length_remaining--; @@ -1083,46 +1074,44 @@ dissect_radiotap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (length_remaining < 2) break; if (tree) { - freq = tvb_get_letohs(tvb, offset); - flags = tvb_get_letohs(tvb, offset+2); - chan_str = ieee80211_mhz_to_str(freq); - if (check_col(pinfo->cinfo, COL_FREQ_CHAN)) { - col_add_fstr(pinfo->cinfo, COL_FREQ_CHAN, "%s", chan_str); - } - proto_tree_add_uint_format(radiotap_tree, hf_radiotap_channel_frequency, - tvb, offset, 2, freq, - "Channel frequency: %s", chan_str); - g_free(chan_str); - /* We're already 2-byte aligned. */ - it = proto_tree_add_uint(radiotap_tree, hf_radiotap_channel_flags, - tvb, offset+2, 2, flags); - flags_tree = proto_item_add_subtree(it, ett_radiotap_channel_flags); - proto_tree_add_boolean(flags_tree, hf_radiotap_channel_flags_turbo, - tvb, offset+2, 1, flags); - proto_tree_add_boolean(flags_tree, hf_radiotap_channel_flags_cck, - tvb, offset+2, 1, flags); - proto_tree_add_boolean(flags_tree, hf_radiotap_channel_flags_ofdm, - tvb, offset+2, 1, flags); - proto_tree_add_boolean(flags_tree, hf_radiotap_channel_flags_2ghz, - tvb, offset+2, 1, flags); - proto_tree_add_boolean(flags_tree, hf_radiotap_channel_flags_5ghz, - tvb, offset+3, 1, flags); - proto_tree_add_boolean(flags_tree, hf_radiotap_channel_flags_passive, - tvb, offset+3, 1, flags); - proto_tree_add_boolean(flags_tree, hf_radiotap_channel_flags_dynamic, - tvb, offset+3, 1, flags); - proto_tree_add_boolean(flags_tree, hf_radiotap_channel_flags_gfsk, - tvb, offset+3, 1, flags); - proto_tree_add_boolean(flags_tree, hf_radiotap_channel_flags_gsm, - tvb, offset+3, 1, flags); - proto_tree_add_boolean(flags_tree, hf_radiotap_channel_flags_sturbo, - tvb, offset+3, 1, flags); - proto_tree_add_boolean(flags_tree, hf_radiotap_channel_flags_half, - tvb, offset+3, 1, flags); - proto_tree_add_boolean(flags_tree, hf_radiotap_channel_flags_quarter, - tvb, offset+3, 1, flags); - radiotap_info->freq=freq; - radiotap_info->flags=flags; + freq = tvb_get_letohs(tvb, offset); + flags = tvb_get_letohs(tvb, offset+2); + chan_str = ieee80211_mhz_to_str(freq); + col_add_fstr(pinfo->cinfo, COL_FREQ_CHAN, "%s", chan_str); + proto_tree_add_uint_format(radiotap_tree, hf_radiotap_channel_frequency, + tvb, offset, 2, freq, + "Channel frequency: %s", chan_str); + g_free(chan_str); + /* We're already 2-byte aligned. */ + it = proto_tree_add_uint(radiotap_tree, hf_radiotap_channel_flags, + tvb, offset+2, 2, flags); + flags_tree = proto_item_add_subtree(it, ett_radiotap_channel_flags); + proto_tree_add_boolean(flags_tree, hf_radiotap_channel_flags_turbo, + tvb, offset+2, 1, flags); + proto_tree_add_boolean(flags_tree, hf_radiotap_channel_flags_cck, + tvb, offset+2, 1, flags); + proto_tree_add_boolean(flags_tree, hf_radiotap_channel_flags_ofdm, + tvb, offset+2, 1, flags); + proto_tree_add_boolean(flags_tree, hf_radiotap_channel_flags_2ghz, + tvb, offset+2, 1, flags); + proto_tree_add_boolean(flags_tree, hf_radiotap_channel_flags_5ghz, + tvb, offset+3, 1, flags); + proto_tree_add_boolean(flags_tree, hf_radiotap_channel_flags_passive, + tvb, offset+3, 1, flags); + proto_tree_add_boolean(flags_tree, hf_radiotap_channel_flags_dynamic, + tvb, offset+3, 1, flags); + proto_tree_add_boolean(flags_tree, hf_radiotap_channel_flags_gfsk, + tvb, offset+3, 1, flags); + proto_tree_add_boolean(flags_tree, hf_radiotap_channel_flags_gsm, + tvb, offset+3, 1, flags); + proto_tree_add_boolean(flags_tree, hf_radiotap_channel_flags_sturbo, + tvb, offset+3, 1, flags); + proto_tree_add_boolean(flags_tree, hf_radiotap_channel_flags_half, + tvb, offset+3, 1, flags); + proto_tree_add_boolean(flags_tree, hf_radiotap_channel_flags_quarter, + tvb, offset+3, 1, flags); + radiotap_info->freq=freq; + radiotap_info->flags=flags; } offset+=4 /* Channel + flags */; length_remaining-=4; |