pfcp — 5G N4 SMF-to-UPF Session Establishment & SEID Rules
- Default Port / Protocol
- UDP 8805
- Host Endpoint Rule
- Dual-Stack IPv4/IPv6
- Wireshark Display Filter
- pfcp
- Standards & Specs
- 3GPP TS 29.244, RFC 768
What It Does on the Wire
Where 5G SMF control plane meets the UPF user plane on UDP 8805 — pfcp builds 3GPP TS 29.244 Heartbeat, Association Setup, and 64-bit seid Session Establishment/Modification/Deletion frames cleanly.
Packet Forwarding Control Protocol (pfcp, 3GPP TS 29.244) is the 5G Core N4 interface (between SMF Session Management Function and UPF User Plane Function) and the 4G CUPS Sxa/Sxb/Sxc control-to-user-plane separation protocol on UDP port 8805. PFCP separates node-level messages (S=0: Heartbeat, Association Setup/Update/Release) from session-level messages (S=1: Session Establishment, Modification, Deletion, Report carrying a 64-bit Session Endpoint Identifier seid + 24-bit Sequence Number).
FrameAssembly automatically sets or clears the S-bit (Version 1) based on message type, writes 8-byte seid headers on session PDUs (50..57), and encodes Node ID (IPv4, IPv6, or FQDN), Recovery Time Stamp, and Cause TLV IEs.
5G Core N4 SMF <-> UPF Session Establishment & Modification Labs
Test Open5GS, free5GC, UPF eBPF/XDP data planes, and 5G packet-core probes with associationsetuprequest, sessionestablishmentrequest (seid), and sessionmodificationrequest flows.
N4 Control-Plane Firewall & SEID Hijack IDS Rule Validation
Verify telco security zones restrict UDP 8805 strictly to authorized SMF/UPF nodeid addresses and alert on unauthorized sessiondeletionrequest or sessionmodificationrequest anomalies.
UPF Restart Detection via PFCP Heartbeat Recovery Timestamps
Simulate an UPF reboot by changing the 32-bit recovery timestamp across consecutive heartbeatrequest / heartbeatresponse exchanges.
RFC Wire Header Layout (pfcp)
Select any 32-bit wire word or field slice below to inspect which .frasm modifiers control those octets and what defaults the compiler writes.
Filter with pfcp on UDP 8805 to inspect S-flag SEID presence, 24-bit Sequence Number, Node ID, F-SEID, and Cause IEs across SMF <-> UPF sessions.
Minimal Quickstart (pfcp_quickstart.frasm)
Select Preview Packets to compile in-browser and inspect timestamps + wire byte lengths, or open directly in the Playground.
host smf_n4 { ip 10.55.4.10 }
host upf_n4 { ip 10.55.4.20 }
compile {
smf_n4 -> upf_n4 pfcp sessionestablishmentrequest seid 0x0000000000001001 seqnum 1 nodeid 10.55.4.10 wait 3ms
smf_n4 <- upf_n4 pfcp sessionestablishmentresponse seid 0x0000000000002001 seqnum 1 nodeid 10.55.4.20 cause 1
}Handled Automatically on the Wire
- Defaults to UDP destination port
8805and auto-toggles the PFCP headerSflag (S=08-byte node header on Heartbeat/Association;S=116-byte session header with 64-bitseidon Session messages). - Computes the 16-bit PFCP
Message Length(covering SEID, 24-bit Sequence Number, Spare byte, and all TLV IEs). - Detects IPv4, IPv6, or FQDN strings passed to
nodeidand formats IE Type60(Node ID) with the matching address-type selector byte (0=IPv4,1=IPv6,2=FQDN).
5G Standalone N4 Lifecycle: Association Setup, PDU Session Establishment & Heartbeat
Walks through N4 Association Setup between an SMF and edge UPF, establishes a 5G PDU session (cause 1 Request accepted), updates forwarding rules after gNB N3 tunnel binding, and exchanges N4 Heartbeats.
host smf_core { ip 10.250.4.11 }
host upf_edge { ip 10.250.4.51 }
compile {
// 1. Node-level N4 Association Setup (S-bit = 0, no SEID field)
smf_core -> upf_edge pfcp associationsetuprequest seqnum 10 nodeid 10.250.4.11 recovery 3910000000 wait 2ms
smf_core <- upf_edge pfcp associationsetupresponse seqnum 10 nodeid 10.250.4.51 cause 1 recovery 3910000005 wait 4ms
// 2. Session-level PDU Session Establishment (S-bit = 1, 64-bit F-SEID)
smf_core -> upf_edge pfcp sessionestablishmentrequest seid 0x00000001000000a1 seqnum 11 nodeid 10.250.4.11 dscp 46 wait 3ms
smf_core <- upf_edge pfcp sessionestablishmentresponse seid 0x00000002000000b1 seqnum 11 nodeid 10.250.4.51 cause 1 dscp 46 wait 3ms
// 3. Session Modification (activates downlink FAR after NGAP InitialContextSetup)
smf_core -> upf_edge pfcp sessionmodificationrequest seid 0x00000001000000a1 seqnum 12 wait 2ms
smf_core <- upf_edge pfcp sessionmodificationresponse seid 0x00000002000000b1 seqnum 12 cause 1 wait 10ms
// 4. Periodic N4 Heartbeat
smf_core -> upf_edge pfcp heartbeatrequest seqnum 13 recovery 3910000000 wait 1ms
smf_core <- upf_edge pfcp heartbeatresponse seqnum 13 recovery 3910000005
}# 1. Eyeball relative timestamps, ports & wire lengths in your terminal
frameassembly show pfcp_5g_n4_lifecycle.frasm
# 2. Compile .frasm -> classic .pcap, nanosecond .pcapng, or pipe via '-'
frameassembly pfcp_5g_n4_lifecycle.frasm pfcp_5g_n4_lifecycle.pcap
frameassembly pfcp_5g_n4_lifecycle.frasm pfcp_5g_n4_lifecycle.pcapng
# 3. Round-trip .pcap <-> .frasm whenever you want to scrub or tweak an existing capture
frameassembly reverse pfcp_5g_n4_lifecycle.pcap pfcp_5g_n4_lifecycle_edited.frasm
# 4. Verify dissected protocol fields in tshark
tshark -r pfcp_5g_n4_lifecycle.pcap -Y "pfcp"All pfcp Keywords & Header Options
Every sub-keyword and header option is lowercase [a-z0-9]+ with zero underscores — mix and match them in any order after pfcp:
src_host -> dst_host pfcp [heartbeatrequest | heartbeatresponse | associationsetuprequest | associationsetupresponse | sessionestablishmentrequest | sessionestablishmentresponse | sessionmodificationrequest | sessionmodificationresponse | sessiondeletionrequest | sessiondeletionresponse | msgtype "<text>"] [seid <number>] [seqnum <0..16777215>] [cause <0..255>] [nodeid <ip_or_text>] [recovery <number>]| Keyword / Option | Accepted Value | Default | Effect on Packet |
|---|---|---|---|
| heartbeatrequest | heartbeatresponse | associationsetuprequest | associationsetupresponse | sessionestablishmentrequest | sessionestablishmentresponse | sessionmodificationrequest | sessionmodificationresponse | sessiondeletionrequest | sessiondeletionresponse | msgtype "<text>" | 3GPP TS 29.244 PFCP Message Type | heartbeatrequest (1) | Sets byte 1 (1/2 Heartbeat, 5/6 Association Setup, 50/51 Session Establishment, 52/53 Modification, 54/55 Deletion) and S flag. |
| seid <number> | 64-bit Session Endpoint Identifier | 1 (on session messages) | Writes the 8-byte big-endian SEID in bytes 4..11 of session-related (S=1) PFCP headers. |
| seqnum <0..16777215> | 24-bit PFCP Sequence Number | 1 | Writes the 3-byte big-endian transaction Sequence Number. |
| cause <0..255> | 8-bit PFCP Cause IE (IE Type 19) | 1 (Request accepted) on responses | Appends IE Type 19 (1 Request accepted, 64 Session context not found, 69 Mandatory IE missing). |
| nodeid <ip_or_text> | IPv4, IPv6, or FQDN string (IE Type 60) | Source host IP on setup/establishment | Appends IE Type 60 (Node ID) identifying the originating SMF or UPF control plane. |
| recovery <number> | 32-bit NTP-era Recovery Time Stamp (IE Type 96) | Auto-populated on Heartbeat / Association | Appends IE Type 96 (Recovery Time Stamp, seconds since 1900-01-01). |
Cross-Layer Wrappers Valid with pfcp
802.1Q VLAN / QinQ / MPLS tags, IPv4/IPv6 QoS & TTL fields, wait gaps, and transport overrides allowed on this protocol
14 options
Cross-Layer Wrappers Valid with pfcp
802.1Q VLAN / QinQ / MPLS tags, IPv4/IPv6 QoS & TTL fields, wait gaps, and transport overrides allowed on this protocol
| Option | Range / Format | Default | Effect on Packet |
|---|---|---|---|
| wait <number><ns|us|ms|s|m> | Time gap (ns, us, ms, s, m) | 10ms | Advances the packet timestamp clock after sending this packet and before the next packet (wait 0ns sends back-to-back). |
| comment "<text>" | Quoted UTF-8 annotation | Omitted | Attaches an Enhanced Packet Block opt_comment annotation when compiling to .pcapng (Wireshark pkt_comment filter). |
| payload "<text>" | hexpayload "<hex>" | Quoted text or hex bytes (choose one) | Omitted | Appends or overrides raw payload bytes ("deadbeef", "de:ad:be:ef", or "\x01\x02") and updates packet lengths and checksums. |
| srcmac <mac> | dstmac <mac> | ethertype <0..65535> | Colon/hyphen/Cisco MAC · EtherType 0..65535 (e.g. 0x0800) | Host MAC / RFC multicast MAC / auto EtherType | Overrides the 14-byte Ethernet II source MAC, destination MAC, or standalone Layer 2 16-bit EtherType. |
| fcs | badfcs | Ethernet CRC-32 trailer flags (choose one) | Omitted | fcs appends a valid IEEE 802.3 4-byte CRC-32 Frame Check Sequence trailer; badfcs XOR-corrupts the CRC-32 for NIC/tap negative tests. |
| vlan <0..4095> [pcp <0..7>] [dei <0|1>] | VLAN ID 0..4095, PCP 0..7, DEI 0..1 | Untagged | Wraps the packet in an IEEE 802.1Q VLAN tag (0x8100) with optional 802.1p QoS priority. |
| qinq <0..4095> [innervlan <0..4095>] | Outer S-VLAN 0..4095, Inner C-VLAN 0..4095 | Untagged (innervlan 1 when qinq is set) | Double-tags the packet with outer IEEE 802.1ad S-Tag (0x88a8) plus inner IEEE 802.1Q C-Tag (0x8100). |
| mpls <0..1048575> [label <0..1048575>] [exp|tc <0..7>] [bos <0|1>] [mplsttl <0..255>] | Repeatable label stack (0..1048575, exp/tc 0..7, bos 0..1, ttl 0..255) | Unlabeled (auto bos=0 on outer labels, bos=1 on bottom) | Prepends one or more 32-bit MPLS label shims (0x8847, e.g. mpls 16000 mpls 24010) ahead of Layer 2 EoMPLS or Layer 3 payloads. |
| ttl <0..255> [dscp <0..63>] [ecn <0..3>] | TTL/Hop Limit 0..255, DSCP 0..63, ECN 0..3 | ttl 64, dscp 0, ecn 0 | Sets IPv4 TTL or IPv6 Hop Limit plus DiffServ (DSCP) and ECN QoS markings. |
| ipid <0..65535> [df] [mf] [fragoffset <0..8191>] [routeralert] [badipchecksum] | IPv4 ID, DF/MF flags, offset 0..8191, Router Alert & checksum fault | ipid 1, flags 0, fragoffset 0, valid RFC 1071 checksum | Sets IPv4 Identification/fragmentation, injects RFC 2113 Router Alert (20 04 00 00), or corrupts the 16-bit IPv4 header checksum (badipchecksum). |
| flowlabel <0..1048575> | 20-bit IPv6 Flow Label (0..1048575) | 0 | Sets the 20-bit IPv6 Flow Label for ECMP routing tests (valid on IPv6 endpoint pairs only). |
| srcport <0..65535> | dstport <0..65535> | Port number 0..65535 | srcport 49152 (remembered), UDP 8805 | Overrides source or destination port and remembers the port pair automatically on <- replies. |
| transport sctp | Optional SCTP association transport (IP Proto 132) | UDP (UDP 8805) | Carries this Layer 7 PDU inside a stateful RFC 9260 SCTP DATA chunk with automatic Verification Tag, TSN tracking, and CRC-32c. |
| badchecksum | nochecksum | L4 checksum fault or UDP zero-checksum flag | Valid RFC checksum / CRC-32c | badchecksum corrupts the L4 checksum for negative firewall/NIC offload tests; nochecksum writes 0x0000 in UDP headers. |
Gotchas & Quick Fixes
PFCP Accepted Cause Code Is 1 (Unlike GTPv2-C Cause 16)
smf <- upf pfcp sessionestablishmentresponse seid 0x10 seqnum 1 cause 16smf <- upf pfcp sessionestablishmentresponse seid 0x10 seqnum 1 cause 1In 3GPP TS 29.244 PFCP, cause 1 means Request accepted (whereas 16 is GTPv2-C’s accepted code in TS 29.274).
Node-Level Messages Do Not Carry a Wire SEID
smf -> upf pfcp heartbeatrequest seqnum 1 recovery 3910000000heartbeat* and associationsetup* transmit S=0 (8-byte header without a SEID slot); use seid on sessionestablishment*, sessionmodification*, and sessiondeletion*.