diff options
author | Pascal Quantin <pascal.quantin@gmail.com> | 2015-07-16 17:08:31 +0200 |
---|---|---|
committer | Pascal Quantin <pascal.quantin@gmail.com> | 2015-07-16 16:56:43 +0000 |
commit | da914431ce2d4e5b154b1491490a54d1de15366f (patch) | |
tree | 348f76c50de597fba3e8f1f8d1535cd066a6460d /asn1 | |
parent | 6d33c124d55c1fdbe8225e82256b77e8f0a13e3c (diff) |
LTE RRC: fix dissection of ETWS/CMAS warning messages
Change-Id: I20bb219a32b6c7e39ac415c5c13ad5379f78cba2
Reviewed-on: https://code.wireshark.org/review/9658
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Diffstat (limited to 'asn1')
-rw-r--r-- | asn1/lte-rrc/lte-rrc.cnf | 44 | ||||
-rw-r--r-- | asn1/lte-rrc/packet-lte-rrc-template.c | 194 |
2 files changed, 235 insertions, 3 deletions
diff --git a/asn1/lte-rrc/lte-rrc.cnf b/asn1/lte-rrc/lte-rrc.cnf index c84976bb54..5efcdee67c 100644 --- a/asn1/lte-rrc/lte-rrc.cnf +++ b/asn1/lte-rrc/lte-rrc.cnf @@ -655,6 +655,16 @@ SystemInformationBlockType11/messageIdentifier TYPE=FT_UINT16 DISPLAY=BASE_DEC|B proto_tree_add_item(subtree, hf_lte_rrc_serialNumber_upd_nb, serial_nb_tvb, 0, 2, ENC_BIG_ENDIAN); } +#.FN_BODY SystemInformationBlockType11/warningMessageSegmentType VAL_PTR=&segment_type + guint32 segment_type; +%(DEFAULT_BODY)s + private_data_set_warning_message_segment_type(actx, (guint8)segment_type); + +#.FN_BODY SystemInformationBlockType11/warningMessageSegmentNumber VAL_PTR=&segment_number + guint32 segment_number; +%(DEFAULT_BODY)s + private_data_set_warning_message_segment_number(actx, (guint8)segment_number); + #.FN_BODY SystemInformationBlockType11/dataCodingScheme VAL_PTR=&data_coding_scheme_tvb tvbuff_t *data_coding_scheme_tvb = NULL; %(DEFAULT_BODY)s @@ -678,8 +688,18 @@ SystemInformationBlockType11/messageIdentifier TYPE=FT_UINT16 DISPLAY=BASE_DEC|B p_dcs = g_hash_table_lookup(lte_rrc_etws_cmas_dcs_hash, GUINT_TO_POINTER((guint)private_data_get_message_identifier(actx))); if (warning_msg_seg_tvb && p_dcs) { proto_tree *subtree; + tvbuff_t *frag_tvb; + fragment_head *frag_data = fragment_add_seq_check(<e_rrc_sib11_reassembly_table, warning_msg_seg_tvb, 0, actx->pinfo, + private_data_get_message_identifier(actx), NULL, + private_data_get_warning_message_segment_number(actx), + tvb_reported_length(warning_msg_seg_tvb), + private_data_get_warning_message_segment_type(actx) ? FALSE : TRUE); subtree = proto_item_add_subtree(actx->created_item, ett_lte_rrc_warningMessageSegment); - dissect_lte_rrc_warningMessageSegment(warning_msg_seg_tvb, subtree, actx->pinfo, GPOINTER_TO_UINT(p_dcs)); + frag_tvb = process_reassembled_data(warning_msg_seg_tvb, 0, actx->pinfo, "Reassembled SIB11 warning message", + frag_data, <e_rrc_sib11_frag_items, NULL, subtree); + if (frag_tvb) { + dissect_lte_rrc_warningMessageSegment(frag_tvb, subtree, actx->pinfo, GPOINTER_TO_UINT(p_dcs)); + } } #.TYPE_ATTR @@ -710,6 +730,16 @@ SystemInformationBlockType12-r9/messageIdentifier-r9 TYPE=FT_UINT16 DISPLAY=BASE proto_tree_add_item(subtree, hf_lte_rrc_serialNumber_upd_nb, serial_nb_tvb, 0, 2, ENC_BIG_ENDIAN); } +#.FN_BODY SystemInformationBlockType12-r9/warningMessageSegmentType-r9 VAL_PTR=&segment_type + guint32 segment_type; +%(DEFAULT_BODY)s + private_data_set_warning_message_segment_type(actx, (guint8)segment_type); + +#.FN_BODY SystemInformationBlockType12-r9/warningMessageSegmentNumber-r9 VAL_PTR=&segment_number + guint32 segment_number; +%(DEFAULT_BODY)s + private_data_set_warning_message_segment_number(actx, (guint8)segment_number); + #.FN_BODY SystemInformationBlockType12-r9/dataCodingScheme-r9 VAL_PTR=&data_coding_scheme_tvb tvbuff_t *data_coding_scheme_tvb = NULL; %(DEFAULT_BODY)s @@ -733,8 +763,18 @@ SystemInformationBlockType12-r9/messageIdentifier-r9 TYPE=FT_UINT16 DISPLAY=BASE p_dcs = g_hash_table_lookup(lte_rrc_etws_cmas_dcs_hash, GUINT_TO_POINTER((guint)private_data_get_message_identifier(actx))); if (warning_msg_seg_tvb && p_dcs) { proto_tree *subtree; + tvbuff_t *frag_tvb; + fragment_head *frag_data = fragment_add_seq_check(<e_rrc_sib12_reassembly_table, warning_msg_seg_tvb, 0, actx->pinfo, + private_data_get_message_identifier(actx), NULL, + private_data_get_warning_message_segment_number(actx), + tvb_reported_length(warning_msg_seg_tvb), + private_data_get_warning_message_segment_type(actx) ? FALSE : TRUE); subtree = proto_item_add_subtree(actx->created_item, ett_lte_rrc_warningMessageSegment); - dissect_lte_rrc_warningMessageSegment(warning_msg_seg_tvb, subtree, actx->pinfo, GPOINTER_TO_UINT(p_dcs)); + frag_tvb = process_reassembled_data(warning_msg_seg_tvb, 0, actx->pinfo, "Reassembled SIB12 warning message", + frag_data, <e_rrc_sib12_frag_items, NULL, subtree); + if (frag_tvb) { + dissect_lte_rrc_warningMessageSegment(frag_tvb, subtree, actx->pinfo, GPOINTER_TO_UINT(p_dcs)); + } } #.TYPE_ATTR diff --git a/asn1/lte-rrc/packet-lte-rrc-template.c b/asn1/lte-rrc/packet-lte-rrc-template.c index 2aa6d6e0e8..5fd2975cef 100644 --- a/asn1/lte-rrc/packet-lte-rrc-template.c +++ b/asn1/lte-rrc/packet-lte-rrc-template.c @@ -33,6 +33,7 @@ #include <epan/to_str.h> #include <epan/asn1.h> #include <epan/expert.h> +#include <epan/reassemble.h> #include "packet-per.h" #include "packet-rrc.h" @@ -233,6 +234,28 @@ static int hf_lte_rrc_modifiedMPR_Behavior_r10_mpr_ampr_28 = -1; static int hf_lte_rrc_modifiedMPR_Behavior_r10_mpr_ampr_29 = -1; static int hf_lte_rrc_modifiedMPR_Behavior_r10_mpr_ampr_30 = -1; static int hf_lte_rrc_modifiedMPR_Behavior_r10_mpr_ampr_31 = -1; +static int hf_lte_rrc_sib11_fragments = -1; +static int hf_lte_rrc_sib11_fragment = -1; +static int hf_lte_rrc_sib11_fragment_overlap = -1; +static int hf_lte_rrc_sib11_fragment_overlap_conflict = -1; +static int hf_lte_rrc_sib11_fragment_multiple_tails = -1; +static int hf_lte_rrc_sib11_fragment_too_long_fragment = -1; +static int hf_lte_rrc_sib11_fragment_error = -1; +static int hf_lte_rrc_sib11_fragment_count = -1; +static int hf_lte_rrc_sib11_reassembled_in = -1; +static int hf_lte_rrc_sib11_reassembled_length = -1; +static int hf_lte_rrc_sib11_reassembled_data = -1; +static int hf_lte_rrc_sib12_fragments = -1; +static int hf_lte_rrc_sib12_fragment = -1; +static int hf_lte_rrc_sib12_fragment_overlap = -1; +static int hf_lte_rrc_sib12_fragment_overlap_conflict = -1; +static int hf_lte_rrc_sib12_fragment_multiple_tails = -1; +static int hf_lte_rrc_sib12_fragment_too_long_fragment = -1; +static int hf_lte_rrc_sib12_fragment_error = -1; +static int hf_lte_rrc_sib12_fragment_count = -1; +static int hf_lte_rrc_sib12_reassembled_in = -1; +static int hf_lte_rrc_sib12_reassembled_length = -1; +static int hf_lte_rrc_sib12_reassembled_data = -1; /* Initialize the subtree pointers */ static int ett_lte_rrc = -1; @@ -257,6 +280,10 @@ static gint ett_lte_rrc_tdd_FDD_CA_PCellDuplex_r12 = -1; static gint ett_lte_rrc_sr_ConfigIndex = -1; static gint ett_lte_rrc_transmissionModeList_r12 = -1; static gint ett_lte_rrc_modifiedMPR_Behavior_r10 = -1; +static gint ett_lte_rrc_sib11_fragment = -1; +static gint ett_lte_rrc_sib11_fragments = -1; +static gint ett_lte_rrc_sib12_fragment = -1; +static gint ett_lte_rrc_sib12_fragments = -1; static expert_field ei_lte_rrc_number_pages_le15 = EI_INIT; static expert_field ei_lte_rrc_si_info_value_changed = EI_INIT; @@ -268,6 +295,43 @@ static expert_field ei_lte_rrc_unexpected_length_value = EI_INIT; static expert_field ei_lte_rrc_too_many_group_a_rapids = EI_INIT; static expert_field ei_lte_rrc_invalid_drx_config = EI_INIT; +static reassembly_table lte_rrc_sib11_reassembly_table; +static reassembly_table lte_rrc_sib12_reassembly_table; + +static const fragment_items lte_rrc_sib11_frag_items = { + &ett_lte_rrc_sib11_fragment, + &ett_lte_rrc_sib11_fragments, + &hf_lte_rrc_sib11_fragments, + &hf_lte_rrc_sib11_fragment, + &hf_lte_rrc_sib11_fragment_overlap, + &hf_lte_rrc_sib11_fragment_overlap_conflict, + &hf_lte_rrc_sib11_fragment_multiple_tails, + &hf_lte_rrc_sib11_fragment_too_long_fragment, + &hf_lte_rrc_sib11_fragment_error, + &hf_lte_rrc_sib11_fragment_count, + &hf_lte_rrc_sib11_reassembled_in, + &hf_lte_rrc_sib11_reassembled_length, + &hf_lte_rrc_sib11_reassembled_data, + "SIB11 warning message segments" +}; + +static const fragment_items lte_rrc_sib12_frag_items = { + &ett_lte_rrc_sib12_fragment, + &ett_lte_rrc_sib12_fragments, + &hf_lte_rrc_sib12_fragments, + &hf_lte_rrc_sib12_fragment, + &hf_lte_rrc_sib12_fragment_overlap, + &hf_lte_rrc_sib12_fragment_overlap_conflict, + &hf_lte_rrc_sib12_fragment_multiple_tails, + &hf_lte_rrc_sib12_fragment_too_long_fragment, + &hf_lte_rrc_sib12_fragment_error, + &hf_lte_rrc_sib12_fragment_count, + &hf_lte_rrc_sib12_reassembled_in, + &hf_lte_rrc_sib12_reassembled_length, + &hf_lte_rrc_sib12_reassembled_data, + "SIB12 warning message segments" +}; + /* Forward declarations */ static int dissect_DL_DCCH_Message_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_); static int dissect_UECapabilityInformation_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_); @@ -2105,6 +2169,8 @@ typedef struct lte_rrc_private_data_t guint8 si_or_psi_geran; guint8 ra_preambles; guint16 message_identifier; + guint8 warning_message_segment_type; + guint8 warning_message_segment_number; drb_mapping_t drb_mapping; drx_config_t drx_config; pdcp_security_info_t pdcp_security; @@ -2198,6 +2264,34 @@ static void private_data_set_message_identifier(asn1_ctx_t *actx, guint16 messag } +/* Warning message segment type */ +static guint16 private_data_get_warning_message_segment_type(asn1_ctx_t *actx) +{ + lte_rrc_private_data_t *private_data = (lte_rrc_private_data_t*)lte_rrc_get_private_data(actx); + return private_data->warning_message_segment_type; +} + +static void private_data_set_warning_message_segment_type(asn1_ctx_t *actx, guint8 segment_type) +{ + lte_rrc_private_data_t *private_data = (lte_rrc_private_data_t*)lte_rrc_get_private_data(actx); + private_data->warning_message_segment_type = segment_type; +} + + +/* Warning message segment number */ +static guint16 private_data_get_warning_message_segment_number(asn1_ctx_t *actx) +{ + lte_rrc_private_data_t *private_data = (lte_rrc_private_data_t*)lte_rrc_get_private_data(actx); + return private_data->warning_message_segment_number; +} + +static void private_data_set_warning_message_segment_number(asn1_ctx_t *actx, guint8 segment_number) +{ + lte_rrc_private_data_t *private_data = (lte_rrc_private_data_t*)lte_rrc_get_private_data(actx); + private_data->warning_message_segment_number = segment_number; +} + + /* Number of RA-preambles */ static guint8 private_data_get_ra_preambles(asn1_ctx_t *actx) { @@ -2711,6 +2805,10 @@ lte_rrc_init_protocol(void) { lte_rrc_etws_cmas_dcs_hash = g_hash_table_new(g_direct_hash, g_direct_equal); lte_rrc_system_info_value_changed_hash = g_hash_table_new(g_direct_hash, g_direct_equal); + reassembly_table_init(<e_rrc_sib11_reassembly_table, + &addresses_reassembly_table_functions); + reassembly_table_init(<e_rrc_sib12_reassembly_table, + &addresses_reassembly_table_functions); } static void @@ -2718,6 +2816,8 @@ lte_rrc_cleanup_protocol(void) { g_hash_table_destroy(lte_rrc_etws_cmas_dcs_hash); g_hash_table_destroy(lte_rrc_system_info_value_changed_hash); + reassembly_table_destroy(<e_rrc_sib11_reassembly_table); + reassembly_table_destroy(<e_rrc_sib12_reassembly_table); } /*--- proto_register_rrc -------------------------------------------*/ @@ -3344,6 +3444,94 @@ void proto_register_lte_rrc(void) { { "MPR/A-MPR behavior 31", "lte-rrc.modifiedMPR_Behavior_r10.mpr_ampr_31", FT_BOOLEAN, BASE_NONE, TFS(&tfs_supported_not_supported), 0, NULL, HFILL }}, + { &hf_lte_rrc_sib11_fragments, + { "Fragments", "lte-rrc.warningMessageSegment.fragments", + FT_NONE, BASE_NONE, NULL, 0, + NULL, HFILL }}, + { &hf_lte_rrc_sib11_fragment, + { "Fragment", "lte-rrc.warningMessageSegment.fragment", + FT_FRAMENUM, BASE_NONE, NULL, 0, + NULL, HFILL }}, + { &hf_lte_rrc_sib11_fragment_overlap, + { "Fragment Overlap", "lte-rrc.warningMessageSegment.fragment_overlap", + FT_BOOLEAN, BASE_NONE, NULL, 0, + NULL, HFILL }}, + { &hf_lte_rrc_sib11_fragment_overlap_conflict, + { "Fragment Overlap Conflict", "lte-rrc.warningMessageSegment.fragment_overlap_conflict", + FT_BOOLEAN, BASE_NONE, NULL, 0, + NULL, HFILL }}, + { &hf_lte_rrc_sib11_fragment_multiple_tails, + { "Fragment Multiple Tails", "lte-rrc.warningMessageSegment.fragment_multiple_tails", + FT_BOOLEAN, BASE_NONE, NULL, 0, + NULL, HFILL }}, + { &hf_lte_rrc_sib11_fragment_too_long_fragment, + { "Too Long Fragment", "lte-rrc.warningMessageSegment.fragment_too_long_fragment", + FT_BOOLEAN, BASE_NONE, NULL, 0, + NULL, HFILL }}, + { &hf_lte_rrc_sib11_fragment_error, + { "Fragment Error", "lte-rrc.warningMessageSegment.fragment_error", + FT_FRAMENUM, BASE_NONE, NULL, 0, + NULL, HFILL }}, + { &hf_lte_rrc_sib11_fragment_count, + { "Fragment Count", "lte-rrc.warningMessageSegment.fragment_count", + FT_UINT32, BASE_DEC, NULL, 0, + NULL, HFILL }}, + { &hf_lte_rrc_sib11_reassembled_in, + { "Reassembled In", "lte-rrc.warningMessageSegment.reassembled_in", + FT_FRAMENUM, BASE_NONE, NULL, 0, + NULL, HFILL }}, + { &hf_lte_rrc_sib11_reassembled_length, + { "Reassembled Length", "lte-rrc.warningMessageSegment.reassembled_length", + FT_UINT32, BASE_DEC, NULL, 0, + NULL, HFILL }}, + { &hf_lte_rrc_sib11_reassembled_data, + { "Reassembled Data", "lte-rrc.warningMessageSegment.reassembled_data", + FT_BYTES, BASE_NONE, NULL, 0, + NULL, HFILL }}, + { &hf_lte_rrc_sib12_fragments, + { "Fragments", "lte-rrc.warningMessageSegment_r9.fragments", + FT_NONE, BASE_NONE, NULL, 0, + NULL, HFILL }}, + { &hf_lte_rrc_sib12_fragment, + { "Fragment", "lte-rrc.warningMessageSegment_r9.fragment", + FT_FRAMENUM, BASE_NONE, NULL, 0, + NULL, HFILL }}, + { &hf_lte_rrc_sib12_fragment_overlap, + { "Fragment Overlap", "lte-rrc.warningMessageSegment_r9.fragment_overlap", + FT_BOOLEAN, BASE_NONE, NULL, 0, + NULL, HFILL }}, + { &hf_lte_rrc_sib12_fragment_overlap_conflict, + { "Fragment Overlap Conflict", "lte-rrc.warningMessageSegment_r9.fragment_overlap_conflict", + FT_BOOLEAN, BASE_NONE, NULL, 0, + NULL, HFILL }}, + { &hf_lte_rrc_sib12_fragment_multiple_tails, + { "Fragment Multiple Tails", "lte-rrc.warningMessageSegment_r9.fragment_multiple_tails", + FT_BOOLEAN, BASE_NONE, NULL, 0, + NULL, HFILL }}, + { &hf_lte_rrc_sib12_fragment_too_long_fragment, + { "Too Long Fragment", "lte-rrc.warningMessageSegment_r9.fragment_too_long_fragment", + FT_BOOLEAN, BASE_NONE, NULL, 0, + NULL, HFILL }}, + { &hf_lte_rrc_sib12_fragment_error, + { "Fragment Error", "lte-rrc.warningMessageSegment_r9.fragment_error", + FT_FRAMENUM, BASE_NONE, NULL, 0, + NULL, HFILL }}, + { &hf_lte_rrc_sib12_fragment_count, + { "Fragment Count", "lte-rrc.warningMessageSegment_r9.fragment_count", + FT_UINT32, BASE_DEC, NULL, 0, + NULL, HFILL }}, + { &hf_lte_rrc_sib12_reassembled_in, + { "Reassembled In", "lte-rrc.warningMessageSegment_r9.reassembled_in", + FT_FRAMENUM, BASE_NONE, NULL, 0, + NULL, HFILL }}, + { &hf_lte_rrc_sib12_reassembled_length, + { "Reassembled Length", "lte-rrc.warningMessageSegment_r9.reassembled_length", + FT_UINT32, BASE_DEC, NULL, 0, + NULL, HFILL }}, + { &hf_lte_rrc_sib12_reassembled_data, + { "Reassembled Data", "lte-rrc.warningMessageSegment_r9.reassembled_data", + FT_BYTES, BASE_NONE, NULL, 0, + NULL, HFILL }} }; /* List of subtrees */ @@ -3368,7 +3556,11 @@ void proto_register_lte_rrc(void) { &ett_lte_rrc_tdd_FDD_CA_PCellDuplex_r12, &ett_lte_rrc_sr_ConfigIndex, &ett_lte_rrc_transmissionModeList_r12, - &ett_lte_rrc_modifiedMPR_Behavior_r10 + &ett_lte_rrc_modifiedMPR_Behavior_r10, + &ett_lte_rrc_sib11_fragment, + &ett_lte_rrc_sib11_fragments, + &ett_lte_rrc_sib12_fragment, + &ett_lte_rrc_sib12_fragments }; static ei_register_info ei[] = { |