/* TODO:
- - Update to latest version of 36.323
- Complete ROHC support for RTP and extend to other profiles (including ROHCv2)
- - Support for decryption
+ - Support for deciphering
- Verify MAC authentication bytes
- - Call LTE RRC dissector for uncompressed, signalling payloads
*/
/* Initialize the protocol and registered fields. */
int proto_pdcp_lte = -1;
+extern int proto_rlc_lte;
+
/* Configuration (info known outside of PDU) */
static int hf_pdcp_lte_configuration = -1;
static int hf_pdcp_lte_direction = -1;
+static int hf_pdcp_lte_ueid = -1;
+static int hf_pdcp_lte_channel_type = -1;
+static int hf_pdcp_lte_channel_id = -1;
static int hf_pdcp_lte_rohc = -1;
static int hf_pdcp_lte_rohc_compression = -1;
static int hf_pdcp_lte_rohc_mode = -1;
static int hf_pdcp_lte_rohc_udp_checksum = -1;
static int hf_pdcp_lte_rohc_payload = -1;
+/* 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;
+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;
+
+
+
/* Protocol subtree. */
static int ett_pdcp = -1;
static int ett_pdcp_configuration = -1;
static int ett_pdcp_packet = -1;
+static int ett_pdcp_lte_sequence_analysis = -1;
static int ett_pdcp_rohc = -1;
static int ett_pdcp_rohc_static_ipv4 = -1;
static int ett_pdcp_rohc_static_udp = -1;
{ 0, NULL }
};
+static const value_string logical_channel_vals[] = {
+ { Channel_DCCH, "DCCH"},
+ { Channel_BCCH, "BCCH"},
+ { Channel_CCCH, "CCCH"},
+ { Channel_PCCH, "PCCH"},
+ { 0, NULL}
+};
static const value_string rohc_mode_vals[] = {
{ UNIDIRECTIONAL, "Unidirectional" },
};
-/* TODO: add more */
+/* Values taken from:
+ http://www.iana.org/assignments/rohc-pro-ids/rohc-pro-ids.txt */
static const value_string rohc_profile_vals[] = {
- { 0, "Uncompressed" },
- { 1, "RTP" },
- { 2, "UDP" },
- { 3, "ESP/IP" },
- { 0, NULL }
+ { 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 }
};
static const value_string pdu_type_vals[] = {
};
-dissector_handle_t ip_handle = 0;
+static dissector_handle_t ip_handle;
/* Preference variables */
static gboolean global_pdcp_show_feedback_option_tag_length = FALSE;
static gboolean global_pdcp_dissect_user_plane_as_ip = FALSE;
static gboolean global_pdcp_dissect_signalling_plane_as_rrc = FALSE;
+static gboolean global_pdcp_check_sequence_numbers = FALSE;
static gboolean global_pdcp_dissect_rohc = FALSE;
+
+/**************************************************/
+/* Sequence number analysis */
+
+/* Channel key */
+typedef struct
+{
+ guint16 ueId;
+ LogicalChannelType channelType;
+ guint16 channelId;
+ guint8 direction;
+} pdcp_channel_hash_key;
+
+/* Channel state */
+typedef struct
+{
+ guint16 previousSequenceNumber;
+ guint32 previousFrameNum;
+} 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)
+{
+ const pdcp_channel_hash_key* val1 = v;
+ const pdcp_channel_hash_key* val2 = v2;
+
+ /* All fields must match */
+ return (memcmp(val1, val2, sizeof(pdcp_channel_hash_key)) == 0);
+}
+
+/* Compute a hash value for a given key. */
+static guint pdcp_channel_hash_func(gconstpointer v)
+{
+ const pdcp_channel_hash_key* val1 = v;
+
+ /* TODO: use multipliers */
+ return val1->ueId + val1->channelType + val1->channelId + val1->direction;
+}
+
+/* Hash table functions for frame reports */
+
+/* TODO: copied from packet-rlc-lte.c. extern, or add to lib? */
+/* Equal keys */
+static gint pdcp_frame_equal(gconstpointer v, gconstpointer v2)
+{
+ return (v == v2);
+}
+
+/* Compute a hash value for a given key. */
+static guint pdcp_frame_hash_func(gconstpointer v)
+{
+ return GPOINTER_TO_UINT(v);
+}
+
+
+/* Info to attach to frame when first read, recording what to show about sequence */
+typedef struct
+{
+ gboolean sequenceExpectedCorrect;
+ guint16 sequenceExpected;
+ guint32 previousFrameNum;
+
+ guint16 firstSN;
+ guint16 lastSN;
+
+ enum { SN_OK, SN_Repeated, SN_MAC_Retx, SN_Retx, SN_Missing} state;
+} pdcp_sequence_report_in_frame;
+
+/* The sequence analysis frame report hash table instance itself */
+static GHashTable *pdcp_lte_frame_sequence_analysis_report_hash = NULL;
+
+
+/* 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,
+ packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb)
+{
+ proto_tree *seqnum_tree;
+ proto_item *seqnum_ti;
+ 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 */
+ ti = proto_tree_add_uint(seqnum_tree, hf_pdcp_lte_sequence_analysis_expected_sn,
+ tvb, 0, 0, p->sequenceExpected);
+ PROTO_ITEM_SET_GENERATED(ti);
+
+ /* Make sure we have recognised SN length */
+ 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:
+ break;
+ default:
+ DISSECTOR_ASSERT_NOT_REACHED();
+ break;
+ }
+
+ switch (p->state) {
+ case SN_OK:
+ ti = proto_tree_add_boolean(seqnum_tree, hf_pdcp_lte_sequence_analysis_ok,
+ tvb, 0, 0, TRUE);
+ PROTO_ITEM_SET_GENERATED(ti);
+ proto_item_append_text(seqnum_ti, " - OK");
+ 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) {
+ expert_add_info_format(pinfo, ti, PI_SEQUENCE, PI_WARN,
+ "PDCP SNs (%u to %u) missing for %s on UE %u",
+ p->firstSN, p->lastSN,
+ val_to_str_const(p_pdcp_lte_info->direction, direction_vals, "Unknown"),
+ p_pdcp_lte_info->ueid);
+ proto_item_append_text(seqnum_ti, " - SNs missing (%u to %u)",
+ p->firstSN, p->lastSN);
+ }
+ else {
+ expert_add_info_format(pinfo, ti, PI_SEQUENCE, PI_WARN,
+ "PDCP SN (%u) missing for %s on UE %u",
+ p->firstSN,
+ val_to_str_const(p_pdcp_lte_info->direction, direction_vals, "Unknown"),
+ p_pdcp_lte_info->ueid);
+ 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);
+ expert_add_info_format(pinfo, ti, PI_SEQUENCE, PI_WARN,
+ "PDCP SN (%u) repeated for %s for UE %u",
+ p->firstSN,
+ val_to_str_const(p_pdcp_lte_info->direction, direction_vals, "Unknown"),
+ p_pdcp_lte_info->ueid);
+ proto_item_append_text(seqnum_ti, "- SN %u Repeated",
+ p->firstSN);
+ break;
+
+ default:
+ /* Incorrect sequence number */
+ expert_add_info_format(pinfo, ti, PI_SEQUENCE, PI_WARN,
+ "Wrong Sequence Number for %s on UE %u - got %u, expected %u",
+ val_to_str_const(p_pdcp_lte_info->direction, direction_vals, "Unknown"),
+ p_pdcp_lte_info->ueid, sequenceNumber, p->sequenceExpected);
+ 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,
+ proto_tree *tree)
+{
+ pdcp_channel_hash_key channel_key;
+ pdcp_channel_hash_key *p_channel_key;
+ 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;
+
+ /* If find stat_report_in_frame already, use that and get out */
+ if (pinfo->fd->flags.visited) {
+ p_report_in_frame = (pdcp_sequence_report_in_frame*)g_hash_table_lookup(pdcp_lte_frame_sequence_analysis_report_hash,
+ &pinfo->fd->num);
+ if (p_report_in_frame != NULL) {
+ addChannelSequenceInfo(p_report_in_frame, p_pdcp_lte_info,
+ sequenceNumber,
+ pinfo, tree, tvb);
+ return;
+ }
+ else {
+ /* Give up - we must have tried already... */
+ return;
+ }
+ }
+
+
+ /**************************************************/
+ /* Create or find an entry for this channel state */
+ memset(&channel_key, 0, sizeof(channel_key));
+ channel_key.ueId = p_pdcp_lte_info->ueid;
+ channel_key.channelType = p_pdcp_lte_info->channelType;
+ channel_key.channelId = p_pdcp_lte_info->channelId;
+ channel_key.direction = p_pdcp_lte_info->direction;
+
+ /* Do the table lookup */
+ p_channel_status = (pdcp_channel_status*)g_hash_table_lookup(pdcp_sequence_analysis_channel_hash, &channel_key);
+
+ /* Create table entry if necessary */
+ if (p_channel_status == NULL) {
+ createdChannel = TRUE;
+
+ /* Allocate a new value and duplicate key contents */
+ p_channel_status = se_alloc0(sizeof(pdcp_channel_status));
+ p_channel_key = se_memdup(&channel_key, sizeof(pdcp_channel_hash_key));
+
+ /* Add entry */
+ g_hash_table_insert(pdcp_sequence_analysis_channel_hash, p_channel_key, p_channel_status);
+ }
+
+ /* Create space for frame state_report */
+ p_report_in_frame = se_alloc(sizeof(pdcp_sequence_report_in_frame));
+
+ 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;
+ default:
+ DISSECTOR_ASSERT_NOT_REACHED();
+ break;
+ }
+
+ /* Work out expected sequence number */
+ if (!createdChannel) {
+ expectedSequenceNumber = (p_channel_status->previousSequenceNumber + 1) % snLimit;
+ }
+
+ /* Set report for this frame */
+ /* For PDCP, sequence number is always expectedSequence number */
+ p_report_in_frame->sequenceExpectedCorrect = (sequenceNumber == expectedSequenceNumber);
+
+ /* 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;
+
+ /* Update channel status to remember *this* frame */
+ p_channel_status->previousFrameNum = pinfo->fd->num;
+ p_channel_status->previousSequenceNumber = sequenceNumber;
+ }
+
+ /* Associate with this frame number */
+ g_hash_table_insert(pdcp_lte_frame_sequence_analysis_report_hash, &pinfo->fd->num, p_report_in_frame);
+
+ /* Add state report for this frame into tree */
+ addChannelSequenceInfo(p_report_in_frame, p_pdcp_lte_info, sequenceNumber,
+ pinfo, tree, tvb);
+}
+
+
+/* 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);
+ proto_item_append_text(pdu_ti, "%s", info_buffer);
+}
+
+
+
+/***************************************************************/
+
+
/* Dissect a Large-CID field.
Return following offset */
static int dissect_large_cid(proto_tree *tree,
proto_item *root_ti;
int tree_start_offset = offset;
guint8 rx;
- guint8 contributing_csrcs;
+ /*guint8 contributing_csrcs;*/
guint16 sequence_number;
guint32 timestamp;
guint8 tis=0, tss=0;
/* V | P | RX | CC */
rx = tvb_get_guint8(tvb, offset) & 0x10;
proto_tree_add_item(dynamic_rtp_tree, hf_pdcp_lte_rohc_dynamic_rtp_rx, tvb, offset, 1, FALSE);
- contributing_csrcs = tvb_get_guint8(tvb, offset) & 0x0f;
+ /*contributing_csrcs = tvb_get_guint8(tvb, offset) & 0x0f;*/
proto_tree_add_item(dynamic_rtp_tree, hf_pdcp_lte_rohc_dynamic_rtp_cc, tvb, offset, 1, FALSE);
offset += 1;
-static int dissect_pdcp_irdyn_packet(proto_tree *tree _U_,
+static int dissect_pdcp_irdyn_packet(proto_tree *tree,
proto_item *root_item,
- tvbuff_t *tvb _U_,
+ tvbuff_t *tvb,
int offset,
- struct pdcp_lte_info *p_pdcp_info _U_,
+ struct pdcp_lte_info *p_pdcp_info,
packet_info *pinfo)
{
col_append_str(pinfo->cinfo, COL_INFO, " IRDYN");
tvbuff_t *tvb,
int offset,
int size,
- struct pdcp_lte_info *p_pdcp_info _U_,
- packet_info *pinfo _U_)
+ struct pdcp_lte_info *p_pdcp_info,
+ packet_info *pinfo)
{
proto_item *ti;
guint8 ack_type;
proto_item *root_item,
tvbuff_t *tvb,
int offset,
- struct pdcp_lte_info *p_pdcp_info _U_,
+ struct pdcp_lte_info *p_pdcp_info,
packet_info *pinfo)
{
guint8 sn;
p_pdcp_info->plane);
PROTO_ITEM_SET_GENERATED(ti);
+ /* 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);
+ }
+
+
/* User-plane-specific fields */
if (p_pdcp_info->plane == USER_PLANE) {
/* Forwad declarations */
-void proto_reg_handoff_pdcp_lte(void);
static void dissect_pdcp_lte(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
/* Heuristic dissection */
return FALSE;
}
- /* If redissecting, use previous info struct (if available) */
- p_pdcp_lte_info = p_get_proto_data(pinfo->fd, proto_pdcp_lte);
- if (p_pdcp_lte_info == NULL) {
- /* Allocate new info struct for this frame */
- p_pdcp_lte_info = se_alloc0(sizeof(struct pdcp_lte_info));
- infoAlreadySet = FALSE;
- }
- else {
- infoAlreadySet = TRUE;
- }
-
/* Do this again on re-dissection to re-discover offset of actual PDU */
/* Needs to be at least as long as:
}
/* OK, compare with signature string */
- if (tvb_strneql(tvb, offset, PDCP_LTE_START_STRING, (gint)strlen(PDCP_LTE_START_STRING)) != 0) {
+ if (tvb_strneql(tvb, offset, PDCP_LTE_START_STRING, strlen(PDCP_LTE_START_STRING)) != 0) {
return FALSE;
}
offset += (gint)strlen(PDCP_LTE_START_STRING);
+
+ /* If redissecting, use previous info struct (if available) */
+ p_pdcp_lte_info = p_get_proto_data(pinfo->fd, proto_pdcp_lte);
+ if (p_pdcp_lte_info == NULL) {
+ /* Allocate new info struct for this frame */
+ p_pdcp_lte_info = se_alloc0(sizeof(struct pdcp_lte_info));
+ infoAlreadySet = FALSE;
+ }
+ else {
+ infoAlreadySet = TRUE;
+ }
+
+
/* Read fixed fields */
p_pdcp_lte_info->no_header_pdu = tvb_get_guint8(tvb, offset++);
p_pdcp_lte_info->plane = tvb_get_guint8(tvb, offset++);
/* Handle PDCP header (if present) */
if (!p_pdcp_info->no_header_pdu) {
+ /* TODO: shouldn't need to initialise this one!! */
+ guint16 seqnum = 0;
+ gboolean seqnum_set = FALSE;
+
/*****************************/
/* Signalling plane messages */
if (p_pdcp_info->plane == SIGNALING_PLANE) {
guint32 data_length;
/* 5-bit sequence number */
+ seqnum = tvb_get_guint8(tvb, offset) & 0x1f;
+ seqnum_set = TRUE;
proto_tree_add_item(pdcp_tree, hf_pdcp_lte_seq_num_5, tvb, offset, 1, FALSE);
- col_append_fstr(pinfo->cinfo, COL_INFO, " sn=%u ",
- tvb_get_guint8(tvb, offset) & 0x1f);
+ write_pdu_label_and_info(root_ti, pinfo, " sn=%-2u ", seqnum);
offset++;
-
/* RRC data is all but last 4 bytes.
Call lte-rrc dissector (according to direction and channel type) */
if (global_pdcp_dissect_signalling_plane_as_rrc) {
col_append_fstr(pinfo->cinfo, COL_INFO, " MAC=0x%08x (%u bytes data)",
mac, data_length);
- return;
}
else if (p_pdcp_info->plane == USER_PLANE) {
/**********************************/
/* User-plane messages */
- guint16 seqnum;
gboolean pdu_type = (tvb_get_guint8(tvb, offset) & 0x80) >> 7;
/* Data/Control flag */
/* Number of sequence number bits depends upon config */
if (p_pdcp_info->seqnum_length == PDCP_SN_LENGTH_7_BITS) {
seqnum = tvb_get_guint8(tvb, offset) & 0x7f;
+ seqnum_set = TRUE;
proto_tree_add_item(pdcp_tree, hf_pdcp_lte_seq_num_7, tvb, offset, 1, FALSE);
offset++;
}
/* 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, FALSE);
offset += 2;
}
return;
}
- col_append_fstr(pinfo->cinfo, COL_INFO, " sn=%u ", seqnum);
+ write_pdu_label_and_info(root_ti, pinfo, " (SN=%u)", seqnum);
}
else {
/*******************************/
if (bitmap_ti != NULL) {
proto_item_append_text(bitmap_ti, " (not-received=%u)", not_received);
}
- col_append_fstr(pinfo->cinfo, COL_INFO,
- " Status Report (fms=%u) not-received=%u",
- fms, not_received);
+ write_pdu_label_and_info(root_ti, pinfo, " Status Report (fms=%u) not-received=%u",
+ fms, not_received);
}
return;
}
else {
/* Invalid plane setting...! */
- col_append_fstr(pinfo->cinfo, COL_INFO, " - INVALID PLANE (%u)",
- p_pdcp_info->plane);
+ write_pdu_label_and_info(root_ti, pinfo, " - INVALID PLANE (%u)",
+ p_pdcp_info->plane);
return;
}
+
+ /* For now, only do sequence analysis if RLC wasn't present in the frame */
+ /* This can be fixed once RLC does re-assembly... */
+ if (global_pdcp_check_sequence_numbers && seqnum_set &&
+ (p_get_proto_data(pinfo->fd, proto_rlc_lte) == NULL)) {
+
+ checkChannelSequenceInfo(pinfo, tvb, p_pdcp_info,
+ (guint16)seqnum, pdcp_tree);
+ }
+
}
else {
/* Show that its a no-header PDU */
- col_append_str(pinfo->cinfo, COL_INFO, " No-Header ");
+ write_pdu_label_and_info(root_ti, pinfo, " No-Header ");
}
/* If not compressed with ROHC, show as user-plane data */
if (!p_pdcp_info->rohc_compression) {
-
- if (global_pdcp_dissect_user_plane_as_ip && (ip_handle != 0)) {
- tvbuff_t *payload_tvb = tvb_new_subset_remaining(tvb, offset);
- call_dissector_only(ip_handle, payload_tvb, pinfo, pdcp_tree);
- }
- else {
- if (tvb_length_remaining(tvb, offset) > 0) {
- if (p_pdcp_info->plane == USER_PLANE) {
- proto_tree_add_item(pdcp_tree, hf_pdcp_lte_user_plane_data, tvb, offset, -1, FALSE);
+ if (tvb_length_remaining(tvb, offset) > 0) {
+ if (p_pdcp_info->plane == USER_PLANE) {
+ if (global_pdcp_dissect_user_plane_as_ip) {
+ tvbuff_t *payload_tvb = tvb_new_subset_remaining(tvb, offset);
+ call_dissector_only(ip_handle, payload_tvb, pinfo, pdcp_tree);
}
else {
- if (global_pdcp_dissect_signalling_plane_as_rrc) {
- /* Get appropriate dissector handle */
- dissector_handle_t rrc_handle = lookup_rrc_dissector_handle(p_pdcp_info);
-
- if (rrc_handle != 0) {
- /* Call RRC dissector if have one */
- tvbuff_t *payload_tvb = tvb_new_subset(tvb, offset,
- tvb_length_remaining(tvb, offset),
- tvb_length_remaining(tvb, offset));
- call_dissector_only(rrc_handle, payload_tvb, pinfo, pdcp_tree);
- }
- else {
- /* Just show data */
- proto_tree_add_item(pdcp_tree, hf_pdcp_lte_signalling_data, tvb, offset,
- tvb_length_remaining(tvb, offset), FALSE);
- }
+ proto_tree_add_item(pdcp_tree, hf_pdcp_lte_user_plane_data, tvb, offset, -1, FALSE);
+ }
+ }
+ else {
+ if (global_pdcp_dissect_signalling_plane_as_rrc) {
+ /* Get appropriate dissector handle */
+ dissector_handle_t rrc_handle = lookup_rrc_dissector_handle(p_pdcp_info);
+
+ if (rrc_handle != 0) {
+ /* Call RRC dissector if have one */
+ tvbuff_t *payload_tvb = tvb_new_subset(tvb, offset,
+ tvb_length_remaining(tvb, offset),
+ tvb_length_remaining(tvb, offset));
+ call_dissector_only(rrc_handle, payload_tvb, pinfo, pdcp_tree);
}
else {
- proto_tree_add_item(pdcp_tree, hf_pdcp_lte_signalling_data, tvb, offset, -1, FALSE);
+ /* Just show data */
+ proto_tree_add_item(pdcp_tree, hf_pdcp_lte_signalling_data, tvb, offset,
+ tvb_length_remaining(tvb, offset), FALSE);
}
}
-
- col_append_fstr(pinfo->cinfo, COL_INFO, "(%u bytes data)",
- tvb_length_remaining(tvb, offset));
+ else {
+ proto_tree_add_item(pdcp_tree, hf_pdcp_lte_signalling_data, tvb, offset, -1, FALSE);
+ }
}
+
+ write_pdu_label_and_info(root_ti, pinfo, "(%u bytes data)",
+ tvb_length_remaining(tvb, offset));
}
return;
}
/* UO-1 if !(ipv4 && rand) */
if (!((p_pdcp_info->rohc_ip_version == 4) &&
(!p_pdcp_info->rnd))) {
- offset = dissect_pdcp_uo_1_packet(rohc_tree, rohc_ti, tvb, offset, p_pdcp_info, pinfo);
- return;
- }
- else {
+
+ dissect_pdcp_uo_1_packet(rohc_tree, rohc_ti, tvb, offset, p_pdcp_info, pinfo);
+ } else {
/* Whether its UO-1-ID or UO-1-TS depends upon T bit */
dissect_pdcp_uo_1_ts_or_id_packet(rohc_tree, rohc_ti, tvb, offset, p_pdcp_info, pinfo);
- return;
- }
+ }
return;
if (!((p_pdcp_info->rohc_ip_version == 4) &&
(!p_pdcp_info->rnd))) {
- offset = dissect_pdcp_uor_2_packet(rohc_tree, rohc_ti, tvb, offset, p_pdcp_info, pinfo);
+ dissect_pdcp_uor_2_packet(rohc_tree, rohc_ti, tvb, offset, p_pdcp_info, pinfo);
}
else {
/* Whether its UOR-2-ID or UOR-2-TS depends upon T bit */
}
}
+/* Initializes the hash table and the mem_chunk area each time a new
+ * file is loaded or re-loaded in wireshark */
+static void
+pdcp_lte_init_protocol(void)
+{
+ /* Destroy any existing hashes. */
+ if (pdcp_sequence_analysis_channel_hash) {
+ g_hash_table_destroy(pdcp_sequence_analysis_channel_hash);
+ }
+ if (pdcp_lte_frame_sequence_analysis_report_hash) {
+ g_hash_table_destroy(pdcp_lte_frame_sequence_analysis_report_hash);
+ }
+
+
+ /* Now create them over */
+ pdcp_sequence_analysis_channel_hash = g_hash_table_new(pdcp_channel_hash_func, pdcp_channel_equal);
+ pdcp_lte_frame_sequence_analysis_report_hash = g_hash_table_new(pdcp_frame_hash_func, pdcp_frame_equal);
+}
+
+
+
void proto_register_pdcp(void)
{
static hf_register_info hf[] =
"Direction of message", HFILL
}
},
+ { &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
+ }
+ },
{ &hf_pdcp_lte_rohc_profile,
{ "ROHC profile",
"pdcp-lte.rohc.profile", FT_UINT8, BASE_DEC, VALS(rohc_profile_vals), 0x0,
}
},
+
+ { &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
+ }
+ },
+ { &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
+ }
+ },
+
{ &hf_pdcp_lte_rohc,
{ "ROHC Message",
"pdcp-lte.rohc", FT_NONE, BASE_NONE, NULL, 0,
&ett_pdcp,
&ett_pdcp_configuration,
&ett_pdcp_packet,
+ &ett_pdcp_lte_sequence_analysis,
&ett_pdcp_rohc,
&ett_pdcp_rohc_static_ipv4,
&ett_pdcp_rohc_static_udp,
"Show unciphered Signalling-Plane data as RRC",
&global_pdcp_dissect_signalling_plane_as_rrc);
+ /* Check for missing sequence numbers */
+ prefs_register_bool_preference(pdcp_lte_module, "check_sequence_numbers",
+ "Do sequence number analysis",
+ "Do sequence number analysis",
+ &global_pdcp_check_sequence_numbers);
+
/* Attempt to dissect ROHC headers */
prefs_register_bool_preference(pdcp_lte_module, "dissect_rohc",
"Attempt to decode ROHC data",
"When enabled, use heuristic dissector to find PDCP-LTE frames sent with "
"UDP framing",
&global_pdcp_lte_heur);
+
+ register_init_routine(&pdcp_lte_init_protocol);
}
void proto_reg_handoff_pdcp_lte(void)
{
- static dissector_handle_t pdcp_lte_handle;
- if (!pdcp_lte_handle) {
- pdcp_lte_handle = find_dissector("pdcp-lte");
+ /* Add as a heuristic UDP dissector */
+ heur_dissector_add("udp", dissect_pdcp_lte_heur, proto_pdcp_lte);
- /* Add as a heuristic UDP dissector */
- heur_dissector_add("udp", dissect_pdcp_lte_heur, proto_pdcp_lte);
- }
ip_handle = find_dissector("ip");
}