Attention is currently required from: fixeria.
neels has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-msc/+/30112 )
Change subject: rtp_stream_commit: check missing MGW ep only when ready for RTP
......................................................................
Patch Set 2: Code-Review+2
(2 comments)
Patchset:
PS1:
> Looks like you need to update the expected unit test output.
Done
Patchset:
PS2:
re-add previous votes after rebase
--
To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/30112
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: I24a81a926b97c9f0fb31df782d1cf931eaff9db1
Gerrit-Change-Number: 30112
Gerrit-PatchSet: 2
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(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-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 10 Jan 2023 02:01:37 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: comment
Attention is currently required from: laforge, pespin.
neels has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-msc/+/30111 )
Change subject: fix sdp_msg_to_sdp_str(), never add fmtp for unset codec
......................................................................
Patch Set 4:
(1 comment)
File src/libmsc/sdp_msg.c:
https://gerrit.osmocom.org/c/osmo-msc/+/30111/comment/ff0bf1e7_20e01b04
PS1, Line 271: if (!sdp_audio_codec_is_set(codec))
> Ah I see what you mean, the codec->fmtp[0] if clause below is not executed then. […]
Done
--
To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/30111
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: I1892efd9360585f98419ebbd0df180f7f3a8160d
Gerrit-Change-Number: 30111
Gerrit-PatchSet: 4
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 10 Jan 2023 01:50:58 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: neels <nhofmeyr(a)sysmocom.de>
Comment-In-Reply-To: laforge <laforge(a)osmocom.org>
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: comment
Attention is currently required from: neels.
Hello Jenkins Builder, laforge, pespin, fixeria,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/osmo-msc/+/30113
to look at the new patch set (#2).
Change subject: rtp_stream: set_remote_addr: do nothing when unchanged
......................................................................
rtp_stream: set_remote_addr: do nothing when unchanged
Change-Id: I15181d84f3eb8a4ab9077cf12fcb138d51733102
---
M src/libmsc/rtp_stream.c
M tests/msc_vlr/msc_vlr_test_call.err
2 files changed, 10 insertions(+), 5 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/13/30113/2
--
To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/30113
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: I15181d84f3eb8a4ab9077cf12fcb138d51733102
Gerrit-Change-Number: 30113
Gerrit-PatchSet: 2
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de>
Gerrit-MessageType: newpatchset
Attention is currently required from: neels.
Hello Jenkins Builder, laforge, pespin, fixeria,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/osmo-msc/+/30112
to look at the new patch set (#2).
Change subject: rtp_stream_commit: check missing MGW ep only when ready for RTP
......................................................................
rtp_stream_commit: check missing MGW ep only when ready for RTP
Change-Id: I24a81a926b97c9f0fb31df782d1cf931eaff9db1
---
M src/libmsc/rtp_stream.c
M tests/msc_vlr/msc_vlr_test_call.err
2 files changed, 9 insertions(+), 9 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/12/30112/2
--
To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/30112
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: I24a81a926b97c9f0fb31df782d1cf931eaff9db1
Gerrit-Change-Number: 30112
Gerrit-PatchSet: 2
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de>
Gerrit-MessageType: newpatchset
neels has submitted this change. ( https://gerrit.osmocom.org/c/osmo-upf/+/30833 )
Change subject: manual: explain new netinst cfg
......................................................................
manual: explain new netinst cfg
Related: SYS#6192
Change-Id: I1d636b8a6ae7628b4369734a45e60f2eaf437dce
---
A doc/manuals/chapters/netinst.adoc
M doc/manuals/osmoupf-usermanual.adoc
2 files changed, 58 insertions(+), 0 deletions(-)
Approvals:
Jenkins Builder: Verified
pespin: Looks good to me, but someone else must approve
laforge: Looks good to me, approved
diff --git a/doc/manuals/chapters/netinst.adoc b/doc/manuals/chapters/netinst.adoc
new file mode 100644
index 0000000..3add2bb
--- /dev/null
+++ b/doc/manuals/chapters/netinst.adoc
@@ -0,0 +1,56 @@
+== Local GTP Addresses / Network Instance
+
+PFCP features optional Network Instance IEs, in which the CPF may tell the UPF which local network interface to use for
+a PDR and/or a FAR.
+
+NOTE:: osmo-upf only evaluates the Network Instances configured in PDRs. Since osmo-upf always pairs a PDR+FAR with
+another PDR+FAR in reverse direction, each side's PDR is sufficient.
+
+Network Instance IEs affect both the tunend and the tunmap use cases, as well as which local IP address is returned
+in the PFCP response
+
+1. Look up Network Instance name in the osmo-upf.cfg `netinst` section, to obtain a local IP address.
+2. Depending on use case:
+ - tunend: create the tunnel on a GTP device matching the local IP address, see <<gtp_module>>.
+ - tunmap: use the local IP address in the netfilter ruleset, see <<nftables>>.
+3. Usually, return the chosen local IP address in the F-TEID IE of the Created PDR IE in the PFCP response.
+
+Network Instance configuration consists of {name, IP address} pairs.
+
+NOTE:: As soon as a `netinst` configuration is nonempty, receiving an undefined Network Instance name results in a PFCP
+Reject response, and a log message on cateogry `session`, level `NOTICE`. To make the PFCP return success, add the
+failing name to the `netinst` config.
+
+=== netinst for tunend
+
+The following configuration sets up two GTP devices for tunend, expecting Network Instance names `access1` or `access2`:
+
+----
+tunend
+ dev create apn1 10.0.0.1
+ dev create apn2 10.0.0.2
+netinst
+ add access1 10.0.0.1
+ add access2 10.0.0.2
+----
+
+For example, if a Create PDR IE indicates Network Instance = `access1`, a GTP tunnel is set up in GTP kernel device
+`apn1`. For `access2`, use `apn2`.
+
+=== netinst for tunmap
+
+For the tunmap use case, it is sufficient to configure `netinst` entries, without any addition to the `tunmap` section.
+The following example configures various interfaces for tunmap, to match Network Instance names received in PFCP:
+
+----
+tunmap
+ table-name osmo-upf
+netinst
+ add access1 10.0.0.1
+ add access2 10.0.0.2
+ add core1 9.0.0.1
+ add core2 9.0.0.2
+----
+
+For example, a Create PDR indicating a Network Instance of `core1` will result in an nftables rule that receives packets
+on local address `9.0.0.1`.
diff --git a/doc/manuals/osmoupf-usermanual.adoc b/doc/manuals/osmoupf-usermanual.adoc
index 0e0e7b7..49e3e23 100644
--- a/doc/manuals/osmoupf-usermanual.adoc
+++ b/doc/manuals/osmoupf-usermanual.adoc
@@ -11,6 +11,8 @@
include::{srcdir}/chapters/running.adoc[]
+include::{srcdir}/chapters/netinst.adoc[]
+
include::./common/chapters/vty.adoc[]
include::./common/chapters/logging.adoc[]
2 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
--
To view, visit https://gerrit.osmocom.org/c/osmo-upf/+/30833
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-upf
Gerrit-Branch: master
Gerrit-Change-Id: I1d636b8a6ae7628b4369734a45e60f2eaf437dce
Gerrit-Change-Number: 30833
Gerrit-PatchSet: 3
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
neels has submitted this change. ( https://gerrit.osmocom.org/c/osmo-upf/+/30834 )
Change subject: manual: tweak 'running' for new netinst feature
......................................................................
manual: tweak 'running' for new netinst feature
Related: SYS#6192
Change-Id: Iaa7af53aae72099283bb29ef0fc0eba03ae2f27d
---
M doc/manuals/chapters/running.adoc
1 file changed, 15 insertions(+), 8 deletions(-)
Approvals:
Jenkins Builder: Verified
pespin: Looks good to me, but someone else must approve
laforge: Looks good to me, approved
diff --git a/doc/manuals/chapters/running.adoc b/doc/manuals/chapters/running.adoc
index ab7ab18..0f56521 100644
--- a/doc/manuals/chapters/running.adoc
+++ b/doc/manuals/chapters/running.adoc
@@ -117,11 +117,12 @@
range that matches the UE IP addresses that are configured in GTP-C / PFCP.
The following configuration placed in `osmo-upf.cfg` creates a GTP device called
-`apn23` on startup, which is also destroyed on program exit:
+`apn23` on startup of osmo-upf, which is destroyed on program exit. It listens
+for GTP on local IP address `1.2.3.4`:
----
tunend
- dev create apn23
+ dev create apn23 1.2.3.4
----
TODO:: `osmo-upf` is not yet able to configure this network device's IP address
@@ -132,7 +133,7 @@
----
tunend
- dev use apn42
+ dev use apn42 2.3.4.5
----
GTP kernel devices can be managed manually using the `gtp-link` program
@@ -146,11 +147,17 @@
$ osmo-upf -c osmo-upf.cfg
----
-NOTE:: It is possible to configure multiple GTP devices in `osmo-upf.cfg`, but
-`osmo-upf` currently _only uses the first GTP device_ found in the
-configuration. In the future, different devices may be used based on the Network
-Instance IE passed in the PFCP Session messages (PDR/FAR). Until then, it makes
-little sense to configure more than one GTP device.
+It is possible to configure multiple GTP devices in `osmo-upf.cfg`. Depending on
+the Network Instance name, osmo-upf creates tunnel endpoints on the GTP device
+with a matching IP address:
+
+- The Network Instance IE in the PDR on the Access side determines the local IP
+ address to use, see <<netinst>>.
+- This local IP address in turn determines the GTP device to use.
+
+It is possible for a GTP device to listen on ANY -- just omit the IP address in
+the `dev` config. In this case, all Network Instance names will be served by
+this GTP device. When using ANY, there should be exactly one GTP dev configured.
[[nftables]]
===== Configure Linux netfilter for `tunmap`
2 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
--
To view, visit https://gerrit.osmocom.org/c/osmo-upf/+/30834
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-upf
Gerrit-Branch: master
Gerrit-Change-Id: Iaa7af53aae72099283bb29ef0fc0eba03ae2f27d
Gerrit-Change-Number: 30834
Gerrit-PatchSet: 3
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
neels has submitted this change. ( https://gerrit.osmocom.org/c/osmo-upf/+/30832 )
Change subject: manual: use 'tunend' and 'tunmap'
......................................................................
manual: use 'tunend' and 'tunmap'
Change-Id: I09a2fa28465945c98b58b4093c7d5de65e184645
---
M doc/manuals/chapters/overview.adoc
M doc/manuals/chapters/running.adoc
2 files changed, 13 insertions(+), 10 deletions(-)
Approvals:
Jenkins Builder: Verified
pespin: Looks good to me, but someone else must approve
laforge: Looks good to me, approved
diff --git a/doc/manuals/chapters/overview.adoc b/doc/manuals/chapters/overview.adoc
index 9cd7751..a6dc345 100644
--- a/doc/manuals/chapters/overview.adoc
+++ b/doc/manuals/chapters/overview.adoc
@@ -79,14 +79,14 @@
OsmoUPF does not support the complete PFCP feature set. It detects exactly two
use cases that will provide service of actual GTP tunnels:
-* GTP tunnel encapsulation/decapsulation:
+* `tunend`: GTP tunnel encapsulation/decapsulation:
- One Packet Detection Rule (PDR) accepts a GTP tunnel from the Access side
with an Outer Header Removal.
- This PDR uses a Forwarding Action Rule (FAR) for plain IP towards Core.
- Another PDR accepts plain IP on a specific IP address from Core.
- The second PDR uses a FAR towards Access with Outer Header Creation for GTP.
-* GTP tunnel forwarding:
+* `tunmap`: GTP tunnel forwarding:
- One Packet Detection Rule (PDR) accepts a GTP tunnel from the Access side
with an Outer Header Removal.
- This PDR uses a Forwarding Action Rule (FAR) towards Core with an Outer
diff --git a/doc/manuals/chapters/running.adoc b/doc/manuals/chapters/running.adoc
index 0459541..ab7ab18 100644
--- a/doc/manuals/chapters/running.adoc
+++ b/doc/manuals/chapters/running.adoc
@@ -55,7 +55,7 @@
naming of individual tunnel rulesets does not collide:
----
-nft
+tunmap
table-name osmo-upf-2
----
@@ -103,10 +103,10 @@
forwarding proxy, without encapsulation/decapsulation of GTP payloads.
[[gtp_module]]
-===== Configure Linux Kernel GTP Module
+===== Configure Linux Kernel GTP Module for `tunend`
-The Linux kernel GTP module is used for GTP encapsulation/decapsulation from/to
-"the internet".
+The Linux kernel GTP module is used for the `tunend` use case, i.e. GTP
+encapsulation/decapsulation from/to "the internet".
To use the GTP kernel module, OsmoUPF requires a GTP device, which is a
dedicated network device provided by the Linux kernel, serving as GTP tunnel
@@ -120,7 +120,7 @@
`apn23` on startup, which is also destroyed on program exit:
----
-gtp
+tunend
dev create apn23
----
@@ -131,7 +131,7 @@
called `apn42`:
----
-gtp
+tunend
dev use apn42
----
@@ -153,7 +153,7 @@
little sense to configure more than one GTP device.
[[nftables]]
-===== Configure Linux netfilter
+===== Configure Linux netfilter for `tunmap`
The Linux kernel netfilter module is used for GTP tunnel proxying, also known as
tunnel forwarding or tunnel mapping.
@@ -165,6 +165,9 @@
can be configured in `osmo-upf.cfg` like this:
----
-nft
+tunmap
table-name my-table-name
----
+
+When running more than one osmo-upf process on a system, pick distinct table
+names to avoid name collisions in the nftables reulesets.
2 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
--
To view, visit https://gerrit.osmocom.org/c/osmo-upf/+/30832
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-upf
Gerrit-Branch: master
Gerrit-Change-Id: I09a2fa28465945c98b58b4093c7d5de65e184645
Gerrit-Change-Number: 30832
Gerrit-PatchSet: 3
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
neels has submitted this change. ( https://gerrit.osmocom.org/c/osmo-upf/+/30836 )
Change subject: manual: some tweaks in overview
......................................................................
manual: some tweaks in overview
Related: SYS#6192
Change-Id: I5a672d24eb12bd29d8684117b2658ad4cd89d682
---
M doc/manuals/chapters/overview.adoc
1 file changed, 13 insertions(+), 10 deletions(-)
Approvals:
Jenkins Builder: Verified
pespin: Looks good to me, but someone else must approve
laforge: Looks good to me, approved
diff --git a/doc/manuals/chapters/overview.adoc b/doc/manuals/chapters/overview.adoc
index 32c3060..9af86d1 100644
--- a/doc/manuals/chapters/overview.adoc
+++ b/doc/manuals/chapters/overview.adoc
@@ -119,11 +119,14 @@
Header Creation for GTP.
- A second PDR+FAR pair like above, with Access and Core swapped.
+Access and Core must be indicated by the Source Interface IE (PDR) and
+Destination Interface IE (FAR) in PFCP.
+
Any set of rules only partially or not at all matching the above PDR and FAR
rules will not result in any actions on the GTP user plane, but will still
return a successful outcome in the PFCP messages.
-For example, a rule set using an interface other than "Access" or "Core" results
+For example, a rule set using a Source Interface other than "Access" or "Core" results
in a PFCP no-op, returning PFCP responses with successful outcome, but not
providing any GTP-U service.
@@ -134,11 +137,11 @@
- OsmoUPF using Linux kernel features for the GTP user plane, where there is
either a full bidirectional GTP tunnel in place or none at all.
-For example, a typical CPF will first establish a PFCP session with the UPF
-before passing on a data service request from Access to Core, because the UPF
-must first choose the GTP TEID that needs to be forwarded towards Core. When the
-Core side has responded with its GTP details, the UPF is updated, to form a
-complete PFCP rule set.
+For example, for `tunmap`, a typical CPF will establish a PFCP session in two
+steps: first request a local F-TEID from the UPF before passing on a data
+service request from Access to Core. When the Core side has responded with its
+GTP details, the PFCP session at the UPF is updated (Session Modifification),
+to form a complete PFCP rule set.
.Typical sequence of establishing a GTP-U tunnel relay
["mscgen"]
@@ -158,16 +161,16 @@
|||;
- sgwc <= sgwu [label="PFCP Session Establishment Response\n\n2x Created PDR\nwith chosen F-TEID"];
+ sgwc <= sgwu [label="PFCP Session Establishment Response\n\n2x Created PDR\nwith chosen local F-TEID"];
|||;
- sgwc => pgwc [label="GTP Create Session Request"];
- sgwc <= pgwc [label="GTP Create Session Response"];
+ sgwc => pgwc [label="GTP Create Session Request\nwith chosen local F-TEID towards Core"];
+ sgwc <= pgwc [label="GTP Create Session Response\nwith remote F-TEID at Core"];
|||;
- sgwc => sgwu [label="PFCP Session Modification Request\n\nUpdate FAR\nwith F-TEID from Core"];
+ sgwc => sgwu [label="PFCP Session Modification Request\n\nUpdate FAR\nwith remote F-TEID at Core"];
|||;
2 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
--
To view, visit https://gerrit.osmocom.org/c/osmo-upf/+/30836
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-upf
Gerrit-Branch: master
Gerrit-Change-Id: I5a672d24eb12bd29d8684117b2658ad4cd89d682
Gerrit-Change-Number: 30836
Gerrit-PatchSet: 3
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
neels has submitted this change. ( https://gerrit.osmocom.org/c/osmo-upf/+/30831 )
Change subject: tunend: choose local GTP addr by Network Instance IEs
......................................................................
tunend: choose local GTP addr by Network Instance IEs
Implement handling of the Network Instance IEs from PFCP for tunend,
like already done for tunmap.
In 'tunend' cfg, allow indicating a local GTP address for both 'dev
create' and 'dev use'. Select a GTP device by the local address the
Network Instance IE in PFCP PDR indicates.
Related: SYS#6192
Change-Id: I376c09bfc1844df1e61d2efac17561fac614858b
---
M include/osmocom/upf/upf_gtp.h
M src/osmo-upf/up_gtp_action.c
M src/osmo-upf/upf_gtp.c
M src/osmo-upf/upf_vty.c
M tests/upf.vty
5 files changed, 64 insertions(+), 27 deletions(-)
Approvals:
Jenkins Builder: Verified
fixeria: Looks good to me, but someone else must approve
pespin: Looks good to me, approved
diff --git a/include/osmocom/upf/upf_gtp.h b/include/osmocom/upf/upf_gtp.h
index 1a358ba..e3db918 100644
--- a/include/osmocom/upf/upf_gtp.h
+++ b/include/osmocom/upf/upf_gtp.h
@@ -83,6 +83,7 @@
int upf_gtp_dev_open(const char *name, bool create_gtp_dev, const char *local_addr, bool listen_for_gtpv0,
bool sgsn_mode);
struct upf_gtp_dev *upf_gtp_dev_find_by_name(const char *name);
+struct upf_gtp_dev *upf_gtp_dev_find_by_local_addr(const struct osmo_sockaddr *local_addr);
struct upf_gtp_dev *upf_gtp_dev_first();
int upf_gtp_dev_tunend_add(struct upf_gtp_dev *dev, const struct upf_gtp_tunend_desc *t);
diff --git a/src/osmo-upf/up_gtp_action.c b/src/osmo-upf/up_gtp_action.c
index 8ce8a6f..3b3da86 100644
--- a/src/osmo-upf/up_gtp_action.c
+++ b/src/osmo-upf/up_gtp_action.c
@@ -79,6 +79,7 @@
static int up_gtp_action_enable_disable(struct up_gtp_action *a, bool enable)
{
struct upf_gtp_dev *gtp_dev;
+ const struct osmo_sockaddr *gtp_addr;
int rc;
switch (a->kind) {
@@ -89,12 +90,15 @@
return 0;
}
- /* use the first available GTP device.
- * TODO: select by interface name?
- */
- gtp_dev = upf_gtp_dev_first();
+ /* Pick GTP device matching the local F-TEID set up for the GTP tunnel (it is on the Access side) */
+ gtp_addr = &a->tunend.access.gtp_local_addr;
+ gtp_dev = upf_gtp_dev_find_by_local_addr(gtp_addr);
if (!gtp_dev) {
- LOG_UP_GTP_ACTION(a, LOGL_ERROR, "No GTP device open, cannot %s\n", enable ? "enable" : "disable");
+ LOG_UP_GTP_ACTION(a, LOGL_ERROR, "No GTP device open for local address %s, cannot %s"
+ " -- consider configuring 'tunend' / 'dev (create|use) foo %s'\n",
+ osmo_sockaddr_to_str_c(OTC_SELECT, gtp_addr),
+ enable ? "enable" : "disable",
+ osmo_sockaddr_to_str_c(OTC_SELECT, gtp_addr));
return -EIO;
}
@@ -107,7 +111,8 @@
enable ? "enable" : "disable", rc, strerror(-rc));
return rc;
}
- LOG_UP_GTP_ACTION(a, LOGL_NOTICE, "%s GTP tunnel\n", enable ? "Enabled" : "Disabled");
+ LOG_UP_GTP_ACTION(a, LOGL_NOTICE, "%s GTP tunnel on dev %s\n", enable ? "Enabled" : "Disabled",
+ gtp_dev->name);
return 0;
case UP_GTP_U_TUNMAP:
diff --git a/src/osmo-upf/upf_gtp.c b/src/osmo-upf/upf_gtp.c
index adac836..2c37bc4 100644
--- a/src/osmo-upf/upf_gtp.c
+++ b/src/osmo-upf/upf_gtp.c
@@ -73,6 +73,26 @@
return NULL;
}
+struct upf_gtp_dev *upf_gtp_dev_find_by_local_addr(const struct osmo_sockaddr *local_addr)
+{
+ struct upf_gtp_dev *dev;
+ struct upf_gtp_dev *dev_any = NULL;
+ struct osmo_sockaddr needle = *local_addr;
+
+ llist_for_each_entry(dev, &g_upf->gtp.devs, entry) {
+ /* To leave the port number out of the cmp, set the needle's port to match */
+ osmo_sockaddr_set_port(&needle.u.sa, osmo_sockaddr_port(&dev->gtpv1.local_addr.u.sa));
+
+ if (!osmo_sockaddr_cmp(&needle, &dev->gtpv1.local_addr))
+ return dev;
+ if (osmo_sockaddr_is_any(&dev->gtpv1.local_addr) == 1)
+ dev_any = dev;
+ }
+ /* No 1:1 match found, but there is a dev listening on ANY? Return that.
+ * If there is no such dev, return NULL. */
+ return dev_any;
+}
+
struct upf_gtp_dev *upf_gtp_dev_first()
{
return llist_first_entry_or_null(&g_upf->gtp.devs, struct upf_gtp_dev, entry);
diff --git a/src/osmo-upf/upf_vty.c b/src/osmo-upf/upf_vty.c
index 4c683c8..afea28d 100644
--- a/src/osmo-upf/upf_vty.c
+++ b/src/osmo-upf/upf_vty.c
@@ -137,37 +137,44 @@
return CMD_SUCCESS;
}
+static struct tunend_vty_cfg_dev *tunend_dev_add(int argc, const char **argv, bool create)
+{
+ struct tunend_vty_cfg_dev *d = talloc_zero(g_upf, struct tunend_vty_cfg_dev);
+ d->create = create;
+ d->dev_name = talloc_strdup(d, argv[0]);
+ if (argc > 1)
+ d->local_addr = talloc_strdup(d, argv[1]);
+ llist_add(&d->entry, &tunend_vty.devs);
+ return d;
+}
+
DEFUN(cfg_tunend_dev_create, cfg_tunend_dev_create_cmd,
"dev create DEVNAME [LISTEN_ADDR]",
DEV_STR
"Add GTP device, creating a new Linux kernel GTP device. Will listen on GTPv1 port "
OSMO_STRINGIFY_VAL(PORT_GTP1_U)
- " and GTPv0 port " OSMO_STRINGIFY_VAL(PORT_GTP0_U) " on the specified interface, or on ANY if LISTEN_ADDR is"
- " omitted.\n"
+ " and GTPv0 port " OSMO_STRINGIFY_VAL(PORT_GTP0_U) " on the specified LISTEN_ADDR\n"
"device name, e.g. 'apn0'\n"
- "IPv4 or IPv6 address to listen on, omit for ANY\n")
+ "IPv4 or IPv6 address to listen on, omit for ANY. LISTEN_ADDR is used to pick a GTP device matching the local"
+ " address for a PFCP Network Instance, which are configured in the 'netinst' node.\n")
{
- struct tunend_vty_cfg_dev *d = talloc_zero(g_upf, struct tunend_vty_cfg_dev);
- d->create = true;
- d->dev_name = talloc_strdup(d, argv[0]);
- if (argc > 1)
- d->local_addr = talloc_strdup(d, argv[1]);
- llist_add(&d->entry, &tunend_vty.devs);
- vty_out(vty, "Added GTP device %s (create new)%s", d->dev_name, VTY_NEWLINE);
+ struct tunend_vty_cfg_dev *d = tunend_dev_add(argc, argv, true);
+ vty_out(vty, "Added GTP device %s on %s (create new)%s", d->dev_name, d->local_addr ? : "0.0.0.0", VTY_NEWLINE);
return CMD_SUCCESS;
}
DEFUN(cfg_tunend_dev_use, cfg_tunend_dev_use_cmd,
- "dev use DEVNAME",
+ "dev use DEVNAME [LOCAL_ADDR]",
DEV_STR
"Add GTP device, using an existing Linux kernel GTP device, e.g. created by 'gtp-link'\n"
- "device name, e.g. 'apn0'\n")
+ "device name, e.g. 'apn0'\n"
+ "The local GTP address this device listens on. It is assumed to be ANY when omitted."
+ " LOCAL_ADDR is used to pick a GTP device matching the local address for a PFCP Network Instance,"
+ " which are configured in the 'netinst' node.\n")
{
- struct tunend_vty_cfg_dev *d = talloc_zero(g_upf, struct tunend_vty_cfg_dev);
- d->create = false;
- d->dev_name = talloc_strdup(d, argv[0]);
- llist_add(&d->entry, &tunend_vty.devs);
- vty_out(vty, "Added GTP device %s (use existing)%s", d->dev_name, VTY_NEWLINE);
+ struct tunend_vty_cfg_dev *d = tunend_dev_add(argc, argv, false);
+ vty_out(vty, "Added GTP device %s on %s (use existing)%s", d->dev_name, d->local_addr ? : "0.0.0.0",
+ VTY_NEWLINE);
return CMD_SUCCESS;
}
diff --git a/tests/upf.vty b/tests/upf.vty
index 51ebeb3..bfaa0cc 100644
--- a/tests/upf.vty
+++ b/tests/upf.vty
@@ -20,7 +20,7 @@
mockup
no mockup
dev create DEVNAME [LISTEN_ADDR]
- dev use DEVNAME
+ dev use DEVNAME [LOCAL_ADDR]
dev delete DEVNAME
OsmoUPF(config-tunend)# exit
@@ -28,19 +28,23 @@
OsmoUPF(config-tunend)# list
...
dev create DEVNAME [LISTEN_ADDR]
- dev use DEVNAME
+ dev use DEVNAME [LOCAL_ADDR]
dev delete DEVNAME
OsmoUPF(config-tunend)# dev?
dev Configure the GTP device to use for encaps/decaps.
OsmoUPF(config-tunend)# dev ?
- create Add GTP device, creating a new Linux kernel GTP device. Will listen on GTPv1 port 2152 and GTPv0 port 3386 on the specified interface, or on ANY if LISTEN_ADDR is omitted.
+ create Add GTP device, creating a new Linux kernel GTP device. Will listen on GTPv1 port 2152 and GTPv0 port 3386 on the specified LISTEN_ADDR
use Add GTP device, using an existing Linux kernel GTP device, e.g. created by 'gtp-link'
delete Remove a GTP device from the configuration, and delete the Linux kernel GTP device if it was created here.
OsmoUPF(config-tunend)# dev create ?
DEVNAME device name, e.g. 'apn0'
OsmoUPF(config-tunend)# dev create foo ?
- [LISTEN_ADDR] IPv4 or IPv6 address to listen on, omit for ANY
+ [LISTEN_ADDR] IPv4 or IPv6 address to listen on, omit for ANY. LISTEN_ADDR is used to pick a GTP device matching the local address for a PFCP Network Instance, which are configured in the 'netinst' node.
+OsmoUPF(config-tunend)# dev use ?
+ DEVNAME device name, e.g. 'apn0'
+OsmoUPF(config-tunend)# dev use foo ?
+ [LOCAL_ADDR] The local GTP address this device listens on. It is assumed to be ANY when omitted. LOCAL_ADDR is used to pick a GTP device matching the local address for a PFCP Network Instance, which are configured in the 'netinst' node.
OsmoUPF(config-tunend)# dev delete ?
DEVNAME device name, e.g. 'apn0'
OsmoUPF(config-tunend)# exit
--
To view, visit https://gerrit.osmocom.org/c/osmo-upf/+/30831
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-upf
Gerrit-Branch: master
Gerrit-Change-Id: I376c09bfc1844df1e61d2efac17561fac614858b
Gerrit-Change-Number: 30831
Gerrit-PatchSet: 3
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged