upf

package
v1.10.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 3, 2026 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PfcpAddress         = "0.0.0.0"
	PfcpNodeID          = "0.0.0.0"
	FTEIDPool           = 65535
	ConnTrackTimeout    = 10 * time.Minute
	InactiveFlowTimeout = 30 * time.Second
	ActiveFlowTimeout   = 30 * time.Minute
)

Variables

This section is empty.

Functions

func RegisterMetrics added in v1.2.0

func RegisterMetrics()

func StringToXDPAttachMode

func StringToXDPAttachMode(Mode string) link.XDPAttachFlags

Types

type SettingsReconciler added in v1.10.0

type SettingsReconciler struct {
	// contains filtered or unexported fields
}

SettingsReconciler drives this node's UPF runtime from replicated DB settings: NAT toggle, flow accounting toggle, advertised N3 address, and per-policy SDF filters. Each tick reads the desired state from the DB and applies it to the local UPF only when it differs from the last-applied snapshot — the underlying Reload* and UpdateFilters calls re-attach XDP / re-write eBPF maps, so calling them unconditionally on every tick would disrupt the data plane.

func NewSettingsReconciler added in v1.10.0

func NewSettingsReconciler(updater Updater, store SettingsStore, changefeed *db.Changefeed, fallbackN3IP netip.Addr) *SettingsReconciler

NewSettingsReconciler wires a reconciler. fallbackN3IP is the local node's configured N3 address used when n3_settings.external_address is empty. changefeed may be nil in tests that drive Reconcile() directly; production callers always pass a non-nil broker.

func (*SettingsReconciler) Reconcile added in v1.10.0

func (r *SettingsReconciler) Reconcile(ctx context.Context) error

Reconcile performs one reconcile pass. Exposed for tests and for callers that want to force convergence after a known change.

func (*SettingsReconciler) Start added in v1.10.0

func (r *SettingsReconciler) Start()

Start launches the reconciler goroutine. Subsequent calls without a paired Stop are no-ops.

func (*SettingsReconciler) Stop added in v1.10.0

func (r *SettingsReconciler) Stop()

Stop signals the reconciler to exit and blocks until the goroutine has drained.

type SettingsStore added in v1.10.0

type SettingsStore interface {
	IsNATEnabled(ctx context.Context) (bool, error)
	IsFlowAccountingEnabled(ctx context.Context) (bool, error)
	GetN3Settings(ctx context.Context) (*db.N3Settings, error)
	ListPoliciesPage(ctx context.Context, page int, perPage int) ([]db.Policy, int, error)
	ListRulesForPolicy(ctx context.Context, policyID string) ([]*db.NetworkRule, error)
}

SettingsStore is the narrow view the reconciler needs over the DB. *db.Database satisfies it; a fake satisfies it in tests.

type UPF added in v0.1.0

type UPF struct {
	// contains filtered or unexported fields
}

func Start

func Start(ctx context.Context, smfHandler engine.SMFReportHandler, n3Interface config.N3Interface, n3IPv4 string, n3IPv6 string, advertisedN3IPv4 string, advertisedN3IPv6 string, n6Interface config.N6Interface, xdpAttachMode string, masquerade bool, flowact bool) (*UPF, error)

func (*UPF) Close added in v0.1.0

func (u *UPF) Close(ctx context.Context)

func (*UPF) Engine added in v1.9.0

func (u *UPF) Engine() *engine.SessionEngine

func (*UPF) FlushUsage added in v1.10.0

func (u *UPF) FlushUsage(ctx context.Context, seid uint64)

FlushUsage drains and reports any pending URR counters for the given SEID. Called by the SMF immediately before session deletion so that traffic accounted since the last periodic poll is reported to the subscriber-usage store and not dropped when the session is removed from the engine (3GPP TS 29.244 §5.2.2.4 termination reporting trigger).

func (*UPF) ReloadFlowAccounting added in v1.4.0

func (u *UPF) ReloadFlowAccounting(flowact bool) error

func (*UPF) ReloadNAT added in v1.4.0

func (u *UPF) ReloadNAT(masquerade bool) error

func (*UPF) UpdateAdvertisedN3Address added in v0.5.0

func (u *UPF) UpdateAdvertisedN3Address(newN3Addr netip.Addr)

func (*UPF) UpdateFilters added in v1.9.0

func (u *UPF) UpdateFilters(ctx context.Context, policyID string, direction models.Direction, rules []models.FilterRule) error

type Updater added in v1.10.0

type Updater interface {
	ReloadNAT(enabled bool) error
	ReloadFlowAccounting(enabled bool) error
	UpdateAdvertisedN3Address(addr netip.Addr)
	UpdateFilters(ctx context.Context, policyID string, direction models.Direction, rules []models.FilterRule) error
}

Updater is the narrow view the reconciler needs over the UPF runtime. *UPF satisfies it.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL