Calculate the channel if we have only the frequency.

That way, the generic 802.11 radio dissector, and any future taps if we
add a tap with radio information, can get the channel for radiotap and
PPI headers, as we do for some other radio headers that supply just a
frequency.

Change-Id: I9e3037f69938bed3b3ba563689ff00aaed486a16
Reviewed-on: https://code.wireshark.org/review/10821
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2015-10-05 23:46:53 -07:00
parent be187b99c7
commit e8d0bf8a5b
2 changed files with 14 additions and 0 deletions

View File

@ -940,8 +940,15 @@ dissect_radiotap(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
* XXX - some captures have 0, which is
* obviously bogus.
*/
gint calc_channel;
phdr.presence_flags |= PHDR_802_11_HAS_FREQUENCY;
phdr.frequency = freq;
calc_channel = ieee80211_mhz_to_chan(freq);
if (calc_channel != -1) {
phdr.presence_flags |= PHDR_802_11_HAS_CHANNEL;
phdr.channel = calc_channel;
}
}
cflags = tvb_get_letohs(tvb, offset + 2);
switch (cflags & IEEE80211_CHAN_ALLTURBO) {

View File

@ -525,8 +525,15 @@ dissect_80211_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int of
common_frequency = tvb_get_letohs(ptvcursor_tvbuff(csr), ptvcursor_current_offset(csr));
if (common_frequency != 0) {
gint calc_channel;
phdr->presence_flags |= PHDR_802_11_HAS_FREQUENCY;
phdr->frequency = common_frequency;
calc_channel = ieee80211_mhz_to_chan(common_frequency);
if (calc_channel != -1) {
phdr->presence_flags |= PHDR_802_11_HAS_CHANNEL;
phdr->channel = calc_channel;
}
}
chan_str = ieee80211_mhz_to_str(common_frequency);
proto_tree_add_uint_format_value(ptvcursor_tree(csr), hf_80211_common_chan_freq, ptvcursor_tvbuff(csr),