2012-04-15 01:37:08 +00:00
|
|
|
/* Routines for LTE PDCP
|
2009-01-26 12:18:32 +00:00
|
|
|
*
|
|
|
|
* Martin Mathieson
|
|
|
|
*
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2012-06-28 22:56:06 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2009-01-26 12:18:32 +00:00
|
|
|
*/
|
|
|
|
|
2012-09-20 02:03:38 +00:00
|
|
|
#include "config.h"
|
2009-01-26 12:18:32 +00:00
|
|
|
|
2009-12-11 14:31:40 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
2012-01-22 03:02:10 +00:00
|
|
|
#include <glib.h>
|
2009-01-26 12:18:32 +00:00
|
|
|
#include <epan/packet.h>
|
|
|
|
#include <epan/prefs.h>
|
|
|
|
#include <epan/expert.h>
|
|
|
|
#include <epan/addr_resolv.h>
|
2013-08-30 14:49:55 +00:00
|
|
|
#include <epan/wmem/wmem.h>
|
2009-01-26 12:18:32 +00:00
|
|
|
|
2013-12-16 11:18:53 +00:00
|
|
|
#include <epan/uat.h>
|
2014-01-14 15:07:20 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_LIBGCRYPT
|
2013-12-16 11:18:53 +00:00
|
|
|
#include <wsutil/wsgcrypt.h>
|
|
|
|
#endif /* HAVE_LIBGCRYPT */
|
|
|
|
|
2014-01-16 12:02:30 +00:00
|
|
|
/* Define this symbol if you have a working implementation of SNOW3G f8() and f9() available.
|
|
|
|
Note that the use of this algorithm is restricted, and that an administrative charge
|
|
|
|
may be applicable if you use it (see e.g. http://www.gsma.com/technicalprojects/fraud-security/security-algorithms).
|
|
|
|
A version of Wireshark with this enabled would not be distributable. */
|
2014-01-27 12:54:34 +00:00
|
|
|
/* #define HAVE_SNOW3G */
|
2014-01-14 11:09:47 +00:00
|
|
|
|
2012-01-22 03:02:10 +00:00
|
|
|
#include "packet-rlc-lte.h"
|
2009-01-26 12:18:32 +00:00
|
|
|
#include "packet-pdcp-lte.h"
|
|
|
|
|
2013-12-14 12:45:57 +00:00
|
|
|
void proto_register_pdcp(void);
|
|
|
|
void proto_reg_handoff_pdcp_lte(void);
|
|
|
|
|
2009-01-26 12:18:32 +00:00
|
|
|
/* Described in:
|
|
|
|
* 3GPP TS 36.323 Evolved Universal Terrestrial Radio Access (E-UTRA)
|
2012-09-21 20:12:32 +00:00
|
|
|
* Packet Data Convergence Protocol (PDCP) specification v11.0.0
|
2009-01-26 12:18:32 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/* TODO:
|
2013-12-17 14:49:21 +00:00
|
|
|
- More deciphering. Next steps are:
|
2013-12-16 11:18:53 +00:00
|
|
|
- Verify MAC authentication bytes for supported protocol(s)?
|
2013-12-24 00:09:41 +00:00
|
|
|
- code that doesn't quite work against gcrypt 1.6 is #if 0'd out...
|
2012-09-21 20:12:32 +00:00
|
|
|
- Add Relay Node user plane data PDU dissection
|
2009-01-26 12:18:32 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/* Initialize the protocol and registered fields. */
|
|
|
|
int proto_pdcp_lte = -1;
|
|
|
|
|
2010-11-22 13:28:49 +00:00
|
|
|
extern int proto_rlc_lte;
|
|
|
|
|
2009-05-31 12:11:44 +00:00
|
|
|
/* Configuration (info known outside of PDU) */
|
2009-01-26 12:18:32 +00:00
|
|
|
static int hf_pdcp_lte_configuration = -1;
|
2009-05-13 09:36:42 +00:00
|
|
|
static int hf_pdcp_lte_direction = -1;
|
2010-11-05 18:00:35 +00:00
|
|
|
static int hf_pdcp_lte_ueid = -1;
|
|
|
|
static int hf_pdcp_lte_channel_type = -1;
|
|
|
|
static int hf_pdcp_lte_channel_id = -1;
|
2012-04-15 01:37:08 +00:00
|
|
|
|
2009-01-26 12:18:32 +00:00
|
|
|
static int hf_pdcp_lte_rohc_compression = -1;
|
|
|
|
static int hf_pdcp_lte_rohc_mode = -1;
|
|
|
|
static int hf_pdcp_lte_rohc_rnd = -1;
|
|
|
|
static int hf_pdcp_lte_rohc_udp_checksum_present = -1;
|
|
|
|
static int hf_pdcp_lte_rohc_profile = -1;
|
2012-04-15 01:37:08 +00:00
|
|
|
|
2009-01-26 12:18:32 +00:00
|
|
|
static int hf_pdcp_lte_no_header_pdu = -1;
|
|
|
|
static int hf_pdcp_lte_plane = -1;
|
|
|
|
static int hf_pdcp_lte_seqnum_length = -1;
|
|
|
|
static int hf_pdcp_lte_cid_inclusion_info = -1;
|
|
|
|
static int hf_pdcp_lte_large_cid_present = -1;
|
|
|
|
|
2009-05-31 12:11:44 +00:00
|
|
|
/* PDCP header fields */
|
2012-02-03 16:44:56 +00:00
|
|
|
static int hf_pdcp_lte_control_plane_reserved = -1;
|
2009-01-26 12:18:32 +00:00
|
|
|
static int hf_pdcp_lte_seq_num_5 = -1;
|
|
|
|
static int hf_pdcp_lte_seq_num_7 = -1;
|
|
|
|
static int hf_pdcp_lte_reserved3 = -1;
|
|
|
|
static int hf_pdcp_lte_seq_num_12 = -1;
|
2012-09-21 20:12:32 +00:00
|
|
|
static int hf_pdcp_lte_seq_num_15 = -1;
|
2009-01-26 12:18:32 +00:00
|
|
|
static int hf_pdcp_lte_signalling_data = -1;
|
|
|
|
static int hf_pdcp_lte_mac = -1;
|
|
|
|
static int hf_pdcp_lte_data_control = -1;
|
|
|
|
static int hf_pdcp_lte_user_plane_data = -1;
|
|
|
|
static int hf_pdcp_lte_control_pdu_type = -1;
|
2009-05-08 23:29:42 +00:00
|
|
|
static int hf_pdcp_lte_fms = -1;
|
2012-09-21 20:12:32 +00:00
|
|
|
static int hf_pdcp_lte_reserved4 = -1;
|
|
|
|
static int hf_pdcp_lte_fms2 = -1;
|
2009-01-26 12:18:32 +00:00
|
|
|
static int hf_pdcp_lte_bitmap = -1;
|
|
|
|
|
|
|
|
|
2010-11-22 13:28:49 +00:00
|
|
|
/* Sequence Analysis */
|
|
|
|
static int hf_pdcp_lte_sequence_analysis = -1;
|
|
|
|
static int hf_pdcp_lte_sequence_analysis_ok = -1;
|
|
|
|
static int hf_pdcp_lte_sequence_analysis_previous_frame = -1;
|
2012-01-22 03:02:10 +00:00
|
|
|
static int hf_pdcp_lte_sequence_analysis_next_frame = -1;
|
2010-11-22 13:28:49 +00:00
|
|
|
static int hf_pdcp_lte_sequence_analysis_expected_sn = -1;
|
|
|
|
|
|
|
|
static int hf_pdcp_lte_sequence_analysis_repeated = -1;
|
|
|
|
static int hf_pdcp_lte_sequence_analysis_skipped = -1;
|
|
|
|
|
2013-10-29 17:46:50 +00:00
|
|
|
/* Security Settings */
|
|
|
|
static int hf_pdcp_lte_security = -1;
|
|
|
|
static int hf_pdcp_lte_security_setup_frame = -1;
|
|
|
|
static int hf_pdcp_lte_security_integrity_algorithm = -1;
|
|
|
|
static int hf_pdcp_lte_security_ciphering_algorithm = -1;
|
2010-11-22 13:28:49 +00:00
|
|
|
|
2013-12-12 11:07:53 +00:00
|
|
|
static int hf_pdcp_lte_security_bearer = -1;
|
|
|
|
static int hf_pdcp_lte_security_direction = -1;
|
|
|
|
static int hf_pdcp_lte_security_count = -1;
|
2013-12-25 08:44:43 +00:00
|
|
|
static int hf_pdcp_lte_security_cipher_key = -1;
|
|
|
|
static int hf_pdcp_lte_security_integrity_key = -1;
|
2013-12-12 11:07:53 +00:00
|
|
|
|
|
|
|
|
2009-01-26 12:18:32 +00:00
|
|
|
|
|
|
|
/* Protocol subtree. */
|
|
|
|
static int ett_pdcp = -1;
|
|
|
|
static int ett_pdcp_configuration = -1;
|
|
|
|
static int ett_pdcp_packet = -1;
|
2010-11-22 13:28:49 +00:00
|
|
|
static int ett_pdcp_lte_sequence_analysis = -1;
|
2012-08-21 21:37:31 +00:00
|
|
|
static int ett_pdcp_report_bitmap = -1;
|
2013-10-29 17:46:50 +00:00
|
|
|
static int ett_pdcp_security = -1;
|
2009-01-26 12:18:32 +00:00
|
|
|
|
2013-09-05 01:05:16 +00:00
|
|
|
static expert_field ei_pdcp_lte_sequence_analysis_wrong_sequence_number = EI_INIT;
|
|
|
|
static expert_field ei_pdcp_lte_reserved_bits_not_zero = EI_INIT;
|
|
|
|
static expert_field ei_pdcp_lte_sequence_analysis_sn_repeated = EI_INIT;
|
|
|
|
static expert_field ei_pdcp_lte_sequence_analysis_sn_missing = EI_INIT;
|
2013-12-23 13:43:13 +00:00
|
|
|
static expert_field ei_pdcp_lte_digest_wrong = EI_INIT;
|
2009-01-26 12:18:32 +00:00
|
|
|
|
2013-12-16 11:18:53 +00:00
|
|
|
/*-------------------------------------
|
|
|
|
* UAT for UE Keys
|
|
|
|
*-------------------------------------
|
|
|
|
*/
|
|
|
|
/* UAT entry structure. */
|
|
|
|
typedef struct {
|
2013-12-16 11:47:04 +00:00
|
|
|
guint16 ueid;
|
2013-12-23 10:56:51 +00:00
|
|
|
gchar *rrcCipherKeyString;
|
|
|
|
gchar *upCipherKeyString;
|
|
|
|
gchar *rrcIntegrityKeyString;
|
|
|
|
|
|
|
|
guint8 rrcCipherBinaryKey[16];
|
|
|
|
gboolean rrcCipherKeyOK;
|
|
|
|
guint8 upCipherBinaryKey[16];
|
|
|
|
gboolean upCipherKeyOK;
|
|
|
|
guint8 rrcIntegrityBinaryKey[16];
|
|
|
|
gboolean rrcIntegrityKeyOK;
|
2013-12-16 11:18:53 +00:00
|
|
|
} uat_ue_keys_record_t;
|
|
|
|
|
|
|
|
static uat_ue_keys_record_t *uat_ue_keys_records = NULL;
|
|
|
|
|
|
|
|
static uat_t * ue_keys_uat = NULL;
|
|
|
|
static guint num_ue_keys_uat = 0;
|
|
|
|
|
2013-12-19 17:21:36 +00:00
|
|
|
/* Convert an ascii hex character into a digit. Should only be given valid
|
|
|
|
hex ascii characters */
|
2013-12-18 12:05:11 +00:00
|
|
|
static guchar hex_ascii_to_binary(gchar c)
|
|
|
|
{
|
|
|
|
if ((c >= '0') && (c <= '9')) {
|
|
|
|
return c - '0';
|
|
|
|
}
|
|
|
|
else if ((c >= 'a') && (c <= 'f')) {
|
|
|
|
return 10 + c - 'a';
|
|
|
|
}
|
|
|
|
else if ((c >= 'A') && (c <= 'F')) {
|
|
|
|
return 10 + c - 'A';
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-12-16 11:18:53 +00:00
|
|
|
static void* uat_ue_keys_record_copy_cb(void* n, const void* o, size_t siz _U_) {
|
|
|
|
uat_ue_keys_record_t* new_rec = (uat_ue_keys_record_t *)n;
|
|
|
|
const uat_ue_keys_record_t* old_rec = (const uat_ue_keys_record_t *)o;
|
|
|
|
|
2013-12-16 11:47:04 +00:00
|
|
|
new_rec->ueid = old_rec->ueid;
|
2013-12-23 10:56:51 +00:00
|
|
|
new_rec->rrcCipherKeyString = (old_rec->rrcCipherKeyString) ? g_strdup(old_rec->rrcCipherKeyString) : NULL;
|
|
|
|
new_rec->upCipherKeyString = (old_rec->upCipherKeyString) ? g_strdup(old_rec->upCipherKeyString) : NULL;
|
|
|
|
new_rec->rrcIntegrityKeyString = (old_rec->rrcIntegrityKeyString) ? g_strdup(old_rec->rrcIntegrityKeyString) : NULL;
|
2013-12-16 11:18:53 +00:00
|
|
|
|
|
|
|
return new_rec;
|
|
|
|
}
|
|
|
|
|
2013-12-19 17:21:36 +00:00
|
|
|
|
|
|
|
static gboolean check_valid_key_sring(const char* raw_string, char* checked_string)
|
|
|
|
{
|
2013-12-19 17:48:32 +00:00
|
|
|
guint n;
|
|
|
|
guint written = 0;
|
|
|
|
guint length = (gint)strlen(raw_string);
|
2013-12-19 17:21:36 +00:00
|
|
|
|
|
|
|
/* Can't be valid if not long enough. */
|
|
|
|
if (length < 32) {
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (n=0; (n < length) && (written < 32); n++) {
|
|
|
|
char c = raw_string[n];
|
|
|
|
|
|
|
|
/* Skipping past allowed 'padding' characters */
|
|
|
|
if ((c == ' ') || (c == '-')) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Other characters must be hex digits, otherwise string is invalid */
|
|
|
|
if (((c >= '0') && (c <= '9')) ||
|
|
|
|
((c >= 'a') && (c <= 'f')) ||
|
|
|
|
((c >= 'A') && (c <= 'F'))) {
|
|
|
|
checked_string[written++] = c;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Must have found exactly 32 hex ascii chars for 16-byte key */
|
|
|
|
return (written == 32);
|
|
|
|
}
|
|
|
|
|
2013-12-18 12:19:42 +00:00
|
|
|
static void uat_ue_keys_record_update_cb(void* record, const char** error _U_) {
|
2013-12-18 12:05:11 +00:00
|
|
|
uat_ue_keys_record_t* rec = (uat_ue_keys_record_t *)record;
|
|
|
|
int n;
|
2013-12-19 17:21:36 +00:00
|
|
|
char cleanString[32];
|
2013-12-18 12:05:11 +00:00
|
|
|
|
|
|
|
/* Check and convert RRC key */
|
2013-12-23 10:56:51 +00:00
|
|
|
if (!check_valid_key_sring(rec->rrcCipherKeyString, cleanString)) {
|
|
|
|
rec->rrcCipherKeyOK = FALSE;
|
2013-12-18 12:05:11 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
for (n=0; n < 32; n += 2) {
|
2013-12-23 10:56:51 +00:00
|
|
|
rec->rrcCipherBinaryKey[n/2] = (hex_ascii_to_binary(cleanString[n]) << 4) +
|
|
|
|
hex_ascii_to_binary(cleanString[n+1]);
|
2013-12-18 12:05:11 +00:00
|
|
|
}
|
2013-12-23 10:56:51 +00:00
|
|
|
rec->rrcCipherKeyOK = TRUE;
|
2013-12-18 12:05:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Check and convert User-plane key */
|
2013-12-23 10:56:51 +00:00
|
|
|
if (!check_valid_key_sring(rec->upCipherKeyString, cleanString)) {
|
|
|
|
rec->upCipherKeyOK = FALSE;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
for (n=0; n < 32; n += 2) {
|
|
|
|
rec->upCipherBinaryKey[n/2] = (hex_ascii_to_binary(cleanString[n]) << 4) +
|
|
|
|
hex_ascii_to_binary(cleanString[n+1]);
|
|
|
|
}
|
|
|
|
rec->upCipherKeyOK = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check and convert Integrity key */
|
|
|
|
if (!check_valid_key_sring(rec->rrcIntegrityKeyString, cleanString)) {
|
|
|
|
rec->rrcIntegrityKeyOK = FALSE;
|
2013-12-18 12:05:11 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
for (n=0; n < 32; n += 2) {
|
2013-12-23 10:56:51 +00:00
|
|
|
rec->rrcIntegrityBinaryKey[n/2] = (hex_ascii_to_binary(cleanString[n]) << 4) +
|
|
|
|
hex_ascii_to_binary(cleanString[n+1]);
|
2013-12-18 12:05:11 +00:00
|
|
|
}
|
2013-12-23 10:56:51 +00:00
|
|
|
rec->rrcIntegrityKeyOK = TRUE;
|
2013-12-18 12:05:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-12-16 11:18:53 +00:00
|
|
|
static void uat_ue_keys_record_free_cb(void*r) {
|
|
|
|
uat_ue_keys_record_t* rec = (uat_ue_keys_record_t*)r;
|
|
|
|
|
2013-12-23 10:56:51 +00:00
|
|
|
g_free(rec->rrcCipherKeyString);
|
|
|
|
g_free(rec->upCipherKeyString);
|
|
|
|
g_free(rec->rrcIntegrityKeyString);
|
2013-12-16 11:18:53 +00:00
|
|
|
}
|
|
|
|
|
2013-12-16 11:47:04 +00:00
|
|
|
UAT_DEC_CB_DEF(uat_ue_keys_records, ueid, uat_ue_keys_record_t)
|
2013-12-23 10:56:51 +00:00
|
|
|
UAT_CSTRING_CB_DEF(uat_ue_keys_records, rrcCipherKeyString, uat_ue_keys_record_t)
|
|
|
|
UAT_CSTRING_CB_DEF(uat_ue_keys_records, upCipherKeyString, uat_ue_keys_record_t)
|
|
|
|
UAT_CSTRING_CB_DEF(uat_ue_keys_records, rrcIntegrityKeyString, uat_ue_keys_record_t)
|
2013-12-16 11:18:53 +00:00
|
|
|
|
2013-12-17 16:40:42 +00:00
|
|
|
static gboolean global_pdcp_decipher_signalling = FALSE;
|
|
|
|
static gboolean global_pdcp_decipher_userplane = FALSE;
|
2013-12-24 13:38:32 +00:00
|
|
|
static gboolean global_pdcp_check_integrity = FALSE;
|
2013-12-16 11:18:53 +00:00
|
|
|
|
2009-05-13 09:36:42 +00:00
|
|
|
static const value_string direction_vals[] =
|
|
|
|
{
|
|
|
|
{ DIRECTION_UPLINK, "Uplink"},
|
|
|
|
{ DIRECTION_DOWNLINK, "Downlink"},
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-01-26 12:18:32 +00:00
|
|
|
static const value_string pdcp_plane_vals[] = {
|
2009-02-19 22:25:36 +00:00
|
|
|
{ SIGNALING_PLANE, "Signalling" },
|
|
|
|
{ USER_PLANE, "User" },
|
2009-01-26 12:18:32 +00:00
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
2010-11-05 18:00:35 +00:00
|
|
|
static const value_string logical_channel_vals[] = {
|
|
|
|
{ Channel_DCCH, "DCCH"},
|
|
|
|
{ Channel_BCCH, "BCCH"},
|
|
|
|
{ Channel_CCCH, "CCCH"},
|
|
|
|
{ Channel_PCCH, "PCCH"},
|
|
|
|
{ 0, NULL}
|
|
|
|
};
|
2009-01-26 12:18:32 +00:00
|
|
|
|
|
|
|
static const value_string rohc_mode_vals[] = {
|
2009-02-19 22:25:36 +00:00
|
|
|
{ UNIDIRECTIONAL, "Unidirectional" },
|
|
|
|
{ OPTIMISTIC_BIDIRECTIONAL, "Optimistic Bidirectional" },
|
|
|
|
{ RELIABLE_BIDIRECTIONAL, "Reliable Bidirectional" },
|
2009-01-26 12:18:32 +00:00
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-12-31 00:24:50 +00:00
|
|
|
/* Values taken from:
|
|
|
|
http://www.iana.org/assignments/rohc-pro-ids/rohc-pro-ids.txt */
|
2009-01-26 12:18:32 +00:00
|
|
|
static const value_string rohc_profile_vals[] = {
|
2012-05-17 14:35:11 +00:00
|
|
|
{ 0x0000, "ROHC uncompressed" }, /* [RFC5795] */
|
|
|
|
{ 0x0001, "ROHC RTP" }, /* [RFC3095] */
|
|
|
|
{ 0x0101, "ROHCv2 RTP" }, /* [RFC5225] */
|
|
|
|
{ 0x0002, "ROHC UDP" }, /* [RFC3095] */
|
|
|
|
{ 0x0102, "ROHCv2 UDP" }, /* [RFC5225] */
|
|
|
|
{ 0x0003, "ROHC ESP" }, /* [RFC3095] */
|
|
|
|
{ 0x0103, "ROHCv2 ESP" }, /* [RFC5225] */
|
|
|
|
{ 0x0004, "ROHC IP" }, /* [RFC3843] */
|
|
|
|
{ 0x0104, "ROHCv2 IP" }, /* [RFC5225] */
|
|
|
|
{ 0x0005, "ROHC LLA" }, /* [RFC4362] */
|
|
|
|
{ 0x0105, "ROHC LLA with R-mode" }, /* [RFC3408] */
|
|
|
|
{ 0x0006, "ROHC TCP" }, /* [RFC4996] */
|
|
|
|
{ 0x0007, "ROHC RTP/UDP-Lite" }, /* [RFC4019] */
|
|
|
|
{ 0x0107, "ROHCv2 RTP/UDP-Lite" }, /* [RFC5225] */
|
|
|
|
{ 0x0008, "ROHC UDP-Lite" }, /* [RFC4019] */
|
|
|
|
{ 0x0108, "ROHCv2 UDP-Lite" }, /* [RFC5225] */
|
|
|
|
{ 0, NULL }
|
2009-01-26 12:18:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const value_string pdu_type_vals[] = {
|
|
|
|
{ 0, "Control PDU" },
|
|
|
|
{ 1, "Data PDU" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const value_string control_pdu_type_vals[] = {
|
|
|
|
{ 0, "PDCP Status report" },
|
|
|
|
{ 1, "Header Compression Feedback Information" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
2013-10-29 17:46:50 +00:00
|
|
|
static const value_string integrity_algorithm_vals[] = {
|
|
|
|
{ 0, "EIA0" },
|
|
|
|
{ 1, "EIA1" },
|
|
|
|
{ 2, "EIA2" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const value_string ciphering_algorithm_vals[] = {
|
|
|
|
{ 0, "EEA0" },
|
|
|
|
{ 1, "EEA1" },
|
|
|
|
{ 2, "EEA2" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
2009-01-26 12:18:32 +00:00
|
|
|
|
2010-10-10 20:28:22 +00:00
|
|
|
static dissector_handle_t ip_handle;
|
2011-07-25 13:47:26 +00:00
|
|
|
static dissector_handle_t ipv6_handle;
|
2011-12-15 20:22:54 +00:00
|
|
|
static dissector_handle_t rohc_handle;
|
2011-07-25 13:47:26 +00:00
|
|
|
static dissector_handle_t data_handle;
|
2009-01-26 12:18:32 +00:00
|
|
|
|
2012-01-22 03:02:10 +00:00
|
|
|
|
|
|
|
#define SEQUENCE_ANALYSIS_RLC_ONLY 1
|
|
|
|
#define SEQUENCE_ANALYSIS_PDCP_ONLY 2
|
|
|
|
|
2009-01-26 12:18:32 +00:00
|
|
|
/* Preference variables */
|
2013-04-23 22:33:53 +00:00
|
|
|
static gboolean global_pdcp_dissect_user_plane_as_ip = TRUE;
|
|
|
|
static gboolean global_pdcp_dissect_signalling_plane_as_rrc = TRUE;
|
|
|
|
static gint global_pdcp_check_sequence_numbers = TRUE;
|
2009-01-26 12:18:32 +00:00
|
|
|
static gboolean global_pdcp_dissect_rohc = FALSE;
|
|
|
|
|
2012-03-08 13:19:41 +00:00
|
|
|
/* Which layer info to show in the info column */
|
|
|
|
enum layer_to_show {
|
|
|
|
ShowRLCLayer, ShowPDCPLayer, ShowTrafficLayer
|
|
|
|
};
|
|
|
|
static gint global_pdcp_lte_layer_to_show = (gint)ShowRLCLayer;
|
|
|
|
|
|
|
|
|
2010-11-22 13:28:49 +00:00
|
|
|
|
|
|
|
/**************************************************/
|
|
|
|
/* Sequence number analysis */
|
|
|
|
|
|
|
|
/* Channel key */
|
|
|
|
typedef struct
|
|
|
|
{
|
2012-10-07 15:14:44 +00:00
|
|
|
/* Using bit fields to fit into 32 bits, so avoiding the need to allocate
|
|
|
|
heap memory for these structs */
|
2013-01-04 05:22:43 +00:00
|
|
|
guint ueId : 16;
|
|
|
|
guint plane : 2;
|
|
|
|
guint channelId : 6;
|
|
|
|
guint direction : 1;
|
|
|
|
guint notUsed : 7;
|
2010-11-22 13:28:49 +00:00
|
|
|
} pdcp_channel_hash_key;
|
|
|
|
|
|
|
|
/* Channel state */
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
guint16 previousSequenceNumber;
|
|
|
|
guint32 previousFrameNum;
|
2013-12-12 11:07:53 +00:00
|
|
|
guint32 hfn;
|
2010-11-22 13:28:49 +00:00
|
|
|
} pdcp_channel_status;
|
|
|
|
|
|
|
|
/* The sequence analysis channel hash table.
|
|
|
|
Maps key -> status */
|
|
|
|
static GHashTable *pdcp_sequence_analysis_channel_hash = NULL;
|
|
|
|
|
|
|
|
/* Equal keys */
|
|
|
|
static gint pdcp_channel_equal(gconstpointer v, gconstpointer v2)
|
|
|
|
{
|
2012-10-07 15:14:44 +00:00
|
|
|
/* Key fits in 4 bytes, so just compare pointers! */
|
|
|
|
return (v == v2);
|
2010-11-22 13:28:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Compute a hash value for a given key. */
|
|
|
|
static guint pdcp_channel_hash_func(gconstpointer v)
|
|
|
|
{
|
2012-10-07 15:14:44 +00:00
|
|
|
/* Just use pointer, as the fields are all in this value */
|
2012-10-07 15:59:26 +00:00
|
|
|
return GPOINTER_TO_UINT(v);
|
2010-11-22 13:28:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-01-22 20:31:09 +00:00
|
|
|
/* Hash table types & functions for frame reports */
|
|
|
|
|
|
|
|
typedef struct {
|
2013-01-04 05:22:43 +00:00
|
|
|
guint32 frameNumber;
|
|
|
|
guint32 SN : 15;
|
|
|
|
guint32 plane : 2;
|
|
|
|
guint32 channelId: 5;
|
|
|
|
guint32 direction: 1;
|
|
|
|
guint32 notUsed : 9;
|
2012-01-22 20:31:09 +00:00
|
|
|
} pdcp_result_hash_key;
|
|
|
|
|
|
|
|
static gint pdcp_result_hash_equal(gconstpointer v, gconstpointer v2)
|
2010-11-22 13:28:49 +00:00
|
|
|
{
|
2012-04-09 18:44:10 +00:00
|
|
|
const pdcp_result_hash_key* val1 = (const pdcp_result_hash_key *)v;
|
|
|
|
const pdcp_result_hash_key* val2 = (const pdcp_result_hash_key *)v2;
|
2012-01-22 20:31:09 +00:00
|
|
|
|
|
|
|
/* All fields must match */
|
|
|
|
return (memcmp(val1, val2, sizeof(pdcp_result_hash_key)) == 0);
|
2010-11-22 13:28:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Compute a hash value for a given key. */
|
2012-01-22 20:31:09 +00:00
|
|
|
static guint pdcp_result_hash_func(gconstpointer v)
|
|
|
|
{
|
2012-04-09 18:44:10 +00:00
|
|
|
const pdcp_result_hash_key* val1 = (const pdcp_result_hash_key *)v;
|
2012-01-22 20:31:09 +00:00
|
|
|
|
2013-11-22 16:52:28 +00:00
|
|
|
/* TODO: This is a bit random. */
|
2012-01-22 20:31:09 +00:00
|
|
|
return val1->frameNumber + (val1->channelId<<13) +
|
|
|
|
(val1->plane<<5) +
|
|
|
|
(val1->SN<<18) +
|
|
|
|
(val1->direction<<9);
|
|
|
|
}
|
|
|
|
|
2012-10-07 15:14:44 +00:00
|
|
|
/* pdcp_channel_hash_key fits into the pointer, so just copy the value into
|
|
|
|
a guint, cast to apointer and return that as the key */
|
|
|
|
static gpointer get_channel_hash_key(pdcp_channel_hash_key *key)
|
|
|
|
{
|
|
|
|
guint asInt = 0;
|
|
|
|
/* TODO: assert that sizeof(pdcp_channel_hash_key) <= sizeof(guint) ? */
|
|
|
|
memcpy(&asInt, key, sizeof(pdcp_channel_hash_key));
|
|
|
|
return GUINT_TO_POINTER(asInt);
|
|
|
|
}
|
|
|
|
|
2012-01-22 20:31:09 +00:00
|
|
|
/* Convenience function to get a pointer for the hash_func to work with */
|
|
|
|
static gpointer get_report_hash_key(guint16 SN, guint32 frameNumber,
|
|
|
|
pdcp_lte_info *p_pdcp_lte_info,
|
|
|
|
gboolean do_persist)
|
2010-11-22 13:28:49 +00:00
|
|
|
{
|
2012-05-17 14:35:11 +00:00
|
|
|
static pdcp_result_hash_key key;
|
|
|
|
pdcp_result_hash_key *p_key;
|
2012-01-22 20:31:09 +00:00
|
|
|
|
|
|
|
/* Only allocate a struct when will be adding entry */
|
|
|
|
if (do_persist) {
|
2013-08-30 14:49:55 +00:00
|
|
|
p_key = wmem_new(wmem_file_scope(), pdcp_result_hash_key);
|
2012-01-22 20:31:09 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
memset(&key, 0, sizeof(pdcp_result_hash_key));
|
|
|
|
p_key = &key;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Fill in details, and return pointer */
|
|
|
|
p_key->frameNumber = frameNumber;
|
|
|
|
p_key->SN = SN;
|
|
|
|
p_key->plane = (guint8)p_pdcp_lte_info->plane;
|
|
|
|
p_key->channelId = p_pdcp_lte_info->channelId;
|
|
|
|
p_key->direction = p_pdcp_lte_info->direction;
|
2012-10-07 15:14:44 +00:00
|
|
|
p_key->notUsed = 0;
|
2012-01-22 20:31:09 +00:00
|
|
|
|
|
|
|
return p_key;
|
2010-11-22 13:28:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Info to attach to frame when first read, recording what to show about sequence */
|
2012-12-16 00:15:26 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
SN_OK, SN_Repeated, SN_MAC_Retx, SN_Retx, SN_Missing
|
|
|
|
} sequence_state;
|
2010-11-22 13:28:49 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
2012-05-17 14:35:11 +00:00
|
|
|
gboolean sequenceExpectedCorrect;
|
|
|
|
guint16 sequenceExpected;
|
|
|
|
guint32 previousFrameNum;
|
|
|
|
guint32 nextFrameNum;
|
2010-11-22 13:28:49 +00:00
|
|
|
|
2012-05-17 14:35:11 +00:00
|
|
|
guint16 firstSN;
|
|
|
|
guint16 lastSN;
|
2013-12-12 11:07:53 +00:00
|
|
|
guint32 hfn;
|
2010-11-22 13:28:49 +00:00
|
|
|
|
2012-12-16 00:15:26 +00:00
|
|
|
sequence_state state;
|
2010-11-22 13:28:49 +00:00
|
|
|
} pdcp_sequence_report_in_frame;
|
|
|
|
|
2013-12-12 11:07:53 +00:00
|
|
|
/* The sequence analysis frame report hash table.
|
|
|
|
Maps pdcp_result_hash_key* -> pdcp_sequence_report_in_frame* */
|
2012-01-22 20:31:09 +00:00
|
|
|
static GHashTable *pdcp_lte_sequence_analysis_report_hash = NULL;
|
|
|
|
|
2013-12-16 18:53:14 +00:00
|
|
|
/* Gather together security settings in order to be able to do deciphering */
|
|
|
|
typedef struct pdu_security_settings_t
|
|
|
|
{
|
|
|
|
enum security_ciphering_algorithm_e ciphering;
|
2013-12-23 13:43:13 +00:00
|
|
|
enum security_integrity_algorithm_e integrity;
|
2013-12-23 10:56:51 +00:00
|
|
|
guint8* cipherKey;
|
|
|
|
guint8* integrityKey;
|
2014-01-14 15:07:20 +00:00
|
|
|
gboolean cipherKeyValid;
|
|
|
|
gboolean integrityKeyValid;
|
2013-12-16 18:53:14 +00:00
|
|
|
guint32 count;
|
|
|
|
guint8 bearer;
|
|
|
|
guint8 direction;
|
|
|
|
} pdu_security_settings_t;
|
2010-11-22 13:28:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* Add to the tree values associated with sequence analysis for this frame */
|
|
|
|
static void addChannelSequenceInfo(pdcp_sequence_report_in_frame *p,
|
|
|
|
pdcp_lte_info *p_pdcp_lte_info,
|
|
|
|
guint16 sequenceNumber,
|
2013-12-12 11:07:53 +00:00
|
|
|
packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb,
|
2013-12-16 18:53:14 +00:00
|
|
|
proto_tree *security_tree,
|
|
|
|
pdu_security_settings_t *pdu_security)
|
2010-11-22 13:28:49 +00:00
|
|
|
{
|
|
|
|
proto_tree *seqnum_tree;
|
|
|
|
proto_item *seqnum_ti;
|
2012-01-22 20:31:09 +00:00
|
|
|
proto_item *ti_expected_sn;
|
2010-11-22 13:28:49 +00:00
|
|
|
proto_item *ti;
|
|
|
|
|
|
|
|
/* Create subtree */
|
|
|
|
seqnum_ti = proto_tree_add_string_format(tree,
|
|
|
|
hf_pdcp_lte_sequence_analysis,
|
|
|
|
tvb, 0, 0,
|
|
|
|
"", "Sequence Analysis");
|
|
|
|
seqnum_tree = proto_item_add_subtree(seqnum_ti,
|
|
|
|
ett_pdcp_lte_sequence_analysis);
|
|
|
|
PROTO_ITEM_SET_GENERATED(seqnum_ti);
|
|
|
|
|
|
|
|
|
|
|
|
/* Previous channel frame */
|
|
|
|
if (p->previousFrameNum != 0) {
|
|
|
|
proto_tree_add_uint(seqnum_tree, hf_pdcp_lte_sequence_analysis_previous_frame,
|
|
|
|
tvb, 0, 0, p->previousFrameNum);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Expected sequence number */
|
2012-01-22 20:31:09 +00:00
|
|
|
ti_expected_sn = proto_tree_add_uint(seqnum_tree, hf_pdcp_lte_sequence_analysis_expected_sn,
|
|
|
|
tvb, 0, 0, p->sequenceExpected);
|
|
|
|
PROTO_ITEM_SET_GENERATED(ti_expected_sn);
|
2010-11-22 13:28:49 +00:00
|
|
|
|
2011-03-16 23:18:59 +00:00
|
|
|
/* Make sure we have recognised SN length */
|
2010-11-22 13:28:49 +00:00
|
|
|
switch (p_pdcp_lte_info->seqnum_length) {
|
|
|
|
case PDCP_SN_LENGTH_5_BITS:
|
|
|
|
case PDCP_SN_LENGTH_7_BITS:
|
|
|
|
case PDCP_SN_LENGTH_12_BITS:
|
2012-09-21 20:12:32 +00:00
|
|
|
case PDCP_SN_LENGTH_15_BITS:
|
2010-11-22 13:28:49 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
DISSECTOR_ASSERT_NOT_REACHED();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (p->state) {
|
|
|
|
case SN_OK:
|
2012-01-22 20:31:09 +00:00
|
|
|
PROTO_ITEM_SET_HIDDEN(ti_expected_sn);
|
2010-11-22 13:28:49 +00:00
|
|
|
ti = proto_tree_add_boolean(seqnum_tree, hf_pdcp_lte_sequence_analysis_ok,
|
|
|
|
tvb, 0, 0, TRUE);
|
|
|
|
PROTO_ITEM_SET_GENERATED(ti);
|
2012-09-19 16:56:59 +00:00
|
|
|
proto_item_append_text(seqnum_ti, " - OK");
|
2012-01-22 03:02:10 +00:00
|
|
|
|
|
|
|
/* Link to next SN in channel (if known) */
|
|
|
|
if (p->nextFrameNum != 0) {
|
|
|
|
proto_tree_add_uint(seqnum_tree, hf_pdcp_lte_sequence_analysis_next_frame,
|
|
|
|
tvb, 0, 0, p->nextFrameNum);
|
|
|
|
}
|
2013-12-12 11:07:53 +00:00
|
|
|
|
|
|
|
/* May also be able to add key inputs to security tree here */
|
2013-12-23 13:43:13 +00:00
|
|
|
if ((pdu_security->ciphering != eea0) ||
|
|
|
|
(pdu_security->integrity != eia0)) {
|
2013-12-16 11:47:04 +00:00
|
|
|
guint32 hfn_multiplier;
|
|
|
|
guint32 count;
|
2013-12-25 08:44:43 +00:00
|
|
|
gchar *cipher_key = NULL;
|
|
|
|
gchar *integrity_key = NULL;
|
2013-12-16 11:47:04 +00:00
|
|
|
guint record_id;
|
2014-01-14 15:07:20 +00:00
|
|
|
|
2013-12-12 11:07:53 +00:00
|
|
|
/* BEARER */
|
|
|
|
ti = proto_tree_add_uint(security_tree, hf_pdcp_lte_security_bearer,
|
|
|
|
tvb, 0, 0, p_pdcp_lte_info->channelId-1);
|
|
|
|
PROTO_ITEM_SET_GENERATED(ti);
|
2013-12-16 18:53:14 +00:00
|
|
|
pdu_security->bearer = p_pdcp_lte_info->channelId-1;
|
2013-12-17 18:43:24 +00:00
|
|
|
|
2013-12-12 11:07:53 +00:00
|
|
|
/* DIRECTION */
|
|
|
|
ti = proto_tree_add_uint(security_tree, hf_pdcp_lte_security_direction,
|
|
|
|
tvb, 0, 0, p_pdcp_lte_info->direction);
|
|
|
|
PROTO_ITEM_SET_GENERATED(ti);
|
2013-12-17 18:43:24 +00:00
|
|
|
|
2013-12-16 11:47:04 +00:00
|
|
|
/* COUNT (HFN * snLength^2 + SN) */
|
2013-12-12 11:07:53 +00:00
|
|
|
switch (p_pdcp_lte_info->seqnum_length) {
|
|
|
|
case PDCP_SN_LENGTH_5_BITS:
|
|
|
|
hfn_multiplier = 32;
|
|
|
|
break;
|
|
|
|
case PDCP_SN_LENGTH_7_BITS:
|
|
|
|
hfn_multiplier = 128;
|
|
|
|
break;
|
|
|
|
case PDCP_SN_LENGTH_12_BITS:
|
|
|
|
hfn_multiplier = 2048;
|
|
|
|
break;
|
|
|
|
case PDCP_SN_LENGTH_15_BITS:
|
|
|
|
hfn_multiplier = 32768;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
DISSECTOR_ASSERT_NOT_REACHED();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
count = (p->hfn * hfn_multiplier) + sequenceNumber;
|
|
|
|
ti = proto_tree_add_uint(security_tree, hf_pdcp_lte_security_count,
|
|
|
|
tvb, 0, 0, count);
|
|
|
|
PROTO_ITEM_SET_GENERATED(ti);
|
2013-12-16 18:53:14 +00:00
|
|
|
pdu_security->count = count;
|
2013-12-16 11:47:04 +00:00
|
|
|
|
2013-12-23 10:56:51 +00:00
|
|
|
/* KEY. Look this UE up among UEs that have keys configured */
|
2013-12-16 11:47:04 +00:00
|
|
|
for (record_id=0; record_id < num_ue_keys_uat; record_id++) {
|
|
|
|
if (uat_ue_keys_records[record_id].ueid == p_pdcp_lte_info->ueid) {
|
|
|
|
if (p_pdcp_lte_info->plane == SIGNALING_PLANE) {
|
2013-12-23 13:43:13 +00:00
|
|
|
/* Get RRC ciphering key */
|
2013-12-23 10:56:51 +00:00
|
|
|
if (uat_ue_keys_records[record_id].rrcCipherKeyOK) {
|
2013-12-25 08:44:43 +00:00
|
|
|
cipher_key = uat_ue_keys_records[record_id].rrcCipherKeyString;
|
2013-12-23 10:56:51 +00:00
|
|
|
pdu_security->cipherKey = &(uat_ue_keys_records[record_id].rrcCipherBinaryKey[0]);
|
2014-01-14 15:07:20 +00:00
|
|
|
pdu_security->cipherKeyValid = TRUE;
|
2013-12-18 12:05:11 +00:00
|
|
|
}
|
2013-12-23 13:43:13 +00:00
|
|
|
/* Get RRC integrity key */
|
|
|
|
if (uat_ue_keys_records[record_id].rrcIntegrityKeyOK) {
|
2013-12-25 08:44:43 +00:00
|
|
|
integrity_key = uat_ue_keys_records[record_id].rrcIntegrityKeyString;
|
2013-12-23 13:43:13 +00:00
|
|
|
pdu_security->integrityKey = &(uat_ue_keys_records[record_id].rrcIntegrityBinaryKey[0]);
|
2014-01-14 15:07:20 +00:00
|
|
|
pdu_security->integrityKeyValid = TRUE;
|
2013-12-23 13:43:13 +00:00
|
|
|
}
|
2013-12-16 11:47:04 +00:00
|
|
|
}
|
|
|
|
else {
|
2013-12-23 13:43:13 +00:00
|
|
|
/* Get userplane ciphering key */
|
2013-12-23 10:56:51 +00:00
|
|
|
if (uat_ue_keys_records[record_id].upCipherKeyOK) {
|
2013-12-25 08:44:43 +00:00
|
|
|
cipher_key = uat_ue_keys_records[record_id].upCipherKeyString;
|
2013-12-23 10:56:51 +00:00
|
|
|
pdu_security->cipherKey = &(uat_ue_keys_records[record_id].upCipherBinaryKey[0]);
|
2014-01-14 15:07:20 +00:00
|
|
|
pdu_security->cipherKeyValid = TRUE;
|
2013-12-18 12:05:11 +00:00
|
|
|
}
|
2013-12-16 11:47:04 +00:00
|
|
|
}
|
|
|
|
|
2013-12-25 08:44:43 +00:00
|
|
|
/* Show keys where known and valid */
|
|
|
|
if (cipher_key != NULL) {
|
|
|
|
ti = proto_tree_add_string(security_tree, hf_pdcp_lte_security_cipher_key,
|
|
|
|
tvb, 0, 0, cipher_key);
|
|
|
|
PROTO_ITEM_SET_GENERATED(ti);
|
|
|
|
}
|
|
|
|
if (integrity_key != NULL) {
|
|
|
|
ti = proto_tree_add_string(security_tree, hf_pdcp_lte_security_integrity_key,
|
|
|
|
tvb, 0, 0, integrity_key);
|
2013-12-16 11:47:04 +00:00
|
|
|
PROTO_ITEM_SET_GENERATED(ti);
|
|
|
|
}
|
2013-12-18 12:05:11 +00:00
|
|
|
break;
|
2013-12-16 11:47:04 +00:00
|
|
|
}
|
|
|
|
}
|
2013-12-16 18:53:14 +00:00
|
|
|
pdu_security->direction = p_pdcp_lte_info->direction;
|
2013-12-12 11:07:53 +00:00
|
|
|
}
|
2010-11-22 13:28:49 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SN_Missing:
|
|
|
|
ti = proto_tree_add_boolean(seqnum_tree, hf_pdcp_lte_sequence_analysis_ok,
|
|
|
|
tvb, 0, 0, FALSE);
|
|
|
|
PROTO_ITEM_SET_GENERATED(ti);
|
|
|
|
ti = proto_tree_add_boolean(seqnum_tree, hf_pdcp_lte_sequence_analysis_skipped,
|
|
|
|
tvb, 0, 0, TRUE);
|
|
|
|
PROTO_ITEM_SET_GENERATED(ti);
|
|
|
|
if (p->lastSN != p->firstSN) {
|
2013-09-09 00:44:09 +00:00
|
|
|
expert_add_info_format(pinfo, ti, &ei_pdcp_lte_sequence_analysis_sn_missing,
|
2012-11-15 21:28:21 +00:00
|
|
|
"PDCP SNs (%u to %u) missing for %s on UE %u (%s-%u)",
|
2010-11-22 13:28:49 +00:00
|
|
|
p->firstSN, p->lastSN,
|
|
|
|
val_to_str_const(p_pdcp_lte_info->direction, direction_vals, "Unknown"),
|
2012-11-15 21:28:21 +00:00
|
|
|
p_pdcp_lte_info->ueid,
|
|
|
|
val_to_str_const(p_pdcp_lte_info->channelType, logical_channel_vals, "Unknown"),
|
|
|
|
p_pdcp_lte_info->channelId);
|
2010-11-22 13:28:49 +00:00
|
|
|
proto_item_append_text(seqnum_ti, " - SNs missing (%u to %u)",
|
|
|
|
p->firstSN, p->lastSN);
|
|
|
|
}
|
|
|
|
else {
|
2013-09-09 00:44:09 +00:00
|
|
|
expert_add_info_format(pinfo, ti, &ei_pdcp_lte_sequence_analysis_sn_missing,
|
2012-11-15 21:28:21 +00:00
|
|
|
"PDCP SN (%u) missing for %s on UE %u (%s-%u)",
|
2010-11-22 13:28:49 +00:00
|
|
|
p->firstSN,
|
|
|
|
val_to_str_const(p_pdcp_lte_info->direction, direction_vals, "Unknown"),
|
2012-11-15 21:28:21 +00:00
|
|
|
p_pdcp_lte_info->ueid,
|
|
|
|
val_to_str_const(p_pdcp_lte_info->channelType, logical_channel_vals, "Unknown"),
|
|
|
|
p_pdcp_lte_info->channelId);
|
2010-11-22 13:28:49 +00:00
|
|
|
proto_item_append_text(seqnum_ti, " - SN missing (%u)",
|
|
|
|
p->firstSN);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SN_Repeated:
|
|
|
|
ti = proto_tree_add_boolean(seqnum_tree, hf_pdcp_lte_sequence_analysis_ok,
|
|
|
|
tvb, 0, 0, FALSE);
|
|
|
|
PROTO_ITEM_SET_GENERATED(ti);
|
|
|
|
ti = proto_tree_add_boolean(seqnum_tree, hf_pdcp_lte_sequence_analysis_repeated,
|
|
|
|
tvb, 0, 0, TRUE);
|
|
|
|
PROTO_ITEM_SET_GENERATED(ti);
|
2013-09-09 00:44:09 +00:00
|
|
|
expert_add_info_format(pinfo, ti, &ei_pdcp_lte_sequence_analysis_sn_repeated,
|
2012-11-15 21:28:21 +00:00
|
|
|
"PDCP SN (%u) repeated for %s for UE %u (%s-%u)",
|
2010-11-22 13:28:49 +00:00
|
|
|
p->firstSN,
|
|
|
|
val_to_str_const(p_pdcp_lte_info->direction, direction_vals, "Unknown"),
|
2012-11-15 21:28:21 +00:00
|
|
|
p_pdcp_lte_info->ueid,
|
|
|
|
val_to_str_const(p_pdcp_lte_info->channelType, logical_channel_vals, "Unknown"),
|
|
|
|
p_pdcp_lte_info->channelId);
|
2010-11-22 13:28:49 +00:00
|
|
|
proto_item_append_text(seqnum_ti, "- SN %u Repeated",
|
|
|
|
p->firstSN);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
/* Incorrect sequence number */
|
2013-09-09 00:44:09 +00:00
|
|
|
expert_add_info_format(pinfo, ti_expected_sn, &ei_pdcp_lte_sequence_analysis_wrong_sequence_number,
|
2012-11-15 21:28:21 +00:00
|
|
|
"Wrong Sequence Number for %s on UE %u (%s-%u) - got %u, expected %u",
|
2010-11-22 13:28:49 +00:00
|
|
|
val_to_str_const(p_pdcp_lte_info->direction, direction_vals, "Unknown"),
|
2012-11-15 21:28:21 +00:00
|
|
|
p_pdcp_lte_info->ueid,
|
|
|
|
val_to_str_const(p_pdcp_lte_info->channelType, logical_channel_vals, "Unknown"),
|
|
|
|
p_pdcp_lte_info->channelId,
|
|
|
|
sequenceNumber, p->sequenceExpected);
|
2010-11-22 13:28:49 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Update the channel status and set report for this frame */
|
|
|
|
static void checkChannelSequenceInfo(packet_info *pinfo, tvbuff_t *tvb,
|
|
|
|
pdcp_lte_info *p_pdcp_lte_info,
|
|
|
|
guint16 sequenceNumber,
|
2013-12-12 11:07:53 +00:00
|
|
|
proto_tree *tree,
|
2013-12-16 18:53:14 +00:00
|
|
|
proto_tree *security_tree,
|
|
|
|
pdu_security_settings_t *pdu_security)
|
2010-11-22 13:28:49 +00:00
|
|
|
{
|
|
|
|
pdcp_channel_hash_key channel_key;
|
2012-05-17 14:35:11 +00:00
|
|
|
pdcp_channel_status *p_channel_status;
|
|
|
|
pdcp_sequence_report_in_frame *p_report_in_frame = NULL;
|
|
|
|
gboolean createdChannel = FALSE;
|
|
|
|
guint16 expectedSequenceNumber = 0;
|
|
|
|
guint16 snLimit = 0;
|
2010-11-22 13:28:49 +00:00
|
|
|
|
|
|
|
/* If find stat_report_in_frame already, use that and get out */
|
|
|
|
if (pinfo->fd->flags.visited) {
|
2012-01-22 20:31:09 +00:00
|
|
|
p_report_in_frame =
|
|
|
|
(pdcp_sequence_report_in_frame*)g_hash_table_lookup(pdcp_lte_sequence_analysis_report_hash,
|
|
|
|
get_report_hash_key(sequenceNumber,
|
|
|
|
pinfo->fd->num,
|
|
|
|
p_pdcp_lte_info, FALSE));
|
2010-11-22 13:28:49 +00:00
|
|
|
if (p_report_in_frame != NULL) {
|
|
|
|
addChannelSequenceInfo(p_report_in_frame, p_pdcp_lte_info,
|
|
|
|
sequenceNumber,
|
2013-12-16 18:53:14 +00:00
|
|
|
pinfo, tree, tvb, security_tree, pdu_security);
|
2010-11-22 13:28:49 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* Give up - we must have tried already... */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************/
|
|
|
|
/* Create or find an entry for this channel state */
|
|
|
|
channel_key.ueId = p_pdcp_lte_info->ueid;
|
2012-01-23 14:39:38 +00:00
|
|
|
channel_key.plane = p_pdcp_lte_info->plane;
|
2010-11-22 13:28:49 +00:00
|
|
|
channel_key.channelId = p_pdcp_lte_info->channelId;
|
|
|
|
channel_key.direction = p_pdcp_lte_info->direction;
|
2012-10-07 15:14:44 +00:00
|
|
|
channel_key.notUsed = 0;
|
2010-11-22 13:28:49 +00:00
|
|
|
|
|
|
|
/* Do the table lookup */
|
2012-10-07 15:14:44 +00:00
|
|
|
p_channel_status = (pdcp_channel_status*)g_hash_table_lookup(pdcp_sequence_analysis_channel_hash,
|
|
|
|
get_channel_hash_key(&channel_key));
|
2010-11-22 13:28:49 +00:00
|
|
|
|
|
|
|
/* Create table entry if necessary */
|
|
|
|
if (p_channel_status == NULL) {
|
|
|
|
createdChannel = TRUE;
|
|
|
|
|
2011-05-05 06:55:12 +00:00
|
|
|
/* Allocate a new value and duplicate key contents */
|
2013-08-30 14:49:55 +00:00
|
|
|
p_channel_status = wmem_new0(wmem_file_scope(), pdcp_channel_status);
|
2010-11-22 13:28:49 +00:00
|
|
|
|
|
|
|
/* Add entry */
|
2012-10-07 15:14:44 +00:00
|
|
|
g_hash_table_insert(pdcp_sequence_analysis_channel_hash,
|
|
|
|
get_channel_hash_key(&channel_key), p_channel_status);
|
2010-11-22 13:28:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Create space for frame state_report */
|
2013-08-30 14:49:55 +00:00
|
|
|
p_report_in_frame = wmem_new(wmem_file_scope(), pdcp_sequence_report_in_frame);
|
2012-01-22 20:31:09 +00:00
|
|
|
p_report_in_frame->nextFrameNum = 0;
|
2010-11-22 13:28:49 +00:00
|
|
|
|
|
|
|
switch (p_pdcp_lte_info->seqnum_length) {
|
|
|
|
case PDCP_SN_LENGTH_5_BITS:
|
|
|
|
snLimit = 32;
|
|
|
|
break;
|
|
|
|
case PDCP_SN_LENGTH_7_BITS:
|
|
|
|
snLimit = 128;
|
|
|
|
break;
|
|
|
|
case PDCP_SN_LENGTH_12_BITS:
|
|
|
|
snLimit = 4096;
|
|
|
|
break;
|
2012-09-21 20:12:32 +00:00
|
|
|
case PDCP_SN_LENGTH_15_BITS:
|
|
|
|
snLimit = 32768;
|
|
|
|
break;
|
2010-11-22 13:28:49 +00:00
|
|
|
default:
|
|
|
|
DISSECTOR_ASSERT_NOT_REACHED();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Work out expected sequence number */
|
|
|
|
if (!createdChannel) {
|
|
|
|
expectedSequenceNumber = (p_channel_status->previousSequenceNumber + 1) % snLimit;
|
|
|
|
}
|
2012-03-30 01:18:12 +00:00
|
|
|
else {
|
|
|
|
expectedSequenceNumber = sequenceNumber;
|
|
|
|
}
|
2010-11-22 13:28:49 +00:00
|
|
|
|
|
|
|
/* Set report for this frame */
|
|
|
|
/* For PDCP, sequence number is always expectedSequence number */
|
|
|
|
p_report_in_frame->sequenceExpectedCorrect = (sequenceNumber == expectedSequenceNumber);
|
2013-12-12 13:23:28 +00:00
|
|
|
p_report_in_frame->hfn = p_channel_status->hfn;
|
2010-11-22 13:28:49 +00:00
|
|
|
|
|
|
|
/* For wrong sequence number... */
|
|
|
|
if (!p_report_in_frame->sequenceExpectedCorrect) {
|
|
|
|
|
|
|
|
/* Frames are not missing if we get an earlier sequence number again */
|
|
|
|
if (((snLimit + expectedSequenceNumber - sequenceNumber) % snLimit) > 15) {
|
|
|
|
p_report_in_frame->state = SN_Missing;
|
|
|
|
p_report_in_frame->firstSN = expectedSequenceNumber;
|
|
|
|
p_report_in_frame->lastSN = (snLimit + sequenceNumber - 1) % snLimit;
|
|
|
|
|
|
|
|
p_report_in_frame->sequenceExpected = expectedSequenceNumber;
|
|
|
|
p_report_in_frame->previousFrameNum = p_channel_status->previousFrameNum;
|
|
|
|
|
|
|
|
/* Update channel status to remember *this* frame */
|
|
|
|
p_channel_status->previousFrameNum = pinfo->fd->num;
|
|
|
|
p_channel_status->previousSequenceNumber = sequenceNumber;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* An SN has been repeated */
|
|
|
|
p_report_in_frame->state = SN_Repeated;
|
|
|
|
p_report_in_frame->firstSN = sequenceNumber;
|
|
|
|
|
|
|
|
p_report_in_frame->sequenceExpected = expectedSequenceNumber;
|
|
|
|
p_report_in_frame->previousFrameNum = p_channel_status->previousFrameNum;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* SN was OK */
|
|
|
|
p_report_in_frame->state = SN_OK;
|
|
|
|
p_report_in_frame->sequenceExpected = expectedSequenceNumber;
|
|
|
|
p_report_in_frame->previousFrameNum = p_channel_status->previousFrameNum;
|
2013-12-12 11:07:53 +00:00
|
|
|
/* SN has rolled around, inc hfn! */
|
|
|
|
if (!createdChannel && (sequenceNumber == 0)) {
|
|
|
|
/* TODO: not worrying about HFN rolling over for now! */
|
|
|
|
p_channel_status->hfn++;
|
|
|
|
p_report_in_frame->hfn = p_channel_status->hfn;
|
|
|
|
}
|
2010-11-22 13:28:49 +00:00
|
|
|
|
|
|
|
/* Update channel status to remember *this* frame */
|
|
|
|
p_channel_status->previousFrameNum = pinfo->fd->num;
|
|
|
|
p_channel_status->previousSequenceNumber = sequenceNumber;
|
2012-01-22 03:02:10 +00:00
|
|
|
|
|
|
|
if (p_report_in_frame->previousFrameNum != 0) {
|
|
|
|
/* Get report for previous frame */
|
|
|
|
pdcp_sequence_report_in_frame *p_previous_report;
|
2012-01-22 20:31:09 +00:00
|
|
|
p_previous_report = (pdcp_sequence_report_in_frame*)g_hash_table_lookup(pdcp_lte_sequence_analysis_report_hash,
|
2012-09-21 20:12:32 +00:00
|
|
|
get_report_hash_key((sequenceNumber+32767) % 32768,
|
2012-01-22 20:31:09 +00:00
|
|
|
p_report_in_frame->previousFrameNum,
|
|
|
|
p_pdcp_lte_info,
|
|
|
|
FALSE));
|
2012-01-22 03:02:10 +00:00
|
|
|
/* It really shouldn't be NULL... */
|
|
|
|
if (p_previous_report != NULL) {
|
|
|
|
/* Point it forward to this one */
|
|
|
|
p_previous_report->nextFrameNum = pinfo->fd->num;
|
|
|
|
}
|
|
|
|
}
|
2010-11-22 13:28:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Associate with this frame number */
|
2012-01-22 20:31:09 +00:00
|
|
|
g_hash_table_insert(pdcp_lte_sequence_analysis_report_hash,
|
|
|
|
get_report_hash_key(sequenceNumber, pinfo->fd->num,
|
|
|
|
p_pdcp_lte_info, TRUE),
|
|
|
|
p_report_in_frame);
|
2010-11-22 13:28:49 +00:00
|
|
|
|
|
|
|
/* Add state report for this frame into tree */
|
|
|
|
addChannelSequenceInfo(p_report_in_frame, p_pdcp_lte_info, sequenceNumber,
|
2013-12-16 18:53:14 +00:00
|
|
|
pinfo, tree, tvb, security_tree, pdu_security);
|
2010-11-22 13:28:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-10-29 13:49:14 +00:00
|
|
|
|
|
|
|
/* Hash table for security state for a UE
|
2013-10-29 17:46:50 +00:00
|
|
|
Maps UEId -> pdcp_security_info_t* */
|
2013-10-29 13:49:14 +00:00
|
|
|
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);
|
|
|
|
}
|
2013-10-29 17:46:50 +00:00
|
|
|
static GHashTable *pdcp_security_hash = NULL;
|
|
|
|
|
|
|
|
/* Result is (ueid, framenum) -> pdcp_security_info_t* */
|
|
|
|
typedef struct ueid_frame_t {
|
|
|
|
guint32 framenum;
|
|
|
|
guint16 ueid;
|
|
|
|
} ueid_frame_t;
|
|
|
|
|
|
|
|
/* Convenience function to get a pointer for the hash_func to work with */
|
|
|
|
static gpointer get_ueid_frame_hash_key(guint16 ueid, guint32 frameNumber,
|
|
|
|
gboolean do_persist)
|
|
|
|
{
|
|
|
|
static ueid_frame_t key;
|
|
|
|
ueid_frame_t *p_key;
|
|
|
|
|
|
|
|
/* Only allocate a struct when will be adding entry */
|
|
|
|
if (do_persist) {
|
|
|
|
p_key = wmem_new(wmem_file_scope(), ueid_frame_t);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
memset(&key, 0, sizeof(ueid_frame_t));
|
|
|
|
p_key = &key;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Fill in details, and return pointer */
|
|
|
|
p_key->framenum = frameNumber;
|
|
|
|
p_key->ueid = ueid;
|
|
|
|
|
|
|
|
return p_key;
|
|
|
|
}
|
2013-10-29 13:49:14 +00:00
|
|
|
|
2013-10-29 17:46:50 +00:00
|
|
|
static gint pdcp_lte_ueid_frame_hash_equal(gconstpointer v, gconstpointer v2)
|
|
|
|
{
|
2014-01-14 05:17:06 +00:00
|
|
|
const ueid_frame_t *ueid_frame_1 = (const ueid_frame_t *)v;
|
|
|
|
const ueid_frame_t *ueid_frame_2 = (const ueid_frame_t *)v2;
|
2013-10-29 17:46:50 +00:00
|
|
|
return ((ueid_frame_1->framenum == ueid_frame_2->framenum) && (ueid_frame_1->ueid == ueid_frame_2->ueid));
|
|
|
|
}
|
|
|
|
static guint pdcp_lte_ueid_frame_hash_func(gconstpointer v)
|
|
|
|
{
|
2014-01-14 05:17:06 +00:00
|
|
|
const ueid_frame_t *ueid_frame = (const ueid_frame_t *)v;
|
2013-10-29 17:46:50 +00:00
|
|
|
return ueid_frame->framenum + 100*ueid_frame->ueid;
|
|
|
|
}
|
|
|
|
static GHashTable *pdcp_security_result_hash = NULL;
|
2013-10-29 13:49:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-02-04 11:47:38 +00:00
|
|
|
/* Write the given formatted text to:
|
|
|
|
- the info column
|
|
|
|
- the top-level RLC PDU item */
|
|
|
|
static void write_pdu_label_and_info(proto_item *pdu_ti,
|
|
|
|
packet_info *pinfo, const char *format, ...)
|
|
|
|
{
|
|
|
|
#define MAX_INFO_BUFFER 256
|
|
|
|
static char info_buffer[MAX_INFO_BUFFER];
|
|
|
|
|
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
va_start(ap, format);
|
|
|
|
g_vsnprintf(info_buffer, MAX_INFO_BUFFER, format, ap);
|
|
|
|
va_end(ap);
|
|
|
|
|
|
|
|
/* Add to indicated places */
|
|
|
|
col_append_str(pinfo->cinfo, COL_INFO, info_buffer);
|
2012-09-19 16:56:59 +00:00
|
|
|
proto_item_append_text(pdu_ti, "%s", info_buffer);
|
2012-08-21 21:37:31 +00:00
|
|
|
}
|
2009-01-26 12:18:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2012-08-21 21:37:31 +00:00
|
|
|
/***************************************************************/
|
2009-01-26 12:18:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Show in the tree the config info attached to this frame, as generated fields */
|
|
|
|
static void show_pdcp_config(packet_info *pinfo, tvbuff_t *tvb, proto_tree *tree,
|
|
|
|
pdcp_lte_info *p_pdcp_info)
|
|
|
|
{
|
|
|
|
proto_item *ti;
|
|
|
|
proto_tree *configuration_tree;
|
|
|
|
proto_item *configuration_ti = proto_tree_add_item(tree,
|
|
|
|
hf_pdcp_lte_configuration,
|
2011-10-15 18:46:26 +00:00
|
|
|
tvb, 0, 0, ENC_ASCII|ENC_NA);
|
2009-01-26 12:18:32 +00:00
|
|
|
configuration_tree = proto_item_add_subtree(configuration_ti, ett_pdcp_configuration);
|
|
|
|
|
2009-05-13 09:36:42 +00:00
|
|
|
/* Direction */
|
|
|
|
ti = proto_tree_add_uint(configuration_tree, hf_pdcp_lte_direction, tvb, 0, 0,
|
|
|
|
p_pdcp_info->direction);
|
|
|
|
PROTO_ITEM_SET_GENERATED(ti);
|
|
|
|
|
2009-01-26 12:18:32 +00:00
|
|
|
/* Plane */
|
|
|
|
ti = proto_tree_add_uint(configuration_tree, hf_pdcp_lte_plane, tvb, 0, 0,
|
|
|
|
p_pdcp_info->plane);
|
|
|
|
PROTO_ITEM_SET_GENERATED(ti);
|
|
|
|
|
2010-11-05 18:00:35 +00:00
|
|
|
/* UEId */
|
|
|
|
if (p_pdcp_info->ueid != 0) {
|
|
|
|
ti = proto_tree_add_uint(configuration_tree, hf_pdcp_lte_ueid, tvb, 0, 0,
|
|
|
|
p_pdcp_info->ueid);
|
|
|
|
PROTO_ITEM_SET_GENERATED(ti);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Channel type */
|
|
|
|
ti = proto_tree_add_uint(configuration_tree, hf_pdcp_lte_channel_type, tvb, 0, 0,
|
|
|
|
p_pdcp_info->channelType);
|
|
|
|
PROTO_ITEM_SET_GENERATED(ti);
|
|
|
|
if (p_pdcp_info->channelId != 0) {
|
|
|
|
/* Channel type */
|
|
|
|
ti = proto_tree_add_uint(configuration_tree, hf_pdcp_lte_channel_id, tvb, 0, 0,
|
|
|
|
p_pdcp_info->channelId);
|
|
|
|
PROTO_ITEM_SET_GENERATED(ti);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-01-26 12:18:32 +00:00
|
|
|
/* User-plane-specific fields */
|
2009-02-19 22:25:36 +00:00
|
|
|
if (p_pdcp_info->plane == USER_PLANE) {
|
2009-01-26 12:18:32 +00:00
|
|
|
|
|
|
|
/* No Header PDU */
|
|
|
|
ti = proto_tree_add_uint(configuration_tree, hf_pdcp_lte_no_header_pdu, tvb, 0, 0,
|
|
|
|
p_pdcp_info->no_header_pdu);
|
|
|
|
PROTO_ITEM_SET_GENERATED(ti);
|
|
|
|
|
|
|
|
if (!p_pdcp_info->no_header_pdu) {
|
|
|
|
|
|
|
|
/* Seqnum length */
|
|
|
|
ti = proto_tree_add_uint(configuration_tree, hf_pdcp_lte_seqnum_length, tvb, 0, 0,
|
|
|
|
p_pdcp_info->seqnum_length);
|
|
|
|
PROTO_ITEM_SET_GENERATED(ti);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-11 12:04:58 +00:00
|
|
|
/* ROHC compression */
|
2009-01-26 12:18:32 +00:00
|
|
|
ti = proto_tree_add_boolean(configuration_tree, hf_pdcp_lte_rohc_compression, tvb, 0, 0,
|
2013-11-11 22:36:08 +00:00
|
|
|
p_pdcp_info->rohc.rohc_compression);
|
2009-01-26 12:18:32 +00:00
|
|
|
PROTO_ITEM_SET_GENERATED(ti);
|
|
|
|
|
2009-03-11 12:04:58 +00:00
|
|
|
/* ROHC-specific settings */
|
2013-11-11 22:36:08 +00:00
|
|
|
if (p_pdcp_info->rohc.rohc_compression) {
|
2009-01-26 12:18:32 +00:00
|
|
|
|
2009-03-11 12:04:58 +00:00
|
|
|
/* Show ROHC mode */
|
2009-01-26 12:18:32 +00:00
|
|
|
ti = proto_tree_add_uint(configuration_tree, hf_pdcp_lte_rohc_mode, tvb, 0, 0,
|
2013-11-11 22:36:08 +00:00
|
|
|
p_pdcp_info->rohc.mode);
|
2009-01-26 12:18:32 +00:00
|
|
|
PROTO_ITEM_SET_GENERATED(ti);
|
|
|
|
|
|
|
|
/* Show RND */
|
|
|
|
ti = proto_tree_add_uint(configuration_tree, hf_pdcp_lte_rohc_rnd, tvb, 0, 0,
|
2013-11-11 22:36:08 +00:00
|
|
|
p_pdcp_info->rohc.rnd);
|
2009-01-26 12:18:32 +00:00
|
|
|
PROTO_ITEM_SET_GENERATED(ti);
|
|
|
|
|
|
|
|
/* UDP Checksum */
|
|
|
|
ti = proto_tree_add_uint(configuration_tree, hf_pdcp_lte_rohc_udp_checksum_present, tvb, 0, 0,
|
2013-11-11 22:36:08 +00:00
|
|
|
p_pdcp_info->rohc.udp_checksum_present);
|
2009-01-26 12:18:32 +00:00
|
|
|
PROTO_ITEM_SET_GENERATED(ti);
|
|
|
|
|
2009-03-11 12:04:58 +00:00
|
|
|
/* ROHC profile */
|
2009-01-26 12:18:32 +00:00
|
|
|
ti = proto_tree_add_uint(configuration_tree, hf_pdcp_lte_rohc_profile, tvb, 0, 0,
|
2013-11-11 22:36:08 +00:00
|
|
|
p_pdcp_info->rohc.profile);
|
2009-01-26 12:18:32 +00:00
|
|
|
PROTO_ITEM_SET_GENERATED(ti);
|
|
|
|
|
|
|
|
/* CID Inclusion Info */
|
|
|
|
ti = proto_tree_add_uint(configuration_tree, hf_pdcp_lte_cid_inclusion_info, tvb, 0, 0,
|
2013-11-11 22:36:08 +00:00
|
|
|
p_pdcp_info->rohc.cid_inclusion_info);
|
2009-01-26 12:18:32 +00:00
|
|
|
PROTO_ITEM_SET_GENERATED(ti);
|
|
|
|
|
|
|
|
/* Large CID */
|
|
|
|
ti = proto_tree_add_uint(configuration_tree, hf_pdcp_lte_large_cid_present, tvb, 0, 0,
|
2013-11-11 22:36:08 +00:00
|
|
|
p_pdcp_info->rohc.large_cid_present);
|
2009-01-26 12:18:32 +00:00
|
|
|
PROTO_ITEM_SET_GENERATED(ti);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Append summary to configuration root */
|
2009-05-13 09:36:42 +00:00
|
|
|
proto_item_append_text(configuration_ti, "(direction=%s, plane=%s",
|
2011-09-23 17:02:56 +00:00
|
|
|
val_to_str_const(p_pdcp_info->direction, direction_vals, "Unknown"),
|
|
|
|
val_to_str_const(p_pdcp_info->plane, pdcp_plane_vals, "Unknown"));
|
2009-01-26 12:18:32 +00:00
|
|
|
|
2013-11-11 22:36:08 +00:00
|
|
|
if (p_pdcp_info->rohc.rohc_compression) {
|
|
|
|
const char *mode = val_to_str_const(p_pdcp_info->rohc.mode, rohc_mode_vals, "Error");
|
2009-01-26 12:18:32 +00:00
|
|
|
proto_item_append_text(configuration_ti, ", mode=%c, profile=%s",
|
|
|
|
mode[0],
|
2013-11-11 22:36:08 +00:00
|
|
|
val_to_str_const(p_pdcp_info->rohc.profile, rohc_profile_vals, "Unknown"));
|
2009-01-26 12:18:32 +00:00
|
|
|
}
|
2012-09-19 16:56:59 +00:00
|
|
|
proto_item_append_text(configuration_ti, ")");
|
2009-01-26 12:18:32 +00:00
|
|
|
PROTO_ITEM_SET_GENERATED(configuration_ti);
|
|
|
|
|
|
|
|
/* Show plane in info column */
|
2009-07-13 11:23:40 +00:00
|
|
|
col_append_fstr(pinfo->cinfo, COL_INFO, " %s: ",
|
2011-09-23 17:02:56 +00:00
|
|
|
val_to_str_const(p_pdcp_info->plane, pdcp_plane_vals, "Unknown"));
|
2009-01-26 12:18:32 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-05-11 15:19:51 +00:00
|
|
|
/* Look for an RRC dissector for signalling data (using channel type and direction) */
|
|
|
|
static dissector_handle_t lookup_rrc_dissector_handle(struct pdcp_lte_info *p_pdcp_info)
|
|
|
|
{
|
|
|
|
dissector_handle_t rrc_handle = 0;
|
|
|
|
|
|
|
|
switch (p_pdcp_info->channelType)
|
|
|
|
{
|
|
|
|
case Channel_CCCH:
|
2009-05-13 09:36:42 +00:00
|
|
|
if (p_pdcp_info->direction == DIRECTION_UPLINK) {
|
2010-06-18 07:07:55 +00:00
|
|
|
rrc_handle = find_dissector("lte_rrc.ul_ccch");
|
2009-05-11 15:19:51 +00:00
|
|
|
}
|
|
|
|
else {
|
2010-06-18 07:07:55 +00:00
|
|
|
rrc_handle = find_dissector("lte_rrc.dl_ccch");
|
2009-05-11 15:19:51 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case Channel_PCCH:
|
2012-09-23 21:01:05 +00:00
|
|
|
rrc_handle = find_dissector("lte_rrc.pcch");
|
2009-05-11 15:19:51 +00:00
|
|
|
break;
|
|
|
|
case Channel_BCCH:
|
|
|
|
switch (p_pdcp_info->BCCHTransport) {
|
|
|
|
case BCH_TRANSPORT:
|
2011-07-25 13:34:40 +00:00
|
|
|
rrc_handle = find_dissector("lte_rrc.bcch_bch");
|
2009-05-11 15:19:51 +00:00
|
|
|
break;
|
|
|
|
case DLSCH_TRANSPORT:
|
2011-07-25 13:34:40 +00:00
|
|
|
rrc_handle = find_dissector("lte_rrc.bcch_dl_sch");
|
2009-05-11 15:19:51 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2009-11-16 15:35:56 +00:00
|
|
|
case Channel_DCCH:
|
|
|
|
if (p_pdcp_info->direction == DIRECTION_UPLINK) {
|
2010-06-18 07:07:55 +00:00
|
|
|
rrc_handle = find_dissector("lte_rrc.ul_dcch");
|
2009-11-16 15:35:56 +00:00
|
|
|
}
|
|
|
|
else {
|
2010-06-18 07:07:55 +00:00
|
|
|
rrc_handle = find_dissector("lte_rrc.dl_dcch");
|
2009-11-16 15:35:56 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2009-05-11 15:19:51 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return rrc_handle;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-12-11 14:31:40 +00:00
|
|
|
/* Forwad declarations */
|
|
|
|
static void dissect_pdcp_lte(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
|
|
|
|
|
|
|
|
/* Heuristic dissection */
|
|
|
|
static gboolean global_pdcp_lte_heur = FALSE;
|
|
|
|
|
|
|
|
/* Heuristic dissector looks for supported framing protocol (see wiki page) */
|
|
|
|
static gboolean dissect_pdcp_lte_heur(tvbuff_t *tvb, packet_info *pinfo,
|
2012-09-10 21:40:21 +00:00
|
|
|
proto_tree *tree, void *data _U_)
|
2009-12-11 14:31:40 +00:00
|
|
|
{
|
2012-05-17 14:35:11 +00:00
|
|
|
gint offset = 0;
|
2009-12-11 14:31:40 +00:00
|
|
|
struct pdcp_lte_info *p_pdcp_lte_info;
|
|
|
|
tvbuff_t *pdcp_tvb;
|
2012-05-17 14:35:11 +00:00
|
|
|
guint8 tag = 0;
|
|
|
|
gboolean infoAlreadySet = FALSE;
|
|
|
|
gboolean seqnumLengthTagPresent = FALSE;
|
2009-12-11 14:31:40 +00:00
|
|
|
|
|
|
|
/* This is a heuristic dissector, which means we get all the UDP
|
|
|
|
* traffic not sent to a known dissector and not claimed by
|
|
|
|
* a heuristic dissector called before us!
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (!global_pdcp_lte_heur) {
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Do this again on re-dissection to re-discover offset of actual PDU */
|
2010-09-23 21:46:31 +00:00
|
|
|
|
2009-12-11 14:31:40 +00:00
|
|
|
/* Needs to be at least as long as:
|
|
|
|
- the signature string
|
|
|
|
- fixed header bytes
|
|
|
|
- tag for data
|
|
|
|
- at least one byte of PDCP PDU payload */
|
2013-06-17 15:39:56 +00:00
|
|
|
if (tvb_length_remaining(tvb, offset) < (gint)(strlen(PDCP_LTE_START_STRING)+3+2)) {
|
2009-12-11 14:31:40 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* OK, compare with signature string */
|
2010-10-30 18:18:12 +00:00
|
|
|
if (tvb_strneql(tvb, offset, PDCP_LTE_START_STRING, strlen(PDCP_LTE_START_STRING)) != 0) {
|
2009-12-11 14:31:40 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
offset += (gint)strlen(PDCP_LTE_START_STRING);
|
|
|
|
|
2010-11-02 15:17:58 +00:00
|
|
|
|
|
|
|
/* If redissecting, use previous info struct (if available) */
|
2013-11-23 02:20:13 +00:00
|
|
|
p_pdcp_lte_info = (pdcp_lte_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_pdcp_lte, 0);
|
2010-11-02 15:17:58 +00:00
|
|
|
if (p_pdcp_lte_info == NULL) {
|
|
|
|
/* Allocate new info struct for this frame */
|
2013-08-30 14:49:55 +00:00
|
|
|
p_pdcp_lte_info = wmem_new0(wmem_file_scope(), pdcp_lte_info);
|
2010-11-02 15:17:58 +00:00
|
|
|
infoAlreadySet = FALSE;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
infoAlreadySet = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-12-11 14:31:40 +00:00
|
|
|
/* Read fixed fields */
|
2012-12-16 00:15:26 +00:00
|
|
|
p_pdcp_lte_info->no_header_pdu = (gboolean)tvb_get_guint8(tvb, offset++);
|
|
|
|
p_pdcp_lte_info->plane = (enum pdcp_plane)tvb_get_guint8(tvb, offset++);
|
2014-01-03 12:21:26 +00:00
|
|
|
if (p_pdcp_lte_info->plane == SIGNALING_PLANE) {
|
|
|
|
p_pdcp_lte_info->seqnum_length = PDCP_SN_LENGTH_5_BITS;
|
|
|
|
}
|
2013-11-11 22:36:08 +00:00
|
|
|
p_pdcp_lte_info->rohc.rohc_compression = (gboolean)tvb_get_guint8(tvb, offset++);
|
2009-12-11 14:31:40 +00:00
|
|
|
|
|
|
|
/* Read optional fields */
|
|
|
|
while (tag != PDCP_LTE_PAYLOAD_TAG) {
|
|
|
|
/* Process next tag */
|
|
|
|
tag = tvb_get_guint8(tvb, offset++);
|
|
|
|
switch (tag) {
|
|
|
|
case PDCP_LTE_SEQNUM_LENGTH_TAG:
|
|
|
|
p_pdcp_lte_info->seqnum_length = tvb_get_guint8(tvb, offset);
|
|
|
|
offset++;
|
|
|
|
seqnumLengthTagPresent = TRUE;
|
|
|
|
break;
|
|
|
|
case PDCP_LTE_DIRECTION_TAG:
|
|
|
|
p_pdcp_lte_info->direction = tvb_get_guint8(tvb, offset);
|
|
|
|
offset++;
|
|
|
|
break;
|
|
|
|
case PDCP_LTE_LOG_CHAN_TYPE_TAG:
|
2013-03-19 19:28:57 +00:00
|
|
|
p_pdcp_lte_info->channelType = (LogicalChannelType)tvb_get_guint8(tvb, offset);
|
2009-12-11 14:31:40 +00:00
|
|
|
offset++;
|
|
|
|
break;
|
|
|
|
case PDCP_LTE_BCCH_TRANSPORT_TYPE_TAG:
|
2013-03-19 19:28:57 +00:00
|
|
|
p_pdcp_lte_info->BCCHTransport = (BCCHTransportType)tvb_get_guint8(tvb, offset);
|
2009-12-11 14:31:40 +00:00
|
|
|
offset++;
|
|
|
|
break;
|
|
|
|
case PDCP_LTE_ROHC_IP_VERSION_TAG:
|
2013-11-11 22:36:08 +00:00
|
|
|
p_pdcp_lte_info->rohc.rohc_ip_version = tvb_get_ntohs(tvb, offset);
|
2009-12-11 14:31:40 +00:00
|
|
|
offset += 2;
|
|
|
|
break;
|
|
|
|
case PDCP_LTE_ROHC_CID_INC_INFO_TAG:
|
2013-11-11 22:36:08 +00:00
|
|
|
p_pdcp_lte_info->rohc.cid_inclusion_info = tvb_get_guint8(tvb, offset);
|
2009-12-11 14:31:40 +00:00
|
|
|
offset++;
|
|
|
|
break;
|
|
|
|
case PDCP_LTE_ROHC_LARGE_CID_PRES_TAG:
|
2013-11-11 22:36:08 +00:00
|
|
|
p_pdcp_lte_info->rohc.large_cid_present = tvb_get_guint8(tvb, offset);
|
2009-12-11 14:31:40 +00:00
|
|
|
offset++;
|
|
|
|
break;
|
|
|
|
case PDCP_LTE_ROHC_MODE_TAG:
|
2013-11-11 22:36:08 +00:00
|
|
|
p_pdcp_lte_info->rohc.mode = (enum rohc_mode)tvb_get_guint8(tvb, offset);
|
2009-12-11 14:31:40 +00:00
|
|
|
offset++;
|
|
|
|
break;
|
|
|
|
case PDCP_LTE_ROHC_RND_TAG:
|
2013-11-11 22:36:08 +00:00
|
|
|
p_pdcp_lte_info->rohc.rnd = tvb_get_guint8(tvb, offset);
|
2009-12-11 14:31:40 +00:00
|
|
|
offset++;
|
|
|
|
break;
|
|
|
|
case PDCP_LTE_ROHC_UDP_CHECKSUM_PRES_TAG:
|
2013-11-11 22:36:08 +00:00
|
|
|
p_pdcp_lte_info->rohc.udp_checksum_present = tvb_get_guint8(tvb, offset);
|
2009-12-11 14:31:40 +00:00
|
|
|
offset++;
|
|
|
|
break;
|
|
|
|
case PDCP_LTE_ROHC_PROFILE_TAG:
|
2013-11-11 22:36:08 +00:00
|
|
|
p_pdcp_lte_info->rohc.profile = tvb_get_ntohs(tvb, offset);
|
2009-12-11 14:31:40 +00:00
|
|
|
offset += 2;
|
|
|
|
break;
|
2013-07-04 12:11:54 +00:00
|
|
|
case PDCP_LTE_CHANNEL_ID_TAG:
|
|
|
|
p_pdcp_lte_info->channelId = tvb_get_ntohs(tvb, offset);
|
|
|
|
offset += 2;
|
|
|
|
break;
|
2013-07-06 21:43:44 +00:00
|
|
|
case PDCP_LTE_UEID_TAG:
|
|
|
|
p_pdcp_lte_info->ueid = tvb_get_ntohs(tvb, offset);
|
|
|
|
offset += 2;
|
|
|
|
break;
|
2009-12-11 14:31:40 +00:00
|
|
|
|
|
|
|
case PDCP_LTE_PAYLOAD_TAG:
|
|
|
|
/* Have reached data, so get out of loop */
|
|
|
|
continue;
|
|
|
|
|
|
|
|
default:
|
|
|
|
/* It must be a recognised tag */
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((p_pdcp_lte_info->plane == USER_PLANE) && (seqnumLengthTagPresent == FALSE)) {
|
|
|
|
/* Conditional field is not present */
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!infoAlreadySet) {
|
|
|
|
/* Store info in packet */
|
2013-11-23 02:20:13 +00:00
|
|
|
p_add_proto_data(wmem_file_scope(), pinfo, proto_pdcp_lte, 0, p_pdcp_lte_info);
|
2009-12-11 14:31:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************/
|
|
|
|
/* OK, now dissect as PDCP LTE */
|
|
|
|
|
|
|
|
/* Create tvb that starts at actual PDCP PDU */
|
2013-02-19 23:17:07 +00:00
|
|
|
pdcp_tvb = tvb_new_subset_remaining(tvb, offset);
|
2009-12-11 14:31:40 +00:00
|
|
|
dissect_pdcp_lte(pdcp_tvb, pinfo, tree);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-10-29 17:46:50 +00:00
|
|
|
/* Called from control protocol to configure security algorithms for the given UE */
|
2013-10-29 13:49:14 +00:00
|
|
|
void set_pdcp_lte_security_algorithms(guint16 ueid, pdcp_security_info_t *security_info)
|
|
|
|
{
|
2014-01-06 18:18:04 +00:00
|
|
|
/* Use for this frame so can check integrity on SecurityCommandRequest frame */
|
|
|
|
/* N.B. won't work for internal, non-RRC signalling methods... */
|
|
|
|
pdcp_security_info_t *p_frame_security;
|
|
|
|
|
2014-01-27 12:06:46 +00:00
|
|
|
/* Create or update current settings, by UEID */
|
|
|
|
pdcp_security_info_t* ue_security =
|
|
|
|
(pdcp_security_info_t*)g_hash_table_lookup(pdcp_security_hash,
|
|
|
|
GUINT_TO_POINTER((guint)ueid));
|
|
|
|
if (ue_security == NULL) {
|
|
|
|
/* Copy whole security struct */
|
|
|
|
ue_security = wmem_new(wmem_file_scope(), pdcp_security_info_t);
|
|
|
|
*ue_security = *security_info;
|
|
|
|
|
|
|
|
/* And add into security table */
|
|
|
|
g_hash_table_insert(pdcp_security_hash, GUINT_TO_POINTER((guint)ueid), ue_security);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* Just update existing entry already in table */
|
|
|
|
ue_security->previous_configuration_frame = ue_security->configuration_frame;
|
|
|
|
ue_security->previous_integrity = ue_security->integrity;
|
|
|
|
ue_security->previous_ciphering = ue_security->ciphering;
|
|
|
|
|
|
|
|
ue_security->configuration_frame = security_info->configuration_frame;
|
|
|
|
ue_security->integrity = security_info->integrity;
|
|
|
|
ue_security->ciphering = security_info->ciphering;
|
|
|
|
ue_security->seen_next_ul_pdu = FALSE;
|
|
|
|
}
|
2014-01-06 18:18:04 +00:00
|
|
|
|
2014-01-27 12:06:46 +00:00
|
|
|
/* Also add an entry for this PDU already to use these settings, as otherwise it won't be present
|
2014-01-06 18:18:04 +00:00
|
|
|
when we query it on the first pass. */
|
|
|
|
p_frame_security = wmem_new(wmem_file_scope(), pdcp_security_info_t);
|
2014-01-27 12:06:46 +00:00
|
|
|
*p_frame_security = *ue_security;
|
2014-01-10 17:56:55 +00:00
|
|
|
g_hash_table_insert(pdcp_security_result_hash,
|
2014-01-27 12:06:46 +00:00
|
|
|
get_ueid_frame_hash_key(ueid, ue_security->configuration_frame, TRUE),
|
2014-01-10 17:56:55 +00:00
|
|
|
p_frame_security);
|
2013-10-29 13:49:14 +00:00
|
|
|
}
|
|
|
|
|
2014-01-27 12:06:46 +00:00
|
|
|
/* UE failed to process SecurityModeCommand so go back to previous security settings */
|
|
|
|
void set_pdcp_lte_security_algorithms_failed(guint16 ueid)
|
|
|
|
{
|
|
|
|
/* Look up current state by UEID */
|
|
|
|
pdcp_security_info_t* ue_security =
|
|
|
|
(pdcp_security_info_t*)g_hash_table_lookup(pdcp_security_hash,
|
|
|
|
GUINT_TO_POINTER((guint)ueid));
|
|
|
|
if (ue_security != NULL) {
|
|
|
|
/* TODO: could remove from table if previous_configuration_frame is 0 */
|
|
|
|
/* Go back to previous state */
|
|
|
|
ue_security->configuration_frame = ue_security->previous_configuration_frame;
|
|
|
|
ue_security->integrity = ue_security->previous_integrity;
|
2014-02-25 16:27:32 +00:00
|
|
|
ue_security->ciphering = ue_security->previous_ciphering;
|
2014-01-27 12:06:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-12-16 18:53:14 +00:00
|
|
|
/* Decipher payload if algorithm is supported and plausible inputs are available */
|
2013-12-18 02:16:42 +00:00
|
|
|
static tvbuff_t *decipher_payload(tvbuff_t *tvb, packet_info *pinfo, int *offset,
|
|
|
|
pdu_security_settings_t *pdu_security_settings,
|
2014-01-06 18:18:04 +00:00
|
|
|
enum pdcp_plane plane, gboolean will_be_deciphered,
|
|
|
|
gboolean *deciphered)
|
2013-12-16 18:53:14 +00:00
|
|
|
{
|
2014-01-14 17:44:21 +00:00
|
|
|
guint8* decrypted_data = NULL;
|
|
|
|
gint payload_length = 0;
|
2013-12-17 14:49:21 +00:00
|
|
|
tvbuff_t *decrypted_tvb;
|
2013-12-16 18:53:14 +00:00
|
|
|
|
2014-01-14 15:07:20 +00:00
|
|
|
/* Nothing to do if NULL ciphering */
|
|
|
|
if (pdu_security_settings->ciphering == eea0) {
|
2013-12-16 18:53:14 +00:00
|
|
|
return tvb;
|
|
|
|
}
|
|
|
|
|
2014-01-14 15:07:20 +00:00
|
|
|
/* Nothing to do if don't have valid cipher key */
|
|
|
|
if (!pdu_security_settings->cipherKeyValid) {
|
|
|
|
return tvb;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check whether algorithm supported (only drop through and process if we do) */
|
|
|
|
if (pdu_security_settings->ciphering == eea1) {
|
|
|
|
#ifndef HAVE_SNOW3G
|
|
|
|
return tvb;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if (pdu_security_settings->ciphering == eea2) {
|
|
|
|
#ifndef HAVE_LIBGCRYPT
|
|
|
|
return tvb;
|
2014-01-14 11:09:47 +00:00
|
|
|
#endif
|
2014-01-14 15:07:20 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* An algorithm we don't support at all! */
|
2013-12-16 18:53:14 +00:00
|
|
|
return tvb;
|
|
|
|
}
|
|
|
|
|
2013-12-17 16:40:42 +00:00
|
|
|
/* Don't decipher if turned off in preferences */
|
|
|
|
if (((plane == SIGNALING_PLANE) && !global_pdcp_decipher_signalling) ||
|
2013-12-18 12:05:11 +00:00
|
|
|
((plane == USER_PLANE) && !global_pdcp_decipher_userplane)) {
|
2013-12-16 18:53:14 +00:00
|
|
|
return tvb;
|
|
|
|
}
|
|
|
|
|
2014-01-06 18:18:04 +00:00
|
|
|
/* Don't decipher if not yet past SecurityModeResponse */
|
|
|
|
if (!will_be_deciphered) {
|
|
|
|
return tvb;
|
|
|
|
}
|
|
|
|
|
2014-01-14 15:07:20 +00:00
|
|
|
#ifdef HAVE_LIBGCRYPT
|
2014-01-14 11:09:47 +00:00
|
|
|
/* AES */
|
|
|
|
if (pdu_security_settings->ciphering == eea2) {
|
2014-01-14 15:07:20 +00:00
|
|
|
unsigned char ctr_block[16];
|
|
|
|
gcry_cipher_hd_t cypher_hd;
|
|
|
|
int gcrypt_err;
|
|
|
|
|
2014-01-14 11:09:47 +00:00
|
|
|
/* Set CTR */
|
|
|
|
memset(ctr_block, 0, 16);
|
|
|
|
/* Only first 5 bytes set */
|
|
|
|
ctr_block[0] = (pdu_security_settings->count & 0xff000000) >> 24;
|
|
|
|
ctr_block[1] = (pdu_security_settings->count & 0x00ff0000) >> 16;
|
|
|
|
ctr_block[2] = (pdu_security_settings->count & 0x0000ff00) >> 8;
|
|
|
|
ctr_block[3] = (pdu_security_settings->count & 0x000000ff);
|
|
|
|
ctr_block[4] = (pdu_security_settings->bearer << 3) + (pdu_security_settings->direction << 2);
|
2014-02-25 16:27:32 +00:00
|
|
|
|
2014-01-14 11:09:47 +00:00
|
|
|
/* Open gcrypt handle */
|
|
|
|
gcrypt_err = gcry_cipher_open(&cypher_hd, GCRY_CIPHER_AES128, GCRY_CIPHER_MODE_CTR, 0);
|
|
|
|
if (gcrypt_err != 0) {
|
|
|
|
return tvb;
|
|
|
|
}
|
2014-02-25 16:27:32 +00:00
|
|
|
|
2014-01-14 11:09:47 +00:00
|
|
|
/* Set the key */
|
|
|
|
gcrypt_err = gcry_cipher_setkey(cypher_hd, pdu_security_settings->cipherKey, 16);
|
|
|
|
if (gcrypt_err != 0) {
|
|
|
|
gcry_cipher_close(cypher_hd);
|
|
|
|
return tvb;
|
|
|
|
}
|
2014-02-25 16:27:32 +00:00
|
|
|
|
2014-01-14 11:09:47 +00:00
|
|
|
/* Set the CTR */
|
|
|
|
gcrypt_err = gcry_cipher_setctr(cypher_hd, ctr_block, 16);
|
|
|
|
if (gcrypt_err != 0) {
|
|
|
|
gcry_cipher_close(cypher_hd);
|
|
|
|
return tvb;
|
|
|
|
}
|
2014-02-25 16:27:32 +00:00
|
|
|
|
2014-01-14 11:09:47 +00:00
|
|
|
/* Extract the encrypted data into a buffer */
|
|
|
|
payload_length = tvb_length_remaining(tvb, *offset);
|
|
|
|
decrypted_data = (guint8 *)g_malloc0(payload_length);
|
|
|
|
tvb_memcpy(tvb, decrypted_data, *offset, payload_length);
|
2014-02-25 16:27:32 +00:00
|
|
|
|
2014-01-14 11:09:47 +00:00
|
|
|
/* Decrypt the actual data */
|
|
|
|
gcrypt_err = gcry_cipher_decrypt(cypher_hd,
|
|
|
|
decrypted_data, payload_length,
|
|
|
|
NULL, 0);
|
|
|
|
if (gcrypt_err != 0) {
|
|
|
|
gcry_cipher_close(cypher_hd);
|
|
|
|
g_free(decrypted_data);
|
|
|
|
return tvb;
|
|
|
|
}
|
2014-02-25 16:27:32 +00:00
|
|
|
|
2014-01-14 11:09:47 +00:00
|
|
|
/* Close gcrypt handle */
|
2014-01-03 12:21:26 +00:00
|
|
|
gcry_cipher_close(cypher_hd);
|
2013-12-17 14:49:21 +00:00
|
|
|
}
|
2014-01-14 15:07:20 +00:00
|
|
|
#endif
|
|
|
|
|
2014-01-14 11:09:47 +00:00
|
|
|
#ifdef HAVE_SNOW3G
|
|
|
|
/* SNOW-3G */
|
2014-01-14 15:07:20 +00:00
|
|
|
if (pdu_security_settings->ciphering == eea1) {
|
2014-01-14 11:09:47 +00:00
|
|
|
/* Extract the encrypted data into a buffer */
|
|
|
|
payload_length = tvb_length_remaining(tvb, *offset);
|
2014-01-14 16:22:44 +00:00
|
|
|
decrypted_data = (guint8 *)g_malloc0(payload_length+4);
|
2014-01-14 11:09:47 +00:00
|
|
|
tvb_memcpy(tvb, decrypted_data, *offset, payload_length);
|
|
|
|
|
|
|
|
/* Do the algorithm */
|
|
|
|
snow3g_f8(pdu_security_settings->cipherKey,
|
|
|
|
pdu_security_settings->count,
|
|
|
|
pdu_security_settings->bearer,
|
|
|
|
pdu_security_settings->direction,
|
|
|
|
decrypted_data, payload_length*8);
|
2013-12-17 14:49:21 +00:00
|
|
|
}
|
2014-01-14 11:09:47 +00:00
|
|
|
#endif
|
2013-12-18 12:19:42 +00:00
|
|
|
|
2013-12-17 14:49:21 +00:00
|
|
|
/* Create tvb for resulting deciphered sdu */
|
|
|
|
decrypted_tvb = tvb_new_child_real_data(tvb, decrypted_data, payload_length, payload_length);
|
|
|
|
tvb_set_free_cb(decrypted_tvb, g_free);
|
|
|
|
add_new_data_source(pinfo, decrypted_tvb, "Deciphered Payload");
|
|
|
|
|
|
|
|
/* Return deciphered data, i.e. beginning of new tvb */
|
|
|
|
*offset = 0;
|
|
|
|
*deciphered = TRUE;
|
|
|
|
return decrypted_tvb;
|
|
|
|
}
|
2013-12-16 18:53:14 +00:00
|
|
|
|
2014-01-14 15:07:20 +00:00
|
|
|
|
|
|
|
/* Try to calculate digest to compare with that found in frame. */
|
2013-12-25 09:23:33 +00:00
|
|
|
static guint32 calculate_digest(pdu_security_settings_t *pdu_security_settings, guint8 header _U_,
|
2013-12-23 18:12:16 +00:00
|
|
|
tvbuff_t *tvb _U_, gint offset _U_, gboolean *calculated)
|
2013-12-23 11:38:38 +00:00
|
|
|
{
|
2013-12-23 15:56:40 +00:00
|
|
|
*calculated = FALSE;
|
|
|
|
|
2014-01-14 15:07:20 +00:00
|
|
|
if (pdu_security_settings->integrity == eia0) {
|
|
|
|
/* Should be zero in this case */
|
|
|
|
*calculated = TRUE;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Can't calculate if don't have valid integrity key */
|
|
|
|
if (!pdu_security_settings->integrityKeyValid) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Can only do if indicated in preferences */
|
|
|
|
if (!global_pdcp_check_integrity) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-12-23 13:43:13 +00:00
|
|
|
switch (pdu_security_settings->integrity) {
|
2014-01-14 15:07:20 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_SNOW3G
|
|
|
|
case eia1:
|
2013-12-23 15:56:40 +00:00
|
|
|
{
|
2014-01-14 15:07:20 +00:00
|
|
|
guint8 *mac;
|
|
|
|
gint message_length = tvb_length_remaining(tvb, offset) - 4;
|
2014-01-14 16:22:44 +00:00
|
|
|
guint8 *message_data = (guint8 *)g_malloc0(message_length+5);
|
2014-01-14 15:07:20 +00:00
|
|
|
message_data[0] = header;
|
|
|
|
tvb_memcpy(tvb, message_data+1, offset, message_length);
|
|
|
|
|
|
|
|
mac = (u8*)snow3g_f9(pdu_security_settings->integrityKey,
|
|
|
|
pdu_security_settings->count,
|
2014-01-16 12:02:30 +00:00
|
|
|
/* 'Fresh' is the bearer bits then zeros */
|
2014-01-14 15:07:20 +00:00
|
|
|
pdu_security_settings->bearer << 27,
|
|
|
|
pdu_security_settings->direction,
|
|
|
|
message_data,
|
|
|
|
(message_length+1)*8);
|
2014-02-25 16:27:32 +00:00
|
|
|
|
2014-01-14 15:07:20 +00:00
|
|
|
*calculated = TRUE;
|
|
|
|
g_free(message_data);
|
|
|
|
return ((mac[0] << 24) | (mac[1] << 16) | (mac[2] << 8) | mac[3]);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2014-01-03 12:21:26 +00:00
|
|
|
#if (defined GCRYPT_VERSION_NUMBER) && (GCRYPT_VERSION_NUMBER >= 0x010600)
|
2014-01-14 15:07:20 +00:00
|
|
|
case eia2:
|
|
|
|
{
|
2013-12-24 00:09:41 +00:00
|
|
|
gcry_mac_hd_t mac_hd;
|
2013-12-23 15:56:40 +00:00
|
|
|
int gcrypt_err;
|
|
|
|
gint message_length;
|
|
|
|
guint8 *message_data;
|
2014-01-03 12:21:26 +00:00
|
|
|
guint8 mac[4];
|
|
|
|
ssize_t read_digest_length = 4;
|
2013-12-23 15:56:40 +00:00
|
|
|
|
|
|
|
/* Open gcrypt handle */
|
|
|
|
/* N.B. Unfortunately GCRY_MAC_CMAC_AES is not available in currently used version of gcrypt! */
|
2013-12-24 00:09:41 +00:00
|
|
|
gcrypt_err = gcry_mac_open(&mac_hd, GCRY_MAC_CMAC_AES, 0, NULL);
|
2013-12-23 15:56:40 +00:00
|
|
|
if (gcrypt_err != 0) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set the key */
|
2013-12-24 00:09:41 +00:00
|
|
|
gcrypt_err = gcry_mac_setkey(mac_hd, pdu_security_settings->integrityKey, 16);
|
2013-12-23 15:56:40 +00:00
|
|
|
if (gcrypt_err != 0) {
|
2014-01-03 12:21:26 +00:00
|
|
|
gcry_mac_close(mac_hd);
|
2013-12-23 15:56:40 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Extract the encrypted data into a buffer */
|
2013-12-24 07:24:39 +00:00
|
|
|
message_length = tvb_length_remaining(tvb, offset) - 4;
|
2013-12-25 08:44:43 +00:00
|
|
|
message_data = (guint8 *)g_malloc0(message_length+9);
|
2013-12-23 15:56:40 +00:00
|
|
|
message_data[0] = (pdu_security_settings->count & 0xff000000) >> 24;
|
|
|
|
message_data[1] = (pdu_security_settings->count & 0x00ff0000) >> 16;
|
|
|
|
message_data[2] = (pdu_security_settings->count & 0x0000ff00) >> 8;
|
|
|
|
message_data[3] = (pdu_security_settings->count & 0x000000ff);
|
|
|
|
message_data[4] = (pdu_security_settings->bearer << 3) + (pdu_security_settings->direction << 2);
|
|
|
|
/* rest of first 8 bytes are left as zeroes... */
|
2013-12-25 08:44:43 +00:00
|
|
|
message_data[8] = header;
|
|
|
|
tvb_memcpy(tvb, message_data+9, offset, message_length);
|
2013-12-23 15:56:40 +00:00
|
|
|
|
2013-12-24 00:09:41 +00:00
|
|
|
/* Pass in the message */
|
2013-12-25 08:44:43 +00:00
|
|
|
gcrypt_err = gcry_mac_write(mac_hd, message_data, message_length+9);
|
2013-12-23 15:56:40 +00:00
|
|
|
if (gcrypt_err != 0) {
|
2014-01-03 12:21:26 +00:00
|
|
|
gcry_mac_close(mac_hd);
|
|
|
|
g_free(message_data);
|
2013-12-23 15:56:40 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-12-24 00:09:41 +00:00
|
|
|
/* Read out the digest */
|
2014-01-03 12:21:26 +00:00
|
|
|
gcrypt_err = gcry_mac_read(mac_hd, mac, &read_digest_length);
|
2013-12-24 00:09:41 +00:00
|
|
|
if (gcrypt_err != 0) {
|
2014-01-03 12:21:26 +00:00
|
|
|
gcry_mac_close(mac_hd);
|
|
|
|
g_free(message_data);
|
2013-12-24 00:09:41 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Now close the mac handle */
|
|
|
|
gcry_mac_close(mac_hd);
|
|
|
|
|
|
|
|
g_free(message_data);
|
|
|
|
|
2013-12-23 15:56:40 +00:00
|
|
|
*calculated = TRUE;
|
2014-01-03 12:21:26 +00:00
|
|
|
return ((mac[0] << 24) | (mac[1] << 16) | (mac[2] << 8) | mac[3]);
|
2013-12-23 15:56:40 +00:00
|
|
|
}
|
2014-01-14 15:07:20 +00:00
|
|
|
#endif
|
2013-12-23 13:43:13 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
/* Can't calculate */
|
|
|
|
*calculated = FALSE;
|
|
|
|
return 0;
|
|
|
|
}
|
2013-12-23 11:38:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-12-11 14:31:40 +00:00
|
|
|
|
2009-01-26 12:18:32 +00:00
|
|
|
/******************************/
|
|
|
|
/* Main dissection function. */
|
|
|
|
static void dissect_pdcp_lte(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|
|
|
{
|
2012-05-17 14:35:11 +00:00
|
|
|
const char *mode;
|
|
|
|
proto_tree *pdcp_tree = NULL;
|
|
|
|
proto_item *root_ti = NULL;
|
|
|
|
gint offset = 0;
|
|
|
|
gint rohc_offset;
|
|
|
|
struct pdcp_lte_info *p_pdcp_info;
|
|
|
|
tvbuff_t *rohc_tvb = NULL;
|
2012-03-08 13:19:41 +00:00
|
|
|
|
2013-12-12 11:07:53 +00:00
|
|
|
pdcp_security_info_t *current_security = NULL; /* current security for this UE */
|
|
|
|
pdcp_security_info_t *pdu_security; /* security in place for this PDU */
|
|
|
|
proto_tree *security_tree = NULL;
|
|
|
|
proto_item *security_ti;
|
2013-12-16 18:53:14 +00:00
|
|
|
tvbuff_t *payload_tvb;
|
|
|
|
pdu_security_settings_t pdu_security_settings;
|
2013-12-17 14:49:21 +00:00
|
|
|
gboolean payload_deciphered = FALSE;
|
2013-12-16 18:53:14 +00:00
|
|
|
|
|
|
|
/* Initialise security settings */
|
2013-12-31 00:46:53 +00:00
|
|
|
memset(&pdu_security_settings, 0, sizeof(pdu_security_settings));
|
2013-10-30 12:58:03 +00:00
|
|
|
|
|
|
|
/* Set protocol name. */
|
2009-09-23 14:43:23 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "PDCP-LTE");
|
2009-01-26 12:18:32 +00:00
|
|
|
|
2012-10-07 15:14:44 +00:00
|
|
|
/* Look for attached packet info! */
|
2013-11-23 02:20:13 +00:00
|
|
|
p_pdcp_info = (struct pdcp_lte_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_pdcp_lte, 0);
|
2012-10-07 15:14:44 +00:00
|
|
|
/* Can't dissect anything without it... */
|
|
|
|
if (p_pdcp_info == NULL) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-03-08 13:19:41 +00:00
|
|
|
/* Don't want to overwrite the RLC Info column if configured not to */
|
|
|
|
if ((global_pdcp_lte_layer_to_show == ShowRLCLayer) &&
|
2013-11-23 02:20:13 +00:00
|
|
|
(p_get_proto_data(wmem_file_scope(), pinfo, proto_rlc_lte, 0) != NULL)) {
|
2012-03-08 13:19:41 +00:00
|
|
|
|
|
|
|
col_set_writable(pinfo->cinfo, FALSE);
|
|
|
|
}
|
|
|
|
else {
|
2012-03-30 01:18:12 +00:00
|
|
|
/* TODO: won't help with multiple PDCP-or-traffic PDUs / frame... */
|
2012-03-08 13:19:41 +00:00
|
|
|
col_clear(pinfo->cinfo, COL_INFO);
|
|
|
|
col_set_writable(pinfo->cinfo, TRUE);
|
|
|
|
}
|
|
|
|
|
2009-01-26 12:18:32 +00:00
|
|
|
/* Create pdcp tree. */
|
|
|
|
if (tree) {
|
2011-10-21 02:10:19 +00:00
|
|
|
root_ti = proto_tree_add_item(tree, proto_pdcp_lte, tvb, offset, -1, ENC_NA);
|
2009-01-26 12:18:32 +00:00
|
|
|
pdcp_tree = proto_item_add_subtree(root_ti, ett_pdcp);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set mode string */
|
2013-11-11 22:36:08 +00:00
|
|
|
mode = val_to_str_const(p_pdcp_info->rohc.mode, rohc_mode_vals, "Error");
|
2009-01-26 12:18:32 +00:00
|
|
|
|
2013-10-30 12:58:03 +00:00
|
|
|
/*****************************************************/
|
2009-01-26 12:18:32 +00:00
|
|
|
/* Show configuration (attached packet) info in tree */
|
|
|
|
if (pdcp_tree) {
|
|
|
|
show_pdcp_config(pinfo, tvb, pdcp_tree, p_pdcp_info);
|
|
|
|
}
|
|
|
|
|
2009-03-11 12:04:58 +00:00
|
|
|
/* Show ROHC mode */
|
2013-11-11 22:36:08 +00:00
|
|
|
if (p_pdcp_info->rohc.rohc_compression) {
|
2009-01-26 12:18:32 +00:00
|
|
|
col_append_fstr(pinfo->cinfo, COL_INFO, " (mode=%c)", mode[0]);
|
|
|
|
}
|
|
|
|
|
2013-10-30 12:58:03 +00:00
|
|
|
/***************************************/
|
|
|
|
/* UE security algorithms */
|
|
|
|
if (!pinfo->fd->flags.visited) {
|
|
|
|
/* Look up current state by UEID */
|
|
|
|
current_security = (pdcp_security_info_t*)g_hash_table_lookup(pdcp_security_hash,
|
2014-01-06 18:18:04 +00:00
|
|
|
GUINT_TO_POINTER((guint)p_pdcp_info->ueid));
|
2013-10-30 12:58:03 +00:00
|
|
|
if (current_security != NULL) {
|
|
|
|
/* Store any result for this frame in the result table */
|
|
|
|
pdcp_security_info_t *security_to_store = wmem_new(wmem_file_scope(), pdcp_security_info_t);
|
2014-01-06 18:18:04 +00:00
|
|
|
/* Take a deep copy of the settings */
|
2013-10-30 12:58:03 +00:00
|
|
|
*security_to_store = *current_security;
|
|
|
|
g_hash_table_insert(pdcp_security_result_hash,
|
|
|
|
get_ueid_frame_hash_key(p_pdcp_info->ueid, pinfo->fd->num, TRUE),
|
|
|
|
security_to_store);
|
|
|
|
}
|
|
|
|
}
|
2013-12-12 11:07:53 +00:00
|
|
|
|
2013-10-30 12:58:03 +00:00
|
|
|
/* Show security settings for this PDU */
|
|
|
|
pdu_security = (pdcp_security_info_t*)g_hash_table_lookup(pdcp_security_result_hash, get_ueid_frame_hash_key(p_pdcp_info->ueid, pinfo->fd->num, FALSE));
|
|
|
|
if (pdu_security != NULL) {
|
2013-12-12 11:07:53 +00:00
|
|
|
proto_item *ti;
|
2013-10-30 12:58:03 +00:00
|
|
|
|
|
|
|
/* Create subtree */
|
|
|
|
security_ti = proto_tree_add_string_format(pdcp_tree,
|
|
|
|
hf_pdcp_lte_security,
|
|
|
|
tvb, 0, 0,
|
|
|
|
"", "UE Security");
|
2013-12-12 11:07:53 +00:00
|
|
|
security_tree = proto_item_add_subtree(security_ti, ett_pdcp_security);
|
2013-10-30 12:58:03 +00:00
|
|
|
PROTO_ITEM_SET_GENERATED(security_ti);
|
|
|
|
|
|
|
|
/* Setup frame */
|
|
|
|
ti = proto_tree_add_uint(security_tree, hf_pdcp_lte_security_setup_frame,
|
|
|
|
tvb, 0, 0, pdu_security->configuration_frame);
|
|
|
|
PROTO_ITEM_SET_GENERATED(ti);
|
|
|
|
|
|
|
|
/* Ciphering */
|
|
|
|
ti = proto_tree_add_uint(security_tree, hf_pdcp_lte_security_ciphering_algorithm,
|
|
|
|
tvb, 0, 0, pdu_security->ciphering);
|
|
|
|
PROTO_ITEM_SET_GENERATED(ti);
|
|
|
|
|
|
|
|
/* Integrity */
|
|
|
|
ti = proto_tree_add_uint(security_tree, hf_pdcp_lte_security_integrity_algorithm,
|
|
|
|
tvb, 0, 0, pdu_security->integrity);
|
|
|
|
PROTO_ITEM_SET_GENERATED(ti);
|
|
|
|
|
|
|
|
proto_item_append_text(security_ti, " (ciphering=%s, integrity=%s)",
|
|
|
|
val_to_str_const(pdu_security->ciphering, ciphering_algorithm_vals, "Unknown"),
|
|
|
|
val_to_str_const(pdu_security->integrity, integrity_algorithm_vals, "Unknown"));
|
2013-12-16 18:53:14 +00:00
|
|
|
|
|
|
|
pdu_security_settings.ciphering = pdu_security->ciphering;
|
2013-12-24 00:09:41 +00:00
|
|
|
pdu_security_settings.integrity = pdu_security->integrity;
|
2013-10-30 12:58:03 +00:00
|
|
|
}
|
|
|
|
|
2009-01-26 12:18:32 +00:00
|
|
|
|
2013-10-30 12:58:03 +00:00
|
|
|
/***********************************/
|
2009-01-26 12:18:32 +00:00
|
|
|
/* Handle PDCP header (if present) */
|
|
|
|
if (!p_pdcp_info->no_header_pdu) {
|
|
|
|
|
2010-11-22 13:28:49 +00:00
|
|
|
/* TODO: shouldn't need to initialise this one!! */
|
|
|
|
guint16 seqnum = 0;
|
|
|
|
gboolean seqnum_set = FALSE;
|
|
|
|
|
2012-10-07 15:14:44 +00:00
|
|
|
guint8 first_byte = tvb_get_guint8(tvb, offset);
|
|
|
|
|
2009-01-26 12:18:32 +00:00
|
|
|
/*****************************/
|
|
|
|
/* Signalling plane messages */
|
2009-02-19 22:25:36 +00:00
|
|
|
if (p_pdcp_info->plane == SIGNALING_PLANE) {
|
2012-02-03 16:44:56 +00:00
|
|
|
/* Verify 3 reserved bits are 0 */
|
2012-10-07 15:14:44 +00:00
|
|
|
guint8 reserved = (first_byte & 0xe0) >> 5;
|
2012-02-03 16:44:56 +00:00
|
|
|
proto_item *ti = proto_tree_add_item(pdcp_tree, hf_pdcp_lte_control_plane_reserved,
|
|
|
|
tvb, offset, 1, ENC_BIG_ENDIAN);
|
|
|
|
if (reserved != 0) {
|
2013-09-09 00:44:09 +00:00
|
|
|
expert_add_info_format(pinfo, ti, &ei_pdcp_lte_reserved_bits_not_zero,
|
2012-02-03 16:44:56 +00:00
|
|
|
"PDCP signalling header reserved bits not zero");
|
|
|
|
}
|
|
|
|
|
2009-01-26 12:18:32 +00:00
|
|
|
/* 5-bit sequence number */
|
2012-10-07 15:14:44 +00:00
|
|
|
seqnum = first_byte & 0x1f;
|
2010-11-22 13:28:49 +00:00
|
|
|
seqnum_set = TRUE;
|
2011-10-06 03:35:44 +00:00
|
|
|
proto_tree_add_item(pdcp_tree, hf_pdcp_lte_seq_num_5, tvb, offset, 1, ENC_BIG_ENDIAN);
|
2011-02-04 11:47:38 +00:00
|
|
|
write_pdu_label_and_info(root_ti, pinfo, " sn=%-2u ", seqnum);
|
2009-01-26 12:18:32 +00:00
|
|
|
offset++;
|
|
|
|
|
2013-07-04 12:11:54 +00:00
|
|
|
if (tvb_length_remaining(tvb, offset) == 0) {
|
|
|
|
/* Only PDCP header was captured, stop dissection here */
|
|
|
|
return;
|
|
|
|
}
|
2009-01-26 12:18:32 +00:00
|
|
|
}
|
2009-02-19 22:25:36 +00:00
|
|
|
else if (p_pdcp_info->plane == USER_PLANE) {
|
2009-01-26 12:18:32 +00:00
|
|
|
|
|
|
|
/**********************************/
|
|
|
|
/* User-plane messages */
|
2012-10-07 15:14:44 +00:00
|
|
|
gboolean pdu_type = (first_byte & 0x80) >> 7;
|
2009-01-26 12:18:32 +00:00
|
|
|
|
|
|
|
/* Data/Control flag */
|
2011-10-06 03:35:44 +00:00
|
|
|
proto_tree_add_item(pdcp_tree, hf_pdcp_lte_data_control, tvb, offset, 1, ENC_BIG_ENDIAN);
|
2009-01-26 12:18:32 +00:00
|
|
|
|
2009-05-13 09:36:42 +00:00
|
|
|
if (pdu_type == 1) {
|
2009-01-26 12:18:32 +00:00
|
|
|
/*****************************/
|
|
|
|
/* Use-plane Data */
|
|
|
|
|
|
|
|
/* Number of sequence number bits depends upon config */
|
2012-09-21 20:12:32 +00:00
|
|
|
switch (p_pdcp_info->seqnum_length) {
|
|
|
|
case PDCP_SN_LENGTH_7_BITS:
|
2012-10-07 15:14:44 +00:00
|
|
|
seqnum = first_byte & 0x7f;
|
2012-09-21 20:12:32 +00:00
|
|
|
seqnum_set = TRUE;
|
|
|
|
proto_tree_add_item(pdcp_tree, hf_pdcp_lte_seq_num_7, tvb, offset, 1, ENC_BIG_ENDIAN);
|
|
|
|
offset++;
|
|
|
|
break;
|
|
|
|
case PDCP_SN_LENGTH_12_BITS:
|
|
|
|
{
|
|
|
|
proto_item *ti;
|
|
|
|
guint8 reserved_value;
|
|
|
|
|
|
|
|
/* 3 reserved bits */
|
|
|
|
ti = proto_tree_add_item(pdcp_tree, hf_pdcp_lte_reserved3, tvb, offset, 1, ENC_BIG_ENDIAN);
|
2012-10-07 15:14:44 +00:00
|
|
|
reserved_value = (first_byte & 0x70) >> 4;
|
2012-09-21 20:12:32 +00:00
|
|
|
|
|
|
|
/* Complain if not 0 */
|
|
|
|
if (reserved_value != 0) {
|
2013-09-09 00:44:09 +00:00
|
|
|
expert_add_info_format(pinfo, ti, &ei_pdcp_lte_reserved_bits_not_zero,
|
2012-09-21 20:12:32 +00:00
|
|
|
"Reserved bits have value 0x%x - should be 0x0",
|
|
|
|
reserved_value);
|
|
|
|
}
|
2009-01-26 12:18:32 +00:00
|
|
|
|
2012-09-21 20:12:32 +00:00
|
|
|
/* 12-bit sequence number */
|
|
|
|
seqnum = tvb_get_ntohs(tvb, offset) & 0x0fff;
|
|
|
|
seqnum_set = TRUE;
|
|
|
|
proto_tree_add_item(pdcp_tree, hf_pdcp_lte_seq_num_12, tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
offset += 2;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case PDCP_SN_LENGTH_15_BITS:
|
|
|
|
seqnum = tvb_get_ntohs(tvb, offset) & 0x7fff;
|
|
|
|
seqnum_set = TRUE;
|
|
|
|
proto_tree_add_item(pdcp_tree, hf_pdcp_lte_seq_num_15, tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
offset += 2;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
/* Not a recognised data format!!!!! */
|
|
|
|
return;
|
2009-01-26 12:18:32 +00:00
|
|
|
}
|
|
|
|
|
2011-02-04 11:47:38 +00:00
|
|
|
write_pdu_label_and_info(root_ti, pinfo, " (SN=%u)", seqnum);
|
2009-01-26 12:18:32 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
/*******************************/
|
|
|
|
/* User-plane Control messages */
|
2012-10-07 15:14:44 +00:00
|
|
|
guint8 control_pdu_type = (first_byte & 0x70) >> 4;
|
2011-10-06 03:35:44 +00:00
|
|
|
proto_tree_add_item(pdcp_tree, hf_pdcp_lte_control_pdu_type, tvb, offset, 1, ENC_BIG_ENDIAN);
|
2009-01-26 12:18:32 +00:00
|
|
|
|
|
|
|
switch (control_pdu_type) {
|
|
|
|
case 0: /* PDCP status report */
|
|
|
|
{
|
2013-06-17 04:26:16 +00:00
|
|
|
guint8 bits;
|
2009-05-08 23:29:42 +00:00
|
|
|
guint16 fms;
|
2012-09-21 20:12:32 +00:00
|
|
|
guint16 modulo;
|
2013-06-17 04:26:16 +00:00
|
|
|
guint not_received = 0;
|
|
|
|
guint sn, i, j, l;
|
|
|
|
guint32 len, bit_offset;
|
2009-05-08 23:29:42 +00:00
|
|
|
proto_tree *bitmap_tree;
|
2009-10-13 13:52:23 +00:00
|
|
|
proto_item *bitmap_ti = NULL;
|
2013-06-17 04:26:16 +00:00
|
|
|
gchar *buff = NULL;
|
|
|
|
#define BUFF_SIZE 49
|
2009-01-26 12:18:32 +00:00
|
|
|
|
2012-09-21 20:12:32 +00:00
|
|
|
if (p_pdcp_info->seqnum_length == PDCP_SN_LENGTH_12_BITS) {
|
|
|
|
/* First-Missing-Sequence SN */
|
|
|
|
fms = tvb_get_ntohs(tvb, offset) & 0x0fff;
|
|
|
|
sn = (fms + 1) % 4096;
|
|
|
|
proto_tree_add_item(pdcp_tree, hf_pdcp_lte_fms, tvb,
|
|
|
|
offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
offset += 2;
|
|
|
|
modulo = 4096;
|
|
|
|
} else {
|
|
|
|
proto_item *ti;
|
|
|
|
guint8 reserved_value;
|
|
|
|
|
|
|
|
/* 5 reserved bits */
|
|
|
|
ti = proto_tree_add_item(pdcp_tree, hf_pdcp_lte_reserved4, tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
reserved_value = (tvb_get_ntohs(tvb, offset) & 0x0f80)>>7;
|
|
|
|
offset++;
|
|
|
|
|
|
|
|
/* Complain if not 0 */
|
|
|
|
if (reserved_value != 0) {
|
2013-09-09 00:44:09 +00:00
|
|
|
expert_add_info_format(pinfo, ti, &ei_pdcp_lte_reserved_bits_not_zero,
|
2012-09-21 20:12:32 +00:00
|
|
|
"Reserved bits have value 0x%x - should be 0x0",
|
|
|
|
reserved_value);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* First-Missing-Sequence SN */
|
|
|
|
fms = tvb_get_ntohs(tvb, offset) & 0x7fff;
|
|
|
|
sn = (fms + 1) % 32768;
|
|
|
|
proto_tree_add_item(pdcp_tree, hf_pdcp_lte_fms2, tvb,
|
|
|
|
offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
offset += 2;
|
|
|
|
modulo = 32768;
|
|
|
|
}
|
2009-01-26 12:18:32 +00:00
|
|
|
|
2013-06-17 04:26:16 +00:00
|
|
|
/* Bitmap tree */
|
2009-10-13 13:52:23 +00:00
|
|
|
if (tvb_length_remaining(tvb, offset) > 0) {
|
|
|
|
bitmap_ti = proto_tree_add_item(pdcp_tree, hf_pdcp_lte_bitmap, tvb,
|
2011-10-16 23:38:49 +00:00
|
|
|
offset, -1, ENC_NA);
|
2012-08-21 21:37:31 +00:00
|
|
|
bitmap_tree = proto_item_add_subtree(bitmap_ti, ett_pdcp_report_bitmap);
|
2010-09-23 21:46:31 +00:00
|
|
|
|
2013-08-30 14:49:55 +00:00
|
|
|
buff = (gchar *)wmem_alloc(wmem_packet_scope(), BUFF_SIZE);
|
2013-06-17 04:26:16 +00:00
|
|
|
len = tvb_length_remaining(tvb, offset);
|
|
|
|
bit_offset = offset<<3;
|
2009-10-13 13:52:23 +00:00
|
|
|
/* For each byte... */
|
2013-06-17 04:26:16 +00:00
|
|
|
for (i=0; i<len; i++) {
|
|
|
|
bits = tvb_get_bits8(tvb, bit_offset, 8);
|
|
|
|
for (l=0, j=0; l<8; l++) {
|
|
|
|
if ((bits << l) & 0x80) {
|
|
|
|
j += g_snprintf(&buff[j], BUFF_SIZE-j, "%5u,", (unsigned)(sn+(8*i)+l)%modulo);
|
|
|
|
} else {
|
|
|
|
j += g_snprintf(&buff[j], BUFF_SIZE-j, " ,");
|
2009-10-13 13:52:23 +00:00
|
|
|
not_received++;
|
|
|
|
}
|
2009-01-26 12:18:32 +00:00
|
|
|
}
|
2013-06-17 04:26:16 +00:00
|
|
|
proto_tree_add_text(bitmap_tree, tvb, bit_offset/8, 1, "%s", buff);
|
|
|
|
bit_offset += 8;
|
2009-01-26 12:18:32 +00:00
|
|
|
}
|
2013-06-16 14:24:47 +00:00
|
|
|
}
|
2013-06-17 04:26:16 +00:00
|
|
|
|
|
|
|
if (bitmap_ti != NULL) {
|
|
|
|
proto_item_append_text(bitmap_ti, " (%u SNs not received)", not_received);
|
2009-10-13 13:52:23 +00:00
|
|
|
}
|
2013-06-17 04:26:16 +00:00
|
|
|
write_pdu_label_and_info(root_ti, pinfo, " Status Report (fms=%u) not-received=%u",
|
|
|
|
fms, not_received);
|
2009-01-26 12:18:32 +00:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
|
2009-03-11 12:04:58 +00:00
|
|
|
case 1: /* ROHC Feedback */
|
2009-01-26 12:18:32 +00:00
|
|
|
offset++;
|
|
|
|
break; /* Drop-through to dissect feedback */
|
|
|
|
|
|
|
|
default: /* Reserved */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* Invalid plane setting...! */
|
2011-02-04 11:47:38 +00:00
|
|
|
write_pdu_label_and_info(root_ti, pinfo, " - INVALID PLANE (%u)",
|
|
|
|
p_pdcp_info->plane);
|
2009-01-26 12:18:32 +00:00
|
|
|
return;
|
|
|
|
}
|
2010-11-22 13:28:49 +00:00
|
|
|
|
2012-01-22 03:02:10 +00:00
|
|
|
/* Do sequence analysis if configured to. */
|
|
|
|
if (seqnum_set) {
|
|
|
|
gboolean do_analysis = FALSE;
|
2010-11-22 13:28:49 +00:00
|
|
|
|
2012-01-22 03:02:10 +00:00
|
|
|
switch (global_pdcp_check_sequence_numbers) {
|
|
|
|
case FALSE:
|
|
|
|
break;
|
|
|
|
case SEQUENCE_ANALYSIS_RLC_ONLY:
|
2013-11-23 02:20:13 +00:00
|
|
|
if ((p_get_proto_data(wmem_file_scope(), pinfo, proto_rlc_lte, 0) != NULL) &&
|
2012-01-23 02:36:46 +00:00
|
|
|
!p_pdcp_info->is_retx) {
|
2012-01-22 03:02:10 +00:00
|
|
|
do_analysis = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SEQUENCE_ANALYSIS_PDCP_ONLY:
|
2013-11-23 02:20:13 +00:00
|
|
|
if (p_get_proto_data(wmem_file_scope(), pinfo, proto_rlc_lte, 0) == NULL) {
|
2012-01-22 03:02:10 +00:00
|
|
|
do_analysis = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2012-05-17 14:35:11 +00:00
|
|
|
|
2012-01-22 03:02:10 +00:00
|
|
|
if (do_analysis) {
|
|
|
|
checkChannelSequenceInfo(pinfo, tvb, p_pdcp_info,
|
2013-12-16 18:53:14 +00:00
|
|
|
(guint16)seqnum, pdcp_tree, security_tree,
|
|
|
|
&pdu_security_settings);
|
2012-01-22 03:02:10 +00:00
|
|
|
}
|
2010-11-22 13:28:49 +00:00
|
|
|
}
|
2009-01-26 12:18:32 +00:00
|
|
|
}
|
|
|
|
else {
|
2013-02-26 01:06:19 +00:00
|
|
|
/* Show that it's a no-header PDU */
|
2011-02-04 11:47:38 +00:00
|
|
|
write_pdu_label_and_info(root_ti, pinfo, " No-Header ");
|
2009-01-26 12:18:32 +00:00
|
|
|
}
|
|
|
|
|
2013-12-16 15:03:41 +00:00
|
|
|
/*******************************************************/
|
|
|
|
/* Now deal with the payload */
|
|
|
|
/*******************************************************/
|
2012-03-08 13:19:41 +00:00
|
|
|
|
2013-12-16 18:53:14 +00:00
|
|
|
/* Check pdu_security_settings - may need to do deciphering before calling
|
|
|
|
further dissectors on payload */
|
2014-01-06 18:18:04 +00:00
|
|
|
payload_tvb = decipher_payload(tvb, pinfo, &offset, &pdu_security_settings, p_pdcp_info->plane,
|
|
|
|
pdu_security ? pdu_security->seen_next_ul_pdu: FALSE, &payload_deciphered);
|
2013-12-16 18:53:14 +00:00
|
|
|
|
2013-12-16 15:03:41 +00:00
|
|
|
if (p_pdcp_info->plane == SIGNALING_PLANE) {
|
|
|
|
guint32 data_length;
|
|
|
|
guint32 mac;
|
2013-12-23 13:43:13 +00:00
|
|
|
proto_item *mac_ti;
|
2013-12-24 00:09:41 +00:00
|
|
|
guint32 calculated_digest = 0;
|
2013-12-23 13:43:13 +00:00
|
|
|
gboolean digest_was_calculated = FALSE;
|
|
|
|
|
|
|
|
/* Try to calculate digest so we can check it */
|
|
|
|
if (global_pdcp_check_integrity) {
|
2013-12-25 08:44:43 +00:00
|
|
|
calculated_digest = calculate_digest(&pdu_security_settings, tvb_get_guint8(tvb, 0), payload_tvb,
|
|
|
|
offset, &digest_was_calculated);
|
2013-12-23 13:43:13 +00:00
|
|
|
}
|
2012-03-08 13:19:41 +00:00
|
|
|
|
2013-12-16 15:03:41 +00:00
|
|
|
/* RRC data is all but last 4 bytes.
|
2014-01-06 18:18:04 +00:00
|
|
|
Call lte-rrc dissector (according to direction and channel type) if we have valid data */
|
2013-12-16 15:03:41 +00:00
|
|
|
if ((global_pdcp_dissect_signalling_plane_as_rrc) &&
|
2013-12-17 14:49:21 +00:00
|
|
|
((pdu_security == NULL) || (pdu_security->ciphering == 0) || payload_deciphered || !pdu_security->seen_next_ul_pdu)){
|
2013-12-16 15:03:41 +00:00
|
|
|
/* Get appropriate dissector handle */
|
|
|
|
dissector_handle_t rrc_handle = lookup_rrc_dissector_handle(p_pdcp_info);
|
2012-03-08 13:19:41 +00:00
|
|
|
|
2013-12-16 15:03:41 +00:00
|
|
|
if (rrc_handle != 0) {
|
|
|
|
/* Call RRC dissector if have one */
|
2013-12-17 14:49:21 +00:00
|
|
|
tvbuff_t *rrc_payload_tvb = tvb_new_subset(payload_tvb, offset,
|
|
|
|
tvb_length_remaining(payload_tvb, offset) - 4,
|
|
|
|
tvb_length_remaining(payload_tvb, offset) - 4);
|
2013-12-16 15:03:41 +00:00
|
|
|
gboolean was_writable = col_get_writable(pinfo->cinfo);
|
2010-11-30 15:10:17 +00:00
|
|
|
|
2013-12-16 15:03:41 +00:00
|
|
|
/* We always want to see this in the info column */
|
|
|
|
col_set_writable(pinfo->cinfo, TRUE);
|
2012-03-08 13:19:41 +00:00
|
|
|
|
2013-12-16 23:08:09 +00:00
|
|
|
call_dissector_only(rrc_handle, rrc_payload_tvb, pinfo, pdcp_tree, NULL);
|
2009-01-26 12:18:32 +00:00
|
|
|
|
2013-12-16 15:03:41 +00:00
|
|
|
/* Restore to whatever it was */
|
|
|
|
col_set_writable(pinfo->cinfo, was_writable);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* Just show data */
|
2013-12-17 14:49:21 +00:00
|
|
|
proto_tree_add_item(pdcp_tree, hf_pdcp_lte_signalling_data, payload_tvb, offset,
|
2013-12-16 15:03:41 +00:00
|
|
|
tvb_length_remaining(tvb, offset) - 4, ENC_NA);
|
|
|
|
}
|
2009-01-26 12:18:32 +00:00
|
|
|
|
2013-12-16 15:03:41 +00:00
|
|
|
if (!pinfo->fd->flags.visited &&
|
|
|
|
(current_security != NULL) && !current_security->seen_next_ul_pdu &&
|
|
|
|
p_pdcp_info->direction == DIRECTION_UPLINK)
|
|
|
|
{
|
|
|
|
/* i.e. we have already seen SecurityModeResponse! */
|
|
|
|
current_security->seen_next_ul_pdu = TRUE;
|
|
|
|
}
|
2009-01-26 12:18:32 +00:00
|
|
|
|
2013-12-16 15:03:41 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* Just show as unparsed data */
|
2013-12-17 14:49:21 +00:00
|
|
|
proto_tree_add_item(pdcp_tree, hf_pdcp_lte_signalling_data, payload_tvb, offset,
|
2013-12-16 15:03:41 +00:00
|
|
|
tvb_length_remaining(tvb, offset) - 4, ENC_NA);
|
|
|
|
}
|
2009-01-26 12:18:32 +00:00
|
|
|
|
2013-12-17 14:49:21 +00:00
|
|
|
data_length = tvb_length_remaining(payload_tvb, offset) - 4;
|
2013-12-16 15:03:41 +00:00
|
|
|
offset += data_length;
|
2012-08-21 21:37:31 +00:00
|
|
|
|
2013-12-16 15:03:41 +00:00
|
|
|
/* Last 4 bytes are MAC */
|
2013-12-25 08:44:43 +00:00
|
|
|
mac = tvb_get_ntohl(payload_tvb, offset);
|
2013-12-23 13:43:13 +00:00
|
|
|
mac_ti = proto_tree_add_item(pdcp_tree, hf_pdcp_lte_mac, payload_tvb, offset, 4, ENC_BIG_ENDIAN);
|
2013-12-16 15:03:41 +00:00
|
|
|
offset += 4;
|
2011-12-15 20:22:54 +00:00
|
|
|
|
2013-12-23 13:43:13 +00:00
|
|
|
if (digest_was_calculated) {
|
|
|
|
/* Compare what was found with calculated value! */
|
|
|
|
if (mac != calculated_digest) {
|
|
|
|
expert_add_info_format(pinfo, mac_ti, &ei_pdcp_lte_digest_wrong,
|
|
|
|
"MAC-I Digest wrong expected %08x but found %08x",
|
|
|
|
calculated_digest, mac);
|
|
|
|
}
|
2014-01-06 18:18:04 +00:00
|
|
|
else {
|
|
|
|
proto_item_append_text(mac_ti, " [Matches calculated result]");
|
|
|
|
}
|
2013-12-23 11:38:38 +00:00
|
|
|
}
|
|
|
|
|
2013-12-16 15:03:41 +00:00
|
|
|
col_append_fstr(pinfo->cinfo, COL_INFO, " MAC=0x%08x (%u bytes data)",
|
|
|
|
mac, data_length);
|
2012-03-08 13:19:41 +00:00
|
|
|
}
|
2012-04-01 14:52:48 +00:00
|
|
|
else {
|
2013-12-16 15:03:41 +00:00
|
|
|
/* User-plane payload here */
|
|
|
|
|
|
|
|
/* If not compressed with ROHC, show as user-plane data */
|
|
|
|
if (!p_pdcp_info->rohc.rohc_compression) {
|
2013-12-17 14:49:21 +00:00
|
|
|
gint payload_length = tvb_length_remaining(payload_tvb, offset);
|
2013-12-16 15:03:41 +00:00
|
|
|
if (payload_length > 0) {
|
|
|
|
if (p_pdcp_info->plane == USER_PLANE) {
|
2013-12-17 18:43:24 +00:00
|
|
|
|
2013-12-16 15:03:41 +00:00
|
|
|
/* Not attempting to decode payload if ciphering is enabled
|
|
|
|
(and NULL ciphering is not being used) */
|
|
|
|
if (global_pdcp_dissect_user_plane_as_ip &&
|
2013-12-17 14:49:21 +00:00
|
|
|
((pdu_security == NULL) || (pdu_security->ciphering == 0) || payload_deciphered))
|
2013-12-16 15:03:41 +00:00
|
|
|
{
|
2013-12-17 14:49:21 +00:00
|
|
|
tvbuff_t *ip_payload_tvb = tvb_new_subset_remaining(payload_tvb, offset);
|
2013-12-17 18:43:24 +00:00
|
|
|
|
2013-12-16 15:03:41 +00:00
|
|
|
/* Don't update info column for ROHC unless configured to */
|
|
|
|
if (global_pdcp_lte_layer_to_show != ShowTrafficLayer) {
|
|
|
|
col_set_writable(pinfo->cinfo, FALSE);
|
|
|
|
}
|
2013-12-17 18:43:24 +00:00
|
|
|
|
2013-12-17 14:49:21 +00:00
|
|
|
switch (tvb_get_guint8(ip_payload_tvb, offset) & 0xf0) {
|
2013-12-16 15:03:41 +00:00
|
|
|
case 0x40:
|
2013-12-16 23:08:09 +00:00
|
|
|
call_dissector_only(ip_handle, ip_payload_tvb, pinfo, pdcp_tree, NULL);
|
2013-12-16 15:03:41 +00:00
|
|
|
break;
|
|
|
|
case 0x60:
|
2013-12-16 23:08:09 +00:00
|
|
|
call_dissector_only(ipv6_handle, ip_payload_tvb, pinfo, pdcp_tree, NULL);
|
2013-12-16 15:03:41 +00:00
|
|
|
break;
|
|
|
|
default:
|
2013-12-16 23:08:09 +00:00
|
|
|
call_dissector_only(data_handle, ip_payload_tvb, pinfo, pdcp_tree, NULL);
|
2013-12-16 15:03:41 +00:00
|
|
|
break;
|
|
|
|
}
|
2013-12-17 18:43:24 +00:00
|
|
|
|
2013-12-16 15:03:41 +00:00
|
|
|
/* Freeze the columns again because we don't want other layers writing to info */
|
|
|
|
if (global_pdcp_lte_layer_to_show == ShowTrafficLayer) {
|
|
|
|
col_set_writable(pinfo->cinfo, FALSE);
|
|
|
|
}
|
2013-12-17 18:43:24 +00:00
|
|
|
|
2013-12-16 15:03:41 +00:00
|
|
|
}
|
|
|
|
else {
|
2013-12-17 14:49:21 +00:00
|
|
|
proto_tree_add_item(pdcp_tree, hf_pdcp_lte_user_plane_data, payload_tvb, offset, -1, ENC_NA);
|
2013-12-16 15:03:41 +00:00
|
|
|
}
|
|
|
|
}
|
2013-12-17 18:43:24 +00:00
|
|
|
|
2013-12-16 15:03:41 +00:00
|
|
|
write_pdu_label_and_info(root_ti, pinfo, "(%u bytes data)",
|
|
|
|
payload_length);
|
|
|
|
}
|
2013-12-17 18:43:24 +00:00
|
|
|
|
2013-12-16 15:03:41 +00:00
|
|
|
/* (there will be no signalling data left at this point) */
|
2013-12-17 18:43:24 +00:00
|
|
|
|
2013-12-16 15:03:41 +00:00
|
|
|
/* Let RLC write to columns again */
|
|
|
|
col_set_writable(pinfo->cinfo, global_pdcp_lte_layer_to_show == ShowRLCLayer);
|
2013-12-17 18:43:24 +00:00
|
|
|
|
2013-12-16 15:03:41 +00:00
|
|
|
/* DROPPING OUT HERE IF NOT DOING ROHC! */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/***************************/
|
|
|
|
/* ROHC packets */
|
|
|
|
/***************************/
|
2013-12-17 18:43:24 +00:00
|
|
|
|
2013-12-16 15:03:41 +00:00
|
|
|
/* Only attempt ROHC if configured to */
|
|
|
|
if (!global_pdcp_dissect_rohc) {
|
|
|
|
col_append_fstr(pinfo->cinfo, COL_PROTOCOL, "|ROHC(%s)",
|
|
|
|
val_to_str_const(p_pdcp_info->rohc.profile, rohc_profile_vals, "Unknown"));
|
|
|
|
return;
|
|
|
|
}
|
2013-12-17 18:43:24 +00:00
|
|
|
|
2013-12-16 15:03:41 +00:00
|
|
|
rohc_offset = offset;
|
2013-12-17 14:49:21 +00:00
|
|
|
rohc_tvb = tvb_new_subset_remaining(payload_tvb, rohc_offset);
|
2013-12-17 18:43:24 +00:00
|
|
|
|
2013-12-16 15:03:41 +00:00
|
|
|
/* Only enable writing to column if configured to show ROHC */
|
|
|
|
if (global_pdcp_lte_layer_to_show != ShowTrafficLayer) {
|
|
|
|
col_set_writable(pinfo->cinfo, FALSE);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
col_clear(pinfo->cinfo, COL_INFO);
|
|
|
|
}
|
2013-12-17 18:43:24 +00:00
|
|
|
|
2013-12-16 15:03:41 +00:00
|
|
|
/* Call the ROHC dissector */
|
|
|
|
call_dissector_with_data(rohc_handle, rohc_tvb, pinfo, tree, &p_pdcp_info->rohc);
|
2013-12-17 18:43:24 +00:00
|
|
|
|
2013-12-16 15:03:41 +00:00
|
|
|
/* Let RLC write to columns again */
|
|
|
|
col_set_writable(pinfo->cinfo, global_pdcp_lte_layer_to_show == ShowRLCLayer);
|
|
|
|
}
|
2012-04-01 14:52:48 +00:00
|
|
|
}
|
2009-01-26 12:18:32 +00:00
|
|
|
}
|
|
|
|
|
2012-01-14 20:14:43 +00:00
|
|
|
/* Initializes the hash tables each time a new
|
2010-11-22 13:28:49 +00:00
|
|
|
* file is loaded or re-loaded in wireshark */
|
2012-05-17 14:35:11 +00:00
|
|
|
static void pdcp_lte_init_protocol(void)
|
2010-11-22 13:28:49 +00:00
|
|
|
{
|
|
|
|
/* Destroy any existing hashes. */
|
|
|
|
if (pdcp_sequence_analysis_channel_hash) {
|
|
|
|
g_hash_table_destroy(pdcp_sequence_analysis_channel_hash);
|
|
|
|
}
|
2012-01-22 20:31:09 +00:00
|
|
|
if (pdcp_lte_sequence_analysis_report_hash) {
|
|
|
|
g_hash_table_destroy(pdcp_lte_sequence_analysis_report_hash);
|
2010-11-22 13:28:49 +00:00
|
|
|
}
|
2013-10-29 13:49:14 +00:00
|
|
|
if (pdcp_security_hash) {
|
|
|
|
g_hash_table_destroy(pdcp_security_hash);
|
|
|
|
}
|
2013-10-29 17:46:50 +00:00
|
|
|
if (pdcp_security_result_hash) {
|
|
|
|
g_hash_table_destroy(pdcp_security_result_hash);
|
|
|
|
}
|
2010-11-22 13:28:49 +00:00
|
|
|
|
|
|
|
/* Now create them over */
|
|
|
|
pdcp_sequence_analysis_channel_hash = g_hash_table_new(pdcp_channel_hash_func, pdcp_channel_equal);
|
2012-01-22 20:31:09 +00:00
|
|
|
pdcp_lte_sequence_analysis_report_hash = g_hash_table_new(pdcp_result_hash_func, pdcp_result_hash_equal);
|
2013-10-29 13:49:14 +00:00
|
|
|
pdcp_security_hash = g_hash_table_new(pdcp_lte_ueid_hash_func, pdcp_lte_ueid_hash_equal);
|
2013-10-29 17:46:50 +00:00
|
|
|
pdcp_security_result_hash = g_hash_table_new(pdcp_lte_ueid_frame_hash_func, pdcp_lte_ueid_frame_hash_equal);
|
2010-11-22 13:28:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-01-26 12:18:32 +00:00
|
|
|
void proto_register_pdcp(void)
|
|
|
|
{
|
|
|
|
static hf_register_info hf[] =
|
|
|
|
{
|
|
|
|
{ &hf_pdcp_lte_configuration,
|
|
|
|
{ "Configuration",
|
2009-05-13 09:36:42 +00:00
|
|
|
"pdcp-lte.configuration", FT_STRING, BASE_NONE, NULL, 0x0,
|
2010-01-25 16:45:46 +00:00
|
|
|
"Configuration info passed into dissector", HFILL
|
2009-01-26 12:18:32 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
{ &hf_pdcp_lte_rohc_compression,
|
2009-03-11 12:04:58 +00:00
|
|
|
{ "ROHC Compression",
|
2010-01-25 16:45:46 +00:00
|
|
|
"pdcp-lte.rohc.compression", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
|
|
|
NULL, HFILL
|
2009-01-26 12:18:32 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pdcp_lte_rohc_mode,
|
2010-01-25 16:45:46 +00:00
|
|
|
{ "ROHC Mode",
|
2009-05-13 09:36:42 +00:00
|
|
|
"pdcp-lte.rohc.mode", FT_UINT8, BASE_DEC, VALS(rohc_mode_vals), 0x0,
|
2010-01-25 16:45:46 +00:00
|
|
|
NULL, HFILL
|
2009-01-26 12:18:32 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pdcp_lte_rohc_rnd,
|
2013-11-22 16:52:28 +00:00
|
|
|
{ "RND",
|
2009-05-13 09:36:42 +00:00
|
|
|
"pdcp-lte.rohc.rnd", FT_UINT8, BASE_DEC, NULL, 0x0,
|
2009-01-26 12:18:32 +00:00
|
|
|
"RND of outer ip header", HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pdcp_lte_rohc_udp_checksum_present,
|
2013-11-22 16:52:28 +00:00
|
|
|
{ "UDP Checksum",
|
2009-05-13 09:36:42 +00:00
|
|
|
"pdcp-lte.rohc.checksum-present", FT_UINT8, BASE_DEC, NULL, 0x0,
|
2010-01-25 16:45:46 +00:00
|
|
|
"UDP Checksum present", HFILL
|
2009-01-26 12:18:32 +00:00
|
|
|
}
|
|
|
|
},
|
2009-05-13 09:36:42 +00:00
|
|
|
{ &hf_pdcp_lte_direction,
|
|
|
|
{ "Direction",
|
|
|
|
"pdcp-lte.direction", FT_UINT8, BASE_DEC, VALS(direction_vals), 0x0,
|
|
|
|
"Direction of message", HFILL
|
|
|
|
}
|
|
|
|
},
|
2010-11-05 18:00:35 +00:00
|
|
|
{ &hf_pdcp_lte_ueid,
|
|
|
|
{ "UE",
|
|
|
|
"pdcp-lte.ueid", FT_UINT16, BASE_DEC, 0, 0x0,
|
|
|
|
"UE Identifier", HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pdcp_lte_channel_type,
|
|
|
|
{ "Channel type",
|
|
|
|
"pdcp-lte.channel-type", FT_UINT8, BASE_DEC, VALS(logical_channel_vals), 0x0,
|
|
|
|
NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pdcp_lte_channel_id,
|
|
|
|
{ "Channel Id",
|
|
|
|
"pdcp-lte.channel-id", FT_UINT8, BASE_DEC, 0, 0x0,
|
|
|
|
NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
2009-01-26 12:18:32 +00:00
|
|
|
{ &hf_pdcp_lte_rohc_profile,
|
2009-03-11 12:04:58 +00:00
|
|
|
{ "ROHC profile",
|
2009-05-13 09:36:42 +00:00
|
|
|
"pdcp-lte.rohc.profile", FT_UINT8, BASE_DEC, VALS(rohc_profile_vals), 0x0,
|
2009-03-11 12:04:58 +00:00
|
|
|
"ROHC Mode", HFILL
|
2009-01-26 12:18:32 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pdcp_lte_no_header_pdu,
|
|
|
|
{ "No Header PDU",
|
2009-05-13 09:36:42 +00:00
|
|
|
"pdcp-lte.no-header_pdu", FT_UINT8, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL
|
2009-01-26 12:18:32 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pdcp_lte_plane,
|
|
|
|
{ "Plane",
|
2009-05-13 09:36:42 +00:00
|
|
|
"pdcp-lte.plane", FT_UINT8, BASE_DEC, VALS(pdcp_plane_vals), 0x0,
|
2010-01-25 16:45:46 +00:00
|
|
|
NULL, HFILL
|
2009-01-26 12:18:32 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pdcp_lte_seqnum_length,
|
|
|
|
{ "Seqnum length",
|
2009-05-13 09:36:42 +00:00
|
|
|
"pdcp-lte.seqnum_length", FT_UINT8, BASE_DEC, NULL, 0x0,
|
2009-01-26 12:18:32 +00:00
|
|
|
"Sequence Number Length", HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
{ &hf_pdcp_lte_cid_inclusion_info,
|
|
|
|
{ "CID Inclusion Info",
|
2009-05-13 09:36:42 +00:00
|
|
|
"pdcp-lte.cid-inclusion-info", FT_UINT8, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL
|
2009-01-26 12:18:32 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pdcp_lte_large_cid_present,
|
|
|
|
{ "Large CID Present",
|
2009-05-13 09:36:42 +00:00
|
|
|
"pdcp-lte.large-cid-present", FT_UINT8, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL
|
2009-01-26 12:18:32 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2012-02-03 16:44:56 +00:00
|
|
|
{ &hf_pdcp_lte_control_plane_reserved,
|
|
|
|
{ "Reserved",
|
|
|
|
"pdcp-lte.reserved", FT_UINT8, BASE_DEC, NULL, 0xe0,
|
|
|
|
NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
2009-01-26 12:18:32 +00:00
|
|
|
{ &hf_pdcp_lte_seq_num_5,
|
|
|
|
{ "Seq Num",
|
2009-05-13 09:36:42 +00:00
|
|
|
"pdcp-lte.seq-num", FT_UINT8, BASE_DEC, NULL, 0x1f,
|
2009-01-26 12:18:32 +00:00
|
|
|
"PDCP Seq num", HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pdcp_lte_seq_num_7,
|
|
|
|
{ "Seq Num",
|
2009-05-13 09:36:42 +00:00
|
|
|
"pdcp-lte.seq-num", FT_UINT8, BASE_DEC, NULL, 0x7f,
|
2009-01-26 12:18:32 +00:00
|
|
|
"PDCP Seq num", HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pdcp_lte_reserved3,
|
|
|
|
{ "Reserved",
|
2009-05-13 09:36:42 +00:00
|
|
|
"pdcp-lte.reserved3", FT_UINT8, BASE_HEX, NULL, 0x70,
|
2009-01-26 12:18:32 +00:00
|
|
|
"3 reserved bits", HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pdcp_lte_seq_num_12,
|
|
|
|
{ "Seq Num",
|
2009-05-13 09:36:42 +00:00
|
|
|
"pdcp-lte.seq-num", FT_UINT16, BASE_DEC, NULL, 0x0fff,
|
2009-01-26 12:18:32 +00:00
|
|
|
"PDCP Seq num", HFILL
|
|
|
|
}
|
|
|
|
},
|
2012-09-21 20:12:32 +00:00
|
|
|
{ &hf_pdcp_lte_seq_num_15,
|
|
|
|
{ "Seq Num",
|
|
|
|
"pdcp-lte.seq-num", FT_UINT16, BASE_DEC, NULL, 0x7fff,
|
|
|
|
"PDCP Seq num", HFILL
|
|
|
|
}
|
|
|
|
},
|
2009-01-26 12:18:32 +00:00
|
|
|
{ &hf_pdcp_lte_signalling_data,
|
|
|
|
{ "Signalling Data",
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
"pdcp-lte.signalling-data", FT_BYTES, BASE_NONE, NULL, 0x0,
|
|
|
|
NULL, HFILL
|
2009-01-26 12:18:32 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pdcp_lte_mac,
|
|
|
|
{ "MAC",
|
2009-05-13 09:36:42 +00:00
|
|
|
"pdcp-lte.mac", FT_UINT32, BASE_HEX_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL
|
2009-01-26 12:18:32 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pdcp_lte_data_control,
|
|
|
|
{ "PDU Type",
|
2009-05-13 09:36:42 +00:00
|
|
|
"pdcp-lte.pdu-type", FT_UINT8, BASE_HEX, VALS(pdu_type_vals), 0x80,
|
2010-09-23 21:46:31 +00:00
|
|
|
NULL, HFILL
|
2009-01-26 12:18:32 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pdcp_lte_user_plane_data,
|
|
|
|
{ "User-Plane Data",
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
"pdcp-lte.user-data", FT_BYTES, BASE_NONE, NULL, 0x0,
|
|
|
|
NULL, HFILL
|
2009-01-26 12:18:32 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pdcp_lte_control_pdu_type,
|
|
|
|
{ "Control PDU Type",
|
2009-05-13 09:36:42 +00:00
|
|
|
"pdcp-lte.control-pdu-type", FT_UINT8, BASE_HEX, VALS(control_pdu_type_vals), 0x70,
|
2010-01-25 16:45:46 +00:00
|
|
|
NULL, HFILL
|
2009-01-26 12:18:32 +00:00
|
|
|
}
|
|
|
|
},
|
2009-05-08 23:29:42 +00:00
|
|
|
{ &hf_pdcp_lte_fms,
|
|
|
|
{ "First Missing Sequence Number",
|
2009-05-13 09:36:42 +00:00
|
|
|
"pdcp-lte.fms", FT_UINT16, BASE_DEC, NULL, 0x0fff,
|
2009-05-08 23:29:42 +00:00
|
|
|
"First Missing PDCP Sequence Number", HFILL
|
2009-01-26 12:18:32 +00:00
|
|
|
}
|
|
|
|
},
|
2012-09-21 20:12:32 +00:00
|
|
|
{ &hf_pdcp_lte_reserved4,
|
|
|
|
{ "Reserved",
|
|
|
|
"pdcp-lte.reserved4", FT_UINT16, BASE_HEX, NULL, 0x0f80,
|
|
|
|
"5 reserved bits", HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pdcp_lte_fms2,
|
|
|
|
{ "First Missing Sequence Number",
|
|
|
|
"pdcp-lte.fms", FT_UINT16, BASE_DEC, NULL, 0x07fff,
|
|
|
|
"First Missing PDCP Sequence Number", HFILL
|
|
|
|
}
|
|
|
|
},
|
2009-01-26 12:18:32 +00:00
|
|
|
{ &hf_pdcp_lte_bitmap,
|
|
|
|
{ "Bitmap",
|
2009-05-13 09:36:42 +00:00
|
|
|
"pdcp-lte.bitmap", FT_NONE, BASE_NONE, NULL, 0x0,
|
2009-01-26 12:18:32 +00:00
|
|
|
"Status report bitmap (0=error, 1=OK)", HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2010-11-22 13:28:49 +00:00
|
|
|
|
|
|
|
{ &hf_pdcp_lte_sequence_analysis,
|
|
|
|
{ "Sequence Analysis",
|
|
|
|
"pdcp-lte.sequence-analysis", FT_STRING, BASE_NONE, 0, 0x0,
|
|
|
|
NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pdcp_lte_sequence_analysis_ok,
|
|
|
|
{ "OK",
|
|
|
|
"pdcp-lte.sequence-analysis.ok", FT_BOOLEAN, BASE_NONE, 0, 0x0,
|
|
|
|
NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pdcp_lte_sequence_analysis_previous_frame,
|
|
|
|
{ "Previous frame for channel",
|
|
|
|
"pdcp-lte.sequence-analysis.previous-frame", FT_FRAMENUM, BASE_NONE, 0, 0x0,
|
|
|
|
NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
2012-01-22 03:02:10 +00:00
|
|
|
{ &hf_pdcp_lte_sequence_analysis_next_frame,
|
|
|
|
{ "Next frame for channel",
|
|
|
|
"pdcp-lte.sequence-analysis.next-frame", FT_FRAMENUM, BASE_NONE, 0, 0x0,
|
|
|
|
NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
2010-11-22 13:28:49 +00:00
|
|
|
{ &hf_pdcp_lte_sequence_analysis_expected_sn,
|
|
|
|
{ "Expected SN",
|
|
|
|
"pdcp-lte.sequence-analysis.expected-sn", FT_UINT16, BASE_DEC, 0, 0x0,
|
|
|
|
NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pdcp_lte_sequence_analysis_skipped,
|
|
|
|
{ "Skipped frames",
|
|
|
|
"pdcp-lte.sequence-analysis.skipped-frames", FT_BOOLEAN, BASE_NONE, 0, 0x0,
|
|
|
|
NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pdcp_lte_sequence_analysis_repeated,
|
|
|
|
{ "Repeated frame",
|
|
|
|
"pdcp-lte.sequence-analysis.repeated-frame", FT_BOOLEAN, BASE_NONE, 0, 0x0,
|
|
|
|
NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2013-10-29 17:46:50 +00:00
|
|
|
{ &hf_pdcp_lte_security,
|
|
|
|
{ "Security Config",
|
|
|
|
"pdcp-lte.security-cofig", FT_STRING, BASE_NONE, 0, 0x0,
|
|
|
|
NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pdcp_lte_security_setup_frame,
|
|
|
|
{ "Configuration frame",
|
|
|
|
"pdcp-lte.security-config.setup-frame", FT_FRAMENUM, BASE_NONE, 0, 0x0,
|
|
|
|
NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pdcp_lte_security_integrity_algorithm,
|
|
|
|
{ "Integrity Algorithm",
|
|
|
|
"pdcp-lte.security-config.integrity", FT_UINT16, BASE_DEC, VALS(integrity_algorithm_vals), 0x0,
|
|
|
|
NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pdcp_lte_security_ciphering_algorithm,
|
|
|
|
{ "Ciphering Algorithm",
|
|
|
|
"pdcp-lte.security-config.ciphering", FT_UINT16, BASE_DEC, VALS(ciphering_algorithm_vals), 0x0,
|
|
|
|
NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
2013-12-12 11:07:53 +00:00
|
|
|
{ &hf_pdcp_lte_security_bearer,
|
|
|
|
{ "BEARER",
|
|
|
|
"pdcp-lte.security-config.bearer", FT_UINT8, BASE_DEC, NULL, 0x0,
|
|
|
|
NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pdcp_lte_security_direction,
|
|
|
|
{ "DIRECTION",
|
|
|
|
"pdcp-lte.security-config.direction", FT_UINT8, BASE_DEC, VALS(direction_vals), 0x0,
|
|
|
|
NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pdcp_lte_security_count,
|
|
|
|
{ "COUNT",
|
|
|
|
"pdcp-lte.security-config.count", FT_UINT32, BASE_DEC, NULL, 0x0,
|
|
|
|
NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
2013-12-25 08:44:43 +00:00
|
|
|
{ &hf_pdcp_lte_security_cipher_key,
|
|
|
|
{ "CIPHER KEY",
|
|
|
|
"pdcp-lte.security-config.cipher-key", FT_STRING, BASE_NONE, NULL, 0x0,
|
|
|
|
NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pdcp_lte_security_integrity_key,
|
|
|
|
{ "INTEGRITY KEY",
|
|
|
|
"pdcp-lte.security-config.integrity-key", FT_STRING, BASE_NONE, NULL, 0x0,
|
2013-12-16 11:47:04 +00:00
|
|
|
NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
2009-01-26 12:18:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static gint *ett[] =
|
|
|
|
{
|
|
|
|
&ett_pdcp,
|
|
|
|
&ett_pdcp_configuration,
|
|
|
|
&ett_pdcp_packet,
|
2010-11-22 13:28:49 +00:00
|
|
|
&ett_pdcp_lte_sequence_analysis,
|
2013-10-29 17:46:50 +00:00
|
|
|
&ett_pdcp_report_bitmap,
|
|
|
|
&ett_pdcp_security
|
2009-01-26 12:18:32 +00:00
|
|
|
};
|
|
|
|
|
2013-09-05 01:05:16 +00:00
|
|
|
static ei_register_info ei[] = {
|
2013-11-22 17:18:11 +00:00
|
|
|
{ &ei_pdcp_lte_sequence_analysis_sn_missing, { "pdcp-lte.sequence-analysis.sn-missing", PI_SEQUENCE, PI_WARN, "PDCP SN missing", EXPFILL }},
|
|
|
|
{ &ei_pdcp_lte_sequence_analysis_sn_repeated, { "pdcp-lte.sequence-analysis.sn-repeated", PI_SEQUENCE, PI_WARN, "PDCP SN repeated", EXPFILL }},
|
|
|
|
{ &ei_pdcp_lte_sequence_analysis_wrong_sequence_number, { "pdcp-lte.sequence-analysis.wrong-sequence-number", PI_SEQUENCE, PI_WARN, "Wrong Sequence Number", EXPFILL }},
|
|
|
|
{ &ei_pdcp_lte_reserved_bits_not_zero, { "pdcp-lte.reserved-bits-not-zero", PI_MALFORMED, PI_ERROR, "Reserved bits not zero", EXPFILL }},
|
2013-12-24 00:09:41 +00:00
|
|
|
{ &ei_pdcp_lte_digest_wrong, { "pdcp-lte.maci-wrong", PI_SEQUENCE, PI_ERROR, "MAC-I doesn't match expected value", EXPFILL }}
|
2013-09-05 01:05:16 +00:00
|
|
|
};
|
|
|
|
|
2012-11-29 20:15:37 +00:00
|
|
|
static const enum_val_t sequence_analysis_vals[] = {
|
2012-01-22 03:02:10 +00:00
|
|
|
{"no-analysis", "No-Analysis", FALSE},
|
|
|
|
{"rlc-only", "Only-RLC-frames", SEQUENCE_ANALYSIS_RLC_ONLY},
|
|
|
|
{"pdcp-only", "Only-PDCP-frames", SEQUENCE_ANALYSIS_PDCP_ONLY},
|
|
|
|
{NULL, NULL, -1}
|
|
|
|
};
|
|
|
|
|
2012-11-29 20:15:37 +00:00
|
|
|
static const enum_val_t show_info_col_vals[] = {
|
2012-03-08 13:19:41 +00:00
|
|
|
{"show-rlc", "RLC Info", ShowRLCLayer},
|
|
|
|
{"show-pdcp", "PDCP Info", ShowPDCPLayer},
|
|
|
|
{"show-traffic", "Traffic Info", ShowTrafficLayer},
|
|
|
|
{NULL, NULL, -1}
|
|
|
|
};
|
|
|
|
|
2013-12-16 11:18:53 +00:00
|
|
|
static uat_field_t ue_keys_uat_flds[] = {
|
2013-12-16 11:47:04 +00:00
|
|
|
UAT_FLD_DEC(uat_ue_keys_records, ueid, "UEId", "UE Identifier of UE associated with keys"),
|
2013-12-23 10:56:51 +00:00
|
|
|
UAT_FLD_CSTRING(uat_ue_keys_records, rrcCipherKeyString, "RRC Cipher Key", "Key for deciphering signalling messages"),
|
|
|
|
UAT_FLD_CSTRING(uat_ue_keys_records, upCipherKeyString, "User-Plane Cipher Key", "Key for deciphering user-plane messages"),
|
|
|
|
UAT_FLD_CSTRING(uat_ue_keys_records, rrcIntegrityKeyString, "RRC Integrity Key", "Key for deciphering user-plane messages"),
|
2013-12-16 11:18:53 +00:00
|
|
|
UAT_END_FIELDS
|
|
|
|
};
|
|
|
|
|
2009-01-26 12:18:32 +00:00
|
|
|
module_t *pdcp_lte_module;
|
2013-09-05 01:05:16 +00:00
|
|
|
expert_module_t* expert_pdcp_lte;
|
2012-03-08 13:19:41 +00:00
|
|
|
|
2009-01-26 12:18:32 +00:00
|
|
|
/* Register protocol. */
|
|
|
|
proto_pdcp_lte = proto_register_protocol("PDCP-LTE", "PDCP-LTE", "pdcp-lte");
|
|
|
|
proto_register_field_array(proto_pdcp_lte, hf, array_length(hf));
|
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
2013-09-05 01:05:16 +00:00
|
|
|
expert_pdcp_lte = expert_register_protocol(proto_pdcp_lte);
|
|
|
|
expert_register_field_array(expert_pdcp_lte, ei, array_length(ei));
|
2009-01-26 12:18:32 +00:00
|
|
|
|
|
|
|
/* Allow other dissectors to find this one by name. */
|
|
|
|
register_dissector("pdcp-lte", dissect_pdcp_lte, proto_pdcp_lte);
|
|
|
|
|
2009-01-26 21:41:44 +00:00
|
|
|
pdcp_lte_module = prefs_register_protocol(proto_pdcp_lte, NULL);
|
2009-01-26 12:18:32 +00:00
|
|
|
|
2012-04-09 01:50:26 +00:00
|
|
|
/* Obsolete preferences */
|
|
|
|
prefs_register_obsolete_preference(pdcp_lte_module, "show_feedback_option_tag_length");
|
|
|
|
|
2013-12-17 16:40:42 +00:00
|
|
|
|
2009-01-26 12:18:32 +00:00
|
|
|
/* Dissect uncompressed user-plane data as IP */
|
|
|
|
prefs_register_bool_preference(pdcp_lte_module, "show_user_plane_as_ip",
|
|
|
|
"Show uncompressed User-Plane data as IP",
|
|
|
|
"Show uncompressed User-Plane data as IP",
|
|
|
|
&global_pdcp_dissect_user_plane_as_ip);
|
|
|
|
|
|
|
|
/* Dissect unciphered signalling data as RRC */
|
|
|
|
prefs_register_bool_preference(pdcp_lte_module, "show_signalling_plane_as_rrc",
|
|
|
|
"Show unciphered Signalling-Plane data as RRC",
|
|
|
|
"Show unciphered Signalling-Plane data as RRC",
|
|
|
|
&global_pdcp_dissect_signalling_plane_as_rrc);
|
|
|
|
|
2010-11-02 15:17:58 +00:00
|
|
|
/* Check for missing sequence numbers */
|
2012-01-22 03:02:10 +00:00
|
|
|
prefs_register_enum_preference(pdcp_lte_module, "check_sequence_numbers",
|
2010-11-22 13:28:49 +00:00
|
|
|
"Do sequence number analysis",
|
|
|
|
"Do sequence number analysis",
|
2012-01-22 03:02:10 +00:00
|
|
|
&global_pdcp_check_sequence_numbers, sequence_analysis_vals, FALSE);
|
2010-11-02 15:17:58 +00:00
|
|
|
|
2012-08-21 21:37:31 +00:00
|
|
|
/* Attempt to dissect ROHC messages */
|
2009-01-26 12:18:32 +00:00
|
|
|
prefs_register_bool_preference(pdcp_lte_module, "dissect_rohc",
|
|
|
|
"Attempt to decode ROHC data",
|
|
|
|
"Attempt to decode ROHC data",
|
|
|
|
&global_pdcp_dissect_rohc);
|
|
|
|
|
2009-12-11 14:31:40 +00:00
|
|
|
prefs_register_bool_preference(pdcp_lte_module, "heuristic_pdcp_lte_over_udp",
|
|
|
|
"Try Heuristic LTE-PDCP over UDP framing",
|
|
|
|
"When enabled, use heuristic dissector to find PDCP-LTE frames sent with "
|
|
|
|
"UDP framing",
|
|
|
|
&global_pdcp_lte_heur);
|
2010-11-22 13:28:49 +00:00
|
|
|
|
2012-03-08 13:19:41 +00:00
|
|
|
prefs_register_enum_preference(pdcp_lte_module, "layer_to_show",
|
|
|
|
"Which layer info to show in Info column",
|
|
|
|
"Can show RLC, PDCP or Traffic layer info in Info column",
|
|
|
|
&global_pdcp_lte_layer_to_show, show_info_col_vals, FALSE);
|
|
|
|
|
2013-12-17 16:40:42 +00:00
|
|
|
ue_keys_uat = uat_new("PDCP UE security keys",
|
|
|
|
sizeof(uat_ue_keys_record_t), /* record size */
|
|
|
|
"pdcp_lte_ue_keys", /* filename */
|
|
|
|
TRUE, /* from_profile */
|
2014-01-30 17:43:52 +00:00
|
|
|
&uat_ue_keys_records, /* data_ptr */
|
2013-12-17 16:40:42 +00:00
|
|
|
&num_ue_keys_uat, /* numitems_ptr */
|
|
|
|
UAT_AFFECTS_DISSECTION, /* affects dissection of packets, but not set of named fields */
|
|
|
|
NULL, /* help */
|
|
|
|
uat_ue_keys_record_copy_cb, /* copy callback */
|
2013-12-18 12:05:11 +00:00
|
|
|
uat_ue_keys_record_update_cb, /* update callback */
|
2013-12-17 16:40:42 +00:00
|
|
|
uat_ue_keys_record_free_cb, /* free callback */
|
|
|
|
NULL, /* post update callback */
|
|
|
|
ue_keys_uat_flds); /* UAT field definitions */
|
|
|
|
|
|
|
|
prefs_register_uat_preference(pdcp_lte_module,
|
|
|
|
"ue_keys_table",
|
|
|
|
"PDCP UE Keys",
|
|
|
|
"Preconfigured PDCP keys",
|
|
|
|
ue_keys_uat);
|
|
|
|
|
|
|
|
/* Attempt to decipher RRC messages */
|
|
|
|
prefs_register_bool_preference(pdcp_lte_module, "decipher_signalling",
|
|
|
|
"Attempt to decipher Signalling (RRC) SDUs",
|
2014-01-14 15:07:20 +00:00
|
|
|
"N.B. only possible if build with algorithm support, and have key available and configured",
|
2013-12-17 16:40:42 +00:00
|
|
|
&global_pdcp_decipher_signalling);
|
|
|
|
|
|
|
|
/* Attempt to decipher user-plane messages */
|
|
|
|
prefs_register_bool_preference(pdcp_lte_module, "decipher_userplane",
|
|
|
|
"Attempt to decipher User-plane (IP) SDUs",
|
2014-01-14 15:07:20 +00:00
|
|
|
"N.B. only possible if build with algorithm support, and have key available and configured",
|
2013-12-17 16:40:42 +00:00
|
|
|
&global_pdcp_decipher_userplane);
|
2013-12-23 10:56:51 +00:00
|
|
|
|
|
|
|
/* Attempt to verify RRC integrity/authentication digest */
|
|
|
|
prefs_register_bool_preference(pdcp_lte_module, "verify_integrity",
|
|
|
|
"Attempt to check integrity calculation",
|
2014-01-14 15:07:20 +00:00
|
|
|
"N.B. only possible if build with algorithm support, and have key available and configured",
|
2013-12-23 13:43:13 +00:00
|
|
|
&global_pdcp_check_integrity);
|
2013-12-16 11:18:53 +00:00
|
|
|
|
2010-11-22 13:28:49 +00:00
|
|
|
register_init_routine(&pdcp_lte_init_protocol);
|
2009-01-26 12:18:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void proto_reg_handoff_pdcp_lte(void)
|
|
|
|
{
|
2010-10-10 20:28:22 +00:00
|
|
|
/* Add as a heuristic UDP dissector */
|
|
|
|
heur_dissector_add("udp", dissect_pdcp_lte_heur, proto_pdcp_lte);
|
2009-12-11 14:31:40 +00:00
|
|
|
|
2012-05-17 14:35:11 +00:00
|
|
|
ip_handle = find_dissector("ip");
|
2011-07-25 13:47:26 +00:00
|
|
|
ipv6_handle = find_dissector("ipv6");
|
2011-12-15 21:00:15 +00:00
|
|
|
rohc_handle = find_dissector("rohc");
|
2011-07-25 13:47:26 +00:00
|
|
|
data_handle = find_dissector("data");
|
2009-01-26 12:18:32 +00:00
|
|
|
}
|
|
|
|
|
2013-12-17 18:43:24 +00:00
|
|
|
/*
|
|
|
|
* Editor modelines
|
|
|
|
*
|
|
|
|
* Local Variables:
|
|
|
|
* c-basic-offset: 4
|
|
|
|
* tab-width: 8
|
|
|
|
* indent-tabs-mode: nil
|
|
|
|
* End:
|
|
|
|
*
|
|
|
|
* ex: set shiftwidth=4 tabstop=8 expandtab:
|
|
|
|
* :indentSize=4:tabSize=8:noTabs=true:
|
|
|
|
*/
|