Add a malformed check to show if GroupA has more RAPIDs than A & B
authormartinm <martinm@f5534014-38df-0310-8fa8-9805f1628bb7>
Sat, 10 Aug 2013 16:17:33 +0000 (16:17 +0000)
committermartinm <martinm@f5534014-38df-0310-8fa8-9805f1628bb7>
Sat, 10 Aug 2013 16:17:33 +0000 (16:17 +0000)
combined.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@51243 f5534014-38df-0310-8fa8-9805f1628bb7

asn1/lte-rrc/lte-rrc.cnf
asn1/lte-rrc/packet-lte-rrc-template.c
epan/dissectors/packet-lte-rrc.c

index 24c2142a58746e1639d8cf8ee040a704d55dd4e9..0c7a05c6e285eb6754f7c74f63f9d747399ddede 100644 (file)
@@ -1269,3 +1269,28 @@ SoundingRS-UL-ConfigDedicated/setup/duration STRINGS=TFS(&lte_rrc_duration_val)
     ((drb_mapping_t*)actx->private_data)->pdcp_sn_size = 15;
     ((drb_mapping_t*)actx->private_data)->pdcp_sn_size_present = TRUE;
   }
+
+
+#.FN_BODY RACH-ConfigCommon/preambleInfo
+%(DEFAULT_BODY)s
+  actx->private_data = NULL;
+
+#.FN_BODY RACH-ConfigCommon/preambleInfo/numberOfRA-Preambles VAL_PTR=&value
+  guint32 value;
+%(DEFAULT_BODY)s
+  /* This is mandatory, store value */
+  actx->private_data = (guint32*)value;
+
+#.FN_BODY RACH-ConfigCommon/preambleInfo/preamblesGroupAConfig/sizeOfRA-PreamblesGroupA VAL_PTR=&value
+  guint32 ra_value, value;
+%(DEFAULT_BODY)s
+  /* Retrived stored value for RA (both Group A & Group B) */
+  ra_value = (guint32)(guint32*)actx->private_data;
+  if (value > ra_value) {
+    /* Something is wrong if A has more RAPIDs than A & B combined! */
+    expert_add_info_format_text(actx->pinfo, actx->created_item, &ei_lte_rrc_too_many_group_a_rapids,
+                                "Group A size (%%s) > Total RA size (%%s)!",
+                                val_to_str_const(value, lte_rrc_T_sizeOfRA_PreamblesGroupA_vals, "Unknown"),
+                                val_to_str_const(ra_value, lte_rrc_T_numberOfRA_Preambles_vals, "Unknown"));
+
+  }
index ae3e32170dd146bc2377a887fc016b122ede4be9..bfa95e3d3c9142d95cebefe8349f469a9a0bbe6d 100644 (file)
@@ -203,6 +203,7 @@ static expert_field ei_lte_rrc_earthquake_warning_sys = EI_INIT;
 static expert_field ei_lte_rrc_commercial_mobile_alert_sys = EI_INIT;
 static expert_field ei_lte_rrc_unexpected_type_value = EI_INIT;
 static expert_field ei_lte_rrc_unexpected_length_value = EI_INIT;
+static expert_field ei_lte_rrc_too_many_group_a_rapids = EI_INIT;
 
 /* Forward declarations */
 static int dissect_DL_DCCH_Message_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_);
@@ -2538,6 +2539,7 @@ void proto_register_lte_rrc(void) {
      { &ei_lte_rrc_commercial_mobile_alert_sys, { "lte_rrc.commercial_mobile_alert_sys", PI_SEQUENCE, PI_WARN, "Commercial Mobile Alert System Indication!", EXPFILL }},
      { &ei_lte_rrc_unexpected_type_value, { "lte_rrc.unexpected_type_value", PI_MALFORMED, PI_ERROR, "Unexpected type value", EXPFILL }},
      { &ei_lte_rrc_unexpected_length_value, { "lte_rrc.unexpected_length_value", PI_MALFORMED, PI_ERROR, "Unexpected type length", EXPFILL }},
+     { &ei_lte_rrc_too_many_group_a_rapids, { "lte_rrc.too_many_groupa_rapids", PI_MALFORMED, PI_ERROR, "Unexpected type length", EXPFILL }},
   };
 
   expert_module_t* expert_lte_rrc;
index 3a31f06e2fa312581a51e0440433910a36075fc6..1ca7e827890daf4267f4d5acf1391b5bb0b95979 100644 (file)
@@ -3529,6 +3529,7 @@ static expert_field ei_lte_rrc_earthquake_warning_sys = EI_INIT;
 static expert_field ei_lte_rrc_commercial_mobile_alert_sys = EI_INIT;
 static expert_field ei_lte_rrc_unexpected_type_value = EI_INIT;
 static expert_field ei_lte_rrc_unexpected_length_value = EI_INIT;
+static expert_field ei_lte_rrc_too_many_group_a_rapids = EI_INIT;
 
 /* Forward declarations */
 static int dissect_DL_DCCH_Message_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_);
@@ -5550,8 +5551,13 @@ static const value_string lte_rrc_T_numberOfRA_Preambles_vals[] = {
 
 static int
 dissect_lte_rrc_T_numberOfRA_Preambles(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
+  guint32 value;
   offset = dissect_per_enumerated(tvb, offset, actx, tree, hf_index,
-                                     16, NULL, FALSE, 0, NULL);
+                                     16, &value, FALSE, 0, NULL);
+
+  /* This is mandatory, store value */
+  actx->private_data = (guint32*)value;
+
 
   return offset;
 }
@@ -5579,8 +5585,20 @@ static const value_string lte_rrc_T_sizeOfRA_PreamblesGroupA_vals[] = {
 
 static int
 dissect_lte_rrc_T_sizeOfRA_PreamblesGroupA(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
+  guint32 ra_value, value;
   offset = dissect_per_enumerated(tvb, offset, actx, tree, hf_index,
-                                     15, NULL, FALSE, 0, NULL);
+                                     15, &value, FALSE, 0, NULL);
+
+  /* Retrived stored value for RA (both Group A & Group B) */
+  ra_value = (guint32)(guint32*)actx->private_data;
+  if (value > ra_value) {
+    /* Something is wrong if A has more RAPIDs than A & B combined! */
+    expert_add_info_format_text(actx->pinfo, actx->created_item, &ei_lte_rrc_too_many_group_a_rapids,
+                                "Group A size (%s) > Total RA size (%s)!",
+                                val_to_str_const(value, lte_rrc_T_sizeOfRA_PreamblesGroupA_vals, "Unknown"),
+                                val_to_str_const(ra_value, lte_rrc_T_numberOfRA_Preambles_vals, "Unknown"));
+
+  }
 
   return offset;
 }
@@ -5653,6 +5671,9 @@ dissect_lte_rrc_T_preambleInfo(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *ac
   offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
                                    ett_lte_rrc_T_preambleInfo, T_preambleInfo_sequence);
 
+  actx->private_data = NULL;
+
+
   return offset;
 }
 
@@ -12487,6 +12508,8 @@ dissect_lte_rrc_T_pdcp_SN_Size_v1130(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx
     ((drb_mapping_t*)actx->private_data)->pdcp_sn_size = 15;
     ((drb_mapping_t*)actx->private_data)->pdcp_sn_size_present = TRUE;
   }
+
+
   return offset;
 }
 
@@ -34151,7 +34174,7 @@ static int dissect_UEAssistanceInformation_r11_PDU(tvbuff_t *tvb _U_, packet_inf
 
 
 /*--- End of included file: packet-lte-rrc-fn.c ---*/
-#line 1945 "../../asn1/lte-rrc/packet-lte-rrc-template.c"
+#line 1946 "../../asn1/lte-rrc/packet-lte-rrc-template.c"
 
 static void
 dissect_lte_rrc_DL_CCCH(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
@@ -42813,7 +42836,7 @@ void proto_register_lte_rrc(void) {
         NULL, HFILL }},
 
 /*--- End of included file: packet-lte-rrc-hfarr.c ---*/
-#line 2094 "../../asn1/lte-rrc/packet-lte-rrc-template.c"
+#line 2095 "../../asn1/lte-rrc/packet-lte-rrc-template.c"
 
     { &hf_lte_rrc_eutra_cap_feat_group_ind_1,
       { "Indicator 1", "lte-rrc.eutra_cap_feat_group_ind_1",
@@ -44324,7 +44347,7 @@ void proto_register_lte_rrc(void) {
     &ett_lte_rrc_CandidateCellInfo_r10,
 
 /*--- End of included file: packet-lte-rrc-ettarr.c ---*/
-#line 2517 "../../asn1/lte-rrc/packet-lte-rrc-template.c"
+#line 2518 "../../asn1/lte-rrc/packet-lte-rrc-template.c"
 
     &ett_lte_rrc_featureGroupIndicators,
     &ett_lte_rrc_featureGroupIndRel9Add,
@@ -44349,6 +44372,7 @@ void proto_register_lte_rrc(void) {
      { &ei_lte_rrc_commercial_mobile_alert_sys, { "lte_rrc.commercial_mobile_alert_sys", PI_SEQUENCE, PI_WARN, "Commercial Mobile Alert System Indication!", EXPFILL }},
      { &ei_lte_rrc_unexpected_type_value, { "lte_rrc.unexpected_type_value", PI_MALFORMED, PI_ERROR, "Unexpected type value", EXPFILL }},
      { &ei_lte_rrc_unexpected_length_value, { "lte_rrc.unexpected_length_value", PI_MALFORMED, PI_ERROR, "Unexpected type length", EXPFILL }},
+     { &ei_lte_rrc_too_many_group_a_rapids, { "lte_rrc.too_many_groupa_rapids", PI_MALFORMED, PI_ERROR, "Unexpected type length", EXPFILL }},
   };
 
   expert_module_t* expert_lte_rrc;
@@ -44389,7 +44413,7 @@ void proto_register_lte_rrc(void) {
 
 
 /*--- End of included file: packet-lte-rrc-dis-reg.c ---*/
-#line 2566 "../../asn1/lte-rrc/packet-lte-rrc-template.c"
+#line 2568 "../../asn1/lte-rrc/packet-lte-rrc-template.c"
 
   register_init_routine(&lte_rrc_init_protocol);
 }