DVB-BB: Add the mode adaptation protocol even when L.1 (no bytes)

Add the mode adaptation protocol to the tree even when it is L.1
(no actual bytes), just with no subtree in that case. This is necessary
in order to access the preferences.
This commit is contained in:
John Thacker 2021-06-30 20:38:42 -04:00 committed by Wireshark GitLab Utility
parent 8226e09fac
commit 983306087c
1 changed files with 7 additions and 13 deletions

View File

@ -1993,18 +1993,17 @@ static int dissect_dvb_s2_modeadapt(tvbuff_t *tvb, packet_info *pinfo, proto_tre
col_set_str(pinfo->cinfo, COL_PROTOCOL, "DVB-S2 ");
col_set_str(pinfo->cinfo, COL_INFO, "DVB-S2 ");
/* Add the protocol even if no length (L.1) so we get access to prefs. */
ti = proto_tree_add_protocol_format(tree, proto_dvb_s2_modeadapt, tvb, 0, modeadapt_len,
"DVB-S2 Mode Adaptation Header L.%d", modeadapt_type);
if (ws_count_ones(matched_headers) > 1) {
expert_add_info_format(pinfo, ti, &ei_dvb_s2_bb_header_ambiguous,
"Mode adaptation header format is ambiguous. Assuming L.%d", modeadapt_type);
}
/* If there's a mode adaptation header, create display subtree for it */
if (modeadapt_len > 0) {
/* ti = proto_tree_add_item(tree, proto_dvb_s2_modeadapt, tvb, 0, modeadapt_len, ENC_NA); */
ti = proto_tree_add_protocol_format(tree, proto_dvb_s2_modeadapt, tvb, 0, modeadapt_len,
"DVB-S2 Mode Adaptation Header L.%d", modeadapt_type);
dvb_s2_modeadapt_tree = proto_item_add_subtree(ti, ett_dvb_s2_modeadapt);
if (ws_count_ones(matched_headers) > 1) {
expert_add_info_format(pinfo, ti, &ei_dvb_s2_bb_header_ambiguous,
"Mode adaptation header format is ambiguous. Assuming L.%d", modeadapt_type);
}
/* SYNC byte if used in this header format; value has already been checked */
if (modeadapt_type == DVB_S2_MODEADAPT_TYPE_L2 ||
modeadapt_type == DVB_S2_MODEADAPT_TYPE_L3) {
@ -2047,11 +2046,6 @@ static int dissect_dvb_s2_modeadapt(tvbuff_t *tvb, packet_info *pinfo, proto_tre
proto_tree_add_item(dvb_s2_modeadapt_tree, hf_dvb_s2_modeadapt_frameno, tvb, cur_off, 1, ENC_BIG_ENDIAN);
cur_off++;
}
} else {
/* Warn if ambiguity exists even when no subtree (i.e. L.1 / length 0) */
if (ws_count_ones(matched_headers) > 1) {
proto_tree_add_expert_format(tree, pinfo, &ei_dvb_s2_bb_header_ambiguous, tvb, 0, 0, "Mode adaptation header format is ambiguous. Assuming L.%d", modeadapt_type);
}
}
/* start DVB-BB dissector */