aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Mathieson <martin.r.mathieson@googlemail.com>2013-10-29 13:49:14 +0000
committerMartin Mathieson <martin.r.mathieson@googlemail.com>2013-10-29 13:49:14 +0000
commit66d64c686e57edee73d3c9833acbaa78c2ab89cd (patch)
tree33b19bd55aec96160a970945e5eabb0fb6e991e3
parent6d3988ffd378867ef0c2d8e398d275ccef1a0de1 (diff)
Pass security command details (integrity and ciphering algorithms) to PDCP (which doesn't yet do much with them)
svn path=/trunk/; revision=52946
-rw-r--r--asn1/lte-rrc/lte-rrc.cnf28
-rw-r--r--asn1/lte-rrc/packet-lte-rrc-template.c13
-rw-r--r--epan/dissectors/packet-lte-rrc.c56
-rw-r--r--epan/dissectors/packet-pdcp-lte.c38
-rw-r--r--epan/dissectors/packet-pdcp-lte.h15
5 files changed, 140 insertions, 10 deletions
diff --git a/asn1/lte-rrc/lte-rrc.cnf b/asn1/lte-rrc/lte-rrc.cnf
index 48c929e7a9..4abe251ce5 100644
--- a/asn1/lte-rrc/lte-rrc.cnf
+++ b/asn1/lte-rrc/lte-rrc.cnf
@@ -1510,3 +1510,31 @@ SoundingRS-UL-ConfigDedicated/setup/duration STRINGS=TFS(&lte_rrc_duration_val)
set_mac_lte_drx_config_release(p_mac_lte_info->ueid, actx->pinfo);
}
%(DEFAULT_BODY)s
+
+
+#.FN_BODY SecurityAlgorithmConfig
+ pdcp_lte_info *p_pdcp_lte_info;
+ pdcp_security_info_t *p_security_algorithms;
+%(DEFAULT_BODY)s
+ p_security_algorithms = private_data_pdcp_security_algorithms(actx);
+ p_security_algorithms->configuration_frame = actx->pinfo->fd->num;
+ /* Look for UE identifier */
+ p_pdcp_lte_info = (pdcp_lte_info *)p_get_proto_data(actx->pinfo->fd, proto_pdcp_lte, 0);
+ if (p_pdcp_lte_info != NULL) {
+ /* Configure algorithms */
+ set_pdcp_lte_security_algorithms(p_pdcp_lte_info->ueid, p_security_algorithms);
+ }
+
+#.FN_BODY SecurityAlgorithmConfig/cipheringAlgorithm VAL_PTR=&value
+ guint32 value;
+ pdcp_security_info_t *p_security_algorithms;
+%(DEFAULT_BODY)s
+ p_security_algorithms = private_data_pdcp_security_algorithms(actx);
+ p_security_algorithms->ciphering = (enum security_ciphering_algorithm_e)value;
+
+#.FN_BODY SecurityAlgorithmConfig/integrityProtAlgorithm VAL_PTR=&value
+ guint32 value;
+ pdcp_security_info_t *p_security_algorithms;
+%(DEFAULT_BODY)s
+ p_security_algorithms = private_data_pdcp_security_algorithms(actx);
+ p_security_algorithms->integrity = (enum security_integrity_algorithm_e)value;
diff --git a/asn1/lte-rrc/packet-lte-rrc-template.c b/asn1/lte-rrc/packet-lte-rrc-template.c
index 5154b081b8..2a74af858b 100644
--- a/asn1/lte-rrc/packet-lte-rrc-template.c
+++ b/asn1/lte-rrc/packet-lte-rrc-template.c
@@ -43,6 +43,7 @@
#include "packet-cell_broadcast.h"
#include "packet-mac-lte.h"
#include "packet-rlc-lte.h"
+#include "packet-pdcp-lte.h"
#define PNAME "LTE Radio Resource Control (RRC) protocol"
#define PSNAME "LTE RRC"
@@ -63,6 +64,7 @@ static gboolean system_info_value_current_set;
extern int proto_mac_lte;
+extern int proto_pdcp_lte;
/* Include constants */
@@ -1804,6 +1806,7 @@ typedef struct lte_rrc_private_data_t
guint16 message_identifier;
drb_mapping_t drb_mapping;
drx_config_t drx_config;
+ pdcp_security_info_t pdcp_security;
} lte_rrc_private_data_t;
/* Helper function to get or create a struct that will be actx->private_data */
@@ -1904,6 +1907,16 @@ static void private_data_set_ra_preambles(asn1_ctx_t *actx, guint8 ra_preambles)
lte_rrc_private_data_t *private_data = (lte_rrc_private_data_t*)lte_rrc_get_private_data(actx);
private_data->ra_preambles = ra_preambles;
}
+
+
+/* PDCP Security info */
+static pdcp_security_info_t* private_data_pdcp_security_algorithms(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->pdcp_security;
+}
+
+
/*****************************************************************************/
diff --git a/epan/dissectors/packet-lte-rrc.c b/epan/dissectors/packet-lte-rrc.c
index 7e9824fdd2..260114b4b6 100644
--- a/epan/dissectors/packet-lte-rrc.c
+++ b/epan/dissectors/packet-lte-rrc.c
@@ -51,6 +51,7 @@
#include "packet-cell_broadcast.h"
#include "packet-mac-lte.h"
#include "packet-rlc-lte.h"
+#include "packet-pdcp-lte.h"
#define PNAME "LTE Radio Resource Control (RRC) protocol"
#define PSNAME "LTE RRC"
@@ -71,6 +72,7 @@ static gboolean system_info_value_current_set;
extern int proto_mac_lte;
+extern int proto_pdcp_lte;
/* Include constants */
@@ -171,7 +173,7 @@ typedef enum _RAT_Type_enum {
} RAT_Type_enum;
/*--- End of included file: packet-lte-rrc-val.h ---*/
-#line 70 "../../asn1/lte-rrc/packet-lte-rrc-template.c"
+#line 72 "../../asn1/lte-rrc/packet-lte-rrc-template.c"
/* Initialize the protocol and registered fields */
static int proto_lte_rrc = -1;
@@ -2310,7 +2312,7 @@ static int hf_lte_rrc_CandidateCellInfoList_r10_item = -1; /* CandidateCellInfo
static int hf_lte_rrc_dummy_eag_field = -1; /* never registered */
/*--- End of included file: packet-lte-rrc-hf.c ---*/
-#line 75 "../../asn1/lte-rrc/packet-lte-rrc-template.c"
+#line 77 "../../asn1/lte-rrc/packet-lte-rrc-template.c"
static int hf_lte_rrc_eutra_cap_feat_group_ind_1 = -1;
static int hf_lte_rrc_eutra_cap_feat_group_ind_2 = -1;
@@ -3508,7 +3510,7 @@ static gint ett_lte_rrc_CandidateCellInfoList_r10 = -1;
static gint ett_lte_rrc_CandidateCellInfo_r10 = -1;
/*--- End of included file: packet-lte-rrc-ett.c ---*/
-#line 185 "../../asn1/lte-rrc/packet-lte-rrc-template.c"
+#line 187 "../../asn1/lte-rrc/packet-lte-rrc-template.c"
static gint ett_lte_rrc_featureGroupIndicators = -1;
static gint ett_lte_rrc_featureGroupIndRel9Add = -1;
@@ -5131,6 +5133,7 @@ typedef struct lte_rrc_private_data_t
guint16 message_identifier;
drb_mapping_t drb_mapping;
drx_config_t drx_config;
+ pdcp_security_info_t pdcp_security;
} lte_rrc_private_data_t;
/* Helper function to get or create a struct that will be actx->private_data */
@@ -5231,6 +5234,16 @@ static void private_data_set_ra_preambles(asn1_ctx_t *actx, guint8 ra_preambles)
lte_rrc_private_data_t *private_data = (lte_rrc_private_data_t*)lte_rrc_get_private_data(actx);
private_data->ra_preambles = ra_preambles;
}
+
+
+/* PDCP Security info */
+static pdcp_security_info_t* private_data_pdcp_security_algorithms(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->pdcp_security;
+}
+
+
/*****************************************************************************/
@@ -18772,6 +18785,8 @@ dissect_lte_rrc_RRCConnectionSetup(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t
ett_lte_rrc_RRCConnectionSetup, RRCConnectionSetup_sequence);
+
+
return offset;
}
@@ -22197,8 +22212,14 @@ static const value_string lte_rrc_T_cipheringAlgorithm_vals[] = {
static int
dissect_lte_rrc_T_cipheringAlgorithm(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
+ guint32 value;
+ pdcp_security_info_t *p_security_algorithms;
offset = dissect_per_enumerated(tvb, offset, actx, tree, hf_index,
- 8, NULL, TRUE, 0, NULL);
+ 8, &value, TRUE, 0, NULL);
+
+ p_security_algorithms = private_data_pdcp_security_algorithms(actx);
+ p_security_algorithms->ciphering = (enum security_ciphering_algorithm_e)value;
+
return offset;
}
@@ -22219,8 +22240,13 @@ static const value_string lte_rrc_T_integrityProtAlgorithm_vals[] = {
static int
dissect_lte_rrc_T_integrityProtAlgorithm(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
+ guint32 value;
+ pdcp_security_info_t *p_security_algorithms;
offset = dissect_per_enumerated(tvb, offset, actx, tree, hf_index,
- 8, NULL, TRUE, 0, NULL);
+ 8, &value, TRUE, 0, NULL);
+
+ p_security_algorithms = private_data_pdcp_security_algorithms(actx);
+ p_security_algorithms->integrity = (enum security_integrity_algorithm_e)value;
return offset;
}
@@ -22234,9 +22260,21 @@ static const per_sequence_t SecurityAlgorithmConfig_sequence[] = {
static int
dissect_lte_rrc_SecurityAlgorithmConfig(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
+ pdcp_lte_info *p_pdcp_lte_info;
+ pdcp_security_info_t *p_security_algorithms;
offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
ett_lte_rrc_SecurityAlgorithmConfig, SecurityAlgorithmConfig_sequence);
+ p_security_algorithms = private_data_pdcp_security_algorithms(actx);
+ p_security_algorithms->configuration_frame = actx->pinfo->fd->num;
+ /* Look for UE identifier */
+ p_pdcp_lte_info = (pdcp_lte_info *)p_get_proto_data(actx->pinfo->fd, proto_pdcp_lte, 0);
+ if (p_pdcp_lte_info != NULL) {
+ /* Configure algorithms */
+ set_pdcp_lte_security_algorithms(p_pdcp_lte_info->ueid, p_security_algorithms);
+ }
+
+
return offset;
}
@@ -34697,7 +34735,7 @@ static int dissect_UEAssistanceInformation_r11_PDU(tvbuff_t *tvb _U_, packet_inf
/*--- End of included file: packet-lte-rrc-fn.c ---*/
-#line 2176 "../../asn1/lte-rrc/packet-lte-rrc-template.c"
+#line 2189 "../../asn1/lte-rrc/packet-lte-rrc-template.c"
static void
dissect_lte_rrc_DL_CCCH(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
@@ -43361,7 +43399,7 @@ void proto_register_lte_rrc(void) {
NULL, HFILL }},
/*--- End of included file: packet-lte-rrc-hfarr.c ---*/
-#line 2323 "../../asn1/lte-rrc/packet-lte-rrc-template.c"
+#line 2336 "../../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",
@@ -44872,7 +44910,7 @@ void proto_register_lte_rrc(void) {
&ett_lte_rrc_CandidateCellInfo_r10,
/*--- End of included file: packet-lte-rrc-ettarr.c ---*/
-#line 2746 "../../asn1/lte-rrc/packet-lte-rrc-template.c"
+#line 2759 "../../asn1/lte-rrc/packet-lte-rrc-template.c"
&ett_lte_rrc_featureGroupIndicators,
&ett_lte_rrc_featureGroupIndRel9Add,
@@ -44939,7 +44977,7 @@ void proto_register_lte_rrc(void) {
/*--- End of included file: packet-lte-rrc-dis-reg.c ---*/
-#line 2797 "../../asn1/lte-rrc/packet-lte-rrc-template.c"
+#line 2810 "../../asn1/lte-rrc/packet-lte-rrc-template.c"
register_init_routine(&lte_rrc_init_protocol);
}
diff --git a/epan/dissectors/packet-pdcp-lte.c b/epan/dissectors/packet-pdcp-lte.c
index 0aa69d8461..6dde3b4d4c 100644
--- a/epan/dissectors/packet-pdcp-lte.c
+++ b/epan/dissectors/packet-pdcp-lte.c
@@ -654,6 +654,25 @@ static void checkChannelSequenceInfo(packet_info *pinfo, tvbuff_t *tvb,
}
+
+/* Hash table for security state for a UE
+ Maps UEId -> pdcp_security_info_t */
+static GHashTable *pdcp_security_hash = NULL;
+
+static gint pdcp_lte_ueid_hash_equal(gconstpointer v, gconstpointer v2)
+{
+ return (v == v2);
+}
+
+static guint pdcp_lte_ueid_hash_func(gconstpointer v)
+{
+ return GPOINTER_TO_UINT(v);
+}
+
+
+
+
+
/* Write the given formatted text to:
- the info column
- the top-level RLC PDU item */
@@ -992,6 +1011,16 @@ static gboolean dissect_pdcp_lte_heur(tvbuff_t *tvb, packet_info *pinfo,
return TRUE;
}
+void set_pdcp_lte_security_algorithms(guint16 ueid, pdcp_security_info_t *security_info)
+{
+ /* Copy security struct */
+ pdcp_security_info_t *p_security = wmem_new(wmem_file_scope(), pdcp_security_info_t);
+ *p_security = *security_info;
+
+ /* And add into security table */
+ g_hash_table_insert(pdcp_security_hash, GUINT_TO_POINTER(ueid), p_security);
+}
+
/******************************/
/* Main dissection function. */
@@ -1324,6 +1353,10 @@ static void dissect_pdcp_lte(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
gint payload_length = tvb_length_remaining(tvb, offset);
if (payload_length > 0) {
if (p_pdcp_info->plane == USER_PLANE) {
+
+ /* TODO: look up security info to see if ciphering is on */
+
+
if (global_pdcp_dissect_user_plane_as_ip) {
tvbuff_t *payload_tvb = tvb_new_subset_remaining(tvb, offset);
@@ -1443,11 +1476,14 @@ static void pdcp_lte_init_protocol(void)
if (pdcp_lte_sequence_analysis_report_hash) {
g_hash_table_destroy(pdcp_lte_sequence_analysis_report_hash);
}
-
+ if (pdcp_security_hash) {
+ g_hash_table_destroy(pdcp_security_hash);
+ }
/* Now create them over */
pdcp_sequence_analysis_channel_hash = g_hash_table_new(pdcp_channel_hash_func, pdcp_channel_equal);
pdcp_lte_sequence_analysis_report_hash = g_hash_table_new(pdcp_result_hash_func, pdcp_result_hash_equal);
+ pdcp_security_hash = g_hash_table_new(pdcp_lte_ueid_hash_func, pdcp_lte_ueid_hash_equal);
}
diff --git a/epan/dissectors/packet-pdcp-lte.h b/epan/dissectors/packet-pdcp-lte.h
index fd14060de5..910d44b3a5 100644
--- a/epan/dissectors/packet-pdcp-lte.h
+++ b/epan/dissectors/packet-pdcp-lte.h
@@ -58,6 +58,15 @@ typedef enum
#define PDCP_SN_LENGTH_12_BITS 12
#define PDCP_SN_LENGTH_15_BITS 15
+enum security_integrity_algorithm_e { eia0, eia1, eia2, eia3 };
+enum security_ciphering_algorithm_e { eea0, eea1, eea2 };
+
+typedef struct pdcp_security_info_t
+{
+ guint32 configuration_frame;
+ enum security_integrity_algorithm_e integrity;
+ enum security_ciphering_algorithm_e ciphering;
+} pdcp_security_info_t;
/* Info attached to each LTE PDCP/RoHC packet */
@@ -170,3 +179,9 @@ typedef struct pdcp_lte_info
/* PDCP PDU. Following this tag comes the actual PDCP PDU (there is no length, the PDU
continues until the end of the frame) */
#define PDCP_LTE_PAYLOAD_TAG 0x01
+
+
+
+/* Function to configure ciphering & integrity algorithms */
+void set_pdcp_lte_security_algorithms(guint16 ueid, pdcp_security_info_t *security_info);
+