18 Commits

Author SHA1 Message Date
Pau Espin Pedrol
528ca8cd78 Log regular tunmap/tunend actions as INFO
Change-Id: If24b1247ab21d1bdb7314244a7936d92377a5548
2025-05-06 19:55:58 +02:00
Pau Espin Pedrol
4ec29cf904 up_session: Log regular Establish/Modify/Release as INFO
Change-Id: Ibc1633f316d1d1009893a6e02361b5be190cbce8
2025-05-06 19:55:32 +02:00
Pau Espin Pedrol
a2289c0730 Increase per PDR (F-TEID) hashtable size
In tunmap scenario there's usually 2 PDRs/local-F-TEIDs per session,
hence it makes sense to at least double the hashtable size with respect
to session hashtable. In here we actually multiply it by 2 twice since
this is actually global and not per peer, hence we account for multiple
peers.

Change-Id: I7ee3e875020d707c05e13ee70952174ca4daad30
2025-02-18 19:36:44 +01:00
Pau Espin Pedrol
d2241da833 up_peer: Increase up/cp seid hashtable sizes
During a 200K session setup, this can still take quite a noticeable
amount of time (20% of a full CPU) during session creation.

Change-Id: I424778a4c75000fb67ba4725a6a3e3e91a80fc76
2025-02-18 18:59:41 +01:00
Pau Espin Pedrol
68c0e96a81 Introduce hashtable to look up session in endpoint by UP SEID
This is used every time a new PFCP session was being allocated.
It allows looking up if a given UP SEID exists in any of the peers.
Before this patch, iterating over tens/hundreds of UP peers on every
session creation took 38% of a full CPU.

Change-Id: I617b405e59a3435a1c4912bf4161bc9e036754b4
2025-02-18 18:59:08 +01:00
Pau Espin Pedrol
b54baeff98 up_peer: Document field
Change-Id: I194074f657fb793681658c021579880f352a3f91
2025-02-18 18:48:02 +01:00
Oliver Smith
6fe425cd47 Bump version: 0.2.0.7-b6d6-dirty → 0.3.0
Change-Id: I645f50a09db9ef16262c1b990c33c2bf115027c5
2025-02-18 12:20:35 +01:00
Pau Espin Pedrol
b6d689d677 Introduce hashtable to look up gtp_tundev by local TEID
Use this hashtable while looking up for tunend based on
<access.local.teid, access.remote.teid, access.remote.addr>.
This kind of look up is used every time a session is added or removed,
which means potentially thousands of tunend sessions were being iterated
linerarly every time.

For simplification (easier/quicker hashtable key generation), reduce the
whole key presented above to a more general one based on
"access.local.teid". This is usually enough since we are anyways
allocating local TEIDs globally per tunnel without caring about remote
address.

Change-Id: Ib12ecc8ce87175071c52c0ed2217a29d901f0f05
2025-02-17 19:33:13 +01:00
Pau Espin Pedrol
bede7f130f Introduce hashtable to lookup chain_id
This lookup was taking ages specially when UPF already managed thousands
of sessions.

Related: SYS#6398
Change-Id: I7df8fd945eedbda98bd08e9fb2f382e0f55c2983
2025-01-31 19:13:27 +01:00
Pau Espin Pedrol
c27e317b21 Introduce hashtable to lookup session by F-TEID
This is a hot path when creating new sessions. Previous code would take
ages specially when UPF already had thousands of sessions created and a
new TEID to allocate was being looked up.

Related: SYS#6398
Change-Id: I90ecbb07b242c1de2298261019f24aa5f5810fda
2025-01-31 19:12:42 +01:00
Pau Espin Pedrol
d4a4f0ce63 Simplify up_session_choose_f_teid() with early returns
Change-Id: I6e8c64d093588157c86bb3acaaeed458ff73132d
2025-01-31 16:16:23 +01:00
Pau Espin Pedrol
63c98c38f1 Remove unused file up_session_to_gtp.c
Change-Id: Iabdf4855be72759569d1ac254774311f8682a2df
2025-01-31 15:35:28 +01:00
Pau Espin Pedrol
a306a1aa01 Improve logging reading packets from gtp device
Change-Id: Ic3d9ea319122acbaf99ca7d6ff615b5812a085f8
2025-01-27 19:14:02 +01:00
Oliver Smith
81ca6a0d16 upf_gtp: automatically delete old gtp devices
If osmo-upf crashes without running the destructor, we may have a
leftover gtp device. This can be simulated with "killall -9 osmo-upf".

Clean it up automatically.

Related: SYS#7240
Depends: libgtpnl Ib99bd8eed854014a5c9118c23e4058a41f3145f2
Change-Id: I7bb5c1ed51f4e05964688ee77b8de77fd3c0f345
2024-12-17 15:08:25 +01:00
Oliver Smith
12d7cf87a9 Bump version: 0.1.1.112-9c90 → 0.2.0
Change-Id: I772edbd17fcac0da597c30eecefa54f9fd8c3ed3
2024-12-11 16:56:21 +01:00
Neels Janosch Hofmeyr
9c904c185a osmo-upf: add VTY 'gtp-echo' command
Allow sending GTPv1-U Echo Requests to GTP peers via new VTY command

  gtp1u-echo send to (A.B.C.D|X:X::X:X)
  gtp1u-echo send to (A.B.C.D|X:X::X:X) local-ip (A.B.C.D|X:X::X:X)
  gtp1u-echo send to (A.B.C.D|X:X::X:X) local-dev DEV_NAME

Related: OS#6541
Tweaked-by: Oliver Smith <osmith@sysmocom.de>
Change-Id: I970dccd7a27b098eea9e660822e24e2c4b059fc6
2024-11-05 11:05:21 +01:00
Neels Janosch Hofmeyr
b3d4ca6d80 nft: batch nftables commands
Store nftables ruleset commands for a limited time and a limited volume
before submitting in batch, in order to minimize the overhead associated
with submitting nftables commands.

Configurable by 'timer nft X32' and 'X33'

Change-Id: Ib0a8e86b29bab1559d94fc55a89daa00ec670318
2024-10-24 11:20:24 +00:00
Neels Janosch Hofmeyr
e16bb2826b pfcp-tool: always use specific PDR ids for access and core
Makes it easier to find the right one later.
This will be used to fetch the UPF chosen TEIDs from PFCP responses in
upcoming "n-sessions [4/4]" I74a21cc31296ab89a2acda1da8ae9693c1992e66.

Related: SYS#6590
Change-Id: Ic343494001c70a84f3402ce5749d08e729551b26
2024-10-24 11:16:54 +00:00
24 changed files with 750 additions and 252 deletions

View File

@@ -1,9 +1,9 @@
# When cleaning up this file: bump API version in corresponding Makefile.am and rename corresponding debian/lib*.install
# according to https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html#Updating-version-info
# In short:
# according to https://osmocom.org/projects/cellular-infrastructure/wiki/Make_a_new_release
# In short: https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html#Updating-version-info
# LIBVERSION=c:r:a
# If the library source code has changed at all since the last update, then increment revision: c:r + 1:a.
# If any interfaces have been added, removed, or changed since the last update: c + 1:0:0.
# If any interfaces have been added, removed, or changed since the last update: c + 1:0:a.
# If any interfaces have been added since the last public release: c:r:a + 1.
# If any interfaces have been removed or changed since the last public release: c:r:0.
#library what description / commit summary line
#library what description / commit summary line

View File

@@ -36,11 +36,11 @@ fi
PKG_PROG_PKG_CONFIG([0.20])
dnl checks for libraries
PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.6.0)
PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.6.0)
PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 1.6.0)
PKG_CHECK_MODULES(LIBOSMOPFCP, libosmo-pfcp >= 0.1.0)
PKG_CHECK_MODULES(LIBGTPNL, libgtpnl >= 1.2.0)
PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.11.0)
PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.11.0)
PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 1.11.0)
PKG_CHECK_MODULES(LIBOSMOPFCP, libosmo-pfcp >= 0.5.0)
PKG_CHECK_MODULES(LIBGTPNL, libgtpnl >= 1.3.2)
PKG_CHECK_MODULES(LIBNFTABLES, libnftables >= 1.0.2)
dnl checks for header files

145
debian/changelog vendored
View File

@@ -1,3 +1,148 @@
osmo-upf (0.3.0) unstable; urgency=medium
[ Oliver Smith ]
* upf_gtp: automatically delete old gtp devices
[ Pau Espin Pedrol ]
* Improve logging reading packets from gtp device
* Remove unused file up_session_to_gtp.c
* Simplify up_session_choose_f_teid() with early returns
* Introduce hashtable to lookup session by F-TEID
* Introduce hashtable to lookup chain_id
* Introduce hashtable to look up gtp_tundev by local TEID
-- Oliver Smith <osmith@sysmocom.de> Tue, 18 Feb 2025 12:20:35 +0100
osmo-upf (0.2.0) unstable; urgency=medium
[ Neels Hofmeyr ]
* improve manual: PFCP and GTP interfaces
* example cfg: tweak logging
[ Oliver Smith ]
* osmo_pfcp_tool: fix osmo_pfcp_tool_copyright error
* debian: add osmo-pfcp-tool to osmo-upf package
* Run struct_endianness.py
* contrib/jenkins: build nftables without python
* contrib/jenkins: clone netfilter repos with https
* contrib/jenkins: netfilter: use PARALLEL_MAKE
* debian: set compat level to 10
* systemd: depend on networking-online.target
* .deb/.rpm: various fixes related to non-root
* contrib/systemd: AmbientCapabilities=CAP_NET_ADMIN
* contrib: remove rpm spec file
* debian/postinst: add checks, be verbose
[ Neels Janosch Hofmeyr ]
* Allow running without a GTP dev
* drop charts/, duplicated from libosmo-pfcp.git
* manual: add/fix running.adoc
* manual: add 'Configure Primary Links'
* vty doc: indicate default nft table name
* silence misleading error: "HEARTBEAT_REQ: Unknown message type"
* drop unused enum up_session_kind
* tests/upf.vty: add some missing nodes to the test
* VTY: rename 'gtp' to 'tunend'
* VTY: rename 'nft' to 'tunmap'
* osmo-pfcp-tool VTY: rename 'endecaps' to 'tunend'
* cosmetic: in code, rename 'endecaps' to 'tunend'
* cosmetic: rename upf_gtp_tun to upf_gtp_tunend
* drop unused upf_gtp_dev_is_tunnel_active()
* cosmetic: rename upf_gtp_dev_tunnel_* to upf_gtp_dev_tunend_*
* vty: revert rename of 'show gtp'
* VTY: show gtp: still list tunmap if no tunend device is open
* up_gtp_action_to_str_buf(): always print PDR IDs
* use osmo_pfcp_ie_outer_header_creation_to_str_buf()
* gtpu_echo: do not osmo_fd_register twice
* VTY 'show gtp': more accurately identify local/remote IP
* fix access/core mixup of PDR IDs / tunmap FAR
* clarify comments and naming around PDR+FAR classification
* tunmap: choose local GTP addr by Network Instance IEs
* log: add missing sep in far_to_str
* fix PFCP Session Mod: Update FAR
* in GTP actions, also store local GTP addrs
* nft: rename addr to addr_remote, add addr_local
* nft: incoming GTP-U: match on local IP, not remote IP
* nft: rewrite source IP in outgoing GTP-U
* nft: log nft rulesets on debug log
* nft: end each rule in semicolon
* nft: ensure to assign rule id only once
* GTP,UE addrs in osmo_sockaddr: assert( port == 0 )
* nft: allow to get the ruleset string without running
* vty: add: show nft-rule tunmap example
* add cfg: tunmap / nft-rule append
* nft: append 'accept' to each rule
* tunend: choose local GTP addr by Network Instance IEs
* manual: use 'tunend' and 'tunmap'
* manual: explain new netinst cfg
* manual: tweak 'running' for new netinst feature
* manual: add charts explaining tunend and tunmap
* manual: some tweaks in overview
* manual: fix broken reference to netinst section
* fix copy-paste bug in up_endpoint.c
* fix deprecation: use telnet_init_default()
* check rc of osmo_use_count_get_put()
* error log: fix msg for gtp_del_tunnel() failure
* fix various crashes on osmo_pfcp_endpoint_tx() err handling
* osmo-pfcp-tool: avoid stale pointers on msg copy
* fix some PFCP peer,session error handling paths
* drop unused function up_peer_tx
* move GTP port definitions to upf.h
* deprecate cfg 'nft rule tunmap append'
* tunmap: prep new nft ruleset: log only mapping id
* tunmap: refactor nft ruleset: fix "martians" and "1024"
* tunmap: ensure nft table is removed on program exit
* osmo_pfcp_tool: make usable again
* minor api doc
* cosmetic: simplify naming: struct upf_tunmap, struct upf_tunend
* cosmetic: reduce dup in tunnel struct definitions
* cosmetic: rename g_upf->gtp to tunend, ->nft to tunmap
* move next_teid from up_endpoint to g_upf
* cosmetic: rename next_seid to next_up_seid
* build: drop LIBOSMO_GTLV
* build: add libupf.la (noinst)
* add unique_ids_test.c
* tunmap: ensure assigned chain_id is unused
* cosmetic: clarify session active / partially active semantics
* unique_ids_test.c: fix coverity ASSERT_SIDE_EFFECT
* manual: fix typo in running.adoc
* manual: 'Running': flatten section depths a bit
* manual: 'Running': tweak, mention 'tunmap' and 'tunend'
* manual: 'Running': tweak word, fix ws at line end
* manual: explain GTP Echo workaround for tunmap
* manual: explain IP forwarding
* tunmap: always set GTP-U source port to 2152 when forwarding
* vty doc fix
* pfcp-tool: fix extra newline in vty_out
* fix msgb memleak on GTP echo response
* fix EXTRA_DIST for vty test scripts
* drop unreachable statement
* contrib/pfcp-tool-scripts: adjust tunend_session_est.vty and upf cfg to match up
* upf gtp-u echo: improve loging
* upf gtp-u echo: rx Echo Response messages
* pfcp-tool: always use specific PDR ids for access and core
* nft: batch nftables commands
* osmo-upf: add VTY 'gtp-echo' command
[ Max ]
* Set working directory in systemd service file
* ctrl: take both address and port from vty config
* .deb/.rpm: add osmocom user during package install
[ Vadim Yanitskiy ]
* update git URLs (git -> https; gitea)
* contrib/jenkins.sh: clone libnftnl and libnftables via git://
* copyright: fix typo: sysmocom s/s.m.f.c./s.f.m.c./ GmbH
[ arehbein ]
* osmo-pfcp-tool: Fix call to strerror
* up_session: Silence coverity warning
[ Andreas Eversberg ]
* Use uniform log format for default config files
-- Oliver Smith <osmith@sysmocom.de> Wed, 11 Dec 2024 16:37:06 +0100
osmo-upf (0.1.1) unstable; urgency=medium
[ Vadim Yanitskiy ]

8
debian/control vendored
View File

@@ -12,11 +12,11 @@ Build-Depends: debhelper (>= 10),
pkg-config,
python3-minimal,
libtalloc-dev,
libgtpnl-dev (>= 1.2.0),
libgtpnl-dev (>= 1.3.2),
libnftables-dev (>= 1.0.2),
libosmocore-dev (>= 1.6.0),
libosmo-pfcp-dev (>= 0.1.0),
osmo-gsm-manuals-dev (>= 1.2.0)
libosmocore-dev (>= 1.11.0),
libosmo-pfcp-dev (>= 0.5.0),
osmo-gsm-manuals-dev (>= 1.6.0)
Standards-Version: 3.9.8
Vcs-Git: https://gitea.osmocom.org/cellular-infrastructure/osmo-upf
Vcs-Browser: https://gitea.osmocom.org/cellular-infrastructure/osmo-upf

View File

@@ -24,6 +24,7 @@
#pragma once
#include <osmocom/core/linuxlist.h>
#include <osmocom/core/hashtable.h>
struct osmo_pfcp_msg;
struct osmo_pfcp_endpoint;
@@ -37,6 +38,10 @@ struct up_endpoint {
/* list of struct up_peer. */
struct llist_head peers;
/* hashtable of (struct up_session) with key up_seid.
* Allows quick access to sessions (and its endpoint as backpointer)
* with a given up_seid. */
DECLARE_HASHTABLE(sessions_by_up_seid, 10);
uint64_t next_up_seid_state;
};

View File

@@ -64,6 +64,9 @@ struct up_gtp_action {
void *handle;
};
struct up_gtp_action *up_gtp_action_alloc(void *ctx, struct up_session *session, enum up_gtp_action_kind kind, struct llist_head *dst);
void up_gtp_action_free(struct up_gtp_action *a);
int up_gtp_action_cmp(const struct up_gtp_action *a, const struct up_gtp_action *b);
int up_gtp_action_enable(struct up_gtp_action *a);

View File

@@ -41,6 +41,7 @@ enum up_peer_event {
};
struct up_peer {
/* item in up_endpoint->peers */
struct llist_head entry;
struct osmo_fsm_inst *fi;
@@ -62,8 +63,8 @@ struct up_peer {
struct osmo_use_count use_count;
struct osmo_use_count_entry use_count_buf[5];
DECLARE_HASHTABLE(sessions_by_up_seid, 6);
DECLARE_HASHTABLE(sessions_by_cp_seid, 6);
DECLARE_HASHTABLE(sessions_by_up_seid, 10);
DECLARE_HASHTABLE(sessions_by_cp_seid, 10);
};
struct up_peer *up_peer_find_or_add(struct up_endpoint *up_ep, const struct osmo_sockaddr *remote_addr);

View File

@@ -45,6 +45,9 @@ struct up_session {
struct hlist_node node_by_up_seid;
struct hlist_node node_by_cp_seid;
/* item in up_endpoint->peers_by_up_seid: */
struct hlist_node ep_node_by_up_seid;
struct osmo_fsm_inst *fi;
/* backpointer */
struct up_peer *up_peer;
@@ -69,7 +72,6 @@ struct up_session {
struct up_session *up_session_find_or_add(struct up_peer *peer, const struct osmo_pfcp_ie_f_seid *cp_f_seid);
struct up_session *up_session_find_by_up_seid(struct up_peer *peer, uint64_t up_seid);
struct up_session *up_session_find_by_cp_f_seid(struct up_peer *peer, const struct osmo_pfcp_ie_f_seid *cp_f_seid);
struct up_session *up_session_find_by_local_teid(struct up_peer *peer, uint32_t teid);
void up_session_set_msg_ctx(struct up_session *session, struct osmo_pfcp_msg *m);
@@ -83,7 +85,8 @@ int up_session_to_str_buf(char *buf, size_t buflen, struct up_session *session);
char *up_session_to_str_c(void *ctx, struct up_session *session);
struct pdr {
struct llist_head entry;
struct llist_head entry; /* item in session->pdrs */
struct hlist_node node_by_local_f_teid; /* item in g_upf->gtp.pdrs_by_local_f_teid */
struct up_session *session;
struct osmo_pfcp_ie_create_pdr desc;

View File

@@ -1,23 +0,0 @@
/*
* (C) 2021-2022 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de>
* All Rights Reserved.
*
* Author: Neels Janosch Hofmeyr <nhofmeyr@sysmocom.de>
*
* SPDX-License-Identifier: GPL-2.0+
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/

View File

@@ -28,6 +28,7 @@
#include <osmocom/core/socket.h>
#include <osmocom/core/select.h>
#include <osmocom/core/linuxlist.h>
#include <osmocom/core/hashtable.h>
struct osmo_tdef;
struct ctrl_handle;
@@ -44,6 +45,7 @@ struct nft_ctx;
#define PORT_GTP1_U 2152
extern struct osmo_tdef_group g_upf_tdef_groups[];
extern struct osmo_tdef g_upf_nft_tdefs[];
struct pfcp_vty_cfg {
char *local_addr;
@@ -113,10 +115,15 @@ struct g_upf {
int priority_pre;
int priority_post;
uint32_t next_chain_id_state;
/* hashtable of (struct upf_nft_tun)->node_by_chain_id: */
DECLARE_HASHTABLE(nft_tun_by_chain_id, 12);
} tunmap;
struct {
uint32_t next_local_teid_state;
/* hashtable of (struct pdr)->node_by_local_f_teid: */
DECLARE_HASHTABLE(pdrs_by_local_f_teid, 12);
uint16_t next_echo_seq_nr;
} gtp;
struct llist_head netinst;

View File

@@ -24,6 +24,7 @@
#pragma once
#include <osmocom/core/linuxlist.h>
#include <osmocom/core/hashtable.h>
#include <osmocom/core/select.h>
#include <osmocom/core/logging.h>
@@ -55,6 +56,8 @@ struct upf_gtp_dev {
/* list of struct upf_gtp_tunend */
struct llist_head tunnels;
/* hashtable of (struct upf_gtp_tunen) with key desc.access.local.teid */
DECLARE_HASHTABLE(tunnels_by_local_f_teid, 10);
};
/* Description of a GTP encapsulation / decapsulation.

View File

@@ -2,3 +2,4 @@
#pragma once
int upf_gtpu_echo_setup(struct upf_gtp_dev *dev);
int upf_gtpu_echo_req_tx(struct upf_gtp_dev *dev, const struct osmo_sockaddr *remote, uint16_t seq_nr);

View File

@@ -24,10 +24,12 @@
#pragma once
#include <stdint.h>
#include <osmocom/core/hashtable.h>
#include <osmocom/upf/upf_tun.h>
struct upf_nft_tun {
struct hlist_node node_by_chain_id; /* item in g_upf->tunmap.nft_tun_by_chain_id */
struct upf_tun tun;
uint32_t chain_id;
};

View File

@@ -397,6 +397,11 @@ DEFUN(s_f_teid_choose, s_f_teid_choose_cmd,
return CMD_SUCCESS;
}
enum pdr_id_fixed {
PDR_ID_CORE = 1,
PDR_ID_ACCESS = 2,
};
int session_tunend_tx_est_req(struct vty *vty, const char **argv, int argc)
{
struct pfcp_tool_session *session = vty->index;
@@ -475,7 +480,7 @@ int session_tunend_tx_est_req(struct vty *vty, const char **argv, int argc)
.create_pdr_count = 2,
.create_pdr = {
{
.pdr_id = 1,
.pdr_id = PDR_ID_CORE,
.precedence = 255,
.pdi = {
.source_iface = OSMO_PFCP_SOURCE_IFACE_CORE,
@@ -492,7 +497,7 @@ int session_tunend_tx_est_req(struct vty *vty, const char **argv, int argc)
.far_id = 1,
},
{
.pdr_id = 2,
.pdr_id = PDR_ID_ACCESS,
.precedence = 255,
.pdi = {
.source_iface = OSMO_PFCP_SOURCE_IFACE_ACCESS,
@@ -635,7 +640,7 @@ int session_tunmap_tx_est_req(struct vty *vty, const char **argv, int argc)
.create_pdr_count = 2,
.create_pdr = {
{
.pdr_id = 1,
.pdr_id = PDR_ID_CORE,
.precedence = 255,
.pdi = {
.source_iface = OSMO_PFCP_SOURCE_IFACE_CORE,
@@ -650,7 +655,7 @@ int session_tunmap_tx_est_req(struct vty *vty, const char **argv, int argc)
.far_id = 1,
},
{
.pdr_id = 2,
.pdr_id = PDR_ID_ACCESS,
.precedence = 255,
.pdi = {
.source_iface = OSMO_PFCP_SOURCE_IFACE_ACCESS,

View File

@@ -239,6 +239,7 @@ struct up_endpoint *up_endpoint_alloc(void *ctx, const struct osmo_sockaddr *loc
struct up_endpoint *up_ep;
up_ep = talloc_zero(ctx, struct up_endpoint);
INIT_LLIST_HEAD(&up_ep->peers);
hash_init(up_ep->sessions_by_up_seid);
cfg = (struct osmo_pfcp_endpoint_cfg){
.local_addr = *local_addr,
@@ -263,10 +264,9 @@ int up_endpoint_bind(struct up_endpoint *up_ep)
static struct up_session *up_endpoint_find_session(struct up_endpoint *ep, uint64_t up_seid)
{
struct up_peer *peer;
llist_for_each_entry(peer, &ep->peers, entry) {
struct up_session *session = up_session_find_by_up_seid(peer, up_seid);
if (session)
struct up_session *session;
hash_for_each_possible(ep->sessions_by_up_seid, session, ep_node_by_up_seid, up_seid) {
if (session->up_seid == up_seid)
return session;
}
return NULL;

View File

@@ -85,7 +85,7 @@ static int up_gtp_action_enable_disable(struct up_gtp_action *a, bool enable)
switch (a->kind) {
case UP_GTP_U_TUNEND:
if (g_upf->tunend.mockup) {
LOG_UP_GTP_ACTION(a, LOGL_NOTICE, "tunend/mockup active, skipping GTP action %s\n",
LOG_UP_GTP_ACTION(a, LOGL_INFO, "tunend/mockup active, skipping GTP action %s\n",
enable ? "enable" : "disable");
return 0;
}
@@ -111,13 +111,13 @@ static int up_gtp_action_enable_disable(struct up_gtp_action *a, bool enable)
enable ? "enable" : "disable", rc);
return rc;
}
LOG_UP_GTP_ACTION(a, LOGL_NOTICE, "%s tunend on dev %s\n", enable ? "Enabled" : "Disabled",
LOG_UP_GTP_ACTION(a, LOGL_INFO, "%s tunend on dev %s\n", enable ? "Enabled" : "Disabled",
gtp_dev->name);
return 0;
case UP_GTP_U_TUNMAP:
if (g_upf->tunmap.mockup) {
LOG_UP_GTP_ACTION(a, LOGL_NOTICE, "tunmap/mockup active, skipping nftables ruleset %s\n",
LOG_UP_GTP_ACTION(a, LOGL_INFO, "tunmap/mockup active, skipping nftables ruleset %s\n",
enable ? "enable" : "disable");
return 0;
}
@@ -131,7 +131,7 @@ static int up_gtp_action_enable_disable(struct up_gtp_action *a, bool enable)
enable ? "enable" : "disable", rc);
return rc;
}
LOG_UP_GTP_ACTION(a, LOGL_NOTICE, "%s tunmap, nft chain IDs: access--%u-> <-%u--core\n",
LOG_UP_GTP_ACTION(a, LOGL_INFO, "%s tunmap, nft chain IDs: access--%u-> <-%u--core\n",
enable ? "Enabled" : "Disabled",
a->tunmap.access.chain_id, a->tunmap.core.chain_id);
return 0;
@@ -198,3 +198,33 @@ char *up_gtp_action_to_str_c(void *ctx, const struct up_gtp_action *a)
{
OSMO_NAME_C_IMPL(ctx, 128, "ERROR", up_gtp_action_to_str_buf, a)
}
struct up_gtp_action *up_gtp_action_alloc(void *ctx, struct up_session *session, enum up_gtp_action_kind kind, struct llist_head *dst)
{
struct up_gtp_action *a = talloc_zero(ctx, struct up_gtp_action);
OSMO_ASSERT(a);
a->session = session;
a->kind = kind;
if (kind == UP_GTP_U_TUNMAP) {
INIT_HLIST_NODE(&a->tunmap.access.node_by_chain_id);
INIT_HLIST_NODE(&a->tunmap.core.node_by_chain_id);
}
llist_add_tail(&a->entry, dst);
return a;
}
void up_gtp_action_free(struct up_gtp_action *a)
{
if (!a)
return;
up_gtp_action_disable(a);
llist_del(&a->entry);
if (a->kind == UP_GTP_U_TUNMAP) {
if (!hlist_unhashed(&a->tunmap.access.node_by_chain_id))
hash_del(&a->tunmap.access.node_by_chain_id);
if (!hlist_unhashed(&a->tunmap.core.node_by_chain_id))
hash_del(&a->tunmap.core.node_by_chain_id);
}
talloc_free(a);
}

View File

@@ -185,43 +185,46 @@ static enum osmo_pfcp_cause up_session_choose_f_teid(struct up_session *session,
bool choose_id_present, uint8_t choose_id,
const char *netinst_name)
{
struct chosen_f_teid *chosen = NULL;
struct chosen_f_teid *chosen;
int rc;
if (choose_id_present)
if (choose_id_present) {
chosen = chosen_f_teid_find(&session->chosen_f_teids, choose_id);
if (chosen) {
/* Re-use a previous F-TEID */
*dst = chosen->f_teid;
} else {
int rc;
if (chosen) {
/* Re-use a previous F-TEID */
*dst = chosen->f_teid;
return OSMO_PFCP_CAUSE_REQUEST_ACCEPTED;
}
/* No previous F-TEID found, allocate a new one below */
}
*dst = (struct osmo_pfcp_ie_f_teid){
.choose_flag = false,
*dst = (struct osmo_pfcp_ie_f_teid){
.choose_flag = false,
};
/* Determine local IP address from Network Instance value received in PFCP request */
rc = up_session_choose_local_ip(session, &dst->fixed.ip_addr, netinst_name);
if (rc)
return rc;
/* Choose a new TEID */
dst->fixed.teid = upf_next_local_teid();
if (dst->fixed.teid == 0) {
LOGPFSML(session->fi, LOGL_ERROR, "Failed to allocate an unused TEID\n");
return OSMO_PFCP_CAUSE_PFCP_ENTITY_IN_CONGESTION;
}
LOGPFSML(session->fi, LOGL_INFO, "Allocated new local F-TEID %s\n",
osmo_pfcp_ie_f_teid_to_str_c(OTC_SELECT, dst));
/* Save this choice */
if (choose_id_present) {
chosen = talloc(session, struct chosen_f_teid);
*chosen = (struct chosen_f_teid){
.f_teid = *dst,
.choose_id = choose_id,
};
/* Determine local IP address from Network Instance value received in PFCP request */
rc = up_session_choose_local_ip(session, &dst->fixed.ip_addr, netinst_name);
if (rc)
return rc;
/* Choose a new TEID */
dst->fixed.teid = upf_next_local_teid();
if (dst->fixed.teid == 0) {
LOGPFSML(session->fi, LOGL_ERROR, "Failed to allocate an unused TEID\n");
return OSMO_PFCP_CAUSE_PFCP_ENTITY_IN_CONGESTION;
}
LOGPFSML(session->fi, LOGL_INFO, "Allocated new local F-TEID %s\n",
osmo_pfcp_ie_f_teid_to_str_c(OTC_SELECT, dst));
/* Save this choice */
if (choose_id_present) {
chosen = talloc(session, struct chosen_f_teid);
*chosen = (struct chosen_f_teid){
.f_teid = *dst,
.choose_id = choose_id,
};
llist_add_tail(&chosen->entry, &session->chosen_f_teids);
}
llist_add_tail(&chosen->entry, &session->chosen_f_teids);
}
return OSMO_PFCP_CAUSE_REQUEST_ACCEPTED;
}
@@ -376,6 +379,8 @@ static struct pdr *pdr_find(struct up_session *session, uint16_t pdr_id)
static void pdr_del(struct pdr *pdr)
{
if (!hlist_unhashed(&pdr->node_by_local_f_teid))
hash_del(&pdr->node_by_local_f_teid);
llist_del(&pdr->entry);
talloc_free(pdr);
}
@@ -408,6 +413,7 @@ static struct pdr *pdr_create(struct up_session *session,
.session = session,
.desc = *create_pdr,
};
INIT_HLIST_NODE(&pdr->node_by_local_f_teid);
llist_add_tail(&pdr->entry, &session->pdrs);
if (pdr->desc.far_id_present) {
@@ -479,6 +485,7 @@ static struct pdr *pdr_create(struct up_session *session,
.local_f_teid_present = true,
.local_f_teid = *pdr->local_f_teid,
};
hash_add(g_upf->gtp.pdrs_by_local_f_teid, &pdr->node_by_local_f_teid, pdr->local_f_teid->fixed.teid);
} else {
created_pdr[*created_pdr_count] = (struct osmo_pfcp_ie_created_pdr){
.pdr_id = pdr->desc.pdr_id,
@@ -731,7 +738,7 @@ static void up_session_mod(struct up_session *session, struct osmo_pfcp_msg *m)
return;
}
LOGPFSML(fi, LOGL_NOTICE, "Session modified: %s\n", up_session_gtp_status(session));
LOGPFSML(fi, LOGL_INFO, "Session modified: %s\n", up_session_gtp_status(session));
return;
nack_response:
@@ -782,7 +789,7 @@ static void up_session_init_action(struct osmo_fsm_inst *fi, uint32_t event, voi
static void up_session_established_onenter(struct osmo_fsm_inst *fi, uint32_t prev_state)
{
struct up_session *session = fi->priv;
LOGPFSML(fi, LOGL_NOTICE, "Session established: %s %s\n", up_session_to_str_c(OTC_SELECT, session),
LOGPFSML(fi, LOGL_INFO, "Session established: %s %s\n", up_session_to_str_c(OTC_SELECT, session),
up_session_gtp_status(session));
}
@@ -813,13 +820,11 @@ static void up_session_established_onleave(struct osmo_fsm_inst *fi, uint32_t ne
{
struct up_session *session = fi->priv;
struct up_gtp_action *a;
LOGPFSML(fi, LOGL_NOTICE, "Session releasing: %s %s\n", up_session_to_str_c(OTC_SELECT, session), up_session_gtp_status(session));
LOGPFSML(fi, LOGL_INFO, "Session releasing: %s %s\n", up_session_to_str_c(OTC_SELECT, session), up_session_gtp_status(session));
/* Shut down all active GTP rules */
while ((a = llist_first_entry_or_null(&session->active_gtp_actions, struct up_gtp_action, entry))) {
up_gtp_action_disable(a);
llist_del(&a->entry);
talloc_free(a);
up_gtp_action_free(a);
}
}
@@ -880,6 +885,7 @@ static void up_session_fsm_cleanup(struct osmo_fsm_inst *fi, enum osmo_fsm_term_
up_session_clear_pdr_far(session);
hash_del(&session->ep_node_by_up_seid);
hash_del(&session->node_by_up_seid);
hash_del(&session->node_by_cp_seid);
}
@@ -1017,6 +1023,7 @@ static struct up_session *up_session_add(struct up_peer *peer, const struct osmo
hash_add(peer->sessions_by_up_seid, &session->node_by_up_seid, session->up_seid);
hash_add(peer->sessions_by_cp_seid, &session->node_by_cp_seid, session->cp_f_seid.seid);
hash_add(peer->up_endpoint->sessions_by_up_seid, &session->ep_node_by_up_seid, session->up_seid);
return session;
}
@@ -1051,22 +1058,6 @@ struct up_session *up_session_find_by_cp_f_seid(struct up_peer *peer, const stru
return NULL;
}
struct up_session *up_session_find_by_local_teid(struct up_peer *peer, uint32_t teid)
{
struct up_session *session;
int bkt;
hash_for_each(peer->sessions_by_up_seid, bkt, session, node_by_up_seid) {
struct pdr *pdr;
llist_for_each_entry(pdr, &session->pdrs, entry) {
if (!pdr->local_f_teid)
continue;
if (pdr->local_f_teid->fixed.teid == teid)
return session;
}
}
return NULL;
}
static bool action_is_forw(const struct osmo_pfcp_ie_apply_action *aa)
{
return osmo_pfcp_bits_get(aa->bits, OSMO_PFCP_APPLY_ACTION_FORW)
@@ -1211,31 +1202,14 @@ static void add_gtp_action_tunend(void *ctx, struct llist_head *dst, struct pdr
talloc_free(rpdr->inactive_reason);
rpdr->inactive_reason = NULL;
a = talloc(ctx, struct up_gtp_action);
OSMO_ASSERT(a);
*a = (struct up_gtp_action){
.session = session,
.pdr_access = pdr->desc.pdr_id,
.pdr_core = rpdr->desc.pdr_id,
.kind = UP_GTP_U_TUNEND,
.tunend = {
.access = {
.local = {
.addr = pdr->local_f_teid->fixed.ip_addr.v4,
.teid = pdr->local_f_teid->fixed.teid,
},
.remote = {
.addr = rfar_forw->outer_header_creation.ip_addr.v4,
.teid = rfar_forw->outer_header_creation.teid,
},
},
.core = {
.ue_local_addr = rpdr->desc.pdi.ue_ip_address.ip_addr.v4,
},
},
};
llist_add_tail(&a->entry, dst);
a = up_gtp_action_alloc(ctx, session, UP_GTP_U_TUNEND, dst);
a->pdr_access = pdr->desc.pdr_id;
a->pdr_core = rpdr->desc.pdr_id;
a->tunend.access.local.addr = pdr->local_f_teid->fixed.ip_addr.v4;
a->tunend.access.local.teid = pdr->local_f_teid->fixed.teid;
a->tunend.access.remote.addr = rfar_forw->outer_header_creation.ip_addr.v4;
a->tunend.access.remote.teid = rfar_forw->outer_header_creation.teid;
a->tunend.core.ue_local_addr = rpdr->desc.pdi.ue_ip_address.ip_addr.v4;
}
/* A GTP tunnel on Access side, mapping to another GTP tunnel on Core side and vice versa.
@@ -1325,38 +1299,17 @@ static void add_gtp_action_tunmap(void *ctx, struct llist_head *dst, struct pdr
talloc_free(rpdr->inactive_reason);
rpdr->inactive_reason = NULL;
a = talloc(ctx, struct up_gtp_action);
OSMO_ASSERT(a);
*a = (struct up_gtp_action){
.session = session,
.pdr_access = pdr->desc.pdr_id,
.pdr_core = rpdr->desc.pdr_id,
.kind = UP_GTP_U_TUNMAP,
.tunmap = {
.access.tun = {
.local = {
.addr = pdr->local_f_teid->fixed.ip_addr.v4,
.teid = pdr->local_f_teid->fixed.teid,
},
.remote = {
.addr = rfar_forw->outer_header_creation.ip_addr.v4,
.teid = rfar_forw->outer_header_creation.teid,
},
},
.core.tun = {
.local = {
.addr = rpdr->local_f_teid->fixed.ip_addr.v4,
.teid = rpdr->local_f_teid->fixed.teid,
},
.remote = {
.addr = far_forw->outer_header_creation.ip_addr.v4,
.teid = far_forw->outer_header_creation.teid,
},
},
},
};
llist_add_tail(&a->entry, dst);
a = up_gtp_action_alloc(ctx, session, UP_GTP_U_TUNMAP, dst);
a->pdr_access = pdr->desc.pdr_id;
a->pdr_core = rpdr->desc.pdr_id;
a->tunmap.access.tun.local.addr = pdr->local_f_teid->fixed.ip_addr.v4;
a->tunmap.access.tun.local.teid = pdr->local_f_teid->fixed.teid;
a->tunmap.access.tun.remote.addr = rfar_forw->outer_header_creation.ip_addr.v4;
a->tunmap.access.tun.remote.teid = rfar_forw->outer_header_creation.teid;
a->tunmap.core.tun.local.addr = rpdr->local_f_teid->fixed.ip_addr.v4;
a->tunmap.core.tun.local.teid = rpdr->local_f_teid->fixed.teid;
a->tunmap.core.tun.remote.addr = far_forw->outer_header_creation.ip_addr.v4;
a->tunmap.core.tun.remote.teid = far_forw->outer_header_creation.teid;
}
/* Analyse all PDRs and FARs and find configurations that match either a GTP encaps/decaps or a GTP forward rule. Add to
@@ -1481,9 +1434,7 @@ static enum osmo_pfcp_cause setup_gtp_actions(struct up_session *session, struct
continue;
LOGPFSML(session->fi, LOGL_DEBUG, "disabling: %s\n", up_gtp_action_to_str_c(OTC_SELECT, a));
up_gtp_action_disable(a);
llist_del(&a->entry);
talloc_free(a);
up_gtp_action_free(a);
}
/* Set up all GTP tunnels requested in the session setup, but not active yet */

View File

@@ -36,8 +36,20 @@
struct g_upf *g_upf = NULL;
struct osmo_tdef g_upf_nft_tdefs[] = {
{ .T = -32, .default_val = 1000, .unit = OSMO_TDEF_MS,
.desc = "How long to wait for more nft rulesets before flushing in batch",
},
{ .T = -33, .default_val = 1, .unit = OSMO_TDEF_CUSTOM,
.desc = "When reaching this nr of queued nft rulesets, flush the queue",
.max_val = 128,
},
{}
};
struct osmo_tdef_group g_upf_tdef_groups[] = {
{ "pfcp", "PFCP endpoint timers", osmo_pfcp_tdefs, },
{ "nft", "netfilter timers", g_upf_nft_tdefs, },
{}
};
@@ -66,6 +78,8 @@ void g_upf_alloc(void *ctx)
INIT_LLIST_HEAD(&g_upf->tunend.vty_cfg.devs);
INIT_LLIST_HEAD(&g_upf->tunend.devs);
INIT_LLIST_HEAD(&g_upf->netinst);
hash_init(g_upf->tunmap.nft_tun_by_chain_id);
hash_init(g_upf->gtp.pdrs_by_local_f_teid);
}
int upf_pfcp_init(void)
@@ -123,11 +137,13 @@ int upf_gtp_devs_open()
static bool upf_is_local_teid_in_use(uint32_t teid)
{
struct up_peer *peer;
llist_for_each_entry(peer, &g_upf->pfcp.ep->peers, entry) {
struct up_session *session = up_session_find_by_local_teid(peer, teid);
if (session)
return true;
struct pdr *pdr;
hash_for_each_possible(g_upf->gtp.pdrs_by_local_f_teid, pdr, node_by_local_f_teid, teid) {
if (!pdr->local_f_teid)
continue;
if (pdr->local_f_teid->fixed.teid != teid)
continue;
return true;
}
return false;
}
@@ -160,6 +176,17 @@ static uint32_t upf_next_chain_id_inc(void)
return g_upf->tunmap.next_chain_id_state;
}
static bool upf_is_chain_id_in_use(uint32_t chain_id)
{
struct upf_nft_tun *nft_tun;
hash_for_each_possible(g_upf->tunmap.nft_tun_by_chain_id, nft_tun, node_by_chain_id, chain_id) {
if (nft_tun->chain_id != chain_id)
continue;
return true;
}
return false;
}
/* Return an unused chain_id, or 0 if none is found with sane effort. */
uint32_t upf_next_chain_id(void)
{
@@ -167,36 +194,14 @@ uint32_t upf_next_chain_id(void)
/* Make sure the new chain_id is not used anywhere */
for (sanity = 2342; sanity; sanity--) {
struct up_peer *peer;
uint32_t chain_id = upf_next_chain_id_inc();
bool taken = false;
if (!g_upf->pfcp.ep)
return chain_id;
llist_for_each_entry(peer, &g_upf->pfcp.ep->peers, entry) {
struct up_session *session;
int bkt;
hash_for_each(peer->sessions_by_up_seid, bkt, session, node_by_up_seid) {
struct up_gtp_action *a;
llist_for_each_entry(a, &session->active_gtp_actions, entry) {
if (a->kind != UP_GTP_U_TUNMAP)
continue;
if (a->tunmap.access.chain_id == chain_id
|| a->tunmap.core.chain_id == chain_id) {
taken = true;
break;
}
}
if (taken)
break;
}
if (taken)
break;
}
if (!taken)
return chain_id;
if (upf_is_chain_id_in_use(chain_id))
continue;
return chain_id;
}
/* finding a chain_id became insane, return invalid = 0 */

View File

@@ -134,6 +134,7 @@ static struct upf_gtp_dev *upf_gtp_dev_alloc(const char *name, const char *local
.gtpv1.ofd.fd = -1,
};
INIT_LLIST_HEAD(&dev->tunnels);
hash_init(dev->tunnels_by_local_f_teid);
osmo_sockaddr_str_from_str(&addr_conv, local_addr, PORT_GTP0_U);
@@ -178,6 +179,13 @@ static int dev_resolve_ifidx(struct upf_gtp_dev *dev)
return 0;
}
static int upf_gtp_dev_create(struct upf_gtp_dev *dev, int gtp0_fd, int gtp1_fd)
{
if (dev->sgsn_mode)
return gtp_dev_create_sgsn(-1, dev->name, gtp0_fd, gtp1_fd);
return gtp_dev_create(-1, dev->name, gtp0_fd, gtp1_fd);
}
int upf_gtp_dev_open(const char *name, bool create_gtp_dev, const char *local_addr, bool listen_for_gtpv0, bool sgsn_mode)
{
const struct osmo_sockaddr any = {
@@ -235,10 +243,13 @@ int upf_gtp_dev_open(const char *name, bool create_gtp_dev, const char *local_ad
if (create_gtp_dev) {
int gtp0_fd = listen_for_gtpv0 ? dev->gtpv0.ofd.fd : -1;
int gtp1_fd = dev->gtpv1.ofd.fd;
if (dev->sgsn_mode)
rc = gtp_dev_create_sgsn(-1, dev->name, gtp0_fd, gtp1_fd);
else
rc = gtp_dev_create(-1, dev->name, gtp0_fd, gtp1_fd);
rc = upf_gtp_dev_create(dev, gtp0_fd, gtp1_fd);
if (rc == -EEXIST && gtp_dev_destroy(dev->name) == 0) {
LOG_GTP_DEV(dev, LOGL_ERROR, "deleted GTP device from unclean shutdown\n");
rc = upf_gtp_dev_create(dev, gtp0_fd, gtp1_fd);
}
if (rc < 0) {
LOG_GTP_DEV(dev, LOGL_ERROR, "Cannot create GTP device: rc=%d\n", rc);
/* name = NULL: signal to the destructor that it does not need to delete the device */
@@ -308,7 +319,8 @@ int upf_gtp_genl_ensure_open()
}
struct upf_gtp_tunend {
struct llist_head entry;
struct llist_head entry; /* item in (struct upf_gtp_dev)->tunnels */
struct hlist_node node_by_local_f_teid; /* item in g_upf->gtp.pdrs_by_local_f_teid */
struct upf_gtp_dev *dev;
struct upf_tunend desc;
@@ -339,6 +351,7 @@ static int upf_gtp_tunend_destruct(struct upf_gtp_tunend *tun)
{
if (tun->active)
upf_gtp_tunend_deactivate(tun);
hash_del(&tun->node_by_local_f_teid);
llist_del(&tun->entry);
return 0;
}
@@ -359,6 +372,7 @@ static struct upf_gtp_tunend *upf_gtp_tunend_alloc(struct upf_gtp_dev *dev, cons
.dev = dev,
.desc = *desc,
};
hash_add(dev->tunnels_by_local_f_teid, &tun->node_by_local_f_teid, tun->desc.access.local.teid);
llist_add(&tun->entry, &dev->tunnels);
talloc_set_destructor(tun, upf_gtp_tunend_destruct);
return tun;
@@ -415,7 +429,8 @@ static struct upf_gtp_tunend *upf_gtp_dev_tunend_find(struct upf_gtp_dev *dev, c
{
struct upf_gtp_tunend *tun;
tunend_validate(tunend);
llist_for_each_entry(tun, &dev->tunnels, entry) {
hash_for_each_possible(dev->tunnels_by_local_f_teid, tun, node_by_local_f_teid, tunend->access.local.teid) {
if (upf_gtp_tunend_cmp(tunend, &tun->desc))
continue;
return tun;

View File

@@ -13,8 +13,12 @@
#define GTP1U_PORT 2152
enum gtp1u_msgt {
GTP1U_MSGTYPE_ECHO_REQ = 1,
GTP1U_MSGTYPE_ECHO_RSP = 2,
GTP1U_MSGTYPE_ECHO_REQ = 1,
GTP1U_MSGTYPE_ECHO_RSP = 2,
GTP1U_MSGTYPE_ERRR_IND = 26,
GTP1U_MSGTYPE_SUPP_EXT_HDR_NOTIF = 31,
GTP1U_MSGTYPE_END_MARKER = 254,
GTP1U_MSGTYPE_GPDU = 255,
};
enum gtp1u_iei {
@@ -122,7 +126,44 @@ static int tx_echo_resp(struct upf_gtp_dev *dev, const struct osmo_sockaddr *rem
return rc;
}
int upf_gtpu_echo_read_cb(struct osmo_fd *ofd, unsigned int what)
int upf_gtpu_echo_req_tx(struct upf_gtp_dev *dev, const struct osmo_sockaddr *remote, uint16_t seq_nr)
{
struct gtp1u_hdr *tx_h;
int rc;
uint8_t msgbuf[sizeof(struct gtp1u_hdr) + 2];
tx_h = (void *)msgbuf;
*tx_h = (struct gtp1u_hdr){
/* 3GPP TS 29.281 5.1 defines that the ECHO REQ & RESP shall contain a sequence nr */
.s = 1,
.pt = 1,
.version = 1,
.msg_type = GTP1U_MSGTYPE_ECHO_REQ,
.ext = {
.seq_nr = seq_nr,
},
};
/* ECHO REQUEST shall contain a recovery counter */
tx_h->data2[0] = GTP1U_IEI_RECOVERY;
tx_h->data2[1] = g_upf->tunend.recovery_count;
osmo_store16be(sizeof(msgbuf) - offsetof(struct gtp1u_hdr, data1), &tx_h->length);
rc = sendto(dev->gtpv1.ofd.fd, msgbuf, sizeof(msgbuf), 0, &remote->u.sa, sizeof(*remote));
if (rc < 0) {
rc = -errno;
LOG_GTP_DEV(dev, LOGL_ERROR, "GTP1-U sendto(len=%zu, to=%s): %s\n", sizeof(msgbuf),
osmo_sockaddr_to_str(remote), strerror(-rc));
} else {
rc = 0;
}
LOG_GTP_DEV(dev, LOGL_INFO, "<- %s: tx GTP1-U Echo Request: seq_nr=%u recovery_count=%u\n",
osmo_sockaddr_to_str(remote), seq_nr, g_upf->tunend.recovery_count);
return rc;
}
int upf_gtpu_read_cb(struct osmo_fd *ofd, unsigned int what)
{
struct upf_gtp_dev *dev = ofd->data;
@@ -171,8 +212,18 @@ int upf_gtpu_echo_read_cb(struct osmo_fd *ofd, unsigned int what)
case GTP1U_MSGTYPE_ECHO_RSP:
rx_echo_resp(dev, &remote, h, sz);
return 0;
case GTP1U_MSGTYPE_ERRR_IND:
/* 3GPP TS 29.281 7.3.1: Log "Tunnel Endpoint Identifier Data I" and "GTP-U Peer Address" */
LOG_GTP_DEV(dev, LOGL_NOTICE, "%s rx: GTPv1-U Error Indication not supported\n",
osmo_sockaddr_to_str(&remote));
return 0;
case GTP1U_MSGTYPE_GPDU:
LOG_GTP_DEV(dev, LOGL_NOTICE, "%s rx: GTPv1-U PDU TEID=0x%08x over slow path not supported\n",
osmo_sockaddr_to_str(&remote), osmo_load32be(&h->tei));
return 0;
default:
LOG_GTP_DEV(dev, LOGL_ERROR, "rx: GTPv1-U message type %u not supported\n", h->msg_type);
LOG_GTP_DEV(dev, LOGL_ERROR, "%s rx: GTPv1-U message type %u not supported\n",
osmo_sockaddr_to_str(&remote), h->msg_type);
return -1;
}
}
@@ -189,7 +240,7 @@ int upf_gtpu_echo_setup(struct upf_gtp_dev *dev)
/* make sure there is no cb yet that this would be replacing. */
OSMO_ASSERT(dev->gtpv1.ofd.cb == NULL);
dev->gtpv1.ofd.cb = upf_gtpu_echo_read_cb;
dev->gtpv1.ofd.cb = upf_gtpu_read_cb;
dev->gtpv1.ofd.data = dev;
return 0;
}

View File

@@ -26,6 +26,7 @@
#include <osmocom/core/talloc.h>
#include <osmocom/core/logging.h>
#include <osmocom/core/timer.h>
#include <osmocom/upf/upf.h>
#include <osmocom/upf/upf_nft.h>
@@ -59,9 +60,10 @@ static char *upf_nft_ruleset_vmap_init(void *ctx, const char *table_name, int pr
table_name);
}
static int upf_nft_run(const char *ruleset)
static int upf_nft_run_now(const char *ruleset)
{
int rc;
const int logmax = 256;
if (g_upf->tunmap.mockup) {
LOGP(DNFT, LOGL_NOTICE, "tunmap/mockup active: not running nft ruleset: '%s'\n", ruleset);
@@ -81,14 +83,135 @@ static int upf_nft_run(const char *ruleset)
return -EIO;
}
LOGP(DNFT, LOGL_DEBUG, "run nft ruleset: %s\n", osmo_quote_str_c(OTC_SELECT, ruleset, -1));
if (log_check_level(DNFT, LOGL_DEBUG)) {
size_t l = strlen(ruleset);
LOGP(DNFT, LOGL_DEBUG, "ran nft ruleset, %zu chars: \"%s%s\"\n",
l,
osmo_escape_cstr_c(OTC_SELECT, ruleset, OSMO_MIN(logmax, l)),
l > logmax ? "..." : "");
}
return 0;
}
struct nft_queue {
struct osmo_tdef *flush_time_tdef;
struct osmo_tdef *ruleset_max_tdef;
struct osmo_strbuf sb;
/* 128 NFT rulesets amount to about 110 kb of char */
char buf[1<<17];
unsigned int ruleset_count;
struct osmo_timer_list timer;
};
static void nft_queue_clear_buf(struct nft_queue *q)
{
q->sb = (struct osmo_strbuf){ .buf = q->buf, .len = sizeof(q->buf) };
q->buf[0] = '\0';
}
static void nft_queue_init(void *ctx, struct nft_queue *q,
struct osmo_tdef *flush_time_tdef,
struct osmo_tdef *ruleset_max_tdef)
{
*q = (struct nft_queue){
.flush_time_tdef = flush_time_tdef,
.ruleset_max_tdef = ruleset_max_tdef,
};
nft_queue_clear_buf(q);
}
static void nft_queue_flush(struct nft_queue *q, const char *reason)
{
static unsigned int flush_count = 0;
static unsigned int ruleset_count = 0;
/* We will now flush the queue empty. A timer needs to run only when the next pending entry is added. */
osmo_timer_del(&q->timer);
/* Nothing to send? */
if (!q->sb.chars_needed)
return;
flush_count++;
ruleset_count += q->ruleset_count;
LOGP(DNFT, LOGL_INFO, "Flushing NFT ruleset queue: %s: n:%u strlen:%zu (flush count: %u avg rules per flush: %s)\n",
reason,
q->ruleset_count, q->sb.chars_needed,
flush_count, osmo_int_to_float_str_c(OTC_SELECT, 10 * ruleset_count / flush_count, 1));
q->ruleset_count = 0;
upf_nft_run_now(q->sb.buf);
nft_queue_clear_buf(q);
}
static void nft_queue_flush_cb(void *q)
{
nft_queue_flush(q, "timeout");
}
static int nft_enqueue(struct nft_queue *q,
int (*tunmap_to_str_buf)(char *buf, size_t len, struct upf_tunmap *tunmap),
struct upf_tunmap *tunmap)
{
int ruleset_max;
struct osmo_strbuf q_sb_was = q->sb;
OSMO_STRBUF_APPEND(q->sb, tunmap_to_str_buf, tunmap);
/* is that being cut off? then revert the addition. This should never happen in practice. */
if (q->sb.chars_needed >= q->sb.len) {
q->sb = q_sb_was;
if (q->sb.pos)
*q->sb.pos = '\0';
nft_queue_flush(q, "reached max nr of chars");
OSMO_STRBUF_APPEND(q->sb, tunmap_to_str_buf, tunmap);
}
/* Append separator -- no problem if that gets cut off. */
OSMO_STRBUF_PRINTF(q->sb, "\n");
q->ruleset_count++;
LOGP(DNFT, LOGL_INFO, "Added NFT ruleset to queue: n:%u strlen:%zu\n",
q->ruleset_count, q->sb.chars_needed);
/* Added a rule, see if it has reached ruleset_max. */
ruleset_max = osmo_tdef_get(q->ruleset_max_tdef, q->ruleset_max_tdef->T, OSMO_TDEF_CUSTOM, 128);
if (q->ruleset_count >= ruleset_max) {
nft_queue_flush(q, "reached max nr of rules");
return 0;
}
/* Item added. If the timer is not running yet, schedule a flush in given timeout */
if (!osmo_timer_pending(&q->timer)) {
struct osmo_tdef *t;
unsigned long us;
osmo_timer_setup(&q->timer, nft_queue_flush_cb, q);
t = q->flush_time_tdef;
us = osmo_tdef_get(t, t->T, OSMO_TDEF_US, 100000);
osmo_timer_schedule(&q->timer, us / 1000000, us % 1000000);
}
return 0;
}
static void nft_queue_free(struct nft_queue *q)
{
osmo_timer_del(&q->timer);
}
static struct nft_queue g_nft_queue = {};
int upf_nft_init()
{
int rc;
nft_queue_init(g_upf, &g_nft_queue,
osmo_tdef_get_entry(g_upf_nft_tdefs, -32),
osmo_tdef_get_entry(g_upf_nft_tdefs, -33));
/* Always set up the default settings, also in mockup mode, so that the VTY reflects sane values */
if (!g_upf->tunmap.table_name)
g_upf->tunmap.table_name = talloc_strdup(g_upf, "osmo-upf");
@@ -106,7 +229,7 @@ int upf_nft_init()
return -EIO;
}
rc = upf_nft_run(upf_nft_tunmap_get_table_init_str(OTC_SELECT));
rc = upf_nft_run_now(upf_nft_tunmap_get_table_init_str(OTC_SELECT));
if (rc) {
LOGP(DNFT, LOGL_ERROR, "Failed to create nft table %s\n",
osmo_quote_str_c(OTC_SELECT, g_upf->tunmap.table_name, -1));
@@ -114,7 +237,7 @@ int upf_nft_init()
}
LOGP(DNFT, LOGL_NOTICE, "Created nft table %s\n", osmo_quote_str_c(OTC_SELECT, g_upf->tunmap.table_name, -1));
rc = upf_nft_run(upf_nft_tunmap_get_vmap_init_str(OTC_SELECT));
rc = upf_nft_run_now(upf_nft_tunmap_get_vmap_init_str(OTC_SELECT));
if (rc) {
LOGP(DNFT, LOGL_ERROR, "Failed to initialize nft verdict map in table %s\n", g_upf->tunmap.table_name);
return rc;
@@ -124,6 +247,7 @@ int upf_nft_init()
int upf_nft_free()
{
nft_queue_free(&g_nft_queue);
if (!g_upf->tunmap.nft_ctx)
return 0;
nft_ctx_free(g_upf->tunmap.nft_ctx);
@@ -263,11 +387,6 @@ static int upf_nft_ruleset_tunmap_create_buf(char *buf, size_t buflen, const str
return sb.chars_needed;
}
static char *upf_nft_ruleset_tunmap_create_c(void *ctx, const struct upf_nft_args *args)
{
OSMO_NAME_C_IMPL(ctx, 1024, "ERROR", upf_nft_ruleset_tunmap_create_buf, args)
}
static int upf_nft_ruleset_tunmap_delete_buf(char *buf, size_t buflen, const struct upf_nft_args *args)
{
struct osmo_strbuf sb = { .buf = buf, .len = buflen };
@@ -280,11 +399,6 @@ static int upf_nft_ruleset_tunmap_delete_buf(char *buf, size_t buflen, const str
return sb.chars_needed;
}
static char *upf_nft_ruleset_tunmap_delete_c(void *ctx, const struct upf_nft_args *args)
{
OSMO_NAME_C_IMPL(ctx, 512, "ERROR", upf_nft_ruleset_tunmap_delete_buf, args)
}
int upf_nft_tunmap_to_str_buf(char *buf, size_t buflen, const struct upf_tunmap *tunmap)
{
struct osmo_strbuf sb = { .buf = buf, .len = buflen };
@@ -344,18 +458,28 @@ char *upf_nft_tunmap_get_vmap_init_str(void *ctx)
g_upf->tunmap.priority_post);
}
char *upf_nft_tunmap_get_ruleset_str(void *ctx, struct upf_tunmap *tunmap)
int upf_nft_tunmap_get_ruleset_str_buf(char *buf, size_t len, struct upf_tunmap *tunmap)
{
struct upf_nft_args args;
upf_nft_args_from_tunmap(&args, tunmap);
return upf_nft_ruleset_tunmap_create_c(ctx, &args);
return upf_nft_ruleset_tunmap_create_buf(buf, len, &args);
}
char *upf_nft_tunmap_get_ruleset_str(void *ctx, struct upf_tunmap *tunmap)
{
OSMO_NAME_C_IMPL(ctx, 1024, "ERROR", upf_nft_tunmap_get_ruleset_str_buf, tunmap)
}
int upf_nft_tunmap_get_ruleset_del_str_buf(char *buf, size_t len, struct upf_tunmap *tunmap)
{
struct upf_nft_args args;
upf_nft_args_from_tunmap(&args, tunmap);
return upf_nft_ruleset_tunmap_delete_buf(buf, len, &args);
}
char *upf_nft_tunmap_get_ruleset_del_str(void *ctx, struct upf_tunmap *tunmap)
{
struct upf_nft_args args;
upf_nft_args_from_tunmap(&args, tunmap);
return upf_nft_ruleset_tunmap_delete_c(ctx, &args);
OSMO_NAME_C_IMPL(ctx, 1024, "ERROR", upf_nft_tunmap_get_ruleset_del_str_buf, tunmap)
}
static int upf_nft_tunmap_ensure_chain_id(struct upf_nft_tun *tun)
@@ -365,6 +489,7 @@ static int upf_nft_tunmap_ensure_chain_id(struct upf_nft_tun *tun)
tun->chain_id = upf_next_chain_id();
if (!tun->chain_id)
return -ENOSPC;
hash_add(g_upf->tunmap.nft_tun_by_chain_id, &tun->node_by_chain_id, tun->chain_id);
return 0;
}
@@ -373,10 +498,10 @@ int upf_nft_tunmap_create(struct upf_tunmap *tunmap)
if (upf_nft_tunmap_ensure_chain_id(&tunmap->access)
|| upf_nft_tunmap_ensure_chain_id(&tunmap->core))
return -ENOSPC;
return upf_nft_run(upf_nft_tunmap_get_ruleset_str(OTC_SELECT, tunmap));
return nft_enqueue(&g_nft_queue, upf_nft_tunmap_get_ruleset_str_buf, tunmap);
}
int upf_nft_tunmap_delete(struct upf_tunmap *tunmap)
{
return upf_nft_run(upf_nft_tunmap_get_ruleset_del_str(OTC_SELECT, tunmap));
return nft_enqueue(&g_nft_queue, upf_nft_tunmap_get_ruleset_del_str_buf, tunmap);
}

View File

@@ -38,6 +38,7 @@
#include <osmocom/upf/up_session.h>
#include <osmocom/upf/up_gtp_action.h>
#include <osmocom/upf/netinst.h>
#include <osmocom/upf/upf_gtpu_echo.h>
enum upf_vty_node {
PFCP_NODE = _LAST_OSMOVTY_NODE + 1,
@@ -486,6 +487,105 @@ DEFUN(show_session, show_session_cmd,
return CMD_SUCCESS;
}
/* variant:
* 0 "gtp1u-echo send to (A.B.C.D|X:X::X:X)"
* 1 "gtp1u-echo send to (A.B.C.D|X:X::X:X) local-ip (A.B.C.D|X:X::X:X)"
* 2 "gtp1u-echo send to (A.B.C.D|X:X::X:X) local-dev DEV_NAME"
*/
static int _gtp_echo_tx(struct vty *vty, int variant, int argc, const char **argv)
{
struct osmo_sockaddr_str addr;
struct osmo_sockaddr osa_remote;
struct osmo_sockaddr osa_local;
struct upf_gtp_dev *gtp_dev = NULL;
const char *remote_str = argv[0];
const char *local_str = NULL;
if (argc > 1)
local_str = argv[1];
/* GTP can be received on port 2152 only, i.e. the remote port must be 2152. (The sending port is allowed to
* differ). */
if (osmo_sockaddr_str_from_str(&addr, remote_str, 2152)
|| osmo_sockaddr_str_to_osa(&addr, &osa_remote)) {
vty_out(vty, "%% Error: cannot send Echo: invalid IP address: %s%s",
osmo_quote_str(remote_str, -1), VTY_NEWLINE);
return CMD_WARNING;
}
switch (variant) {
case 0:
gtp_dev = llist_first_entry_or_null(&g_upf->tunend.devs, struct upf_gtp_dev, entry);
if (!gtp_dev) {
vty_out(vty, "%% Error: cannot send Echo: there is no GTP device%s",
VTY_NEWLINE);
return CMD_WARNING;
}
break;
case 1:
if (osmo_sockaddr_str_from_str(&addr, local_str, 2152)
|| osmo_sockaddr_str_to_osa(&addr, &osa_local)) {
vty_out(vty, "%% Error: cannot send Echo: invalid IP address: %s%s",
osmo_quote_str(local_str, -1), VTY_NEWLINE);
return CMD_WARNING;
}
gtp_dev = upf_gtp_dev_find_by_local_addr(&osa_local);
if (!gtp_dev) {
vty_out(vty, "%% Error: cannot send Echo: this does not seem to be a locally bound GTP address: %s%s",
osmo_sockaddr_to_str_c(OTC_SELECT, &osa_local), VTY_NEWLINE);
return CMD_WARNING;
}
break;
case 2:
gtp_dev = upf_gtp_dev_find_by_name(local_str);
if (!gtp_dev) {
vty_out(vty, "%% Error: cannot send Echo: there is no GTP device by the name of '%s'%s",
local_str, VTY_NEWLINE);
return CMD_WARNING;
}
break;
}
OSMO_ASSERT(gtp_dev);
if (upf_gtpu_echo_req_tx(gtp_dev, &osa_remote, g_upf->gtp.next_echo_seq_nr++)) {
vty_out(vty, "%% Error: Failed to transmit Echo Request (see DGTP logging)%s", VTY_NEWLINE);
return CMD_WARNING;
}
vty_out(vty, "%s -> %s tx Echo Request; for responses, see DGTP logging level INFO%s",
gtp_dev->name, osmo_sockaddr_to_str_c(OTC_SELECT, &osa_remote), VTY_NEWLINE);
return CMD_SUCCESS;
}
#define IP46_STR "IPv4 address\nIPv6 address\n"
#define GTP_ECHO_TX_STR \
"GTP1-U Echo probing\n" \
"Send a GTP1-U Echo Request to a remote peer\n" \
"Send to remote peer's GTP address\n" IP46_STR
DEFUN(gtp_echo_tx, gtp_echo_tx_cmd,
"gtp1u-echo send to " VTY_IPV46_CMD,
GTP_ECHO_TX_STR)
{
return _gtp_echo_tx(vty, 0, argc, argv);
}
DEFUN(gtp_echo_tx_local_ip, gtp_echo_tx_local_ip_cmd,
"gtp1u-echo send to " VTY_IPV46_CMD " local-ip " VTY_IPV46_CMD,
GTP_ECHO_TX_STR
"Send from local GTP device, chosen by IP address\n"
IP46_STR)
{
return _gtp_echo_tx(vty, 1, argc, argv);
}
DEFUN(gtp_echo_tx_local_dev, gtp_echo_tx_local_dev_cmd,
"gtp1u-echo send to " VTY_IPV46_CMD " local-dev DEV_NAME",
GTP_ECHO_TX_STR
"Send from local GTP device, chosen by name as configured in 'dev create' or 'dev use'.\n"
"A GTP device name as it appears in the cfg\n")
{
return _gtp_echo_tx(vty, 2, argc, argv);
}
void upf_vty_init()
{
OSMO_ASSERT(g_upf != NULL);
@@ -495,6 +595,9 @@ void upf_vty_init()
install_element_ve(&show_session_cmd);
install_element_ve(&show_netinst_cmd);
install_element_ve(&show_nft_rule_append_cmd);
install_element_ve(&gtp_echo_tx_cmd);
install_element_ve(&gtp_echo_tx_local_ip_cmd);
install_element_ve(&gtp_echo_tx_local_dev_cmd);
install_node(&cfg_pfcp_node, config_write_pfcp);
install_element(CONFIG_NODE, &cfg_pfcp_cmd);

42
tests/gtp-echo.vty Normal file
View File

@@ -0,0 +1,42 @@
OsmoUPF> list
...
gtp1u-echo send to (A.B.C.D|X:X::X:X)
gtp1u-echo send to (A.B.C.D|X:X::X:X) local-ip (A.B.C.D|X:X::X:X)
gtp1u-echo send to (A.B.C.D|X:X::X:X) local-dev DEV_NAME
...
OsmoUPF> enable
OsmoUPF# list
...
gtp1u-echo send to (A.B.C.D|X:X::X:X)
gtp1u-echo send to (A.B.C.D|X:X::X:X) local-ip (A.B.C.D|X:X::X:X)
gtp1u-echo send to (A.B.C.D|X:X::X:X) local-dev DEV_NAME
...
OsmoUPF# configure terminal
OsmoUPF(config)# list
... !gtp1u-echo
OsmoUPF(config)# end
OsmoUPF# gtp1u-echo?
gtp1u-echo GTP1-U Echo probing
OsmoUPF# gtp1u-echo ?
send Send a GTP1-U Echo Request to a remote peer
OsmoUPF# gtp1u-echo send ?
to Send to remote peer's GTP address
OsmoUPF# gtp1u-echo send to ?
A.B.C.D IPv4 address
X:X::X:X IPv6 address
OsmoUPF# gtp1u-echo send to 1.2.3.4 ?
local-ip Send from local GTP device, chosen by IP address
local-dev Send from local GTP device, chosen by name as configured in 'dev create' or 'dev use'.
<cr>
OsmoUPF# gtp1u-echo send to 1.2.3.4 local-ip ?
A.B.C.D IPv4 address
X:X::X:X IPv6 address
OsmoUPF# gtp1u-echo send to 1.2.3.4 local-dev ?
DEV_NAME A GTP device name as it appears in the cfg
OsmoUPF# gtp1u-echo send to 1.2.3.4
% Error: cannot send Echo: there is no GTP device
OsmoUPF# gtp1u-echo send to 1.2.3.4 local-ip 1.2.3.4
% Error: cannot send Echo: this does not seem to be a locally bound GTP address: 1.2.3.4:2152
OsmoUPF# gtp1u-echo send to 1.2.3.4 local-dev apn0
% Error: cannot send Echo: there is no GTP device by the name of 'apn0'

View File

@@ -8,7 +8,7 @@ DLPFCP NOTICE PFCP endpoint: recovery timestamp = 0x83aa7e80 (0 seconds since UN
[test override] nft_run_cmd_from_buffer():
add table inet osmo-upf { flags owner; };
DNFT DEBUG run nft ruleset: "add table inet osmo-upf { flags owner; };\n"
DNFT DEBUG ran nft ruleset, 42 chars: "add table inet osmo-upf { flags owner; };\n"
DNFT NOTICE Created nft table "osmo-upf"
[test override] nft_run_cmd_from_buffer():
@@ -19,7 +19,7 @@ add map inet osmo-upf tunmap-post { typeof meta mark : verdict; };
add rule inet osmo-upf pre udp dport 2152 ip daddr . @ih,32,32 vmap @tunmap-pre;
add rule inet osmo-upf post meta mark vmap @tunmap-post;
DNFT DEBUG run nft ruleset: "add chain inet osmo-upf pre { type filter hook prerouting priority -300; policy accept; };\nadd chain inet osmo-upf post { type filter hook postrouting priority 400; policy accept; };\nadd map inet osmo-upf tunmap-pre { typeof ip daddr . @ih,32,32 : verdict; };\nadd map inet osmo-upf tunmap-post { typeof meta mark : verdict; };\nadd rule inet osmo-upf pre udp dport 2152 ip daddr . @ih,32,32 vmap @tunmap-pre;\nadd rule inet osmo-upf post meta mark vmap @tunmap-post;\n"
DNFT DEBUG ran nft ruleset, 465 chars: "add chain inet osmo-upf pre { type filter hook prerouting priority -300; policy accept; };\nadd chain inet osmo-upf post { type filter hook postrouting priority 400; policy accept; };\nadd map inet osmo-upf tunmap-pre { typeof ip daddr . @ih,32,32 : verdict;..."
PFCP Associate peer
DPEER DEBUG up_peer{NOT_ASSOCIATED}: Allocated
@@ -58,6 +58,8 @@ DSESSION DEBUG up_session(1-2-3-4-0x1){INIT}: Active PDR set: + PDR-1{src:Core T
DSESSION DEBUG up_session(1-2-3-4-0x1){INIT}: GTP actions: 0 previously active; want active: 1
DSESSION DEBUG up_session(1-2-3-4-0x1){INIT}: want: GTP:tunmap GTP-access-r:5.6.7.8 TEID-access-r:0x100 GTP-access-l:1.1.1.1 TEID-access-l:0x2 GTP-core-r:13.14.15.16 TEID-core-r:0x101 GTP-core-l:1.1.1.1 TEID-core-l:0x1 PFCP-peer:1.2.3.4 SEID-l:0x1 PDR-access:2 PDR-core:1
DSESSION DEBUG up_session(1-2-3-4-0x1){INIT}: enabling: GTP:tunmap GTP-access-r:5.6.7.8 TEID-access-r:0x100 GTP-access-l:1.1.1.1 TEID-access-l:0x2 GTP-core-r:13.14.15.16 TEID-core-r:0x101 GTP-core-l:1.1.1.1 TEID-core-l:0x1 PFCP-peer:1.2.3.4 SEID-l:0x1 PDR-access:2 PDR-core:1
DNFT INFO Added NFT ruleset to queue: n:1 strlen:847
DNFT INFO Flushing NFT ruleset queue: reached max nr of rules: n:1 strlen:847 (flush count: 1 avg rules per flush: 1)
[test override] nft_run_cmd_from_buffer():
add chain inet osmo-upf tunmap-pre-1;
@@ -73,8 +75,9 @@ add rule inet osmo-upf tunmap-post-2 ip saddr set 1.1.1.1 udp sport set 2152 @ih
add element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x1 : jump tunmap-pre-2 };
add element inet osmo-upf tunmap-post { 2 : jump tunmap-post-2 };
DNFT DEBUG run nft ruleset: "add chain inet osmo-upf tunmap-pre-1;\nadd rule inet osmo-upf tunmap-pre-1 ip daddr set 13.14.15.16 meta mark set 1 counter accept;\nadd chain inet osmo-upf tunmap-post-1;\nadd rule inet osmo-upf tunmap-post-1 ip saddr set 1.1.1.1 udp sport set 2152 @ih,32,32 set 0x101 counter accept;\nadd element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x2 : jump tunmap-pre-1 };\nadd element inet osmo-upf tunmap-post { 1 : jump tunmap-post-1 };\nadd chain inet osmo-upf tunmap-pre-2;\nadd rule inet osmo-upf tunmap-pre-2 ip daddr set 5.6.7.8 meta mark set 2 counter accept;\nadd chain inet osmo-upf tunmap-post-2;\nadd rule inet osmo-upf tunmap-post-2 ip saddr set 1.1.1.1 udp sport set 2152 @ih,32,32 set 0x100 counter accept;\nadd element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x1 : jump tunmap-pre-2 };\nadd element inet osmo-upf tunmap-post { 2 : jump tunmap-post-2 };\n"
DGTP NOTICE GTP:tunmap GTP-access-r:5.6.7.8 TEID-access-r:0x100 GTP-access-l:1.1.1.1 TEID-access-l:0x2 GTP-core-r:13.14.15.16 TEID-core-r:0x101 GTP-core-l:1.1.1.1 TEID-core-l:0x1 PFCP-peer:1.2.3.4 SEID-l:0x1 PDR-access:2 PDR-core:1: Enabled tunmap, nft chain IDs: access--1-> <-2--core
DNFT DEBUG ran nft ruleset, 847 chars: "add chain inet osmo-upf tunmap-pre-1;\nadd rule inet osmo-upf tunmap-pre-1 ip daddr set 13.14.15.16 meta mark set 1 counter accept;\nadd chain inet osmo-upf tunmap-post-1;\nadd rule inet osmo-upf tunmap-post-1 ip saddr set 1.1.1.1 udp sport set 2152 @ih,32,32..."
DGTP INFO GTP:tunmap GTP-access-r:5.6.7.8 TEID-access-r:0x100 GTP-access-l:1.1.1.1 TEID-access-l:0x2 GTP-core-r:13.14.15.16 TEID-core-r:0x101 GTP-core-l:1.1.1.1 TEID-core-l:0x1 PFCP-peer:1.2.3.4 SEID-l:0x1 PDR-access:2 PDR-core:1: Enabled tunmap, nft chain IDs: access--1-> <-2--core
[test override] PFCP tx:
PFCPv1 SESSION_EST_RESP hdr={seq=0 SEID=0x100} ies={ 'Node ID'=v4:unsupported family 0 'Cause'=Request accepted (success) 'F-SEID'=0x1,v4:1.1.1.1 'Created PDR'={ { 'PDR ID'=1 'F-TEID'=TEID-0x1,v4:1.1.1.1 }, { 'PDR ID'=2 'F-TEID'=TEID-0x2,v4:1.1.1.1 } } }
@@ -84,7 +87,7 @@ osmo-upf created session 0x1
DREF DEBUG up_session(1-2-3-4-0x1){INIT}: - msg-tx: now used by 1 (msg-rx)
DREF DEBUG up_peer(1-2-3-4){ASSOCIATED}: - msg-tx: now used by 1 (msg-rx)
DSESSION DEBUG up_session(1-2-3-4-0x1){INIT}: State change to ESTABLISHED (no timeout)
DSESSION NOTICE up_session(1-2-3-4-0x1){ESTABLISHED}: Session established: peer:1.2.3.4 SEID-r:0x100 SEID-l:0x1 state:ESTABLISHED PDR-active:2/2 FAR-active:2/2 GTP-active:1
DSESSION INFO up_session(1-2-3-4-0x1){ESTABLISHED}: Session established: peer:1.2.3.4 SEID-r:0x100 SEID-l:0x1 state:ESTABLISHED PDR-active:2/2 FAR-active:2/2 GTP-active:1
DREF INFO up_session(1-2-3-4-0x1){ESTABLISHED}: - msg-rx: now used by 0 (-)
DSESSION DEBUG up_session(1-2-3-4-0x1){ESTABLISHED}: Received Event UP_SESSION_EV_USE_COUNT_ZERO
DREF INFO up_peer(1-2-3-4){ASSOCIATED}: - msg-rx: now used by 0 (-)
@@ -123,6 +126,8 @@ DSESSION DEBUG up_session(1-2-3-4-0x2){INIT}: Active PDR set: + PDR-1{src:Core T
DSESSION DEBUG up_session(1-2-3-4-0x2){INIT}: GTP actions: 0 previously active; want active: 1
DSESSION DEBUG up_session(1-2-3-4-0x2){INIT}: want: GTP:tunmap GTP-access-r:5.6.7.8 TEID-access-r:0x102 GTP-access-l:1.1.1.1 TEID-access-l:0x4 GTP-core-r:13.14.15.16 TEID-core-r:0x103 GTP-core-l:1.1.1.1 TEID-core-l:0x3 PFCP-peer:1.2.3.4 SEID-l:0x2 PDR-access:2 PDR-core:1
DSESSION DEBUG up_session(1-2-3-4-0x2){INIT}: enabling: GTP:tunmap GTP-access-r:5.6.7.8 TEID-access-r:0x102 GTP-access-l:1.1.1.1 TEID-access-l:0x4 GTP-core-r:13.14.15.16 TEID-core-r:0x103 GTP-core-l:1.1.1.1 TEID-core-l:0x3 PFCP-peer:1.2.3.4 SEID-l:0x2 PDR-access:2 PDR-core:1
DNFT INFO Added NFT ruleset to queue: n:1 strlen:847
DNFT INFO Flushing NFT ruleset queue: reached max nr of rules: n:1 strlen:847 (flush count: 2 avg rules per flush: 1)
[test override] nft_run_cmd_from_buffer():
add chain inet osmo-upf tunmap-pre-3;
@@ -138,8 +143,9 @@ add rule inet osmo-upf tunmap-post-4 ip saddr set 1.1.1.1 udp sport set 2152 @ih
add element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x3 : jump tunmap-pre-4 };
add element inet osmo-upf tunmap-post { 4 : jump tunmap-post-4 };
DNFT DEBUG run nft ruleset: "add chain inet osmo-upf tunmap-pre-3;\nadd rule inet osmo-upf tunmap-pre-3 ip daddr set 13.14.15.16 meta mark set 3 counter accept;\nadd chain inet osmo-upf tunmap-post-3;\nadd rule inet osmo-upf tunmap-post-3 ip saddr set 1.1.1.1 udp sport set 2152 @ih,32,32 set 0x103 counter accept;\nadd element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x4 : jump tunmap-pre-3 };\nadd element inet osmo-upf tunmap-post { 3 : jump tunmap-post-3 };\nadd chain inet osmo-upf tunmap-pre-4;\nadd rule inet osmo-upf tunmap-pre-4 ip daddr set 5.6.7.8 meta mark set 4 counter accept;\nadd chain inet osmo-upf tunmap-post-4;\nadd rule inet osmo-upf tunmap-post-4 ip saddr set 1.1.1.1 udp sport set 2152 @ih,32,32 set 0x102 counter accept;\nadd element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x3 : jump tunmap-pre-4 };\nadd element inet osmo-upf tunmap-post { 4 : jump tunmap-post-4 };\n"
DGTP NOTICE GTP:tunmap GTP-access-r:5.6.7.8 TEID-access-r:0x102 GTP-access-l:1.1.1.1 TEID-access-l:0x4 GTP-core-r:13.14.15.16 TEID-core-r:0x103 GTP-core-l:1.1.1.1 TEID-core-l:0x3 PFCP-peer:1.2.3.4 SEID-l:0x2 PDR-access:2 PDR-core:1: Enabled tunmap, nft chain IDs: access--3-> <-4--core
DNFT DEBUG ran nft ruleset, 847 chars: "add chain inet osmo-upf tunmap-pre-3;\nadd rule inet osmo-upf tunmap-pre-3 ip daddr set 13.14.15.16 meta mark set 3 counter accept;\nadd chain inet osmo-upf tunmap-post-3;\nadd rule inet osmo-upf tunmap-post-3 ip saddr set 1.1.1.1 udp sport set 2152 @ih,32,32..."
DGTP INFO GTP:tunmap GTP-access-r:5.6.7.8 TEID-access-r:0x102 GTP-access-l:1.1.1.1 TEID-access-l:0x4 GTP-core-r:13.14.15.16 TEID-core-r:0x103 GTP-core-l:1.1.1.1 TEID-core-l:0x3 PFCP-peer:1.2.3.4 SEID-l:0x2 PDR-access:2 PDR-core:1: Enabled tunmap, nft chain IDs: access--3-> <-4--core
[test override] PFCP tx:
PFCPv1 SESSION_EST_RESP hdr={seq=0 SEID=0x101} ies={ 'Node ID'=v4:unsupported family 0 'Cause'=Request accepted (success) 'F-SEID'=0x2,v4:1.1.1.1 'Created PDR'={ { 'PDR ID'=1 'F-TEID'=TEID-0x3,v4:1.1.1.1 }, { 'PDR ID'=2 'F-TEID'=TEID-0x4,v4:1.1.1.1 } } }
@@ -149,7 +155,7 @@ osmo-upf created session 0x2
DREF DEBUG up_session(1-2-3-4-0x2){INIT}: - msg-tx: now used by 1 (msg-rx)
DREF DEBUG up_peer(1-2-3-4){ASSOCIATED}: - msg-tx: now used by 1 (msg-rx)
DSESSION DEBUG up_session(1-2-3-4-0x2){INIT}: State change to ESTABLISHED (no timeout)
DSESSION NOTICE up_session(1-2-3-4-0x2){ESTABLISHED}: Session established: peer:1.2.3.4 SEID-r:0x101 SEID-l:0x2 state:ESTABLISHED PDR-active:2/2 FAR-active:2/2 GTP-active:1
DSESSION INFO up_session(1-2-3-4-0x2){ESTABLISHED}: Session established: peer:1.2.3.4 SEID-r:0x101 SEID-l:0x2 state:ESTABLISHED PDR-active:2/2 FAR-active:2/2 GTP-active:1
DREF INFO up_session(1-2-3-4-0x2){ESTABLISHED}: - msg-rx: now used by 0 (-)
DSESSION DEBUG up_session(1-2-3-4-0x2){ESTABLISHED}: Received Event UP_SESSION_EV_USE_COUNT_ZERO
DREF INFO up_peer(1-2-3-4){ASSOCIATED}: - msg-rx: now used by 0 (-)
@@ -181,7 +187,9 @@ DREF INFO up_session(1-2-3-4-0x1){ESTABLISHED}: - msg-tx: now used by 0 (-)
DSESSION DEBUG up_session(1-2-3-4-0x1){ESTABLISHED}: Received Event UP_SESSION_EV_USE_COUNT_ZERO
DREF INFO up_peer(1-2-3-4){ASSOCIATED}: - msg-tx: now used by 0 (-)
DPEER DEBUG up_peer(1-2-3-4){ASSOCIATED}: Received Event UP_PEER_EV_USE_COUNT_ZERO
DSESSION NOTICE up_session(1-2-3-4-0x1){ESTABLISHED}: Session releasing: peer:1.2.3.4 SEID-r:0x100 SEID-l:0x1 state:ESTABLISHED PDR-active:2/2 FAR-active:2/2 GTP-active:1
DSESSION INFO up_session(1-2-3-4-0x1){ESTABLISHED}: Session releasing: peer:1.2.3.4 SEID-r:0x100 SEID-l:0x1 state:ESTABLISHED PDR-active:2/2 FAR-active:2/2 GTP-active:1
DNFT INFO Added NFT ruleset to queue: n:1 strlen:381
DNFT INFO Flushing NFT ruleset queue: reached max nr of rules: n:1 strlen:381 (flush count: 3 avg rules per flush: 1)
[test override] nft_run_cmd_from_buffer():
delete element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x2 };
@@ -193,8 +201,9 @@ delete element inet osmo-upf tunmap-post { 2 };
delete chain inet osmo-upf tunmap-pre-2;
delete chain inet osmo-upf tunmap-post-2;
DNFT DEBUG run nft ruleset: "delete element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x2 };\ndelete element inet osmo-upf tunmap-post { 1 };\ndelete chain inet osmo-upf tunmap-pre-1;\ndelete chain inet osmo-upf tunmap-post-1;\ndelete element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x1 };\ndelete element inet osmo-upf tunmap-post { 2 };\ndelete chain inet osmo-upf tunmap-pre-2;\ndelete chain inet osmo-upf tunmap-post-2;\n"
DGTP NOTICE GTP:tunmap GTP-access-r:5.6.7.8 TEID-access-r:0x100 GTP-access-l:1.1.1.1 TEID-access-l:0x2 GTP-core-r:13.14.15.16 TEID-core-r:0x101 GTP-core-l:1.1.1.1 TEID-core-l:0x1 PFCP-peer:1.2.3.4 SEID-l:0x1 PDR-access:2 PDR-core:1: Disabled tunmap, nft chain IDs: access--1-> <-2--core
DNFT DEBUG ran nft ruleset, 381 chars: "delete element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x2 };\ndelete element inet osmo-upf tunmap-post { 1 };\ndelete chain inet osmo-upf tunmap-pre-1;\ndelete chain inet osmo-upf tunmap-post-1;\ndelete element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x1 };\ndelete ..."
DGTP INFO GTP:tunmap GTP-access-r:5.6.7.8 TEID-access-r:0x100 GTP-access-l:1.1.1.1 TEID-access-l:0x2 GTP-core-r:13.14.15.16 TEID-core-r:0x101 GTP-core-l:1.1.1.1 TEID-core-l:0x1 PFCP-peer:1.2.3.4 SEID-l:0x1 PDR-access:2 PDR-core:1: Disabled tunmap, nft chain IDs: access--1-> <-2--core
DSESSION DEBUG up_session(1-2-3-4-0x1){ESTABLISHED}: State change to WAIT_USE_COUNT (no timeout)
DSESSION DEBUG up_session(1-2-3-4-0x1){WAIT_USE_COUNT}: GTP actions: 0 previously active; want active: 0
DSESSION DEBUG up_session(1-2-3-4-0x1){WAIT_USE_COUNT}: Terminating (cause = OSMO_FSM_TERM_REGULAR)
@@ -231,6 +240,8 @@ DSESSION DEBUG up_session(1-2-3-4-0x1){INIT}: Active PDR set: + PDR-1{src:Core T
DSESSION DEBUG up_session(1-2-3-4-0x1){INIT}: GTP actions: 0 previously active; want active: 1
DSESSION DEBUG up_session(1-2-3-4-0x1){INIT}: want: GTP:tunmap GTP-access-r:5.6.7.8 TEID-access-r:0x104 GTP-access-l:1.1.1.1 TEID-access-l:0x2 GTP-core-r:13.14.15.16 TEID-core-r:0x105 GTP-core-l:1.1.1.1 TEID-core-l:0x1 PFCP-peer:1.2.3.4 SEID-l:0x1 PDR-access:2 PDR-core:1
DSESSION DEBUG up_session(1-2-3-4-0x1){INIT}: enabling: GTP:tunmap GTP-access-r:5.6.7.8 TEID-access-r:0x104 GTP-access-l:1.1.1.1 TEID-access-l:0x2 GTP-core-r:13.14.15.16 TEID-core-r:0x105 GTP-core-l:1.1.1.1 TEID-core-l:0x1 PFCP-peer:1.2.3.4 SEID-l:0x1 PDR-access:2 PDR-core:1
DNFT INFO Added NFT ruleset to queue: n:1 strlen:847
DNFT INFO Flushing NFT ruleset queue: reached max nr of rules: n:1 strlen:847 (flush count: 4 avg rules per flush: 1)
[test override] nft_run_cmd_from_buffer():
add chain inet osmo-upf tunmap-pre-1;
@@ -246,8 +257,9 @@ add rule inet osmo-upf tunmap-post-2 ip saddr set 1.1.1.1 udp sport set 2152 @ih
add element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x1 : jump tunmap-pre-2 };
add element inet osmo-upf tunmap-post { 2 : jump tunmap-post-2 };
DNFT DEBUG run nft ruleset: "add chain inet osmo-upf tunmap-pre-1;\nadd rule inet osmo-upf tunmap-pre-1 ip daddr set 13.14.15.16 meta mark set 1 counter accept;\nadd chain inet osmo-upf tunmap-post-1;\nadd rule inet osmo-upf tunmap-post-1 ip saddr set 1.1.1.1 udp sport set 2152 @ih,32,32 set 0x105 counter accept;\nadd element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x2 : jump tunmap-pre-1 };\nadd element inet osmo-upf tunmap-post { 1 : jump tunmap-post-1 };\nadd chain inet osmo-upf tunmap-pre-2;\nadd rule inet osmo-upf tunmap-pre-2 ip daddr set 5.6.7.8 meta mark set 2 counter accept;\nadd chain inet osmo-upf tunmap-post-2;\nadd rule inet osmo-upf tunmap-post-2 ip saddr set 1.1.1.1 udp sport set 2152 @ih,32,32 set 0x104 counter accept;\nadd element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x1 : jump tunmap-pre-2 };\nadd element inet osmo-upf tunmap-post { 2 : jump tunmap-post-2 };\n"
DGTP NOTICE GTP:tunmap GTP-access-r:5.6.7.8 TEID-access-r:0x104 GTP-access-l:1.1.1.1 TEID-access-l:0x2 GTP-core-r:13.14.15.16 TEID-core-r:0x105 GTP-core-l:1.1.1.1 TEID-core-l:0x1 PFCP-peer:1.2.3.4 SEID-l:0x1 PDR-access:2 PDR-core:1: Enabled tunmap, nft chain IDs: access--1-> <-2--core
DNFT DEBUG ran nft ruleset, 847 chars: "add chain inet osmo-upf tunmap-pre-1;\nadd rule inet osmo-upf tunmap-pre-1 ip daddr set 13.14.15.16 meta mark set 1 counter accept;\nadd chain inet osmo-upf tunmap-post-1;\nadd rule inet osmo-upf tunmap-post-1 ip saddr set 1.1.1.1 udp sport set 2152 @ih,32,32..."
DGTP INFO GTP:tunmap GTP-access-r:5.6.7.8 TEID-access-r:0x104 GTP-access-l:1.1.1.1 TEID-access-l:0x2 GTP-core-r:13.14.15.16 TEID-core-r:0x105 GTP-core-l:1.1.1.1 TEID-core-l:0x1 PFCP-peer:1.2.3.4 SEID-l:0x1 PDR-access:2 PDR-core:1: Enabled tunmap, nft chain IDs: access--1-> <-2--core
[test override] PFCP tx:
PFCPv1 SESSION_EST_RESP hdr={seq=0 SEID=0x102} ies={ 'Node ID'=v4:unsupported family 0 'Cause'=Request accepted (success) 'F-SEID'=0x1,v4:1.1.1.1 'Created PDR'={ { 'PDR ID'=1 'F-TEID'=TEID-0x1,v4:1.1.1.1 }, { 'PDR ID'=2 'F-TEID'=TEID-0x2,v4:1.1.1.1 } } }
@@ -257,7 +269,7 @@ osmo-upf created session 0x1
DREF DEBUG up_session(1-2-3-4-0x1){INIT}: - msg-tx: now used by 1 (msg-rx)
DREF DEBUG up_peer(1-2-3-4){ASSOCIATED}: - msg-tx: now used by 1 (msg-rx)
DSESSION DEBUG up_session(1-2-3-4-0x1){INIT}: State change to ESTABLISHED (no timeout)
DSESSION NOTICE up_session(1-2-3-4-0x1){ESTABLISHED}: Session established: peer:1.2.3.4 SEID-r:0x102 SEID-l:0x1 state:ESTABLISHED PDR-active:2/2 FAR-active:2/2 GTP-active:1
DSESSION INFO up_session(1-2-3-4-0x1){ESTABLISHED}: Session established: peer:1.2.3.4 SEID-r:0x102 SEID-l:0x1 state:ESTABLISHED PDR-active:2/2 FAR-active:2/2 GTP-active:1
DREF INFO up_session(1-2-3-4-0x1){ESTABLISHED}: - msg-rx: now used by 0 (-)
DSESSION DEBUG up_session(1-2-3-4-0x1){ESTABLISHED}: Received Event UP_SESSION_EV_USE_COUNT_ZERO
DREF INFO up_peer(1-2-3-4){ASSOCIATED}: - msg-rx: now used by 0 (-)
@@ -296,6 +308,8 @@ DSESSION DEBUG up_session(1-2-3-4-0x3){INIT}: Active PDR set: + PDR-1{src:Core T
DSESSION DEBUG up_session(1-2-3-4-0x3){INIT}: GTP actions: 0 previously active; want active: 1
DSESSION DEBUG up_session(1-2-3-4-0x3){INIT}: want: GTP:tunmap GTP-access-r:5.6.7.8 TEID-access-r:0x106 GTP-access-l:1.1.1.1 TEID-access-l:0x6 GTP-core-r:13.14.15.16 TEID-core-r:0x107 GTP-core-l:1.1.1.1 TEID-core-l:0x5 PFCP-peer:1.2.3.4 SEID-l:0x3 PDR-access:2 PDR-core:1
DSESSION DEBUG up_session(1-2-3-4-0x3){INIT}: enabling: GTP:tunmap GTP-access-r:5.6.7.8 TEID-access-r:0x106 GTP-access-l:1.1.1.1 TEID-access-l:0x6 GTP-core-r:13.14.15.16 TEID-core-r:0x107 GTP-core-l:1.1.1.1 TEID-core-l:0x5 PFCP-peer:1.2.3.4 SEID-l:0x3 PDR-access:2 PDR-core:1
DNFT INFO Added NFT ruleset to queue: n:1 strlen:847
DNFT INFO Flushing NFT ruleset queue: reached max nr of rules: n:1 strlen:847 (flush count: 5 avg rules per flush: 1)
[test override] nft_run_cmd_from_buffer():
add chain inet osmo-upf tunmap-pre-5;
@@ -311,8 +325,9 @@ add rule inet osmo-upf tunmap-post-6 ip saddr set 1.1.1.1 udp sport set 2152 @ih
add element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x5 : jump tunmap-pre-6 };
add element inet osmo-upf tunmap-post { 6 : jump tunmap-post-6 };
DNFT DEBUG run nft ruleset: "add chain inet osmo-upf tunmap-pre-5;\nadd rule inet osmo-upf tunmap-pre-5 ip daddr set 13.14.15.16 meta mark set 5 counter accept;\nadd chain inet osmo-upf tunmap-post-5;\nadd rule inet osmo-upf tunmap-post-5 ip saddr set 1.1.1.1 udp sport set 2152 @ih,32,32 set 0x107 counter accept;\nadd element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x6 : jump tunmap-pre-5 };\nadd element inet osmo-upf tunmap-post { 5 : jump tunmap-post-5 };\nadd chain inet osmo-upf tunmap-pre-6;\nadd rule inet osmo-upf tunmap-pre-6 ip daddr set 5.6.7.8 meta mark set 6 counter accept;\nadd chain inet osmo-upf tunmap-post-6;\nadd rule inet osmo-upf tunmap-post-6 ip saddr set 1.1.1.1 udp sport set 2152 @ih,32,32 set 0x106 counter accept;\nadd element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x5 : jump tunmap-pre-6 };\nadd element inet osmo-upf tunmap-post { 6 : jump tunmap-post-6 };\n"
DGTP NOTICE GTP:tunmap GTP-access-r:5.6.7.8 TEID-access-r:0x106 GTP-access-l:1.1.1.1 TEID-access-l:0x6 GTP-core-r:13.14.15.16 TEID-core-r:0x107 GTP-core-l:1.1.1.1 TEID-core-l:0x5 PFCP-peer:1.2.3.4 SEID-l:0x3 PDR-access:2 PDR-core:1: Enabled tunmap, nft chain IDs: access--5-> <-6--core
DNFT DEBUG ran nft ruleset, 847 chars: "add chain inet osmo-upf tunmap-pre-5;\nadd rule inet osmo-upf tunmap-pre-5 ip daddr set 13.14.15.16 meta mark set 5 counter accept;\nadd chain inet osmo-upf tunmap-post-5;\nadd rule inet osmo-upf tunmap-post-5 ip saddr set 1.1.1.1 udp sport set 2152 @ih,32,32..."
DGTP INFO GTP:tunmap GTP-access-r:5.6.7.8 TEID-access-r:0x106 GTP-access-l:1.1.1.1 TEID-access-l:0x6 GTP-core-r:13.14.15.16 TEID-core-r:0x107 GTP-core-l:1.1.1.1 TEID-core-l:0x5 PFCP-peer:1.2.3.4 SEID-l:0x3 PDR-access:2 PDR-core:1: Enabled tunmap, nft chain IDs: access--5-> <-6--core
[test override] PFCP tx:
PFCPv1 SESSION_EST_RESP hdr={seq=0 SEID=0x103} ies={ 'Node ID'=v4:unsupported family 0 'Cause'=Request accepted (success) 'F-SEID'=0x3,v4:1.1.1.1 'Created PDR'={ { 'PDR ID'=1 'F-TEID'=TEID-0x5,v4:1.1.1.1 }, { 'PDR ID'=2 'F-TEID'=TEID-0x6,v4:1.1.1.1 } } }
@@ -322,7 +337,7 @@ osmo-upf created session 0x3
DREF DEBUG up_session(1-2-3-4-0x3){INIT}: - msg-tx: now used by 1 (msg-rx)
DREF DEBUG up_peer(1-2-3-4){ASSOCIATED}: - msg-tx: now used by 1 (msg-rx)
DSESSION DEBUG up_session(1-2-3-4-0x3){INIT}: State change to ESTABLISHED (no timeout)
DSESSION NOTICE up_session(1-2-3-4-0x3){ESTABLISHED}: Session established: peer:1.2.3.4 SEID-r:0x103 SEID-l:0x3 state:ESTABLISHED PDR-active:2/2 FAR-active:2/2 GTP-active:1
DSESSION INFO up_session(1-2-3-4-0x3){ESTABLISHED}: Session established: peer:1.2.3.4 SEID-r:0x103 SEID-l:0x3 state:ESTABLISHED PDR-active:2/2 FAR-active:2/2 GTP-active:1
DREF INFO up_session(1-2-3-4-0x3){ESTABLISHED}: - msg-rx: now used by 0 (-)
DSESSION DEBUG up_session(1-2-3-4-0x3){ESTABLISHED}: Received Event UP_SESSION_EV_USE_COUNT_ZERO
DREF INFO up_peer(1-2-3-4){ASSOCIATED}: - msg-rx: now used by 0 (-)
@@ -348,6 +363,8 @@ DSESSION DEBUG up_session(1-2-3-4-0x3){ESTABLISHED}: Removing from parent up_pee
DSESSION DEBUG up_session(1-2-3-4-0x3){ESTABLISHED}: GTP actions: 1 previously active; want active: 0
DSESSION DEBUG up_session(1-2-3-4-0x3){ESTABLISHED}: active: GTP:tunmap GTP-access-r:5.6.7.8 TEID-access-r:0x106 GTP-access-l:1.1.1.1 TEID-access-l:0x6 GTP-core-r:13.14.15.16 TEID-core-r:0x107 GTP-core-l:1.1.1.1 TEID-core-l:0x5 PFCP-peer:1.2.3.4 SEID-l:0x3 PDR-access:2 PDR-core:1
DSESSION DEBUG up_session(1-2-3-4-0x3){ESTABLISHED}: disabling: GTP:tunmap GTP-access-r:5.6.7.8 TEID-access-r:0x106 GTP-access-l:1.1.1.1 TEID-access-l:0x6 GTP-core-r:13.14.15.16 TEID-core-r:0x107 GTP-core-l:1.1.1.1 TEID-core-l:0x5 PFCP-peer:1.2.3.4 SEID-l:0x3 PDR-access:2 PDR-core:1
DNFT INFO Added NFT ruleset to queue: n:1 strlen:381
DNFT INFO Flushing NFT ruleset queue: reached max nr of rules: n:1 strlen:381 (flush count: 6 avg rules per flush: 1)
[test override] nft_run_cmd_from_buffer():
delete element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x6 };
@@ -359,8 +376,9 @@ delete element inet osmo-upf tunmap-post { 6 };
delete chain inet osmo-upf tunmap-pre-6;
delete chain inet osmo-upf tunmap-post-6;
DNFT DEBUG run nft ruleset: "delete element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x6 };\ndelete element inet osmo-upf tunmap-post { 5 };\ndelete chain inet osmo-upf tunmap-pre-5;\ndelete chain inet osmo-upf tunmap-post-5;\ndelete element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x5 };\ndelete element inet osmo-upf tunmap-post { 6 };\ndelete chain inet osmo-upf tunmap-pre-6;\ndelete chain inet osmo-upf tunmap-post-6;\n"
DGTP NOTICE GTP:tunmap GTP-access-r:5.6.7.8 TEID-access-r:0x106 GTP-access-l:1.1.1.1 TEID-access-l:0x6 GTP-core-r:13.14.15.16 TEID-core-r:0x107 GTP-core-l:1.1.1.1 TEID-core-l:0x5 PFCP-peer:1.2.3.4 SEID-l:0x3 PDR-access:2 PDR-core:1: Disabled tunmap, nft chain IDs: access--5-> <-6--core
DNFT DEBUG ran nft ruleset, 381 chars: "delete element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x6 };\ndelete element inet osmo-upf tunmap-post { 5 };\ndelete chain inet osmo-upf tunmap-pre-5;\ndelete chain inet osmo-upf tunmap-post-5;\ndelete element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x5 };\ndelete ..."
DGTP INFO GTP:tunmap GTP-access-r:5.6.7.8 TEID-access-r:0x106 GTP-access-l:1.1.1.1 TEID-access-l:0x6 GTP-core-r:13.14.15.16 TEID-core-r:0x107 GTP-core-l:1.1.1.1 TEID-core-l:0x5 PFCP-peer:1.2.3.4 SEID-l:0x3 PDR-access:2 PDR-core:1: Disabled tunmap, nft chain IDs: access--5-> <-6--core
DSESSION DEBUG up_session(1-2-3-4-0x3){ESTABLISHED}: Freeing instance
DSESSION DEBUG up_session(1-2-3-4-0x3){ESTABLISHED}: Deallocated
DSESSION DEBUG up_session(1-2-3-4-0x1){ESTABLISHED}: Terminating (cause = OSMO_FSM_TERM_PARENT)
@@ -368,6 +386,8 @@ DSESSION DEBUG up_session(1-2-3-4-0x1){ESTABLISHED}: Removing from parent up_pee
DSESSION DEBUG up_session(1-2-3-4-0x1){ESTABLISHED}: GTP actions: 1 previously active; want active: 0
DSESSION DEBUG up_session(1-2-3-4-0x1){ESTABLISHED}: active: GTP:tunmap GTP-access-r:5.6.7.8 TEID-access-r:0x104 GTP-access-l:1.1.1.1 TEID-access-l:0x2 GTP-core-r:13.14.15.16 TEID-core-r:0x105 GTP-core-l:1.1.1.1 TEID-core-l:0x1 PFCP-peer:1.2.3.4 SEID-l:0x1 PDR-access:2 PDR-core:1
DSESSION DEBUG up_session(1-2-3-4-0x1){ESTABLISHED}: disabling: GTP:tunmap GTP-access-r:5.6.7.8 TEID-access-r:0x104 GTP-access-l:1.1.1.1 TEID-access-l:0x2 GTP-core-r:13.14.15.16 TEID-core-r:0x105 GTP-core-l:1.1.1.1 TEID-core-l:0x1 PFCP-peer:1.2.3.4 SEID-l:0x1 PDR-access:2 PDR-core:1
DNFT INFO Added NFT ruleset to queue: n:1 strlen:381
DNFT INFO Flushing NFT ruleset queue: reached max nr of rules: n:1 strlen:381 (flush count: 7 avg rules per flush: 1)
[test override] nft_run_cmd_from_buffer():
delete element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x2 };
@@ -379,8 +399,9 @@ delete element inet osmo-upf tunmap-post { 2 };
delete chain inet osmo-upf tunmap-pre-2;
delete chain inet osmo-upf tunmap-post-2;
DNFT DEBUG run nft ruleset: "delete element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x2 };\ndelete element inet osmo-upf tunmap-post { 1 };\ndelete chain inet osmo-upf tunmap-pre-1;\ndelete chain inet osmo-upf tunmap-post-1;\ndelete element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x1 };\ndelete element inet osmo-upf tunmap-post { 2 };\ndelete chain inet osmo-upf tunmap-pre-2;\ndelete chain inet osmo-upf tunmap-post-2;\n"
DGTP NOTICE GTP:tunmap GTP-access-r:5.6.7.8 TEID-access-r:0x104 GTP-access-l:1.1.1.1 TEID-access-l:0x2 GTP-core-r:13.14.15.16 TEID-core-r:0x105 GTP-core-l:1.1.1.1 TEID-core-l:0x1 PFCP-peer:1.2.3.4 SEID-l:0x1 PDR-access:2 PDR-core:1: Disabled tunmap, nft chain IDs: access--1-> <-2--core
DNFT DEBUG ran nft ruleset, 381 chars: "delete element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x2 };\ndelete element inet osmo-upf tunmap-post { 1 };\ndelete chain inet osmo-upf tunmap-pre-1;\ndelete chain inet osmo-upf tunmap-post-1;\ndelete element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x1 };\ndelete ..."
DGTP INFO GTP:tunmap GTP-access-r:5.6.7.8 TEID-access-r:0x104 GTP-access-l:1.1.1.1 TEID-access-l:0x2 GTP-core-r:13.14.15.16 TEID-core-r:0x105 GTP-core-l:1.1.1.1 TEID-core-l:0x1 PFCP-peer:1.2.3.4 SEID-l:0x1 PDR-access:2 PDR-core:1: Disabled tunmap, nft chain IDs: access--1-> <-2--core
DSESSION DEBUG up_session(1-2-3-4-0x1){ESTABLISHED}: Freeing instance
DSESSION DEBUG up_session(1-2-3-4-0x1){ESTABLISHED}: Deallocated
DSESSION DEBUG up_session(1-2-3-4-0x2){ESTABLISHED}: Terminating (cause = OSMO_FSM_TERM_PARENT)
@@ -388,6 +409,8 @@ DSESSION DEBUG up_session(1-2-3-4-0x2){ESTABLISHED}: Removing from parent up_pee
DSESSION DEBUG up_session(1-2-3-4-0x2){ESTABLISHED}: GTP actions: 1 previously active; want active: 0
DSESSION DEBUG up_session(1-2-3-4-0x2){ESTABLISHED}: active: GTP:tunmap GTP-access-r:5.6.7.8 TEID-access-r:0x102 GTP-access-l:1.1.1.1 TEID-access-l:0x4 GTP-core-r:13.14.15.16 TEID-core-r:0x103 GTP-core-l:1.1.1.1 TEID-core-l:0x3 PFCP-peer:1.2.3.4 SEID-l:0x2 PDR-access:2 PDR-core:1
DSESSION DEBUG up_session(1-2-3-4-0x2){ESTABLISHED}: disabling: GTP:tunmap GTP-access-r:5.6.7.8 TEID-access-r:0x102 GTP-access-l:1.1.1.1 TEID-access-l:0x4 GTP-core-r:13.14.15.16 TEID-core-r:0x103 GTP-core-l:1.1.1.1 TEID-core-l:0x3 PFCP-peer:1.2.3.4 SEID-l:0x2 PDR-access:2 PDR-core:1
DNFT INFO Added NFT ruleset to queue: n:1 strlen:381
DNFT INFO Flushing NFT ruleset queue: reached max nr of rules: n:1 strlen:381 (flush count: 8 avg rules per flush: 1)
[test override] nft_run_cmd_from_buffer():
delete element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x4 };
@@ -399,8 +422,9 @@ delete element inet osmo-upf tunmap-post { 4 };
delete chain inet osmo-upf tunmap-pre-4;
delete chain inet osmo-upf tunmap-post-4;
DNFT DEBUG run nft ruleset: "delete element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x4 };\ndelete element inet osmo-upf tunmap-post { 3 };\ndelete chain inet osmo-upf tunmap-pre-3;\ndelete chain inet osmo-upf tunmap-post-3;\ndelete element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x3 };\ndelete element inet osmo-upf tunmap-post { 4 };\ndelete chain inet osmo-upf tunmap-pre-4;\ndelete chain inet osmo-upf tunmap-post-4;\n"
DGTP NOTICE GTP:tunmap GTP-access-r:5.6.7.8 TEID-access-r:0x102 GTP-access-l:1.1.1.1 TEID-access-l:0x4 GTP-core-r:13.14.15.16 TEID-core-r:0x103 GTP-core-l:1.1.1.1 TEID-core-l:0x3 PFCP-peer:1.2.3.4 SEID-l:0x2 PDR-access:2 PDR-core:1: Disabled tunmap, nft chain IDs: access--3-> <-4--core
DNFT DEBUG ran nft ruleset, 381 chars: "delete element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x4 };\ndelete element inet osmo-upf tunmap-post { 3 };\ndelete chain inet osmo-upf tunmap-pre-3;\ndelete chain inet osmo-upf tunmap-post-3;\ndelete element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x3 };\ndelete ..."
DGTP INFO GTP:tunmap GTP-access-r:5.6.7.8 TEID-access-r:0x102 GTP-access-l:1.1.1.1 TEID-access-l:0x4 GTP-core-r:13.14.15.16 TEID-core-r:0x103 GTP-core-l:1.1.1.1 TEID-core-l:0x3 PFCP-peer:1.2.3.4 SEID-l:0x2 PDR-access:2 PDR-core:1: Disabled tunmap, nft chain IDs: access--3-> <-4--core
DSESSION DEBUG up_session(1-2-3-4-0x2){ESTABLISHED}: Freeing instance
DSESSION DEBUG up_session(1-2-3-4-0x2){ESTABLISHED}: Deallocated
DPEER NOTICE up_peer(1-2-3-4){ASSOCIATED}: Peer removed