aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Quantin <pascal.quantin@gmail.com>2018-04-11 21:59:14 +0200
committerPascal Quantin <pascal.quantin@gmail.com>2018-04-12 08:00:00 +0000
commitb5ca12a88e50768e6fd8dbaaf593687ccc3c9414 (patch)
tree8118a10d34690032228d3a1c57b85178e96d6926
parentd0d0cf05cc6872c7d49f1ed7b2432ba97a66331f (diff)
PDCP NR: rework UDP framing format
Change-Id: I6f4a17ed91d4cb6ea39b5938add6ee882b033687 Reviewed-on: https://code.wireshark.org/review/26893 Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
-rw-r--r--epan/dissectors/packet-pdcp-nr.c24
-rw-r--r--epan/dissectors/packet-pdcp-nr.h58
2 files changed, 42 insertions, 40 deletions
diff --git a/epan/dissectors/packet-pdcp-nr.c b/epan/dissectors/packet-pdcp-nr.c
index b61d8dfcad..7ce9b132a1 100644
--- a/epan/dissectors/packet-pdcp-nr.c
+++ b/epan/dissectors/packet-pdcp-nr.c
@@ -784,9 +784,10 @@ static gboolean dissect_pdcp_nr_heur(tvbuff_t *tvb, packet_info *pinfo,
/* Needs to be at least as long as:
- the signature string
- - mandatory fields
- - at least the payload tag and a byte of data.
- However, let attempted dissection show if there are any tags at all. */
+ - fixed header byte(s)
+ - tag for data
+ - at least one byte of PDCP PDU payload.
+ However, let attempted dissection show if there are any tags at all. */
gint min_length = (gint)(strlen(PDCP_NR_START_STRING) + 3); /* signature */
if (tvb_captured_length_remaining(tvb, offset) < min_length) {
@@ -811,15 +812,18 @@ static gboolean dissect_pdcp_nr_heur(tvbuff_t *tvb, packet_info *pinfo,
infoAlreadySet = TRUE;
}
+ /* Read fixed fields */
+ p_pdcp_nr_info->plane = (enum pdcp_nr_plane)tvb_get_guint8(tvb, offset++);
+ if (p_pdcp_nr_info->plane == NR_SIGNALING_PLANE) {
+ /* Signalling plane always has 12 SN bits */
+ p_pdcp_nr_info->seqnum_length = PDCP_NR_SN_LENGTH_12_BITS;
+ }
/* Read tagged fields */
while (tag != PDCP_NR_PAYLOAD_TAG) {
/* Process next tag */
tag = tvb_get_guint8(tvb, offset++);
switch (tag) {
- case PDCP_NR_PLANE_TAG:
- p_pdcp_nr_info->plane = (enum pdcp_nr_plane)tvb_get_guint8(tvb, offset++);
- break;
case PDCP_NR_SEQNUM_LENGTH_TAG:
p_pdcp_nr_info->seqnum_length = tvb_get_guint8(tvb, offset);
offset++;
@@ -841,14 +845,12 @@ static gboolean dissect_pdcp_nr_heur(tvbuff_t *tvb, packet_info *pinfo,
p_pdcp_nr_info->ueid = tvb_get_ntohs(tvb, offset);
offset += 2;
break;
-
case PDCP_NR_ROHC_COMPRESSION_TAG:
- p_pdcp_nr_info->rohc.rohc_compression = tvb_get_guint8(tvb, offset);
- offset += 2;
+ p_pdcp_nr_info->rohc.rohc_compression = TRUE;
break;
case PDCP_NR_ROHC_IP_VERSION_TAG:
- p_pdcp_nr_info->rohc.rohc_ip_version = tvb_get_ntohs(tvb, offset);
- offset += 2;
+ p_pdcp_nr_info->rohc.rohc_ip_version = tvb_get_guint8(tvb, offset);
+ offset++;
break;
case PDCP_NR_ROHC_CID_INC_INFO_TAG:
p_pdcp_nr_info->rohc.cid_inclusion_info = tvb_get_guint8(tvb, offset);
diff --git a/epan/dissectors/packet-pdcp-nr.h b/epan/dissectors/packet-pdcp-nr.h
index c4c3d7d869..e570f9a032 100644
--- a/epan/dissectors/packet-pdcp-nr.h
+++ b/epan/dissectors/packet-pdcp-nr.h
@@ -63,9 +63,7 @@ typedef struct pdcp_nr_info
/* Several people have asked about dissecting PDCP by framing */
/* PDUs over IP. A suggested format over UDP has been defined */
/* and implemented by this dissector, using the definitions */
-/* below. A link to an example program showing you how to encode */
-/* these headers and send nr PDCP PDUs on a UDP socket is */
-/* provided at https://wiki.wireshark.org/PDCP-nr */
+/* below. */
/* */
/* A heuristic dissecter (enabled by a preference) will */
/* recognise a signature at the beginning of these frames. */
@@ -79,55 +77,57 @@ typedef struct pdcp_nr_info
terminating NULL */
#define PDCP_NR_START_STRING "pdcp-nr"
+/* Fixed fields:
+ - plane (1 byte) */
-/* The format for fields is to have the tag, followed by the value
- (there is no length field, it's implicit from the tag).
- The allowed values for each field should be taken from pdcp_nr_info above. */
+/* Conditional field. This field is mandatory in case of User Plane PDCP PDU.
+ The format is to have the tag, followed by the value (there is no length field,
+ it's implicit from the tag). The allowed values are defined above. */
-#define PDCP_NR_PLANE_TAG 0x02
-/* 1 byte, mandatory */
-
-#define PDCP_NR_SEQNUM_LENGTH_TAG 0x03
-/* 1 byte, mandatory */
+#define PDCP_NR_SEQNUM_LENGTH_TAG 0x02
+/* 1 byte */
-#define PDCP_NR_DIRECTION_TAG 0x04
-/* 1 byte, mandatory */
+/* Optional fields. Attaching this info should be added if available.
+ The format is to have the tag, followed by the value (there is no length field,
+ it's implicit from the tag) */
-#define PDCP_NR_BEARER_TYPE_TAG 0x05
-/* 1 byte, mandatory */
+#define PDCP_NR_DIRECTION_TAG 0x03
+/* 1 byte */
-#define PDCP_NR_BEARER_ID_TAG 0x06
-/* 1 byte, mandatory depending upon bearer type */
+#define PDCP_NR_BEARER_TYPE_TAG 0x04
+/* 1 byte */
-#define PDCP_NR_UEID_TAG 0x07
-/* 2 bytes, network order. Optional, but needed if > 1 UE logged. */
+#define PDCP_NR_BEARER_ID_TAG 0x05
+/* 1 byte */
+#define PDCP_NR_UEID_TAG 0x06
+/* 2 bytes, network order */
-#define PDCP_NR_ROHC_COMPRESSION_TAG 0x08
-/* 1 byte, network order (mandatory for user-plane) */
+#define PDCP_NR_ROHC_COMPRESSION_TAG 0x07
+/* 0 byte */
/* N.B. The following ROHC values only have significance if rohc_compression
is in use for the current channel */
-#define PDCP_NR_ROHC_IP_VERSION_TAG 0x09
-/* 2 bytes, network order */
+#define PDCP_NR_ROHC_IP_VERSION_TAG 0x08
+/* 1 byte */
-#define PDCP_NR_ROHC_CID_INC_INFO_TAG 0x0A
+#define PDCP_NR_ROHC_CID_INC_INFO_TAG 0x09
/* 1 byte */
-#define PDCP_NR_ROHC_LARGE_CID_PRES_TAG 0x0B
+#define PDCP_NR_ROHC_LARGE_CID_PRES_TAG 0x0A
/* 1 byte */
-#define PDCP_NR_ROHC_MODE_TAG 0x0C
+#define PDCP_NR_ROHC_MODE_TAG 0x0B
/* 1 byte */
-#define PDCP_NR_ROHC_RND_TAG 0x0D
+#define PDCP_NR_ROHC_RND_TAG 0x0C
/* 1 byte */
-#define PDCP_NR_ROHC_UDP_CHECKSUM_PRES_TAG 0x0E
+#define PDCP_NR_ROHC_UDP_CHECKSUM_PRES_TAG 0x0D
/* 1 byte */
-#define PDCP_NR_ROHC_PROFILE_TAG 0x0F
+#define PDCP_NR_ROHC_PROFILE_TAG 0x0E
/* 2 bytes, network order */