Skip to content

About

VectorCore SMF/UPF PGW-C/PGW-U

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

10 Commits

Folders and files

Repository files navigation

VectorCore SMF/UPF

Warning

Alpha software. Under active development. This code is not fully tested and is not expected to be fully functional yet. Interfaces, configuration and behavior may change without notice. Do not use it in production.

Project status

This is not yet a complete SMF/UPF. Development is 4G-first:

  • In progress: the 4G/EPC side (PGW-C/PGW-U role over GTPv2-C (S5/S8, S2b) and PFCP/Sx)
  • Planned: the 5G side (N4 toward the SMF role, then Nsmf/N1)

Expect missing features, rough edges and breaking changes while the 4G path is being built out.

Testing and bug reports

Feedback is very welcome. If you can test this against your own SGW, ePDG, TWAG or other core components, please open an issue with:

  • What you were testing and which peer equipment/software was used
  • Your configuration (with secrets removed)
  • Logs and, if possible, a pcap of the GTPv2-C/PFCP/GTP-U exchange
  • What you expected versus what happened

Bug reports, interop results (including "it worked with X") and pull requests are all appreciated.

A converged SMF/UPF: one control-plane process (SMF) and one user-plane

process (UPF) in a CUPS split (TS 23.214), joined by PFCP, with an XDP/eBPF fast path in the UPF. Rel-15 throughout.

Toward LTE and non-3GPP access, the SMF's GTPv2-C access front-end plays the role TS 29.274 calls PGW-C (and the UPF the role it calls PGW-U), so the node interoperates with an SGW, ePDG or TWAG. The session/policy core is access-neutral, so 5G (N4, and later Nsmf/N1) is extra front-ends on the same node rather than a separate product.

 SGW ──S5/S8-C──┐                    ┌── Gx  ── PCRF
ePDG ──S2b──────┼── SMF ─────────────┼── Gy  ── OCS
TWAG ──S2a──────┘    │               ├── S6b ── 3GPP AAA
                     │ PFCP (Sxb/N4) └── RADIUS accounting
                     ▼
 SGW-U/ePDG/TWAG ── UPF (XDP/eBPF) ── SGi (per-APN interfaces)
      GTP-U

Features

Access front-ends (SMF, one shared GTPv2-C socket)

  • S5/S8-C — Create/Modify/Delete Session, Modify Bearer (incl. access handover), Echo, Create/Update/Delete Bearer (network-initiated). Interop peer: vectorcore-sgw.
  • S2b (untrusted WLAN / VoWiFi) — Create/Delete Session, bearer procedures, gated on S6b authorization. Interop peer: vectorcore-ePDG.
  • S2a (trusted WLAN) — Create/Delete Session. Interop peer: vectorcore-twag.
  • Re-attach collision handling across front-ends, with full PFCP/BPF teardown of the old session.
  • GTPv2-C path management and restart detection (TS 23.007).

Session & policy core (SMF)

  • Per-APN IPv4 and IPv6 pools; PDN types IPv4, IPv6 and IPv4v6.
  • PCO: DNS, MTU, P-CSCF (IPv4 and IPv6).
  • Local PCC rules and per-APN policy, with fallback when the PCRF is unavailable.
  • Dedicated bearers with TFT/SDF classification, QCI/ARP/GBR/MBR, APN-AMBR.
  • Gx (PCRF-driven PCC, incl. RAR), Gy (online charging, Final-Unit-Indication: terminate/redirect/restrict), S6b (AAA for S2b) — all on one shared Diameter peer manager.
  • RADIUS accounting (RFC 2866) per APN.

User plane (UPF)

  • PFCP association, heartbeat, session establishment/modification/deletion; PDR/FAR/QER/URR. PFCP state is authoritative; BPF maps are compiled from it.
  • 5G N4 IEs (QFI etc.) on the same PFCP layer.
  • XDP/eBPF dataplane: uplink GTP-U decap and TEID lookup, downlink UE-IP lookup and GTP-U encap, IPv4 and IPv6, SDF classification, QER rate limiting, per-rule counters, DSCP marking, multiple SGi interfaces by PFCP Network Instance.
  • Usage reporting to the SMF (URR) for Gy and RADIUS.
  • GTP-U Echo and Error Indication; next-hop neighbour resolution.
  • HTTP redirect for out-of-credit sessions, and optional per-APN HTTP header enrichment (cleartext HTTP only, off by default).
  • Restart and path-failure recovery toward the SMF.

Not built yet: the Nsmf_PDUSession SBI service and Namf client. The N1 NAS-SM (5GSM) codec exists (internal/smf/nas) but nothing reaches it from an AMF yet.

Repository layout

cmd/vectorcore-smf/      SMF daemon
cmd/vectorcore-upf/      UPF daemon
cmd/vectorcore-smfctl/   Operational CLI
internal/gtpv2/          GTPv2-C IEs, messages, transport, PCO, TFT
internal/pfcp/           PFCP IEs (incl. N4), messages, transport
internal/diameter/       Shared Diameter peer manager
internal/smf/            SMF: GTP-C front-end, attach, sessions, IP pools,
                         PFCP client, policy, Gx, Gy, S6b, RADIUS,
                         recovery, NAS-SM
internal/upf/            UPF: PFCP server, GTP-U, neighbour resolution,
                         redirect, header enrichment
internal/dataplane/bpf/  BPF loader, PFCP→BPF compiler, generated bindings
ebpf/                    XDP program C sources
internal/api/            JSON API (Huma, no web UI)
internal/config/         SMF and UPF YAML config
configs/                 Example configs (smf.yaml, upf.yaml)
deploy/systemd/          systemd units
docs/                    Project overview, compliance records, audits,
                         handoffs, local 3GPP specs

Build

Requires Go (see go.mod). Rebuilding the XDP object also needs clang and libbpf-dev; the generated bindings are checked in, so a plain build works without them.

make build    # bin/smf, bin/upf, bin/smfctl
make test
make vet
make verify   # generate + vet + test + build

Install and run

make install  # /opt/vectorcore/{bin,etc} and the systemd units
systemctl enable --now vectorcore-upf vectorcore-smf

Both daemons take -c <config>, -validate (check config and exit), -d (debug console logging) and -v (version). Without -c they read /etc/vectorcore/upf/{smf,upf}.yaml; the systemd units point at /opt/vectorcore/etc/.

Config notes:

  • SMF gtpc.s5c.listen must be a specific routable IP (it is advertised to peers). S2b, S2a, Gx, Gy, S6b and RADIUS are each enabled separately and are off by default.
  • SMF pfcp.upf_addr must match the UPF's pfcp.node_ip/pfcp.listen. Either side can start first: the SMF keeps retrying Association Setup.
  • The UPF needs a host that can load XDP programs. Set dataplane.attach_on_start: false to run PFCP without a dataplane (e.g. in containers that can't load BPF).

Operations

  • smfctl validate -smf configs/smf.yaml -upf configs/upf.yaml — check configs without opening sockets or BPF hooks.
  • smfctl health — SMF and UPF health over the JSON API.
  • JSON API: SMF :8080, UPF :8081 (GET /health). No web UI.
  • Prometheus /metrics: SMF :9090, UPF :9091 — active sessions and per-session info, PFCP peer state, active PDRs/FARs, uplink/downlink packet and byte counters.

About

VectorCore SMF/UPF PGW-C/PGW-U

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages