neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-upf/+/30497 )
Change subject: nft: make sure to use only IP addrs, not port numbers
......................................................................
nft: make sure to use only IP addrs, not port numbers
There should be no port set in the sockaddrs. If there is a nonzero port
by accident, it would mess up the nftables rule: to-string conversion
should yield only an IP address. So ensure all port numbers are zero.
In upf_nft_args, use osmo_sockaddr members instead of pointers, so that
the input args can be modified (to set ports to zero).
Change-Id: If49f1e82e8cb92b7225e85a7c3b059e0f7f92fa3
---
M src/osmo-upf/upf_nft.c
1 file changed, 15 insertions(+), 9 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-upf refs/changes/97/30497/1
diff --git a/src/osmo-upf/upf_nft.c b/src/osmo-upf/upf_nft.c
index c34cbfb..e9c69c4 100644
--- a/src/osmo-upf/upf_nft.c
+++ b/src/osmo-upf/upf_nft.c
@@ -100,11 +100,11 @@
struct upf_nft_args_peer {
/* The source IP address in packets received from this peer */
- const struct osmo_sockaddr *addr_remote;
+ struct osmo_sockaddr addr_remote;
/* The TEID that we send to the peer in GTP packets. */
uint32_t teid_remote;
/* The local destination IP address in packets received from this peer */
- const struct osmo_sockaddr *addr_local;
+ struct osmo_sockaddr addr_local;
/* The TEID that the peer sends to us in GTP packets. */
uint32_t teid_local;
};
@@ -133,18 +133,18 @@
/* Match on packets coming in at specific local IP */
OSMO_STRBUF_PRINTF(sb, " ip daddr ");
- OSMO_STRBUF_APPEND(sb, osmo_sockaddr_to_str_buf2, from_peer->addr_local);
+ OSMO_STRBUF_APPEND(sb, osmo_sockaddr_to_str_buf2, &from_peer->addr_local);
/* Match on the TEID in the header */
OSMO_STRBUF_PRINTF(sb, " @ih,32,32 0x%08x", from_peer->teid_local);
/* Change outgoing address to local IP on outgoing interface */
OSMO_STRBUF_PRINTF(sb, " ip saddr set ");
- OSMO_STRBUF_APPEND(sb, osmo_sockaddr_to_str_buf2, to_peer->addr_local);
+ OSMO_STRBUF_APPEND(sb, osmo_sockaddr_to_str_buf2, &to_peer->addr_local);
/* Change destination address to to_peer */
OSMO_STRBUF_PRINTF(sb, " ip daddr set ");
- OSMO_STRBUF_APPEND(sb, osmo_sockaddr_to_str_buf2, to_peer->addr_remote);
+ OSMO_STRBUF_APPEND(sb, osmo_sockaddr_to_str_buf2, &to_peer->addr_remote);
/* Change the TEID in the header to the one to_peer expects */
OSMO_STRBUF_PRINTF(sb, " @ih,32,32 set 0x%08x", to_peer->teid_remote);
@@ -196,18 +196,24 @@
.chain_id = tunmap->id,
.priority = g_upf->nft.priority,
.peer_a = {
- .addr_remote = &tunmap->access.gtp_remote_addr,
+ .addr_remote = tunmap->access.gtp_remote_addr,
.teid_remote = tunmap->access.remote_teid,
- .addr_local = &tunmap->access.gtp_local_addr,
+ .addr_local = tunmap->access.gtp_local_addr,
.teid_local = tunmap->access.local_teid,
},
.peer_b = {
- .addr_remote = &tunmap->core.gtp_remote_addr,
+ .addr_remote = tunmap->core.gtp_remote_addr,
.teid_remote = tunmap->core.remote_teid,
- .addr_local = &tunmap->core.gtp_local_addr,
+ .addr_local = tunmap->core.gtp_local_addr,
.teid_local = tunmap->core.local_teid,
},
};
+ /* There should be no port set in the sockaddrs. If there is a nonzero port by accident, it would mess up the
+ * nftables rule: to-string conversion should yield only an IP address. So ensure all port numbers are zero. */
+ osmo_sockaddr_set_port(&args->peer_a.addr_remote.u.sa, 0);
+ osmo_sockaddr_set_port(&args->peer_a.addr_local.u.sa, 0);
+ osmo_sockaddr_set_port(&args->peer_b.addr_remote.u.sa, 0);
+ osmo_sockaddr_set_port(&args->peer_b.addr_local.u.sa, 0);
}
int upf_nft_tunmap_create(struct upf_nft_tunmap_desc *tunmap)
--
To view, visit https://gerrit.osmocom.org/c/osmo-upf/+/30497
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-upf
Gerrit-Branch: master
Gerrit-Change-Id: If49f1e82e8cb92b7225e85a7c3b059e0f7f92fa3
Gerrit-Change-Number: 30497
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-MessageType: newchange
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-upf/+/30498 )
Change subject: nft: allow to get the ruleset string without running
......................................................................
nft: allow to get the ruleset string without running
Separate string composition of the nftables ruleset from the actual
actvation of the ruleset to nftables.
For a 'show' VTY command added in upcoming patch, I'd like to be able to
vty_out() an nftables rule set. Provide API for that.
Change-Id: I0124a68ccf1ac7b90c5cc32d0cbf58d0cc219ccc
---
M include/osmocom/upf/upf_nft.h
M src/osmo-upf/upf_nft.c
2 files changed, 8 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-upf refs/changes/98/30498/1
diff --git a/include/osmocom/upf/upf_nft.h b/include/osmocom/upf/upf_nft.h
index fe8bb12..4cdcb51 100644
--- a/include/osmocom/upf/upf_nft.h
+++ b/include/osmocom/upf/upf_nft.h
@@ -49,5 +49,6 @@
int upf_nft_init();
int upf_nft_free();
+char *upf_nft_tunmap_get_ruleset_str(void *ctx, struct upf_nft_tunmap_desc *tunmap);
int upf_nft_tunmap_create(struct upf_nft_tunmap_desc *tunmap);
int upf_nft_tunmap_delete(struct upf_nft_tunmap_desc *tunmap);
diff --git a/src/osmo-upf/upf_nft.c b/src/osmo-upf/upf_nft.c
index e9c69c4..afc2fac 100644
--- a/src/osmo-upf/upf_nft.c
+++ b/src/osmo-upf/upf_nft.c
@@ -216,7 +216,7 @@
osmo_sockaddr_set_port(&args->peer_b.addr_local.u.sa, 0);
}
-int upf_nft_tunmap_create(struct upf_nft_tunmap_desc *tunmap)
+char *upf_nft_tunmap_get_ruleset_str(void *ctx, struct upf_nft_tunmap_desc *tunmap)
{
struct upf_nft_args args;
@@ -229,7 +229,12 @@
}
upf_nft_args_from_tunmap_desc(&args, tunmap);
- return upf_nft_run(upf_nft_ruleset_tunmap_create_c(OTC_SELECT, &args));
+ return upf_nft_ruleset_tunmap_create_c(ctx, &args);
+}
+
+int upf_nft_tunmap_create(struct upf_nft_tunmap_desc *tunmap)
+{
+ return upf_nft_run(upf_nft_tunmap_get_ruleset_str(OTC_SELECT, tunmap));
}
int upf_nft_tunmap_delete(struct upf_nft_tunmap_desc *tunmap)
--
To view, visit https://gerrit.osmocom.org/c/osmo-upf/+/30498
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-upf
Gerrit-Branch: master
Gerrit-Change-Id: I0124a68ccf1ac7b90c5cc32d0cbf58d0cc219ccc
Gerrit-Change-Number: 30498
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-MessageType: newchange
arehbein has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-upf/+/30466 )
Change subject: fix tunmap: mixup of Access/Core side FAR rules
......................................................................
Patch Set 1:
(1 comment)
Patchset:
PS1:
I find the commit message + ASCII graphic confusing. How do PDR-1, PDR-2 relate to PDR and 'reverse PDR'?
Similar for FAR-1, FAR-2.
I would have preferred something like (my understanding of the setup...):
<--------|{{FAR} PDR}|<-------
Access | UPF | Core
-------->|{R-PDR {R-FAR}}|------->
If that is correct and the field `tunmap.access` contains information on how to forward packets incoming on the access interface to the tunnel set up at the core interfaces and vice versa, then the fix makes sense to me.
I would be in favor of refactoring the identifiers/naming scheme concerning this, i.e. call the pairings 'pdr_at_core'/'far_at_core'
'pdr_at_access'/'far_at_access', or just 'pdr_core', 'pdr_access'... something among those lines
--
To view, visit https://gerrit.osmocom.org/c/osmo-upf/+/30466
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-upf
Gerrit-Branch: master
Gerrit-Change-Id: I66babdfe4c1746bd3bf259342ce80dae2661de8c
Gerrit-Change-Number: 30466
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: arehbein <arehbein(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 07 Dec 2022 22:17:22 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: pespin.
neels has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-upf/+/30465 )
Change subject: clarify comments and naming around PDR+FAR classification
......................................................................
Patch Set 1:
(3 comments)
File include/osmocom/upf/up_session.h:
https://gerrit.osmocom.org/c/osmo-upf/+/30465/comment/6c3f64b1_d09f85f6
PS1, Line 97: bool access_to_core;
> Isn't access_to_core and core_to_access exclusive? meaning it's one or another and hence can be stor […]
it can be { access_to_core, core_to_access, neither }. a single bool is not sufficient, an enum would do. a bool (two bools) is simplest to use in 'if' conditions
File src/osmo-upf/up_session.c:
https://gerrit.osmocom.org/c/osmo-upf/+/30465/comment/50e0494d_66d2f3d4
PS1, Line 1140: static void add_gtp_action_tunend(void *ctx, struct llist_head *dst, struct pdr *pdr)
> Looks like this function should return an int?
(s.b.)
https://gerrit.osmocom.org/c/osmo-upf/+/30465/comment/dced0d69_0d8cb932
PS1, Line 1235: static void add_gtp_action_tunmap(void *ctx, struct llist_head *dst, struct pdr *pdr)
> Same, looks like this function should return an int?
the caller isn't interested in any result. since it is a static funtion no need to return anything before there is a direct need for that in the caller
--
To view, visit https://gerrit.osmocom.org/c/osmo-upf/+/30465
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-upf
Gerrit-Branch: master
Gerrit-Change-Id: Ia199bb6944476eff6af89b5ab015a9a2f8ce330e
Gerrit-Change-Number: 30465
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 07 Dec 2022 21:49:55 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: comment
Attention is currently required from: arehbein, pespin.
neels has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-upf/+/30459 )
Change subject: VTY 'show gtp': more accurately identify local/remote IP
......................................................................
Patch Set 1:
(1 comment)
File src/osmo-upf/up_session.c:
https://gerrit.osmocom.org/c/osmo-upf/+/30459/comment/bf86a615_1fd2d7d4
PS1, Line 1147: /* A GTP tunnel on Access side, TODO TODO TODO plain IP on Core side.
> TODO?
i was sure i wouldn't forget it ... it is fixed in a later patch, can move that here or maybe that's not necessary
--
To view, visit https://gerrit.osmocom.org/c/osmo-upf/+/30459
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-upf
Gerrit-Branch: master
Gerrit-Change-Id: Ic539ebe84a0853f665e5b8b8489dd587e6907287
Gerrit-Change-Number: 30459
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: arehbein <arehbein(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-CC: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: arehbein <arehbein(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 07 Dec 2022 21:42:56 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: comment
Attention is currently required from: fixeria.
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/30489 )
Change subject: llc: Proper separation of public & private APIs, Introduce llc_prim API
......................................................................
Patch Set 3:
(1 comment)
File configure.ac:
https://gerrit.osmocom.org/c/libosmo-gprs/+/30489/comment/014d82e1_7796ff6e
PS1, Line 35: libosmogsm
> Ack
In debian/control it already depends on libosmocore-dev, which is enough (there's no libosmogsm-dev package).
--
To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/30489
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-gprs
Gerrit-Branch: master
Gerrit-Change-Id: I588eb576b2703262f4ab9566ec362920d8390cfd
Gerrit-Change-Number: 30489
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 07 Dec 2022 15:04:58 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: comment
Attention is currently required from: pespin, fixeria.
Hello Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/libosmo-gprs/+/30489
to look at the new patch set (#3).
Change subject: llc: Proper separation of public & private APIs, Introduce llc_prim API
......................................................................
llc: Proper separation of public & private APIs, Introduce llc_prim API
Most of the existing (and added) data structures are kept private, since
most of those don't really need to be used outside internal code in the
library.
Most if not all the interaction from upper and lower layers towards LLC
is now done through the new llc_prim pubic interface. This interface is
based on 3GPP TS 44.064 section 7.1.2.
This commit also implements some of the code paths of the public API by
means on importing LLC code from osmo-sgsn.git commit
57b63875c762a784127a13becd1c2549ca6c5454.
The import of code cannot be done in a separate commit since existing code
in osmo-sgsn.git is low quality and has tons of layer violations in all
directions.
Hence, this commit aims at being an initial point of having some working
LLC stack by means of a few unit tests, but by no means aims to be a
total working implementation. Some code paths are missing; bugs are
expected at this point.
Related: OS#5502
Change-Id: I588eb576b2703262f4ab9566ec362920d8390cfd
---
M configure.ac
M contrib/libosmo-gprs.spec.in
M include/osmocom/gprs/llc/Makefile.am
M include/osmocom/gprs/llc/llc.h
M include/osmocom/gprs/llc/llc_prim.h
A include/osmocom/gprs/llc/llc_private.h
M libosmo-gprs-llc.pc.in
M src/llc/Makefile.am
A src/llc/llc.c
A src/llc/llc_bssgp.c
A src/llc/llc_grr.c
A src/llc/llc_ll.c
A src/llc/llc_llgmm.c
M src/llc/llc_pdu.c
A src/llc/llc_prim.c
M src/llc/llc_xid.c
M src/llc/misc.c
M tests/llc/Makefile.am
A tests/llc/llc_prim_test.c
A tests/llc/llc_prim_test.err
A tests/llc/llc_prim_test.ok
M tests/llc/pdu_codec_test.c
M tests/llc/pdu_codec_test.ok
A tests/llc/xid_codec_test.c
A tests/llc/xid_codec_test.err
A tests/llc/xid_codec_test.ok
M tests/testsuite.at
27 files changed, 2,930 insertions(+), 444 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-gprs refs/changes/89/30489/3
--
To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/30489
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-gprs
Gerrit-Branch: master
Gerrit-Change-Id: I588eb576b2703262f4ab9566ec362920d8390cfd
Gerrit-Change-Number: 30489
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: newpatchset