[PFCP] Add basic dissector for Packet Forwarding Control Protocol (PFCP) 3GPP TS 29.244 V14.0.0 (2017-06)S

Change-Id: Id377870caa7649e19832ea3fd3484ed805c2c9cf
Signed-off-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-on: https://code.wireshark.org/review/23375
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Anders 2017-09-03 15:38:23 +02:00 committed by Anders Broman
parent 78a14e4c57
commit ed75d67394
4 changed files with 867 additions and 0 deletions

View File

@ -59,6 +59,7 @@ ISOBUS
AMT (Automatic Multicast Tunneling)
QUIC (IETF)
Wi-Fi Device Provisioning Protocol
PFCP (Packet Forwarding Control Protocol)
--sort-and-group--
=== Updated Protocol Support

View File

@ -1057,6 +1057,7 @@ set(DISSECTOR_SRC
packet-pdcp-lte.c
packet-peekremote.c
packet-per.c
packet-pfcp.c
packet-pflog.c
packet-pgm.c
packet-pgsql.c

View File

@ -1079,6 +1079,7 @@ DISSECTOR_SRC = \
packet-pdcp-lte.c \
packet-peekremote.c \
packet-per.c \
packet-pfcp.c \
packet-pflog.c \
packet-pgm.c \
packet-pgsql.c \

View File

@ -0,0 +1,864 @@
/* packet-pfcp.c
*
* Routines for Packet Forwarding Control Protocol (PFCP) dissection
*
* Copyright 2017, Anders Broman <anders.broman@ericsson.com>
*
* 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
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Ref 3GPP TS 29.244 V14.0.0 (2017-06)
*/
#include "config.h"
#include <epan/packet.h>
#include <epan/expert.h>
#include <epan/sminmpec.h>
#include <epan/addr_resolv.h> /* Needed for BASE_ENTERPRISES */
#include "packet-ntp.h"
void proto_register_pfcp(void);
void proto_reg_handoff_pfcp(void);
static dissector_handle_t pfcp_handle;
static dissector_handle_t pfcp_3gpp_ies_handle;
static int proto_pfcp = -1;
static int hf_pfcp_msg_type = -1;
static int hf_pfcp_msg_length = -1;
static int hf_pfcp_hdr_flags = -1;
static int hf_pfcp_version = -1;
static int hf_pfcp_mp_flag = -1;
static int hf_pfcp_s_flag = -1;
static int hf_pfcp_seid = -1;
static int hf_pfcp_seqno = -1;
static int hf_pfcp_mp = -1;
static int hf_pfcp2_ie = -1;
static int hf_pfcp2_ie_len = -1;
static int hf_pfcp2_enterprise_ie = -1;
static int hf_pfcp_enterprice_id = -1;
static int hf_pfcp_spare_b2 = -1;
static int hf_pfcp_spare_b3 = -1;
static int hf_pfcp_spare_b4 = -1;
static int hf_pfcp_spare_oct = -1;
static int hf_pfcp_spare_h0 = -1;
static int hf_pfcp_recovery_time_stamp = -1;
static int ett_pfcp = -1;
static int ett_pfcp_flags = -1;
static int ett_pfcp_ie = -1;
static int ett_pfcp_grouped_ie = -1;
static expert_field ei_pfcp_ie_reserved = EI_INIT;
static expert_field ei_pfcp_ie_data_not_decoded = EI_INIT;
static expert_field ei_pfcp_ie_not_decoded_null = EI_INIT;
static expert_field ei_pfcp_ie_not_decoded_to_large = EI_INIT;
static expert_field ei_pfcp_enterprise_ie_3gpp = EI_INIT;
static dissector_table_t pfcp_enterprise_ies_dissector_table;
static void dissect_pfcp_ies_common(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, gint offset, guint8 message_type);
#define PFCP_MSG_RESERVED_0 0
static const value_string pfcp_message_type[] = {
{PFCP_MSG_RESERVED_0, "Reserved"},
/* Sx Node related messages */
{ 1, "Sx Heartbeat Request"},
{ 2, "Sx Heartbeat Response"},
{ 3, "Sx PFD Management Request"},
{ 4, "Sx PFD Management Response"},
{ 5, "Sx Association Setup Request"},
{ 6, "Sx Association Setup Response"},
{ 7, "Sx Association Update Request"},
{ 8, "Sx Association Update Response"},
{ 9, "Sx Association Release Request"},
{ 10, "Sx Association Release Response"},
{ 11, "Sx Version Not Supported Response"},
{ 12, "Sx Node Report Request"},
{ 13, "Sx Node Report Response"},
{ 14, "Sx Session Set Deletion Request"},
{ 15, "Sx Session Set Deletion Response"},
//16 to 49 For future use
//Sx Session related messages
{ 50, "Sx Session Establishment Request"},
{ 51, "Sx Session Establishment Response"},
{ 52, "Sx Session Modification Request"},
{ 53, "Sx Session Modification Response"},
{ 54, "Sx Session Deletion Request"},
{ 55, "Sx Session Deletion Response"},
{ 56, "Sx Session Report Request"},
{ 57, "Sx Session Report Response"},
//58 to 99 For future use
//Other messages
//100 to 255 For future use
{0, NULL}
};
static value_string_ext pfcp_message_type_ext = VALUE_STRING_EXT_INIT(pfcp_message_type);
/* 8.1.2 Information Element Types */
static const value_string pfcp_ie_type[] = {
{ 0, "Reserved"},
{ 1, "Create PDR"}, /* Extendable / Table 7.5.2.2-1 */
{ 2, "PDI"}, /* Extendable / Table 7.5.2.2-2 */
{ 3, "Create FAR"}, /* Extendable / Table 7.5.2.3-1 */
{ 4, "Forwarding Parameters"}, /* Extendable / Table 7.5.2.3-2 */
{ 5, "Duplicating Parameters"}, /* Extendable / Table 7.5.2.3-3 */
{ 6, "Create URR"}, /* Extendable / Table 7.5.2.4-1 */
{ 7, "Create QER"}, /* Extendable / Table 7.5.2.5-1 */
{ 8, "Created PDR"}, /* Extendable / Table 7.5.3.2-1 */
{ 9, "Update PDR" }, /* Extendable / Table 7.5.4.2-1 */
{ 10, "Update FAR" }, /* Extendable / Table 7.5.4.3-1 */
{ 11, "Update Forwarding Parameters" }, /* Extendable / Table 7.5.4.3-2 */
{ 12, "Update BAR (Sx Session Report Response)" }, /* Extendable / Table 7.5.9.2-1 */
{ 13, "Update URR" }, /* Extendable / Table 7.5.4.4 */
{ 14, "Update QER" }, /* Extendable / Table 7.5.4.5 */
{ 15, "Remove PDR" }, /* Extendable / Table 7.5.4.6 */
{ 16, "Remove FAR" }, /* Extendable / Table 7.5.4.7 */
{ 17, "Remove URR" }, /* Extendable / Table 7.5.4.8 */
{ 18, "Remove QER" }, /* Extendable / Table 7.5.4.9 */
{ 19, "Cause" }, /* Fixed / Subclause 8.2.1 */
{ 20, "Source Interface" }, /* Extendable / Subclause 8.2.2 */
{ 21, "F-TEID" }, /* Extendable / Subclause 8.2.3 */
{ 22, "PDN Instance" }, /* Variable Length / Subclause 8.2.4 */
{ 23, "SDF Filter" }, /* Extendable / Subclause 8.2.5 */
{ 24, "Application ID" }, /* Variable Length / Subclause 8.2.6 */
{ 25, "Gate Status" }, /* Extendable / Subclause 8.2.7 */
{ 26, "MBR" }, /* Extendable / Subclause 8.2.8 */
{ 27, "GBR" }, /* Extendable / Subclause 8.2.9 */
{ 28, "QER Correlation ID" }, /* Extendable / Subclause 8.2.10 */
{ 29, "Precedence" }, /* Extendable / Subclause 8.2.11 */
{ 30, "DL Transport Level Marking" }, /* Extendable / Subclause 8.2.12 */
{ 31, "Volume Threshold" }, /* Extendable /Subclause 8.2.13 */
{ 32, "Time Threshold" }, /* Extendable /Subclause 8.2.14 */
{ 33, "Monitoring Time" }, /* Extendable /Subclause 8.2.15 */
{ 34, "Subsequent Volume Threshold" }, /* Extendable /Subclause 8.2.16 */
{ 35, "Subsequent Time Threshold" }, /* Extendable /Subclause 8.2.17 */
{ 36, "Inactivity Detection Time" }, /* Extendable /Subclause 8.2.18 */
{ 37, "Reporting Triggers" }, /* Extendable /Subclause 8.2.19 */
{ 38, "Redirect Information" }, /* Extendable /Subclause 8.2.20 */
{ 39, "Report Type" }, /* Extendable / Subclause 8.2.21 */
{ 40, "Offending IE" }, /* Fixed / Subclause 8.2.22 */
{ 41, "Forwarding Policy" }, /* Extendable / Subclause 8.2.23 */
{ 42, "Destination Interface" }, /* Extendable / Subclause 8.2.24 */
{ 43, "UP Function Features" }, /* Extendable / Subclause 8.2.25 */
{ 44, "Apply Action" }, /* Extendable / Subclause 8.2.26 */
{ 45, "Downlink Data Service Information" }, /* Extendable / Subclause 8.2.27 */
{ 46, "Downlink Data Notification Delay" }, /* Extendable / Subclause 8.2.28 */
{ 47, "DL Buffering Duration" }, /* Extendable / Subclause 8.2.29 */
{ 48, "DL Buffering Suggested Packet Count" }, /* Variable / Subclause 8.2.30 */
{ 49, "SxSMReq-Flags" }, /* Extendable / Subclause 8.2.31 */
{ 50, "SxSRRsp-Flags" }, /* Extendable / Subclause 8.2.32 */
{ 51, "Load Control Information" }, /* Extendable / Table 7.5.3.3-1 */
{ 52, "Sequence Number" }, /* Fixed Length / Subclause 8.2.33 */
{ 53, "Metric" }, /* Fixed Length / Subclause 8.2.34 */
{ 54, "Overload Control Information" }, /* Extendable / Table 7.5.3.4-1 */
{ 55, "Timer" }, /* Extendable / Subclause 8.2 35 */
{ 56, "Packet Detection Rule ID" }, /* Extendable / Subclause 8.2 36 */
{ 57, "F-SEID" }, /* Extendable / Subclause 8.2 37 */
{ 58, "Application ID's PFDs" }, /* Extendable / Table 7.4.3.1-2 */
{ 59, "PFD context" }, /* Extendable / Table 7.4.3.1-3 */
{ 60, "Node ID" }, /* Extendable / Subclause 8.2.38 */
{ 61, "PFD contents" }, /* Extendable / Subclause 8.2.39 */
{ 62, "Measurement Method" }, /* Extendable / Subclause 8.2.40 */
{ 63, "Usage Report Trigger" }, /* Extendable / Subclause 8.2.41 */
{ 64, "Measurement Period" }, /* Extendable / Subclause 8.2.42 */
{ 65, "FQ-CSID" }, /* Extendable / Subclause 8.2.43 */
{ 66, "Volume Measurement" }, /* Extendable / Subclause 8.2.44 */
{ 67, "Duration Measurement" }, /* Extendable / Subclause 8.2.45 */
{ 68, "Application Detection Information" }, /* Extendable / Table 7.5.8.3-2 */
{ 69, "Time of First Packet" }, /* Extendable / Subclause 8.2.46 */
{ 70, "Time of Last Packet" }, /* Extendable / Subclause 8.2.47 */
{ 71, "Quota Holding Time" }, /* Extendable / Subclause 8.2.48 */
{ 72, "Dropped DL Traffic Threshold" }, /* Extendable / Subclause 8.2.49 */
{ 73, "Volume Quota" }, /* Extendable / Subclause 8.2.50 */
{ 74, "Time Quota" }, /* Extendable / Subclause 8.2.51 */
{ 75, "Start Time" }, /* Extendable / Subclause 8.2.52 */
{ 76, "End Time" }, /* Extendable / Subclause 8.2.53 */
{ 77, "Query URR" }, /* Extendable / Table 7.5.4.10-1 */
{ 78, "Usage Report (in Session Modification Response)" }, /* Extendable / Table 7.5.5.2-1 */
{ 79, "Usage Report (Session Deletion Response)" }, /* Extendable / Table 7.5.7.2-1 */
{ 80, "Usage Report (Session Report Request)" }, /* Extendable / Table 7.5.8.3-1 */
{ 81, "URR ID" }, /* Extendable / Subclause 8.2.54 */
{ 82, "Linked URR ID" }, /* Extendable / Subclause 8.2.55 */
{ 83, "Downlink Data Report" }, /* Extendable / Table 7.5.8.2-1 */
{ 84, "Outer Header Creation" }, /* Extendable / Subclause 8.2.56 */
{ 85, "Create BAR" }, /* Extendable / Table 7.5.2.6-1 */
{ 86, "Update BAR (Session Modification Request)" }, /* Extendable / Table 7.5.4.11-1 */
{ 87, "Remove BAR" }, /* Extendable / Table 7.5.4.12-1 */
{ 88, "BAR ID" }, /* Extendable / Subclause 8.2.57 */
{ 89, "CP Function Features" }, /* Extendable / Subclause 8.2.58 */
{ 90, "Usage Information" }, /* Extendable / Subclause 8.2.59 */
{ 91, "Application Instance ID" }, /* Variable Length / Subclause 8.2.60 */
{ 92, "Flow Information" }, /* Extendable / Subclause 8.2.61 */
{ 93, "UE IP Address" }, /* Extendable / Subclause 8.2.62 */
{ 94, "Packet Rate" }, /* Extendable / Subclause 8.2.63 */
{ 95, "Outer Header Removal" }, /* Extendable / Subclause 8.2.64 */
{ 96, "Recovery Time Stamp" }, /* Extendable / Subclause 8.2.65 */
{ 97, "DL Flow Level Marking" }, /* Extendable / Subclause 8.2.66 */
{ 98, "Header Enrichment" }, /* Extendable / Subclause 8.2.67 */
{ 99, "Error Indication Report" }, /* Extendable / Table 7.5.8.4-1 */
{ 100, "Measurement Information" }, /* Extendable / Subclause 8.2.68 */
{ 101, "Node Report Type" }, /* Extendable / Subclause 8.2.69 */
{ 102, "User Plane Path Failure Report" }, /* Extendable / Table 7.4.5.1.2-1 */
{ 103, "Remote GTP-U Peer" }, /* Extendable / Subclause 8.2.70 */
{ 104, "UR-SEQN" }, /* Fixed Length / Subclause 8.2.71 */
{ 105, "Update Duplicating Parameters" }, /* Extendable / Table 7.5.4.3-3 */
{ 106, "Activate Predefined Rules" }, /* Variable Length / Subclause 8.2.72 */
{ 107, "Deactivate Predefined Rules" }, /* Variable Length / Subclause 8.2.73 */
{ 108, "FAR ID" }, /* Extendable / Subclause 8.2.74 */
{ 109, "QER ID" }, /* Extendable / Subclause 8.2.75 */
{ 110, "OCI Flags" }, /* Extendable / Subclause 8.2.76 */
{ 111, "Sx Association Release Request" }, /* Extendable / Subclause 8.2.77 */
{ 112, "Graceful Release Period" }, /* Extendable / Subclause 8.2.78 */
//113 to 65535 Spare. For future use.
{0, NULL}
};
static value_string_ext pfcp_ie_type_ext = VALUE_STRING_EXT_INIT(pfcp_ie_type);
static void
dissect_pfcp_reserved(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
{
proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_reserved, tvb, 0, length);
}
/*
* 8.2.1 Cause
*/
/*
* 8.2.2 Source Interface
*/
/*
* 8.2.3 F-SEID
*/
static void
dissect_pfcp_f_seid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
{
proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, 0, length);
}
/*
* 8.2.4 PDN Instance
*/
/*
* 8.2.5 SDF Filter
* 8.2.6 Application ID
* 8.2.7 Gate Status
* 8.2.8 MBR
* 8.2.9 GBR
* 8.2.10 QER Correlation ID
* 8.2.11 Precedence
* 8.2.12 DL Transport Level Marking
* 8.2.13 Volume Threshold
* 8.2.14 Time Threshold
* 8.2.15 Monitoring Time
* 8.2.16 Subsequent Volume Threshold
* 8.2.17 Subsequent Time Threshold
* 8.2.18 Inactivity Detection Time
* 8.2.19 Reporting Triggers
* 8.2.20 Redirect Information
* 8.2.21 Report Type
* 8.2.22 Offending IE
* 8.2.23 Forwarding Policy
* 8.2.24 Destination Interface
* 8.2.25 UP Function Features
* 8.2.26 Apply Action
* 8.2.27 Downlink Data Service Information
* 8.2.28 Downlink Data Notification Delay
* 8.2.29 DL Buffering Duration
* 8.2.30 DL Buffering Suggested Packet Count
* 8.2.31 SxSMReq-Flags
* 8.2.32 SxSRRsp-Flags
* 8.2.33 Sequence Number
* 8.2.34 Metric
* 8.2.35 Timer
* 8.2.36 Packet Detection Rule ID (PDR ID)
* 8.2.37 F-SEID
*/
/*
* 8.2.38 Node ID
*/
static void
dissect_pfcp_node_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
{
proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, 0, length);
}
/*
* 8.2.39 PFD Contents
* 8.2.40 Measurement Method
* 8.2.41 Usage Report Trigger
* 8.2.42 Measurement Period
* 8.2.43 Fully qualified PDN Connection Set Identifier (FQ-CSID)
* 8.2.44 Volume Measurement
* 8.2.45 Duration Measurement
* 8.2.46 Time of First Packet
* 8.2.47 Time of Last Packet
* 8.2.48 Quota Holding Time
* 8.2.49 Dropped DL Traffic Threshold
* 8.2.50 Volume Quota
* 8.2.51 Time Quota
* 8.2.52 Start Time
* 8.2.53 End Time
* 8.2.54 URR ID
* 8.2.55 Linked URR ID IE
* 8.2.56 Outer Header Creation
* 8.2.57 BAR ID
* 8.2.58 CP Function Features
* 8.2.59 Usage Information
* 8.2.60 Application Instance ID
* 8.2.61 Flow Information
* 8.2.62 UE IP Address
* 8.2.63 Packet Rate
* 8.2.64 Outer Header Removal
*/
/*
* 8.2.65 Recovery Time Stamp
*/
static void
dissect_pfcp_recovery_time_stamp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_)
{
const gchar *time_str;
int offset = 0;
/* indicates the UTC time when the node started. Octets 5 to 8 are encoded in the same format as
* the first four octets of the 64-bit timestamp format as defined in section 6 of IETF RFC 5905 [26].
*/
time_str = tvb_ntp_fmt_ts_sec(tvb, 0);
proto_tree_add_string(tree, hf_pfcp_recovery_time_stamp, tvb, offset, 4, time_str);
proto_item_append_text(item, "%s", time_str);
offset += 4;
if (offset < length) {
proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
}
}
/*
* 8.2.66 DL Flow Level Marking
* 8.2.67 Header Enrichment
* 8.2.68 Measurement Information
* 8.2.69 Node Report Type
* 8.2.70 Remote GTP-U Peer
* 8.2.71 UR-SEQN
* 8.2.72 Activate Predefined Rules
* 8.2.73 Deactivate Predefined Rules
* 8.2.74 FAR ID
* 8.2.75 QER ID
* 8.2.76 OCI Flag
* 8.2.77 Sx Association Release Request
* 8.2.78 Graceful Release Period
*/
/* 7.2.3.3 Grouped Information Elements */
static void
dissect_pfcp_grouped_ie(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type)
{
int offset = 0;
tvbuff_t *new_tvb;
proto_tree *grouped_tree;
proto_item_append_text(item, "[Grouped IE]");
grouped_tree = proto_item_add_subtree(tree, ett_pfcp_grouped_ie);
new_tvb = tvb_new_subset_length(tvb, offset, length);
dissect_pfcp_ies_common(new_tvb, pinfo, grouped_tree, 0, message_type);
}
/* Array of functions to dissect IEs
* (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type)
*/
typedef struct _pfcp_ie {
void(*decode) (tvbuff_t *, packet_info *, proto_tree *, proto_item *, guint16, guint8);
} pfcp_ie_t;
static const pfcp_ie_t pfcp_ies[] = {
/* 0 */ { dissect_pfcp_reserved },
/* 1 */ { dissect_pfcp_grouped_ie }, /* Create PDR Extendable / Table 7.5.2.2-1 */
/* 2 */ { NULL }, /* PDI Extendable / Table 7.5.2.2-2 */
/* 3 */ { NULL }, /* Create FAR Extendable / Table 7.5.2.3-1 */
/* 4 */ { NULL }, /* Forwarding Parameters Extendable / Table 7.5.2.3-2 */
/* 5 */ { NULL }, /* Duplicating Parameters Extendable / Table 7.5.2.3-3 */
/* 6 */ { NULL }, /* Create URR Extendable / Table 7.5.2.4-1 */
/* 7 */ { NULL }, /* Create QER Extendable / Table 7.5.2.5-1 */
/* 8 */ { NULL }, /* Created PDR Extendable / Table 7.5.3.2-1 */
/* 9 */ { NULL }, /* Update PDR Extendable / Table 7.5.4.2-1 */
/* 10 */ { NULL }, /* Update FAR Extendable / Table 7.5.4.3-1 */
/* 11 */ { NULL }, /* Update Forwarding Parameters Extendable / Table 7.5.4.3-2 */
/* 12 */ { NULL }, /* Update BAR (Sx Session Report Response) Extendable / Table 7.5.9.2-1 */
/* 13 */ { NULL }, /* Update URR Extendable / Table 7.5.4.4 */
/* 14 */ { NULL }, /* Update QER Extendable / Table 7.5.4.5 */
/* 15 */ { NULL }, /* Remove PDR Extendable / Table 7.5.4.6 */
/* 16 */ { NULL }, /* Remove FAR Extendable / Table 7.5.4.7 */
/* 17 */ { NULL }, /* Remove URR Extendable / Table 7.5.4.8 */
/* 18 */ { NULL }, /* Remove QER Extendable / Table 7.5.4.9 */
/* 19 */ { NULL }, /* Cause Fixed / Subclause 8.2.1 */
/* 20 */ { NULL }, /* Source Interface Extendable / Subclause 8.2.2 */
/* 21 */ { NULL }, /* F-TEID Extendable / Subclause 8.2.3 */
/* 22 */ { NULL }, /* PDN Instance Variable Length / Subclause 8.2.4 */
/* 23 */ { NULL }, /* SDF Filter Extendable / Subclause 8.2.5 */
/* 24 */ { NULL }, /* Application ID Variable Length / Subclause 8.2.6 */
/* 25 */ { NULL }, /* Gate Status Extendable / Subclause 8.2.7 */
/* 26 */ { NULL }, /* MBR Extendable / Subclause 8.2.8 */
/* 27 */ { NULL }, /* GBR Extendable / Subclause 8.2.9 */
/* 28 */ { NULL }, /* QER Correlation ID Extendable / Subclause 8.2.10 */
/* 29 */ { NULL }, /* Precedence Extendable / Subclause 8.2.11 */
/* 30 */ { NULL }, /* DL Transport Level Marking Extendable / Subclause 8.2.12 */
/* 31 */ { NULL }, /* Volume Threshold Extendable /Subclause 8.2.13 */
/* 32 */ { NULL }, /* Time Threshold Extendable /Subclause 8.2.14 */
/* 33 */ { NULL }, /* Monitoring Time Extendable /Subclause 8.2.15 */
/* 34 */ { NULL }, /* Subsequent Volume Threshold Extendable /Subclause 8.2.16 */
/* 35 */ { NULL }, /* Subsequent Time Threshold Extendable /Subclause 8.2.17 */
/* 36 */ { NULL }, /* Inactivity Detection Time Extendable /Subclause 8.2.18 */
/* 37 */ { NULL }, /* Reporting Triggers Extendable /Subclause 8.2.19 */
/* 38 */ { NULL }, /* Redirect Information Extendable /Subclause 8.2.20 */
/* 39 */ { NULL }, /* Report Type Extendable / Subclause 8.2.21 */
/* 40 */ { NULL }, /* Offending IE Fixed / Subclause 8.2.22 */
/* 41 */ { NULL }, /* Forwarding Policy Extendable / Subclause 8.2.23 */
/* 42 */ { NULL }, /* Destination Interface Extendable / Subclause 8.2.24 */
/* 43 */ { NULL }, /* UP Function Features Extendable / Subclause 8.2.25 */
/* 44 */ { NULL }, /* Apply Action Extendable / Subclause 8.2.26 */
/* 45 */ { NULL }, /* Downlink Data Service Information Extendable / Subclause 8.2.27 */
/* 46 */ { NULL }, /* Downlink Data Notification Delay Extendable / Subclause 8.2.28 */
/* 47 */ { NULL }, /* DL Buffering Duration Extendable / Subclause 8.2.29 */
/* 48 */ { NULL }, /* DL Buffering Suggested Packet Count Variable / Subclause 8.2.30 */
/* 49 */ { NULL }, /* SxSMReq-Flags Extendable / Subclause 8.2.31 */
/* 50 */ { NULL }, /* SxSRRsp-Flags Extendable / Subclause 8.2.32 */
/* 51 */ { NULL }, /* Load Control Information Extendable / Table 7.5.3.3-1 */
/* 52 */ { NULL }, /* Sequence Number Fixed Length / Subclause 8.2.33 */
/* 53 */ { NULL }, /* Metric Fixed Length / Subclause 8.2.34 */
/* 54 */ { NULL }, /* Overload Control Information Extendable / Table 7.5.3.4-1 */
/* 55 */ { NULL }, /* Timer Extendable / Subclause 8.2 35 */
/* 56 */ { NULL }, /* Packet Detection Rule ID Extendable / Subclause 8.2 36 */
/* 57 */ { dissect_pfcp_f_seid }, /* F-SEID Extendable / Subclause 8.2 37 */
/* 58 */ { NULL }, /* Application ID's PFDs Extendable / Table 7.4.3.1-2 */
/* 59 */ { NULL }, /* PFD context Extendable / Table 7.4.3.1-3 */
/* 60 */ { dissect_pfcp_node_id }, /* Node ID Extendable / Subclause 8.2.38 */
/* 61 */ { NULL }, /* PFD contents Extendable / Subclause 8.2.39 */
/* 62 */ { NULL }, /* Measurement Method Extendable / Subclause 8.2.40 */
/* 63 */ { NULL }, /* Usage Report Trigger Extendable / Subclause 8.2.41 */
/* 64 */ { NULL }, /* Measurement Period Extendable / Subclause 8.2.42 */
/* 65 */ { NULL }, /* FQ-CSID Extendable / Subclause 8.2.43 */
/* 66 */ { NULL }, /* Volume Measurement Extendable / Subclause 8.2.44 */
/* 67 */ { NULL }, /* Duration Measurement Extendable / Subclause 8.2.45 */
/* 68 */ { NULL }, /* Application Detection Information Extendable / Table 7.5.8.3-2 */
/* 69 */ { NULL }, /* Time of First Packet Extendable / Subclause 8.2.46 */
/* 70 */ { NULL }, /* Time of Last Packet Extendable / Subclause 8.2.47 */
/* 71 */ { NULL }, /* Quota Holding Time Extendable / Subclause 8.2.48 */
/* 72 */ { NULL }, /* Dropped DL Traffic Threshold Extendable / Subclause 8.2.49 */
/* 73 */ { NULL }, /* Volume Quota Extendable / Subclause 8.2.50 */
/* 74 */ { NULL }, /* Time Quota Extendable / Subclause 8.2.51 */
/* 75 */ { NULL }, /* Start Time Extendable / Subclause 8.2.52 */
/* 76 */ { NULL }, /* End Time Extendable / Subclause 8.2.53 */
/* 77 */ { NULL }, /* Query URR Extendable / Table 7.5.4.10-1 */
/* 78 */ { NULL }, /* Usage Report (in Session Modification Response) Extendable / Table 7.5.5.2-1 */
/* 79 */ { NULL }, /* Usage Report (Session Deletion Response) Extendable / Table 7.5.7.2-1 */
/* 80 */ { NULL }, /* Usage Report (Session Report Request) Extendable / Table 7.5.8.3-1 */
/* 81 */ { NULL }, /* URR ID Extendable / Subclause 8.2.54 */
/* 82 */ { NULL }, /* Linked URR ID Extendable / Subclause 8.2.55 */
/* 83 */ { NULL }, /* Downlink Data Report Extendable / Table 7.5.8.2-1 */
/* 84 */ { NULL }, /* Outer Header Creation Extendable / Subclause 8.2.56 */
/* 85 */ { NULL }, /* Create BAR Extendable / Table 7.5.2.6-1 */
/* 86 */ { NULL }, /* Update BAR (Session Modification Request) Extendable / Table 7.5.4.11-1 */
/* 87 */ { NULL }, /* Remove BAR Extendable / Table 7.5.4.12-1 */
/* 88 */ { NULL }, /* BAR ID Extendable / Subclause 8.2.57 */
/* 89 */ { NULL }, /* CP Function Features Extendable / Subclause 8.2.58 */
/* 90 */ { NULL }, /* Usage Information Extendable / Subclause 8.2.59 */
/* 91 */ { NULL }, /* Application Instance ID Variable Length / Subclause 8.2.60 */
/* 92 */ { NULL }, /* Flow Information Extendable / Subclause 8.2.61 */
/* 93 */ { NULL }, /* UE IP Address Extendable / Subclause 8.2.62 */
/* 94 */ { NULL }, /* Packet Rate Extendable / Subclause 8.2.63 */
/* 95 */ { NULL }, /* Outer Header Removal Extendable / Subclause 8.2.64 */
/* 96 */ { dissect_pfcp_recovery_time_stamp }, /* Recovery Time Stamp Extendable / Subclause 8.2.65 */
/* 97 */ { NULL }, /* DL Flow Level Marking Extendable / Subclause 8.2.66 */
/* 98 */ { NULL }, /* Header Enrichment Extendable / Subclause 8.2.67 */
/* 99 */ { NULL }, /* Error Indication Report Extendable / Table 7.5.8.4-1 */
/* 100 */ { NULL }, /* Measurement Information Extendable / Subclause 8.2.68 */
/* 101 */ { NULL }, /* Node Report Type Extendable / Subclause 8.2.69 */
/* 102 */ { NULL }, /* User Plane Path Failure Report Extendable / Table 7.4.5.1.2-1 */
/* 103 */ { NULL }, /* Remote GTP-U Peer Extendable / Subclause 8.2.70 */
/* 104 */ { NULL }, /* UR-SEQN Fixed Length / Subclause 8.2.71 */
/* 105 */ { NULL }, /* Update Duplicating Parameters Extendable / Table 7.5.4.3-3 */
/* 106 */ { NULL }, /* Activate Predefined Rules Variable Length / Subclause 8.2.72 */
/* 107 */ { NULL }, /* Deactivate Predefined Rules Variable Length / Subclause 8.2.73 */
/* 108 */ { NULL }, /* FAR ID Extendable / Subclause 8.2.74 */
/* 109 */ { NULL }, /* QER ID Extendable / Subclause 8.2.75 */
/* 110 */ { NULL }, /* OCI Flags Extendable / Subclause 8.2.76 */
/* 111 */ { NULL }, /* Sx Association Release Request Extendable / Subclause 8.2.77 */
/* 112 */ { NULL }, /* Graceful Release Period Extendable / Subclause 8.2.78 */
{ NULL }, /* End of List */
};
#define NUM_PFCP_IES (sizeof(pfcp_ies)/sizeof(pfcp_ie_t))
static void
dissect_pfcp_ies_common(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, gint offset, guint8 message_type)
{
proto_tree *ie_tree;
proto_item *ti;
tvbuff_t *ie_tvb;
guint16 type, length, enterprise_type;
guint16 enterprise_id;
/* 8.1.1 Information Element Format */
/*
Octets 8 7 6 5 4 3 2 1
1 to 2 Type = xxx (decimal)
3 to 4 Length = n
p to (p+1) Enterprise ID
k to (n+4) IE specific data or content of a grouped IE
If the Bit 8 of Octet 1 is not set, this indicates that the IE is defined by 3GPP and the Enterprise ID is absent.
If Bit 8 of Octet 1 is set, this indicates that the IE is defined by a vendor and the Enterprise ID is present
identified by the Enterprise ID
*/
/*Enterprise ID : if the IE type value is within the range of 32768 to 65535,
* this field shall contain the IANA - assigned "SMI Network Management Private Enterprise Codes"
* value of the vendor defining the IE.
*/
/* Length: this field contains the length of the IE excluding the first four octets, which are common for all IEs */
/* Process the IEs*/
while (offset < (gint)tvb_reported_length(tvb)) {
/* Octet 1 -2 */
type = tvb_get_ntohs(tvb, offset);
length = tvb_get_ntohs(tvb, offset + 2);
if ((type & 0x8000) == 0x8000 ) {
enterprise_id = tvb_get_ntohs(tvb, offset + 4);
enterprise_type = (type & 0x8000);
ie_tree = proto_tree_add_subtree_format(tree, tvb, offset, 4 + length, ett_pfcp_ie, &ti, "Enterprise %s specific IE: %u",
try_enterprises_lookup(enterprise_id),
enterprise_type);
proto_tree_add_item(ie_tree, hf_pfcp2_enterprise_ie, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(ie_tree, hf_pfcp2_ie_len, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
/* Bit 8 of Octet 1 is set, this indicates that the IE is defined by a vendor and the Enterprise ID is present */
proto_tree_add_item(ie_tree, hf_pfcp_enterprice_id, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
/* give the whole IE to the subdissector */
ie_tvb = tvb_new_subset_remaining(tvb, offset-6);
dissector_try_uint_new(pfcp_enterprise_ies_dissector_table, enterprise_id, ie_tvb, pinfo, ie_tree, FALSE, ti);
offset += length;
}
else {
ie_tree = proto_tree_add_subtree_format(tree, tvb, offset, 4 + length, ett_pfcp_ie, &ti, "%s : ",
val_to_str_ext_const(type, &pfcp_ie_type_ext, "Unknown"));
proto_tree_add_item(ie_tree, hf_pfcp2_ie, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(ie_tree, hf_pfcp2_ie_len, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
if (type < (NUM_PFCP_IES -1)) {
ie_tvb = tvb_new_subset_remaining(tvb, offset);
if(pfcp_ies[type].decode){
(*pfcp_ies[type].decode) (ie_tvb, pinfo, ie_tree, ti, length, message_type);
} else {
/* NULL function pointer, we have no decoding function*/
proto_tree_add_expert(ie_tree, pinfo, &ei_pfcp_ie_not_decoded_null, tvb, offset, length);
}
} else {
/* IE id outside of array, We have no decoding function for it */
proto_tree_add_expert(ie_tree, pinfo, &ei_pfcp_ie_not_decoded_to_large, tvb, offset, length);
}
offset += length;
}
}
}
static int
dissect_pfcp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void *data _U_)
{
proto_item *item;
proto_tree *sub_tree;
int offset = 0;
guint64 pfcp_flags;
guint8 message_type;
guint32 length;
static const int * pfcp_hdr_flags[] = {
&hf_pfcp_version,
&hf_pfcp_spare_b4,
&hf_pfcp_spare_b3,
&hf_pfcp_spare_b2,
&hf_pfcp_mp_flag,
&hf_pfcp_s_flag,
NULL
};
col_set_str(pinfo->cinfo, COL_PROTOCOL, "PFCP");
col_clear(pinfo->cinfo, COL_INFO);
message_type = tvb_get_guint8(tvb, 1);
col_set_str(pinfo->cinfo, COL_INFO, val_to_str_ext_const(message_type, &pfcp_message_type_ext, "Unknown"));
item = proto_tree_add_item(tree, proto_pfcp, tvb, 0, -1, ENC_NA);
sub_tree = proto_item_add_subtree(item, ett_pfcp);
/* 7.2.2 Message Header */
/*
Octet 8 7 6 5 4 3 2 1
1 | Version |Spare|Spare|Spare| MP | S |
2 | Message Type |
3 | Message Length (1st Octet) |
4 | Message Length (2nd Octet) |
m to | If S flag is set to 1, then SEID shall be |
k(m+7) | placed into octets 5-12. Otherwise, SEID field |
| is not present at all. |
n to | Sequence Number |
(n+2) | |
(n+3) | Spare |
*/
/* Octet 1 */
proto_tree_add_bitmask_with_flags_ret_uint64(sub_tree, tvb, offset, hf_pfcp_hdr_flags,
ett_pfcp_flags, pfcp_hdr_flags, ENC_BIG_ENDIAN, BMT_NO_FALSE | BMT_NO_INT, &pfcp_flags);
offset += 1;
/* Octet 2 Message Type */
proto_tree_add_item(sub_tree, hf_pfcp_msg_type, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
/* Octet 3 - 4 Message Length */
proto_tree_add_item_ret_uint(sub_tree, hf_pfcp_msg_length, tvb, offset, 2, ENC_BIG_ENDIAN, &length);
if ((pfcp_flags & 0x1) == 1) {
/* If S flag is set to 1, then SEID shall be placed into octets 5-12*/
/* Session Endpoint Identifier 8 Octets */
proto_tree_add_item(sub_tree, hf_pfcp_seid, tvb, offset, 8, ENC_BIG_ENDIAN);
offset += 8;
}
/* 7.2.2.2 PFCP Header for Node Related Messages */
/*
Octet 8 7 6 5 4 3 2 1
1 | Version |Spare|Spare|Spare| MP=0 | S=0 |
2 | Message Type |
3 | Message Length (1st Octet) |
4 | Message Length (2nd Octet) |
5 | Sequence Number (1st Octet) |
6 | Sequence Number (2st Octet) |
7 | Sequence Number (3st Octet) |
8 | Spare |
*/
proto_tree_add_item(sub_tree, hf_pfcp_seqno, tvb, offset, 3, ENC_BIG_ENDIAN);
offset += 3;
if ((pfcp_flags & 0x2) == 0x2) {
/* If the "MP" flag is set to "1", then bits 8 to 5 of octet 16 shall indicate the message priority.*/
proto_tree_add_item(sub_tree, hf_pfcp_mp, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(sub_tree, hf_pfcp_spare_h0, tvb, offset, 1, ENC_BIG_ENDIAN);
} else {
proto_tree_add_item(sub_tree, hf_pfcp_spare_oct, tvb, offset, 1, ENC_BIG_ENDIAN);
}
offset++;
/* Dissect the IEs in the message */
dissect_pfcp_ies_common(tvb, pinfo, sub_tree, offset, message_type);
return tvb_reported_length(tvb);
}
/* Enterprise IE decoding 3GPP */
static int
dissect_pfcp_3gpp_enterprise_ies(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
proto_item *top_item = (proto_item *)data;
/* We are give the complete ie, but the first 6 octets are dissected in the pfcp dissector*/
proto_item_append_text(top_item, " Enterprise ID set to '10415' shall not be used for the vendor specific IEs.");
proto_tree_add_expert(tree, pinfo, &ei_pfcp_enterprise_ie_3gpp, tvb, 0, -1);
return tvb_reported_length(tvb);
}
void
proto_register_pfcp(void)
{
static hf_register_info hf_pfcp[] = {
{ &hf_pfcp_msg_type,
{ "Message Type", "pfcp.msg_type",
FT_UINT8, BASE_DEC | BASE_EXT_STRING, &pfcp_message_type_ext, 0x0,
NULL, HFILL }
},
{ &hf_pfcp_msg_length,
{ "Length", "pfcp.length",
FT_UINT8, BASE_HEX, NULL, 0x0,
NULL, HFILL }
},
{ &hf_pfcp_hdr_flags,
{ "Flags", "pfcp.flags",
FT_UINT8, BASE_HEX, NULL, 0x0,
NULL, HFILL }
},
{ &hf_pfcp_version,
{ "Version", "pfcp.version",
FT_UINT8, BASE_DEC, NULL, 0xe0,
NULL, HFILL }
},
{ &hf_pfcp_mp_flag,
{ "MP", "pfcp.mp",
FT_UINT8, BASE_DEC, NULL, 0x02,
NULL, HFILL }
},
{ &hf_pfcp_s_flag,
{ "S", "pfcp.s",
FT_UINT8, BASE_DEC, NULL, 0x01,
NULL, HFILL }
},
{ &hf_pfcp_spare_b2,
{ "Spare", "pfcp.spare_b2",
FT_UINT8, BASE_DEC, NULL, 0x04,
NULL, HFILL }
},
{ &hf_pfcp_spare_b3,
{ "Spare", "pfcp.spare_b3",
FT_UINT8, BASE_DEC, NULL, 0x08,
NULL, HFILL }
},
{ &hf_pfcp_spare_b4,
{ "Spare", "pfcp.spare_b4",
FT_UINT8, BASE_DEC, NULL, 0x10,
NULL, HFILL }
},
{ &hf_pfcp_spare_oct,
{ "Spare", "pfcp.spare_oct",
FT_UINT8, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_pfcp_spare_h0,
{ "Spare", "pfcp.spare_h0",
FT_UINT8, BASE_DEC, NULL, 0x0f,
NULL, HFILL }
},
{ &hf_pfcp_seid,
{ "SEID", "pfcp.seid",
FT_UINT64, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_pfcp_seqno,
{ "Sequence Number", "pfcp.seqno",
FT_UINT24, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_pfcp_mp,
{ "Message Priority", "pfcp.mp",
FT_UINT24, BASE_DEC, NULL, 0xf0,
NULL, HFILL }
},
{ &hf_pfcp_enterprice_id,
{ "Enterprise ID", "pfcp.enterprice_id",
FT_UINT16, BASE_ENTERPRISES, STRINGS_ENTERPRISES,
0x0, NULL, HFILL } },
{ &hf_pfcp2_ie,
{ "IE Type", "pfcp.ie_type",
FT_UINT16, BASE_DEC | BASE_EXT_STRING, &pfcp_ie_type_ext, 0x0,
NULL, HFILL }
},
{ &hf_pfcp2_enterprise_ie,
{ "Enterprise specific IE Type", "pfcp.enterprise_ie",
FT_UINT16, BASE_DEC, NULL, 0x7fff,
NULL, HFILL }
},
{ &hf_pfcp2_ie_len,
{ "Length", "pfcp.ie_len",
FT_UINT16, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_pfcp_recovery_time_stamp,
{ "Recovery Time Stamp", "pfcp.recovery_time_stamp",
FT_STRING, BASE_NONE, NULL, 0,
NULL, HFILL }
},
};
/* Setup protocol subtree array */
static gint *ett[] = {
&ett_pfcp,
&ett_pfcp_flags,
&ett_pfcp_ie,
&ett_pfcp_grouped_ie,
};
static ei_register_info ei[] = {
{ &ei_pfcp_ie_reserved,{ "pfcp.ie_id_reserved", PI_PROTOCOL, PI_ERROR, "Reserved IE value used", EXPFILL } },
{ &ei_pfcp_ie_data_not_decoded,{ "pfcp.ie_data_not_decoded", PI_UNDECODED, PI_NOTE, "IE data not decoded by WS yet", EXPFILL } },
{ &ei_pfcp_ie_not_decoded_null,{ "pfcp.ie_not_decoded_null", PI_UNDECODED, PI_NOTE, "IE not decoded yet(WS:no decoding function(NULL))", EXPFILL } },
{ &ei_pfcp_ie_not_decoded_to_large,{ "pfcp.ie_not_decoded", PI_UNDECODED, PI_NOTE, "IE not decoded yet(WS:IE id to large)", EXPFILL } },
{ &ei_pfcp_enterprise_ie_3gpp,{ "pfcp.ie_enterprise_3gpp", PI_PROTOCOL, PI_ERROR, "IE not decoded yet(WS:No vendor dissector)", EXPFILL } },
};
expert_module_t* expert_pfcp;
proto_pfcp = proto_register_protocol("Packet Forwarding Control Protocol", "PFCP", "pfcp");
pfcp_handle = register_dissector("pfcp", dissect_pfcp, proto_pfcp);
proto_register_field_array(proto_pfcp, hf_pfcp, array_length(hf_pfcp));
proto_register_subtree_array(ett, array_length(ett));
expert_pfcp = expert_register_protocol(proto_pfcp);
expert_register_field_array(expert_pfcp, ei, array_length(ei));
/* Register dissector table for enterprise IE dissectors */
pfcp_enterprise_ies_dissector_table = register_dissector_table("pfcp.enterprise_ies", "PFCP Enterprice IEs",
proto_pfcp, FT_UINT32, BASE_DEC);
pfcp_3gpp_ies_handle = register_dissector("pfcp_3gpp_ies", dissect_pfcp_3gpp_enterprise_ies, proto_pfcp);
}
void
proto_reg_handoff_pfcp(void)
{
dissector_add_for_decode_as_with_preference("udp.port", pfcp_handle);
/* Register 3GPP in the table to give expert info and serve as an example how to add decoding of enterprise IEs*/
dissector_add_uint("pfcp.enterprise_ies", VENDOR_THE3GPP, pfcp_3gpp_ies_handle);
}
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 4
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/