diff options
author | Jakub Zawadzki <darkjames-ws@darkjames.pl> | 2012-10-08 12:05:14 +0000 |
---|---|---|
committer | Jakub Zawadzki <darkjames-ws@darkjames.pl> | 2012-10-08 12:05:14 +0000 |
commit | cef1e32ede312ae8e485c32e68a643cf8e81518f (patch) | |
tree | 55ceea1f0c524edbb052df13e87b79ac2c2acadb /epan/dissectors/packet-homeplug-av.c | |
parent | da00b4089e1ff776423400fd4e0188a5fde41e3d (diff) |
Patch from Florian Fainelli
Fix bug #7772: dissect only the number of active HomePlug AV subcarriers
The dissector currently dissects all 1156 sub-carriers available in the Tone
Map Characteristisc Confirmation frame no matter what is the number of active
ones.
This is not valid, because the frame only contains the number of active
sub-carriers, even though it is padded to 1156 sub-carriers. This is also an
issue for newest HomePlug AV devices with a 500Mbits/sec PHY rate, because
those will have up to 2690 sub-carriers, and we would only dissect the first
1156 active ones.
svn path=/trunk/; revision=45381
Diffstat (limited to 'epan/dissectors/packet-homeplug-av.c')
-rw-r--r-- | epan/dissectors/packet-homeplug-av.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/epan/dissectors/packet-homeplug-av.c b/epan/dissectors/packet-homeplug-av.c index d928aa317b..7fac5c8362 100644 --- a/epan/dissectors/packet-homeplug-av.c +++ b/epan/dissectors/packet-homeplug-av.c @@ -1074,8 +1074,6 @@ static const value_string homeplug_av_tone_map_status_vals[] = { { 0, NULL } }; -#define HOMEPLUG_AV_MAX_CARRIERS (1156 / 2) - #define TVB_LEN_GREATEST 1 #define TVB_LEN_UNDEF 0 #define TVB_LEN_SHORTEST -1 @@ -2644,6 +2642,8 @@ dissect_homeplug_av_tone_map_cnf(ptvcursor_t *cursor) { proto_item *it; guint16 i; + guint16 num_act_carriers; + guint16 max_carriers; if (!ptvcursor_tree(cursor)) return; @@ -2655,10 +2655,20 @@ dissect_homeplug_av_tone_map_cnf(ptvcursor_t *cursor) ptvcursor_add(cursor, hf_homeplug_av_tone_map_cnf_status, 1, ENC_BIG_ENDIAN); ptvcursor_add(cursor, hf_homeplug_av_tone_map_cnf_slot, 1, ENC_BIG_ENDIAN); ptvcursor_add(cursor, hf_homeplug_av_tone_map_cnf_num_tms, 1, ENC_BIG_ENDIAN); + num_act_carriers = tvb_get_letohs(ptvcursor_tvbuff(cursor), + ptvcursor_current_offset(cursor)); ptvcursor_add(cursor, hf_homeplug_av_tone_map_cnf_num_act, 2, ENC_LITTLE_ENDIAN); - for (i = 0; i < HOMEPLUG_AV_MAX_CARRIERS; i++) { - dissect_homeplug_av_tone_map_carrier(cursor); + if (num_act_carriers) { + max_carriers = num_act_carriers / 2; + + /* check if number of carriers is odd */ + if (num_act_carriers & 1) + max_carriers += 1; + + for (i = 0; i < max_carriers; i++) { + dissect_homeplug_av_tone_map_carrier(cursor); + } } } ptvcursor_pop_subtree(cursor); |