aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--epan/dissectors/packet-diameter_3gpp.c49
-rw-r--r--epan/dissectors/packet-gtpv2.c72
2 files changed, 107 insertions, 14 deletions
diff --git a/epan/dissectors/packet-diameter_3gpp.c b/epan/dissectors/packet-diameter_3gpp.c
index 303d3a4218..8fc74959ac 100644
--- a/epan/dissectors/packet-diameter_3gpp.c
+++ b/epan/dissectors/packet-diameter_3gpp.c
@@ -592,6 +592,52 @@ dissect_diameter_3gpp_ipaddr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *
}
+/* AVP Code: 903 RAI AVP
+ * 17.7.12 RAI AVP
+ * The RAI AVP (AVP Code 909) is of type UTF8String, and contains the Routing Area Identity of the SGSN where the
+ * UE is registered. RAI use and structure is specified in 3GPP TS 23.003 [40].
+ * Its value shall be encoded as a UTF-8 string on either 11 (if the MNC contains two digits) or 12 (if the MNC contains
+ * three digits) octets as follows:
+ * - The MCC shall be encoded first using three UTF-8 characters on three octets, each character representing a
+ * decimal digit starting with the first MCC digit.
+ * - Then, the MNC shall be encoded as either two or three UTF-8 characters on two or three octets, each character
+ * representing a decimal digit starting with the first MNC digit.
+ * - The Location Area Code (LAC) is encoded next using four UTF-8 characters on four octets, each character
+ * representing a hexadecimal digit of the LAC which is two binary octets long.
+ * - The Routing Area Code (RAC) is encoded last using two UTF-8 characters on two octets, each character
+ * representing a hexadecimal digit of the RAC which is one binary octet long.
+ * NOTE: As an example, a RAI with the following information: MCC=123, MNC=45, LAC=41655(0xA2C1) and
+ * RAC=10(0x0A) is encoded within the RAI AVP as a UTF-8 string of "12345A2C10A".
+ */
+
+static int
+dissect_diameter_3gpp_rai(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data) {
+
+ diam_sub_dis_t *diam_sub_dis = (diam_sub_dis_t*)data;
+ int offset = 0;
+ guint length;
+
+ length = tvb_length(tvb);
+
+ if(length==12){
+ diam_sub_dis->avp_str = wmem_strdup_printf(wmem_packet_scope(), "MNC %s, MCC %s, LAC 0x%s, RAC 0x%s",
+ tvb_get_string_enc(wmem_packet_scope(), tvb, 0, 3, ENC_UTF_8|ENC_NA), /* MNC 3 digits */
+ tvb_get_string_enc(wmem_packet_scope(), tvb, 3, 3, ENC_UTF_8|ENC_NA), /* MCC 3 digits */
+ tvb_get_string_enc(wmem_packet_scope(), tvb, 6, 4, ENC_UTF_8|ENC_NA), /* LCC 4 digits */
+ tvb_get_string_enc(wmem_packet_scope(), tvb, 10, 2, ENC_UTF_8|ENC_NA) /* RAC 2 digits */
+ );
+ }else{
+ diam_sub_dis->avp_str = wmem_strdup_printf(wmem_packet_scope(), "MNC %s, MCC %s, LAC 0x%s, RAC 0x%s",
+ tvb_get_string_enc(wmem_packet_scope(), tvb, 0, 3, ENC_UTF_8|ENC_NA), /* MNC 3 digits */
+ tvb_get_string_enc(wmem_packet_scope(), tvb, 3, 2, ENC_UTF_8|ENC_NA), /* MCC 2 digits */
+ tvb_get_string_enc(wmem_packet_scope(), tvb, 5, 4, ENC_UTF_8|ENC_NA), /* LCC 4 digits */
+ tvb_get_string_enc(wmem_packet_scope(), tvb, 9, 2, ENC_UTF_8|ENC_NA) /* RAC 2 digits */
+ );
+ }
+
+ return offset;
+
+}
/* AVP Code: 913 MBMS-Required-QoS */
static int
dissect_diameter_3gpp_mbms_required_qos(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) {
@@ -955,6 +1001,9 @@ proto_reg_handoff_diameter_3gpp(void)
/* AVP Code: 904 MBMS-Session-Duration Registered by packet-gtp.c */
/* AVP Code: 903 MBMS-Service-Area Registered by packet-gtp.c */
+ /* AVP Code: 909 RAI */
+ dissector_add_uint("diameter.3gpp", 909, new_create_dissector_handle(dissect_diameter_3gpp_rai, proto_diameter_3gpp));
+
/* AVP Code: 911 MBMS-Time-To-Data-Transfer Registered by packet-gtp.c */
/* Registered by packet-gtp.c */
diff --git a/epan/dissectors/packet-gtpv2.c b/epan/dissectors/packet-gtpv2.c
index 29f1a8b7cb..3e7851c6ef 100644
--- a/epan/dissectors/packet-gtpv2.c
+++ b/epan/dissectors/packet-gtpv2.c
@@ -42,6 +42,7 @@
#include "packet-bssgp.h"
#include "packet-ntp.h"
#include "packet-gtpv2.h"
+#include "packet-diameter.h"
void proto_register_gtpv2(void);
void proto_reg_handoff_gtpv2(void);
@@ -1849,71 +1850,102 @@ dissect_gtpv2_tad(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_ite
* to 23.003 in a future version.
*/
-static void
+static gchar*
decode_gtpv2_uli(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 instance _U_, guint flags)
{
int offset = 1; /* flags are already dissected */
proto_item *fi;
proto_tree *part_tree;
+ gchar *mcc_mnc_str;
+ gchar *str = NULL;
/* 8.21.1 CGI field */
if (flags & GTPv2_ULI_CGI_MASK)
{
+ guint16 lac, ci;
+
proto_item_append_text(item, "CGI ");
fi = proto_tree_add_text(tree, tvb, offset, 7, "Cell Global Identity (CGI)");
part_tree = proto_item_add_subtree(fi, ett_gtpv2_uli_field);
- dissect_e212_mcc_mnc(tvb, pinfo, part_tree, offset, TRUE);
+ mcc_mnc_str = dissect_e212_mcc_mnc_wmem_packet_str(tvb, pinfo, part_tree, offset, TRUE);
offset += 3;
+ lac = tvb_get_ntohs(tvb, offset);
proto_tree_add_item(part_tree, hf_gtpv2_uli_cgi_lac, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
+ ci = tvb_get_ntohs(tvb, offset);
proto_tree_add_item(part_tree, hf_gtpv2_uli_cgi_ci, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
+ str = wmem_strdup_printf(wmem_packet_scope(), "%s, LAC 0x%x, CI 0x%x",
+ mcc_mnc_str,
+ lac,
+ ci);
if (offset == length)
- return;
+ return str;
}
/* 8.21.2 SAI field */
if (flags & GTPv2_ULI_SAI_MASK)
{
+ guint16 lac, sac;
+
proto_item_append_text(item, "SAI ");
fi = proto_tree_add_text(tree, tvb, offset, 7, "Service Area Identity (SAI)");
part_tree = proto_item_add_subtree(fi, ett_gtpv2_uli_field);
- dissect_e212_mcc_mnc(tvb, pinfo, part_tree, offset, TRUE);
+ mcc_mnc_str = dissect_e212_mcc_mnc_wmem_packet_str(tvb, pinfo, part_tree, offset, TRUE);
offset += 3;
+ lac = tvb_get_ntohs(tvb, offset);
proto_tree_add_item(part_tree, hf_gtpv2_uli_sai_lac, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
+ sac = tvb_get_ntohs(tvb, offset);
proto_tree_add_item(part_tree, hf_gtpv2_uli_sai_sac, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
+ str = wmem_strdup_printf(wmem_packet_scope(), "%s, LAC 0x%x, SAC 0x%x",
+ mcc_mnc_str,
+ lac,
+ sac);
if (offset == length)
- return;
+ return str;
}
/* 8.21.3 RAI field */
if (flags & GTPv2_ULI_RAI_MASK)
{
+ guint16 lac, rac;
proto_item_append_text(item, "RAI ");
fi = proto_tree_add_text(tree, tvb, offset, 7, "Routeing Area Identity (RAI)");
part_tree = proto_item_add_subtree(fi, ett_gtpv2_uli_field);
- dissect_e212_mcc_mnc(tvb, pinfo, part_tree, offset, TRUE);
+ mcc_mnc_str = dissect_e212_mcc_mnc_wmem_packet_str(tvb, pinfo, part_tree, offset, TRUE);
offset += 3;
+ lac = tvb_get_ntohs(tvb, offset);
proto_tree_add_item(part_tree, hf_gtpv2_uli_rai_lac, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
+ rac = tvb_get_ntohs(tvb, offset);
proto_tree_add_item(part_tree, hf_gtpv2_uli_rai_rac, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
+ str = wmem_strdup_printf(wmem_packet_scope(), "%s, LAC 0x%x, RAC 0x%x",
+ mcc_mnc_str,
+ lac,
+ rac);
+
if (offset == length)
- return;
+ return str;
}
/* 8.21.4 TAI field */
if (flags & GTPv2_ULI_TAI_MASK)
{
+ guint16 tac;
proto_item_append_text(item, "TAI ");
fi = proto_tree_add_text(tree, tvb, offset, 5, "Tracking Area Identity (TAI)");
part_tree = proto_item_add_subtree(fi, ett_gtpv2_uli_field);
- dissect_e212_mcc_mnc(tvb, pinfo, part_tree, offset, TRUE);
+ mcc_mnc_str = dissect_e212_mcc_mnc_wmem_packet_str(tvb, pinfo, part_tree, offset, TRUE);
offset += 3;
+ tac = tvb_get_ntohs(tvb, offset);
proto_tree_add_item(part_tree, hf_gtpv2_uli_tai_tac, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
+ str = wmem_strdup_printf(wmem_packet_scope(), "%s, TAC 0x%x",
+ mcc_mnc_str,
+ tac);
if (offset == length)
- return;
+ return str;
}
/* 8.21.5 ECGI field */
if (flags & GTPv2_ULI_ECGI_MASK)
@@ -1926,7 +1958,7 @@ decode_gtpv2_uli(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item
proto_item_append_text(item, "ECGI ");
fi = proto_tree_add_text(tree, tvb, offset, 7, "E-UTRAN Cell Global Identifier (ECGI)");
part_tree = proto_item_add_subtree(fi, ett_gtpv2_uli_field);
- dissect_e212_mcc_mnc(tvb, pinfo, part_tree, offset, TRUE);
+ mcc_mnc_str = dissect_e212_mcc_mnc_wmem_packet_str(tvb, pinfo, part_tree, offset, TRUE);
offset += 3;
/* The bits 8 through 5, of octet e+3 (Fig 8.21.5-1 in TS 29.274 V8.2.0) are spare
* and hence they would not make any difference to the hex string following it,
@@ -1944,17 +1976,22 @@ decode_gtpv2_uli(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item
proto_tree_add_uint(part_tree, hf_gtpv2_uli_ecgi_eci, tvb, offset, 4, ECGI);
/*proto_tree_add_item(tree, hf_gtpv2_uli_ecgi_eci, tvb, offset, 4, ENC_BIG_ENDIAN);*/
offset += 4;
+ str = wmem_strdup_printf(wmem_packet_scope(), "%s, ECGI 0x%x",
+ mcc_mnc_str,
+ ECGI);
+
if (offset == length)
- return;
+ return str;
}
/* 8.21.6 LAI field */
if (flags & GTPv2_ULI_LAI_MASK)
{
+ guint16 lac;
proto_item_append_text(item, "LAI ");
fi = proto_tree_add_text(tree, tvb, offset, 5, "LAI (Location Area Identifier)");
part_tree = proto_item_add_subtree(fi, ett_gtpv2_uli_field);
- dissect_e212_mcc_mnc(tvb, pinfo, part_tree, offset, TRUE);
+ mcc_mnc_str = dissect_e212_mcc_mnc_wmem_packet_str(tvb, pinfo, part_tree, offset, TRUE);
offset += 3;
/* The Location Area Code (LAC) consists of 2 octets. Bit 8 of Octet f+3 is the most significant bit
@@ -1962,9 +1999,15 @@ decode_gtpv2_uli(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item
* responsibility of each administration. Coding using full hexadecimal representation shall be used.
*/
proto_tree_add_item(part_tree, hf_gtpv2_uli_lai_lac, tvb, offset, 2, ENC_BIG_ENDIAN);
+ lac = tvb_get_ntohs(tvb, offset);
+ str = wmem_strdup_printf(wmem_packet_scope(), "%s, LAC 0x%x",
+ mcc_mnc_str,
+ lac);
}
+ return str;
+
}
static void
@@ -2027,8 +2070,9 @@ static const value_string geographic_location_type_vals[] = {
};
static int
-dissect_diameter_3gpp_uli(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_diameter_3gpp_uli(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
+ diam_sub_dis_t *diam_sub_dis = (diam_sub_dis_t*)data;
int offset = 0;
guint length;
guint flags;
@@ -2069,7 +2113,7 @@ dissect_diameter_3gpp_uli(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, v
return length;
}
- decode_gtpv2_uli(tvb, pinfo, tree, NULL, length, 0, flags);
+ diam_sub_dis->avp_str = decode_gtpv2_uli(tvb, pinfo, tree, NULL, length, 0, flags);
return length;
}