173 Commits

Author SHA1 Message Date
Neels Janosch Hofmeyr
3572241df5 tunmap: choose local GTP addr by Network Instance IEs
Add 'netinst' config section to osmo-upf.cfg, to define Network Instance
name to local IP address mappings.

For the tunmap use case (forwarding GTP tunnels), heed the Network
Instance IEs in PFCP session creation and return IP addresses in F-TEIDs
accordingly.

Related: SYS#6192
Related: I37bebc7d6ef75c3e6ae05e81b83a1b5895839a64 (osmo-ttcn3-hacks)
Change-Id: I15ee046a1c37b83b8a83527a67a6215a30106d81
2022-12-09 17:25:58 +00:00
Neels Janosch Hofmeyr
e68eca0e8f clarify comments and naming around PDR+FAR classification
No functional change.

Rename forw_to_core to access_to_core.
Rename forw_from_core to core_to_access.

Rename add_gtp_action_endecaps to add_gtp_action_tunend.
Rename add_gtp_action_forw to add_gtp_action_tunmap.

Add assertions to clearly indicate expected PDR and reverse PDR
directions.

Tweak various comments and log messages.

Fix some comments that have Access / Core flipped.

Change-Id: Ia199bb6944476eff6af89b5ab015a9a2f8ce330e
2022-12-09 17:25:58 +00:00
Neels Janosch Hofmeyr
8e842b890c fix access/core mixup of PDR IDs / tunmap FAR
The GTP action detection always has 'pdr' detecting on the Access side
and its reverse 'rpdr' on the Core side.

  Access      osmo-upf      Core
    |------>  pdr|far  ----->|
    |<------ rfar|rpdr <-----|

Related: SYS#6192
Change-Id: I66babdfe4c1746bd3bf259342ce80dae2661de8c
2022-12-09 17:25:58 +00:00
Neels Janosch Hofmeyr
d7f683a66c VTY 'show gtp': more accurately identify local/remote IP
Indicate whether a shown IP address is local or remote, by adding '-l'
or '-r' to the field names shown.

So far, osmo-upf is only tracking remote GTP addrs, but we are about to
implement choosing local GTP addrs by Network Instance IEs. Those should
also be shown and will need to be set apart from the remote addresses.

Related: I440466f1cc9689391869ac2579a4497ef6008adb (osmo-ttcn3-hacks)
Change-Id: Ic539ebe84a0853f665e5b8b8489dd587e6907287
2022-12-09 17:25:58 +00:00
Neels Janosch Hofmeyr
65788ed64e gtpu_echo: do not osmo_fd_register twice
Change-Id: Ib498cc8d5252c05e12196f84bd1ea18d67e3052c
2022-12-09 17:25:58 +00:00
Oliver Smith
88b3b63987 debian: add osmo-pfcp-tool to osmo-upf package
Make the osmo-upf debian package consistent with the rpm package, by
adding osmo-pfcp-tool to it.

Related: OS#5817
Change-Id: Icf4bb566d9b627ead370174e92629a9fccde755e
2022-12-08 16:52:07 +01:00
Neels Janosch Hofmeyr
391259bd8c use osmo_pfcp_ie_outer_header_creation_to_str_buf()
Fix missing IP address in to-string of Outer Header Creation IE: Use
osmo_pfcp_ie_outer_header_creation_to_str_buf() from libosmo-pfcp
instead of re-inventing.

Depends: I4ad1570485c8081b82284e4e6b4de4d7eed414b0 (libosmo-pfcp)
Change-Id: I0d4d9edcfc94b61bdc74cfd4ff837f151d1c28ae
2022-12-01 00:59:36 +01:00
Neels Janosch Hofmeyr
6d17c43c42 up_gtp_action_to_str_buf(): always print PDR IDs
Change-Id: I16dae4d693850435e98e8ba18ea4ab339ee28e23
2022-12-01 00:58:24 +01:00
Neels Janosch Hofmeyr
54ebc4772b VTY: show gtp: still list tunmap if no tunend device is open
When there was only tunend implemented, it made sense to show on VTY
when no GTP kernel device was open. Since we now also have tunmap via
netfilter, drop the early exit.

Change-Id: I9a43a240f2ca55cf2ca237a83aa13e68a625d6ea
2022-11-21 17:28:05 +01:00
Neels Janosch Hofmeyr
0575e9bad9 vty: revert rename of 'show gtp'
Rename 'show tunend' back to 'show gtp'.
Clarify the VTY doc.

While renaming 'gtp' to 'tunend', i also renamed the general 'show gtp'
VTY command by accident / by misunderstanding. This command shows all
GTP tunnel state, not just the tunend state.

Reverts a small portion of commit "VTY: rename 'gtp' to 'tunend'"
  95eb2c6a89
  I49ac7b1f8b5b74f586edfed1dfb29f9af55a521b

Change-Id: I8f619d4ddda3efffb62cf594878d3166cb37fe45
2022-11-21 16:47:22 +01:00
Neels Janosch Hofmeyr
28180a6246 cosmetic: rename upf_gtp_dev_tunnel_* to upf_gtp_dev_tunend_*
Change-Id: I73e7b3c4841520909185aaba3ec41c6cf1e3ff51
2022-11-19 00:10:14 +01:00
Neels Janosch Hofmeyr
0fca3412d8 drop unused upf_gtp_dev_is_tunnel_active()
Change-Id: Ia8517f702118af55ce47a4f63fb08ac5ee284217
2022-11-19 00:09:56 +01:00
Neels Janosch Hofmeyr
b183aa84af cosmetic: rename upf_gtp_tun to upf_gtp_tunend
Change-Id: I0815012679237838a031e28c0afb98b7e0d184bd
2022-11-19 00:03:28 +01:00
Neels Janosch Hofmeyr
527f1b3b94 cosmetic: in code, rename 'endecaps' to 'tunend'
Change-Id: I55ce7cc842f36b2528e6a1a15d6f3bcb960f492b
2022-11-18 23:49:14 +01:00
Neels Janosch Hofmeyr
cd3f25cc20 osmo-pfcp-tool VTY: rename 'endecaps' to 'tunend'
We're establishing 'tunend' as short name for
encapsulation/decapsulation, also do this in osmo-pfcp-tool.

Keep a hidden "session endecaps" VTY cmd as backwards compat alias.

Related: SYS#6192
Change-Id: I0b44429cd6762fe401a4dced22ae2a3fd9bbe93b
2022-11-18 23:49:14 +01:00
Neels Janosch Hofmeyr
701bb8addc VTY: rename 'nft' to 'tunmap'
So far the config nodes were named after the implementation:
"GTP kernel module" = "gtp" and
"netfilter" = "nft"

We found that this is confusing, since both are related to handling GTP.
Rename "nft" to "tunmap"; a previous patch already renamed "gtp" to
"tunend".

Keep a hidden "nft" VTY cmd as backwards compat alias.

Related: SYS#6192
Change-Id: Ia3c5224dd3b5f5c9437bbdec997d02176818cc97
2022-11-18 23:49:14 +01:00
Neels Janosch Hofmeyr
95eb2c6a89 VTY: rename 'gtp' to 'tunend'
So far the config nodes were named after the implementation:
"GTP kernel module" = "gtp" and
"netfilter" = "nft"

We found that this is confusing, since both are related to handling GTP.
Rename "gtp" to "tunend"; a subsequent patch will rename "nft" to
"tunmap".

Keep a hidden "gtp" VTY cmd as backwards compat alias.

In log output, also print "tunend" instead of "endecaps"
(up_gtp_action_to_str_buf()).

Related: SYS#6192
Change-Id: I49ac7b1f8b5b74f586edfed1dfb29f9af55a521b
2022-11-18 23:49:14 +01:00
Neels Janosch Hofmeyr
80aefa42c6 tests/upf.vty: add some missing nodes to the test
Change-Id: I93c49dce23efaf9c533619112fb7a8114e258fa0
2022-11-18 23:49:14 +01:00
Neels Janosch Hofmeyr
a3b5488b69 drop unused enum up_session_kind
Change-Id: I10e17338485b11d6c03da209c70323f69f93fc2e
2022-11-18 23:49:14 +01:00
Neels Janosch Hofmeyr
6730f104d8 silence misleading error: "HEARTBEAT_REQ: Unknown message type"
Heartbeat is handled in libosmo-pfcp, osmo-upf does not need to take any
action.

Related: SYS#5599
Change-Id: Id81556129b528fa3a1f11ae4d01ad8b89a9be2f9
2022-11-06 22:20:46 +01:00
Neels Janosch Hofmeyr
2d2fcd81bc vty doc: indicate default nft table name
Change-Id: I79b4d287cae47c37b45a35904f298e57120a65f0
2022-09-17 23:02:40 +02:00
Neels Janosch Hofmeyr
ffc461ab38 manual: add 'Configure Primary Links'
Add section 'Configure Primary Links' with detailed explanation of the
GTP and netfilter setup.

Related: SYS#5599
Change-Id: I2378d4856b28e81dae2a85e20aaf2999768de4d9
2022-09-17 23:01:49 +02:00
Neels Janosch Hofmeyr
361ecd8cd0 manual: add/fix running.adoc
Actually add running.adoc to osmoupf-usermanual.adoc so that the chapter
shows in the generated PDF.

Related: SYS#5599
Change-Id: I1ae668ff75882e7ac55dd5b27566a68c449bdee5
2022-09-17 23:00:12 +02:00
Vadim Yanitskiy
7c3eeb0760 update git URLs (git -> https; gitea)
Change-Id: I7e0190b36861710d8cc8dd0cfd50d3dbe301ede5
2022-09-08 13:47:38 +00:00
Max
c88dc7866f Set working directory in systemd service file
By default systemd will execute service with root directory (or home directory for user instance) which might result in
attempts to create files in unexpected place. Let's set it to 'osmocom' subdir of state directory (/var/lib for system instance) instead.

Related: OS#4821
Change-Id: I786e4a655c35617bbea523275a709e865fc86689
2022-09-05 13:05:43 +00:00
Neels Janosch Hofmeyr
f95bd5b895 drop charts/, duplicated from libosmo-pfcp.git
When placing libosmo-pfcp in a separate repository, I accidentally
duplicated the charts. Since the charts are generally valid for PFCP,
libosmo-pfcp is the proper place, not here.

Change-Id: I95f11e1525b3bc6b782e5f8aecddea672a104c99
2022-08-30 14:21:31 +00:00
Neels Janosch Hofmeyr
114277cff7 Allow running without a GTP dev
Allow running without opening a GTP dev for encapsulation/decapsulation.
Probe and open the mnl socket for talking to the GTP kernel module only
when actual GTP devices exist in the config.

A site that is only doing tunnel proxying via netfilter hence does not
require GTP support in the kernel.

Change-Id: Ibb79b3ce1906136f77a895ff6f691d72a92c9fb9
2022-08-30 14:21:14 +00:00
Oliver Smith
d186d59aa2 osmo_pfcp_tool: fix osmo_pfcp_tool_copyright error
Fix for building on opensuse 15.4 with GCC 7.5.0+r278197:
  osmo_pfcp_tool_main.c:219:15: error: initializer element is not constant
    .copyright = osmo_pfcp_tool_copyright,

The variable is only used once, so move its contents directly into the
struct vty_app_info, like it is done in osmo_upf_main.c.

Fixes: OS#5655
Change-Id: Iff273283a082bb6d07c4c98d421b17b54457abe1
2022-08-26 11:02:19 +02:00
Neels Hofmeyr
803c1968e6 example cfg: tweak logging
Related: SYS#5599
Change-Id: I6b767b2e9f023cdbe5d2ea014e2d41878e848d24
2022-08-24 17:16:04 +02:00
Neels Hofmeyr
436c165f1c improve manual: PFCP and GTP interfaces
Related: SYS#5599
Change-Id: Iccb3f0f52bd5006bc94d0ca06ac5d3271ea89eb9
2022-08-24 17:16:04 +02:00
Neels Janosch Hofmeyr
4ee2a4be5e Bump version: 0.1.0 → 0.1.1
Change-Id: I1d73255f8cc30feabd3c251bdc3af1682ed4694a
0.1.1
2022-08-24 16:50:56 +02:00
Neels Janosch Hofmeyr
b78cc91e4a configure: set libosmocore >= 1.6.0 like in packaging
Change-Id: Ib31f96ffca844c2b62361cc4ff1fbb98bbe3258c
2022-08-24 16:49:08 +02:00
Neels Hofmeyr
22006ba039 debian,RPM,configure: fix packaging (deps etc)
Related: SYS#5599
Change-Id: I068736d513ddb54b9a62c1d7970a0fbff3095b4b
2022-08-24 16:11:21 +02:00
Neels Hofmeyr
9fd081534c add missing COPYING file
Came to my attention because the RPM build complained about it.

Change-Id: If3443ef22625f17b1e75f7f53e21eeffda8d90c8
2022-08-24 16:10:56 +02:00
Harald Welte
581f5c63dc add missing dependencies to libosmo-{gtlv,pfcp} to rpm + dpkg
This should hopefully fix the many daily build error mails about
failed package builds on a dozen of distributions/architectures:

[  148s] No package 'libosmo-gtlv' found
[  148s] configure:12570: error: Package requirements (libosmo-gtlv >= 0.1.0) were not met:

Change-Id: Iac551616a9831dfd9e3203d1f40e312c4dd286b6
2022-08-21 12:59:10 +02:00
Vadim Yanitskiy
0db788aecd Fix missing dash in Redmine project URL
Change-Id: I2e3fd2ec734799098fed1ea361b8236746c97812
2022-08-18 03:41:45 +07:00
Vadim Yanitskiy
183ff5c0a9 configure.ac: do not require unused dlopen
Change-Id: Ied459216cc13f1481e8b0db978a284363197f32a
2022-08-17 08:29:44 +00:00
Neels Hofmeyr
4c823221c6 debian: add missing changelog
Change-Id: I53551ce1a6d3176d480a56f8f5d2441da7346711
2022-08-16 23:17:32 +02:00
Neels Hofmeyr
2442ccd673 vty doc tweaks
Clarify "Add" and "Delete" of GTP devices.
Clarify GTP device in config vs. real GTP device.
Clarify s/kernel/Linux kernel

Related: SYS#5599
Change-Id: I918e0a9a332e4dd4b71965614c19481eb41004d6
2022-08-10 02:12:06 +02:00
Neels Hofmeyr
8c29080dde add comment about fd cleanup
Clarify that calling osmo_fd_close() is fine if no fd is open.

Related: SYS#5599
Change-Id: Ibd471485fde90a14fe19f558b38a49b0b7d62909
2022-08-09 14:14:25 +02:00
Neels Hofmeyr
9f8dd6f043 main: show just a brief talloc report for vty
Upon ^C, do not barf a huge amount of full talloc report for the entire
VTY config tree. Show a brief report on VTY instead.

Related: SYS#5599
Change-Id: I038951c6d62679e3cfcda51512768d1fbacaa0d1
2022-08-09 14:14:25 +02:00
Neels Hofmeyr
e35c12454a log: fix/tweak log msg about nft/mockup
There is no cmdline option --mockup-nft, that was an earlier stage of
the nftables mockup patch.

Related: SYS#5599
Change-Id: I2f77cfe727649bbdcebb4a656ebf97b186134ee8
2022-08-09 14:14:25 +02:00
Neels Hofmeyr
1b3e2711cd add contrib/set_cap_net_admin.sh
Related: SYS#5599
Change-Id: If31c304e2602d3c37d5d8a5a2705417b2fc4686c
2022-08-08 20:23:51 +00:00
Neels Hofmeyr
506b763094 apply refactoring of osmo_pfcp_endpoint API
libosmo-pfcp If80c35c6a942bf9593781b5a6bc28ba37323ce5e changes the
osmo_pfcp_endpoint API, apply the necessary changes here.

Related: SYS#5599
Depends: If80c35c6a942bf9593781b5a6bc28ba37323ce5e (libosmo-pfcp)
Change-Id: I01deb3f347435c9fa1c49e9a0c5ef70742444ad4
2022-07-28 15:02:06 +02:00
Neels Hofmeyr
665e8874f4 apply refactoring of osmo_pfcp_msg_alloc API
libosmo-pfcp I0d71134e42932cc72992eba73a15e82bc7cd11bd clarifies the
osmo_pfcp_msg_alloc functions, apply the necessary changes here.

Related: SYS#5599
Depends: I0d71134e42932cc72992eba73a15e82bc7cd11bd (libosmo-pfcp)
Change-Id: I73e6da3b80f05e9408c81f41ac05d6578b8e31cf
2022-07-27 11:42:34 +00:00
Neels Hofmeyr
5b87376ba5 constify local var in upf_gtp.c
Related: SYS#5599
Change-Id: I08085a6e777175b97b9c32d4c302c9863c6f6f59
2022-07-22 17:18:24 +02:00
Neels Hofmeyr
77cf6ccf21 add some comments in upf_gtp.c
Related: SYS#5599
Change-Id: I58f86cd84207a74e078ae4758bbed76bb1595d95
2022-07-22 17:18:24 +02:00
Neels Hofmeyr
0388579be9 implement GTPv1-U ECHO response
Accept data on the GTPv1-U socket and respond to GTPv1-U ECHO REQUEST
messages.

We should keep a deterministic recovery counter that increases with
every restart. As a quick and dirty way just use the current time at
startup for now, until osmo-upf reaches production maturity.

Related: OS#5599
Change-Id: I135370a7723e2c667ec681f50c21107cde63ea5b
2022-07-22 17:18:24 +02:00
Neels Hofmeyr
7493d6db71 add osmo-pfcp-tool
A tool for quick testing of PFCP interaction with a UPF, based on VTY
scripts / interaction.

The main motivation to create this tool was to test both the CPF and UPF
sides of the new PFCP protocol encoding and decoding, and then to test
interaction of osmo-upf with the kernel modules. It may also come in
handy as a fast way to verify basic operation in a production
environment.

Related: SYS#5599
Change-Id: I34a80d43a14c7b68952c7d337d8042d6f28ceae7
2022-07-22 12:18:29 +02:00
Neels Hofmeyr
06482c6554 implement GTP tunnel mapping via netfilter
Implement support for PFCP rulesets that ask for mapping a GTP tunnel:
forwarding GTP payload between two GTP tunnels.

For a GTP tunnel mapping, dispatch netfilter rules that detect GTP
packets with a given source address and TEID, and replace the TEID and
destination address according to the PFCP ruleset.

The netfilter implementation is chosen to effect the packet rewriting
and forwarding to take place directly in the kernel, for high throughput
of GTP packets.

Related: SYS#5599
Change-Id: Ic0d319eb4f98cd51a5999c804c4203ab0bdda650
2022-07-20 17:08:53 +02:00