DOCSIS: Fixed FDX Sub-band ID/offset TLVs dissection

This commit is contained in:
Andrii Vladyka 2020-12-02 16:26:08 -08:00 committed by AndersBroman
parent bfc7630e3c
commit 708ada8381
1 changed files with 23 additions and 21 deletions

View File

@ -5474,7 +5474,10 @@ dissect_mdd_full_duplex_descriptor(tvbuff_t * tvb, packet_info* pinfo _U_, proto
guint32 length; guint32 length;
guint32 sublength; guint32 sublength;
proto_tree *mdd_tree; proto_tree *mdd_tree;
proto_tree *fdx_sub_band_tree;
proto_item *mdd_item; proto_item *mdd_item;
proto_item *fdx_sub_band_item;
proto_item *fdx_sub_band_offset_item;
int pos; int pos;
guint subpos; guint subpos;
guint32 sub_band_offset; guint32 sub_band_offset;
@ -5523,36 +5526,35 @@ dissect_mdd_full_duplex_descriptor(tvbuff_t * tvb, packet_info* pinfo _U_, proto
} }
break; break;
case FDX_SUB_BAND_DESCRIPTOR: case FDX_SUB_BAND_DESCRIPTOR:
mdd_tree = proto_tree_add_subtree(mdd_tree, tvb, pos, 1, subpos = pos;
ett_docsis_mdd_full_duplex_sub_band_descriptor, &mdd_item, while (subpos < pos + length) {
val_to_str(type, mdd_full_duplex_sub_band_vals,
"Unknown TLV (%u)"));
proto_tree_add_item (mdd_tree, hf_docsis_mdd_full_duplex_sub_band_descriptor, tvb, pos, 1, ENC_BIG_ENDIAN);
proto_tree_add_item_ret_uint (mdd_tree, hf_docsis_mdd_full_duplex_sub_band_descriptor_length, tvb, pos + 1, 1, ENC_BIG_ENDIAN, &sublength);
proto_item_set_len(mdd_item, length + 2);
subpos = pos + 2;
while (subpos < pos + length + 2) {
subtype = tvb_get_guint8 (tvb, subpos); subtype = tvb_get_guint8 (tvb, subpos);
sublength = tvb_get_guint8 (tvb, subpos + 1); fdx_sub_band_tree = proto_tree_add_subtree(mdd_tree, tvb, subpos, -1,
ett_docsis_mdd_full_duplex_sub_band_descriptor, &fdx_sub_band_item,
val_to_str(subtype, mdd_full_duplex_sub_band_vals,
"Unknown TLV (%u)"));
proto_tree_add_item (fdx_sub_band_tree, hf_docsis_mdd_full_duplex_sub_band_descriptor, tvb, subpos, 1, ENC_BIG_ENDIAN);
proto_tree_add_item_ret_uint (fdx_sub_band_tree, hf_docsis_mdd_full_duplex_sub_band_descriptor_length, tvb, subpos + 1, 1, ENC_BIG_ENDIAN, &sublength);
proto_item_set_len(fdx_sub_band_item, sublength + 2);
switch(subtype) { switch(subtype) {
case FDX_SUB_BAND_ID: case FDX_SUB_BAND_ID:
if (length == 1) if (sublength == 1)
{ {
proto_tree_add_item (mdd_tree, hf_docsis_mdd_full_duplex_sub_band_id, tvb, subpos + 2, sublength, ENC_BIG_ENDIAN); proto_tree_add_item (fdx_sub_band_tree, hf_docsis_mdd_full_duplex_sub_band_id, tvb, subpos + 2, sublength, ENC_BIG_ENDIAN);
} else } else
{ {
expert_add_info_format(pinfo, mdd_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length); expert_add_info_format(pinfo, fdx_sub_band_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", sublength);
} }
break; break;
case FDX_SUB_BAND_OFFSET: case FDX_SUB_BAND_OFFSET:
if (length == 2) if (sublength == 2)
{ {
mdd_item = proto_tree_add_item_ret_uint (mdd_tree, hf_docsis_mdd_full_duplex_sub_band_offset, fdx_sub_band_offset_item = proto_tree_add_item_ret_uint (fdx_sub_band_tree, hf_docsis_mdd_full_duplex_sub_band_offset,
tvb, subpos + 2, sublength, ENC_BIG_ENDIAN, &sub_band_offset); tvb, subpos + 2, sublength, ENC_BIG_ENDIAN, &sub_band_offset);
proto_item_append_text(mdd_item, "%s", (sub_band_offset) ? " MHz" : " (108 MHz)"); proto_item_append_text(fdx_sub_band_offset_item, "%s", (sub_band_offset) ? " MHz" : " (108 MHz)");
} else } else
{ {
expert_add_info_format(pinfo, mdd_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length); expert_add_info_format(pinfo, fdx_sub_band_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", sublength);
} }
break; break;
default: default:
@ -5563,7 +5565,7 @@ dissect_mdd_full_duplex_descriptor(tvbuff_t * tvb, packet_info* pinfo _U_, proto
} }
break; break;
default: default:
expert_add_info_format(pinfo, mdd_item, &ei_docsis_mgmt_tlvtype_unknown, "Unknown Diplexer Band Edge TLV type: %u", type); expert_add_info_format(pinfo, mdd_item, &ei_docsis_mgmt_tlvtype_unknown, "Unknown Full Duplex Descriptor TLV type: %u", type);
break; break;
} }
pos += length; pos += length;
@ -9618,7 +9620,7 @@ proto_register_docsis_mgmt (void)
NULL, HFILL} NULL, HFILL}
}, },
{&hf_docsis_mdd_full_duplex_sub_band_offset, {&hf_docsis_mdd_full_duplex_sub_band_offset,
{"Full Duplex Sub-band ID", "docsis_mdd.full_duplex_sub_band_offset", {"Full Duplex Sub-band Offset", "docsis_mdd.full_duplex_sub_band_offset",
FT_UINT16, BASE_DEC, NULL, 0x0, FT_UINT16, BASE_DEC, NULL, 0x0,
NULL, HFILL} NULL, HFILL}
}, },