mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-upf.git
synced 2025-11-15 19:31:34 +00:00
tunmap: ensure assigned chain_id is unused
When handing out a chain_id, make sure it is not in use yet. So far picking a chain_id was of PoC grade quality. As osmo-upf is approaching production grade, make this waterproof. So far with inefficient iteration of all sessions; faster lookup follows in I36a75ec4698cd83558185c1f202400eb53ae8ff6. Related: OS#5900 Change-Id: I139b46de0bd15185a7a06109d55f7c759755ec81
This commit is contained in:
committed by
neels
parent
27a90869c7
commit
40a30fce4a
@@ -141,3 +141,4 @@ int upf_gtp_devs_open();
|
|||||||
void upf_gtp_devs_close();
|
void upf_gtp_devs_close();
|
||||||
|
|
||||||
uint32_t upf_next_local_teid(void);
|
uint32_t upf_next_local_teid(void);
|
||||||
|
uint32_t upf_next_chain_id(void);
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
#include <osmocom/upf/up_endpoint.h>
|
#include <osmocom/upf/up_endpoint.h>
|
||||||
#include <osmocom/upf/up_peer.h>
|
#include <osmocom/upf/up_peer.h>
|
||||||
#include <osmocom/upf/up_session.h>
|
#include <osmocom/upf/up_session.h>
|
||||||
|
#include <osmocom/upf/up_gtp_action.h>
|
||||||
#include <osmocom/upf/upf_gtp.h>
|
#include <osmocom/upf/upf_gtp.h>
|
||||||
|
|
||||||
struct g_upf *g_upf = NULL;
|
struct g_upf *g_upf = NULL;
|
||||||
@@ -150,3 +151,54 @@ uint32_t upf_next_local_teid(void)
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static uint32_t upf_next_chain_id_inc(void)
|
||||||
|
{
|
||||||
|
g_upf->tunmap.next_chain_id_state++;
|
||||||
|
if (!g_upf->tunmap.next_chain_id_state)
|
||||||
|
g_upf->tunmap.next_chain_id_state++;
|
||||||
|
return g_upf->tunmap.next_chain_id_state;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Return an unused chain_id, or 0 if none is found with sane effort. */
|
||||||
|
uint32_t upf_next_chain_id(void)
|
||||||
|
{
|
||||||
|
uint32_t sanity;
|
||||||
|
|
||||||
|
/* 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* finding a chain_id became insane, return invalid = 0 */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|||||||
@@ -343,23 +343,9 @@ char *upf_nft_tunmap_get_vmap_init_str(void *ctx)
|
|||||||
g_upf->tunmap.priority_post);
|
g_upf->tunmap.priority_post);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t chain_id_next(void)
|
|
||||||
{
|
|
||||||
g_upf->tunmap.next_chain_id_state++;
|
|
||||||
if (!g_upf->tunmap.next_chain_id_state)
|
|
||||||
g_upf->tunmap.next_chain_id_state++;
|
|
||||||
return g_upf->tunmap.next_chain_id_state;
|
|
||||||
}
|
|
||||||
|
|
||||||
char *upf_nft_tunmap_get_ruleset_str(void *ctx, struct upf_tunmap *tunmap)
|
char *upf_nft_tunmap_get_ruleset_str(void *ctx, struct upf_tunmap *tunmap)
|
||||||
{
|
{
|
||||||
struct upf_nft_args args;
|
struct upf_nft_args args;
|
||||||
|
|
||||||
if (!tunmap->access.chain_id)
|
|
||||||
tunmap->access.chain_id = chain_id_next();
|
|
||||||
if (!tunmap->core.chain_id)
|
|
||||||
tunmap->core.chain_id = chain_id_next();
|
|
||||||
|
|
||||||
upf_nft_args_from_tunmap(&args, tunmap);
|
upf_nft_args_from_tunmap(&args, tunmap);
|
||||||
return upf_nft_ruleset_tunmap_create_c(ctx, &args);
|
return upf_nft_ruleset_tunmap_create_c(ctx, &args);
|
||||||
}
|
}
|
||||||
@@ -371,8 +357,21 @@ char *upf_nft_tunmap_get_ruleset_del_str(void *ctx, struct upf_tunmap *tunmap)
|
|||||||
return upf_nft_ruleset_tunmap_delete_c(ctx, &args);
|
return upf_nft_ruleset_tunmap_delete_c(ctx, &args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int upf_nft_tunmap_ensure_chain_id(struct upf_nft_tun *tun)
|
||||||
|
{
|
||||||
|
if (tun->chain_id)
|
||||||
|
return 0;
|
||||||
|
tun->chain_id = upf_next_chain_id();
|
||||||
|
if (!tun->chain_id)
|
||||||
|
return -ENOSPC;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int upf_nft_tunmap_create(struct upf_tunmap *tunmap)
|
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 upf_nft_run(upf_nft_tunmap_get_ruleset_str(OTC_SELECT, tunmap));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -349,8 +349,8 @@ static void test_skip_used_id(void)
|
|||||||
log_assert(a->kind == UP_GTP_U_TUNMAP);
|
log_assert(a->kind == UP_GTP_U_TUNMAP);
|
||||||
log_assert(a->tunmap.core.tun.local.teid == 3);
|
log_assert(a->tunmap.core.tun.local.teid == 3);
|
||||||
log_assert(a->tunmap.access.tun.local.teid == 4);
|
log_assert(a->tunmap.access.tun.local.teid == 4);
|
||||||
log_assert_expect_failure(a->tunmap.access.chain_id == 3);
|
log_assert(a->tunmap.access.chain_id == 3);
|
||||||
log_assert_expect_failure(a->tunmap.core.chain_id == 4);
|
log_assert(a->tunmap.core.chain_id == 4);
|
||||||
log("\n");
|
log("\n");
|
||||||
|
|
||||||
log("drop first tunmap (%s)\n", s1->fi->name);
|
log("drop first tunmap (%s)\n", s1->fi->name);
|
||||||
@@ -387,8 +387,8 @@ static void test_skip_used_id(void)
|
|||||||
log_assert(a->kind == UP_GTP_U_TUNMAP);
|
log_assert(a->kind == UP_GTP_U_TUNMAP);
|
||||||
log_assert(a->tunmap.core.tun.local.teid == 5);
|
log_assert(a->tunmap.core.tun.local.teid == 5);
|
||||||
log_assert(a->tunmap.access.tun.local.teid == 6);
|
log_assert(a->tunmap.access.tun.local.teid == 6);
|
||||||
log_assert_expect_failure(a->tunmap.access.chain_id == 5);
|
log_assert(a->tunmap.access.chain_id == 5);
|
||||||
log_assert_expect_failure(a->tunmap.core.chain_id == 6);
|
log_assert(a->tunmap.core.chain_id == 6);
|
||||||
log("\n");
|
log("\n");
|
||||||
|
|
||||||
cleanup();
|
cleanup();
|
||||||
|
|||||||
@@ -125,21 +125,21 @@ DSESSION DEBUG up_session(1-2-3-4-0x2){INIT}: want: GTP:tunmap GTP-access-r:5.6.
|
|||||||
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
|
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
|
||||||
|
|
||||||
[test override] nft_run_cmd_from_buffer():
|
[test override] nft_run_cmd_from_buffer():
|
||||||
add chain inet osmo-upf tunmap-pre-1;
|
add chain inet osmo-upf tunmap-pre-3;
|
||||||
add rule inet osmo-upf tunmap-pre-1 ip daddr set 13.14.15.16 meta mark set 1 counter accept;
|
add rule inet osmo-upf tunmap-pre-3 ip daddr set 13.14.15.16 meta mark set 3 counter accept;
|
||||||
add chain inet osmo-upf tunmap-post-1;
|
add chain inet osmo-upf tunmap-post-3;
|
||||||
add rule inet osmo-upf tunmap-post-1 ip saddr set 1.1.1.1 @ih,32,32 set 0x103 counter accept;
|
add rule inet osmo-upf tunmap-post-3 ip saddr set 1.1.1.1 @ih,32,32 set 0x103 counter accept;
|
||||||
add element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x4 : jump tunmap-pre-1 };
|
add element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x4 : jump tunmap-pre-3 };
|
||||||
add element inet osmo-upf tunmap-post { 1 : jump tunmap-post-1 };
|
add element inet osmo-upf tunmap-post { 3 : jump tunmap-post-3 };
|
||||||
add chain inet osmo-upf tunmap-pre-2;
|
add chain inet osmo-upf tunmap-pre-4;
|
||||||
add rule inet osmo-upf tunmap-pre-2 ip daddr set 5.6.7.8 meta mark set 2 counter accept;
|
add rule inet osmo-upf tunmap-pre-4 ip daddr set 5.6.7.8 meta mark set 4 counter accept;
|
||||||
add chain inet osmo-upf tunmap-post-2;
|
add chain inet osmo-upf tunmap-post-4;
|
||||||
add rule inet osmo-upf tunmap-post-2 ip saddr set 1.1.1.1 @ih,32,32 set 0x102 counter accept;
|
add rule inet osmo-upf tunmap-post-4 ip saddr set 1.1.1.1 @ih,32,32 set 0x102 counter accept;
|
||||||
add element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x3 : jump tunmap-pre-2 };
|
add element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x3 : jump tunmap-pre-4 };
|
||||||
add element inet osmo-upf tunmap-post { 2 : jump tunmap-post-2 };
|
add element inet osmo-upf tunmap-post { 4 : jump tunmap-post-4 };
|
||||||
|
|
||||||
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 @ih,32,32 set 0x103 counter accept;\nadd element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x4 : 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 @ih,32,32 set 0x102 counter accept;\nadd element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x3 : jump tunmap-pre-2 };\nadd element inet osmo-upf tunmap-post { 2 : jump tunmap-post-2 };\n"
|
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 @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 @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--1-> <-2--core
|
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
|
||||||
|
|
||||||
[test override] PFCP tx:
|
[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 } } }
|
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 } } }
|
||||||
@@ -158,15 +158,15 @@ DPEER DEBUG up_peer(1-2-3-4){ASSOCIATED}: Received Event UP_PEER_EV_USE_COUNT_ZE
|
|||||||
state:
|
state:
|
||||||
| peer up_peer(1-2-3-4) ASSOCIATED
|
| peer up_peer(1-2-3-4) ASSOCIATED
|
||||||
| session[ESTABLISHED]: UP-SEID 0x1; chain_id access=1 core=2; local TEID access=0x2 core=0x1
|
| session[ESTABLISHED]: UP-SEID 0x1; chain_id access=1 core=2; local TEID access=0x2 core=0x1
|
||||||
| session[ESTABLISHED]: UP-SEID 0x2; chain_id access=1 core=2; local TEID access=0x4 core=0x3
|
| session[ESTABLISHED]: UP-SEID 0x2; chain_id access=3 core=4; local TEID access=0x4 core=0x3
|
||||||
|
|
||||||
assert(s2->up_seid == 2)
|
assert(s2->up_seid == 2)
|
||||||
assert(a = llist_first_entry_or_null(&s2->active_gtp_actions, struct up_gtp_action, entry))
|
assert(a = llist_first_entry_or_null(&s2->active_gtp_actions, struct up_gtp_action, entry))
|
||||||
assert(a->kind == UP_GTP_U_TUNMAP)
|
assert(a->kind == UP_GTP_U_TUNMAP)
|
||||||
assert(a->tunmap.core.tun.local.teid == 3)
|
assert(a->tunmap.core.tun.local.teid == 3)
|
||||||
assert(a->tunmap.access.tun.local.teid == 4)
|
assert(a->tunmap.access.tun.local.teid == 4)
|
||||||
assert(a->tunmap.access.chain_id == 3) <-- EXPECTED TO FAIL (known error)
|
assert(a->tunmap.access.chain_id == 3)
|
||||||
assert(a->tunmap.core.chain_id == 4) <-- EXPECTED TO FAIL (known error)
|
assert(a->tunmap.core.chain_id == 4)
|
||||||
|
|
||||||
drop first tunmap (up_session(1-2-3-4-0x1))
|
drop first tunmap (up_session(1-2-3-4-0x1))
|
||||||
assert(session)
|
assert(session)
|
||||||
@@ -206,7 +206,7 @@ DPEER DEBUG up_peer(1-2-3-4){ASSOCIATED}: Received Event UP_PEER_EV_SESSION_TERM
|
|||||||
|
|
||||||
state:
|
state:
|
||||||
| peer up_peer(1-2-3-4) ASSOCIATED
|
| peer up_peer(1-2-3-4) ASSOCIATED
|
||||||
| session[ESTABLISHED]: UP-SEID 0x2; chain_id access=1 core=2; local TEID access=0x4 core=0x3
|
| session[ESTABLISHED]: UP-SEID 0x2; chain_id access=3 core=4; local TEID access=0x4 core=0x3
|
||||||
|
|
||||||
assert(up_session_find_by_up_seid(peer, s1_up_seid) == NULL)
|
assert(up_session_find_by_up_seid(peer, s1_up_seid) == NULL)
|
||||||
|
|
||||||
@@ -266,7 +266,7 @@ DPEER DEBUG up_peer(1-2-3-4){ASSOCIATED}: Received Event UP_PEER_EV_USE_COUNT_ZE
|
|||||||
state:
|
state:
|
||||||
| peer up_peer(1-2-3-4) ASSOCIATED
|
| peer up_peer(1-2-3-4) ASSOCIATED
|
||||||
| session[ESTABLISHED]: UP-SEID 0x1; chain_id access=1 core=2; local TEID access=0x2 core=0x1
|
| session[ESTABLISHED]: UP-SEID 0x1; chain_id access=1 core=2; local TEID access=0x2 core=0x1
|
||||||
| session[ESTABLISHED]: UP-SEID 0x2; chain_id access=1 core=2; local TEID access=0x4 core=0x3
|
| session[ESTABLISHED]: UP-SEID 0x2; chain_id access=3 core=4; local TEID access=0x4 core=0x3
|
||||||
|
|
||||||
assert(s3->up_seid == 1)
|
assert(s3->up_seid == 1)
|
||||||
assert(a = llist_first_entry_or_null(&s3->active_gtp_actions, struct up_gtp_action, entry))
|
assert(a = llist_first_entry_or_null(&s3->active_gtp_actions, struct up_gtp_action, entry))
|
||||||
@@ -298,21 +298,21 @@ DSESSION DEBUG up_session(1-2-3-4-0x3){INIT}: want: GTP:tunmap GTP-access-r:5.6.
|
|||||||
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
|
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
|
||||||
|
|
||||||
[test override] nft_run_cmd_from_buffer():
|
[test override] nft_run_cmd_from_buffer():
|
||||||
add chain inet osmo-upf tunmap-pre-3;
|
add chain inet osmo-upf tunmap-pre-5;
|
||||||
add rule inet osmo-upf tunmap-pre-3 ip daddr set 13.14.15.16 meta mark set 3 counter accept;
|
add rule inet osmo-upf tunmap-pre-5 ip daddr set 13.14.15.16 meta mark set 5 counter accept;
|
||||||
add chain inet osmo-upf tunmap-post-3;
|
add chain inet osmo-upf tunmap-post-5;
|
||||||
add rule inet osmo-upf tunmap-post-3 ip saddr set 1.1.1.1 @ih,32,32 set 0x107 counter accept;
|
add rule inet osmo-upf tunmap-post-5 ip saddr set 1.1.1.1 @ih,32,32 set 0x107 counter accept;
|
||||||
add element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x6 : jump tunmap-pre-3 };
|
add element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x6 : jump tunmap-pre-5 };
|
||||||
add element inet osmo-upf tunmap-post { 3 : jump tunmap-post-3 };
|
add element inet osmo-upf tunmap-post { 5 : jump tunmap-post-5 };
|
||||||
add chain inet osmo-upf tunmap-pre-4;
|
add chain inet osmo-upf tunmap-pre-6;
|
||||||
add rule inet osmo-upf tunmap-pre-4 ip daddr set 5.6.7.8 meta mark set 4 counter accept;
|
add rule inet osmo-upf tunmap-pre-6 ip daddr set 5.6.7.8 meta mark set 6 counter accept;
|
||||||
add chain inet osmo-upf tunmap-post-4;
|
add chain inet osmo-upf tunmap-post-6;
|
||||||
add rule inet osmo-upf tunmap-post-4 ip saddr set 1.1.1.1 @ih,32,32 set 0x106 counter accept;
|
add rule inet osmo-upf tunmap-post-6 ip saddr set 1.1.1.1 @ih,32,32 set 0x106 counter accept;
|
||||||
add element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x5 : jump tunmap-pre-4 };
|
add element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x5 : jump tunmap-pre-6 };
|
||||||
add element inet osmo-upf tunmap-post { 4 : jump tunmap-post-4 };
|
add element inet osmo-upf tunmap-post { 6 : jump tunmap-post-6 };
|
||||||
|
|
||||||
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 @ih,32,32 set 0x107 counter accept;\nadd element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x6 : 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 @ih,32,32 set 0x106 counter accept;\nadd element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x5 : jump tunmap-pre-4 };\nadd element inet osmo-upf tunmap-post { 4 : jump tunmap-post-4 };\n"
|
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 @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 @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--3-> <-4--core
|
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
|
||||||
|
|
||||||
[test override] PFCP tx:
|
[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 } } }
|
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 } } }
|
||||||
@@ -330,17 +330,17 @@ DPEER DEBUG up_peer(1-2-3-4){ASSOCIATED}: Received Event UP_PEER_EV_USE_COUNT_ZE
|
|||||||
|
|
||||||
state:
|
state:
|
||||||
| peer up_peer(1-2-3-4) ASSOCIATED
|
| peer up_peer(1-2-3-4) ASSOCIATED
|
||||||
| session[ESTABLISHED]: UP-SEID 0x3; chain_id access=3 core=4; local TEID access=0x6 core=0x5
|
| session[ESTABLISHED]: UP-SEID 0x3; chain_id access=5 core=6; local TEID access=0x6 core=0x5
|
||||||
| session[ESTABLISHED]: UP-SEID 0x1; chain_id access=1 core=2; local TEID access=0x2 core=0x1
|
| session[ESTABLISHED]: UP-SEID 0x1; chain_id access=1 core=2; local TEID access=0x2 core=0x1
|
||||||
| session[ESTABLISHED]: UP-SEID 0x2; chain_id access=1 core=2; local TEID access=0x4 core=0x3
|
| session[ESTABLISHED]: UP-SEID 0x2; chain_id access=3 core=4; local TEID access=0x4 core=0x3
|
||||||
|
|
||||||
assert(s4->up_seid == 3)
|
assert(s4->up_seid == 3)
|
||||||
assert(a = llist_first_entry_or_null(&s4->active_gtp_actions, struct up_gtp_action, entry))
|
assert(a = llist_first_entry_or_null(&s4->active_gtp_actions, struct up_gtp_action, entry))
|
||||||
assert(a->kind == UP_GTP_U_TUNMAP)
|
assert(a->kind == UP_GTP_U_TUNMAP)
|
||||||
assert(a->tunmap.core.tun.local.teid == 5)
|
assert(a->tunmap.core.tun.local.teid == 5)
|
||||||
assert(a->tunmap.access.tun.local.teid == 6)
|
assert(a->tunmap.access.tun.local.teid == 6)
|
||||||
assert(a->tunmap.access.chain_id == 5) <-- EXPECTED TO FAIL (known error)
|
assert(a->tunmap.access.chain_id == 5)
|
||||||
assert(a->tunmap.core.chain_id == 6) <-- EXPECTED TO FAIL (known error)
|
assert(a->tunmap.core.chain_id == 6)
|
||||||
|
|
||||||
DPEER DEBUG up_peer(1-2-3-4){ASSOCIATED}: Terminating (cause = OSMO_FSM_TERM_REGULAR)
|
DPEER DEBUG up_peer(1-2-3-4){ASSOCIATED}: Terminating (cause = OSMO_FSM_TERM_REGULAR)
|
||||||
DSESSION DEBUG up_session(1-2-3-4-0x3){ESTABLISHED}: Terminating (cause = OSMO_FSM_TERM_PARENT)
|
DSESSION DEBUG up_session(1-2-3-4-0x3){ESTABLISHED}: Terminating (cause = OSMO_FSM_TERM_PARENT)
|
||||||
@@ -351,16 +351,16 @@ DSESSION DEBUG up_session(1-2-3-4-0x3){ESTABLISHED}: disabling: GTP:tunmap GTP-a
|
|||||||
|
|
||||||
[test override] nft_run_cmd_from_buffer():
|
[test override] nft_run_cmd_from_buffer():
|
||||||
delete element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x6 };
|
delete element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x6 };
|
||||||
delete element inet osmo-upf tunmap-post { 3 };
|
delete element inet osmo-upf tunmap-post { 5 };
|
||||||
delete chain inet osmo-upf tunmap-pre-3;
|
delete chain inet osmo-upf tunmap-pre-5;
|
||||||
delete chain inet osmo-upf tunmap-post-3;
|
delete chain inet osmo-upf tunmap-post-5;
|
||||||
delete element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x5 };
|
delete element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x5 };
|
||||||
delete element inet osmo-upf tunmap-post { 4 };
|
delete element inet osmo-upf tunmap-post { 6 };
|
||||||
delete chain inet osmo-upf tunmap-pre-4;
|
delete chain inet osmo-upf tunmap-pre-6;
|
||||||
delete chain inet osmo-upf tunmap-post-4;
|
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 { 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 . 0x5 };\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"
|
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--3-> <-4--core
|
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
|
||||||
DSESSION DEBUG up_session(1-2-3-4-0x3){ESTABLISHED}: Freeing instance
|
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-0x3){ESTABLISHED}: Deallocated
|
||||||
DSESSION DEBUG up_session(1-2-3-4-0x1){ESTABLISHED}: Terminating (cause = OSMO_FSM_TERM_PARENT)
|
DSESSION DEBUG up_session(1-2-3-4-0x1){ESTABLISHED}: Terminating (cause = OSMO_FSM_TERM_PARENT)
|
||||||
@@ -391,16 +391,16 @@ DSESSION DEBUG up_session(1-2-3-4-0x2){ESTABLISHED}: disabling: GTP:tunmap GTP-a
|
|||||||
|
|
||||||
[test override] nft_run_cmd_from_buffer():
|
[test override] nft_run_cmd_from_buffer():
|
||||||
delete element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x4 };
|
delete element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x4 };
|
||||||
delete element inet osmo-upf tunmap-post { 1 };
|
delete element inet osmo-upf tunmap-post { 3 };
|
||||||
delete chain inet osmo-upf tunmap-pre-1;
|
delete chain inet osmo-upf tunmap-pre-3;
|
||||||
delete chain inet osmo-upf tunmap-post-1;
|
delete chain inet osmo-upf tunmap-post-3;
|
||||||
delete element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x3 };
|
delete element inet osmo-upf tunmap-pre { 1.1.1.1 . 0x3 };
|
||||||
delete element inet osmo-upf tunmap-post { 2 };
|
delete element inet osmo-upf tunmap-post { 4 };
|
||||||
delete chain inet osmo-upf tunmap-pre-2;
|
delete chain inet osmo-upf tunmap-pre-4;
|
||||||
delete chain inet osmo-upf tunmap-post-2;
|
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 { 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 . 0x3 };\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"
|
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--1-> <-2--core
|
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
|
||||||
DSESSION DEBUG up_session(1-2-3-4-0x2){ESTABLISHED}: Freeing instance
|
DSESSION DEBUG up_session(1-2-3-4-0x2){ESTABLISHED}: Freeing instance
|
||||||
DSESSION DEBUG up_session(1-2-3-4-0x2){ESTABLISHED}: Deallocated
|
DSESSION DEBUG up_session(1-2-3-4-0x2){ESTABLISHED}: Deallocated
|
||||||
DPEER NOTICE up_peer(1-2-3-4){ASSOCIATED}: Peer removed
|
DPEER NOTICE up_peer(1-2-3-4){ASSOCIATED}: Peer removed
|
||||||
|
|||||||
Reference in New Issue
Block a user