S1AP: fix filtering on cell-ID
authorPavel Strnad <pavel_strnad@hotmail.com>
Mon, 19 Mar 2018 08:13:35 +0000 (09:13 +0100)
committerPascal Quantin <pascal.quantin@gmail.com>
Mon, 19 Mar 2018 14:37:04 +0000 (14:37 +0000)
Filter does not work due to same shared short name for cell-id being used for two different asn.1 defintions
  cell-ID OCTET STRING,
  cell-ID CellIdentity,

Change-Id: I5921bc82d46f38d43f9083e41d3a0558821042eb
Reviewed-on: https://code.wireshark.org/review/26545
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Pavel Strnad <pavel_strnad@hotmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
epan/dissectors/asn1/s1ap/s1ap.cnf
epan/dissectors/packet-s1ap.c

index 52e43b17cba63299f8b1f6ba1f7ee52ff369fffc..d0f4d9a48be4885c1a3d74595c709939c3a8917e 100644 (file)
@@ -2120,6 +2120,17 @@ SecondaryRATReport                      N s1ap.proc.imsg id-SecondaryRATReport
 
 #.END
 
+#.FIELD_ATTR
+EUTRAN-CGI/cell-ID ABBREV=CellIdentity TYPE=FT_UINT32 DISPLAY=BASE_HEX
+#.FN_BODY CellIdentity VAL_PTR = &cell_id_tvb HF_INDEX=-1
+  tvbuff_t *cell_id_tvb = NULL;
+%(DEFAULT_BODY)s
+  if (cell_id_tvb) {
+    guint32 cell_id = tvb_get_bits32(cell_id_tvb, 0, 28, ENC_BIG_ENDIAN);
+    actx->created_item = proto_tree_add_uint(tree, hf_index, cell_id_tvb, 0, 4, cell_id);
+  }
+#.END
+
 #
 # Editor modelines  -  http://www.wireshark.org/tools/modelines.html
 #
index b45bd80124d414803d5d4ff55abc1bf1612f00b3..23cad496bfaa276ca21ac4dbfce240eb741eb10e 100644 (file)
@@ -2600,8 +2600,16 @@ dissect_s1ap_Additional_GUTI(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx
 
 static int
 dissect_s1ap_CellIdentity(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-  offset = dissect_per_bit_string(tvb, offset, actx, tree, hf_index,
-                                     28, 28, FALSE, NULL, NULL);
+#line 2126 "./asn1/s1ap/s1ap.cnf"
+  tvbuff_t *cell_id_tvb = NULL;
+  offset = dissect_per_bit_string(tvb, offset, actx, tree, -1,
+                                     28, 28, FALSE, &cell_id_tvb, NULL);
+
+  if (cell_id_tvb) {
+    guint32 cell_id = tvb_get_bits32(cell_id_tvb, 0, 28, ENC_BIG_ENDIAN);
+    actx->created_item = proto_tree_add_uint(tree, hf_index, cell_id_tvb, 0, 4, cell_id);
+  }
+
 
   return offset;
 }
@@ -17227,8 +17235,8 @@ void proto_register_s1ap(void) {
         FT_INT32, BASE_DEC|BASE_UNIT_STRING, &units_octet_octets, 0,
         "INTEGER", HFILL }},
     { &hf_s1ap_cell_ID,
-      { "cell-ID", "s1ap.cell_ID",
-        FT_BYTES, BASE_NONE, NULL, 0,
+      { "cell-ID", "s1ap.CellIdentity",
+        FT_UINT32, BASE_HEX, NULL, 0,
         "CellIdentity", HFILL }},
     { &hf_s1ap_expectedActivity,
       { "expectedActivity", "s1ap.expectedActivity_element",