Dear GTP-interested folks,
I would love to somehow get towards some degree of unit testing (or even
"continuous integration") for teh kernel GTP code.
We currently have the original code in the kernel, we had some recent
small fixes and now are getting more patches into place. With
relatively few active users out there (and probably none of them in
production yet), it's particularly easy to introduce regressions while
working on the code. Also, having tested new code even against a
test set with limited covrage could help to get more confidence in new
patches and thus get them merged sooner.
Using tools like sgsnemu of OpenGGSN and the command line tools included
in libgtpnl, it should be possibel to cook up some scripts for testing.
Even the most basic set of tests would be an improvement over what we
have now. One could also think about pcap replay to test with
hand-crafted or real-world packets from other GTP implementations.
As much as I'd like to put something like this into place myself, I
don't think I will be able to work much on this in the near future. The
GTP module at this point is a pure hobby and contrary to some years ago
while I started it, I don't have any contract work in the GTP area at
this point, so other projects currently unfortunately get more
attention.
So in case somebody among the GTP-interested parties (Travelping, OAI,
...) would want to do something in terms of testing, I'd be more than
happy if somebody would step ahead. Otherwise it's all just vapourware
going to end up on my ever-growing TODO list :/
Also, if netdev folks have some ideas/pointers about possible
frameworks/tools for this kind of testing [it must exist for at least
some other kernel networking code?]: Please let me know. I'd be
interested to have a look if there's something that can be used as a
basis (starting network namespaces, sending/transmitting packets, test
case startup/teardown, ...)
My "old school" approach would have been to start one or multiple
user-mode-linux kernels (those that are to be tested), and then have
scripts that set up a gtp socket and gtp tunnels via the libgtp command
line tools, and throw packets at that. But I'm sure there must be
quite powerful frameworks for that kind of testing in the 21st century?
How do other tunneling implementations handle this?
Regards,
Harald
--
- Harald Welte <laforge(a)gnumonks.org> http://laforge.gnumonks.org/
============================================================================
"Privacy in residential applications is a desirable marketing option."
(ETSI EN 300 175-7 Ch. A6)
Harald,
As requested I've copied this to the osmocom-net-gprs(a)lists.osmocom.org
list.
I'm not sure if any of you are interested in this (or even if it's
useful as the "gtp5g" module is still 'work in progress'), however
if you are interested any comments ??.
I've attached a tarball (gtp-patches.tar.xz) with all the
patches and here are some notes:
1) This has been built and tested on Fedora 34 using
linux-5.14-rc4 kernel.
2) The first two kernel patches reinstall the current gtp
driver into manageable modules. You can build the kernel with just
these patches and should still be able to use libgtpnl, osmo-ggsn
etc. as no code changes.
3) The remaining three kernel patches install the services
from https://github.com/free5gc/gtp5g to DRV_VERSION "1.0.3a",
also update core services (where possible) to use common functions
e.g. gtp_dev_xmit().
It is possible to implement more common functions, but that
can be done if the patch series is of any use !!!
4) There are three possible Kconfig configuration options:
GTP_PDP only - GTP_PDR only - GTP_PDP and GTP_PDR
5) If GTP_PDP and GTP_PDR build selected, the basic tests
using osmo-ggsn or openggsn work using tests in [1] and the tests
from libgtp5gnl [2] (./run.sh SimpleUPTest & ULCLTest1) will also
run - provided the following tarball patch has been applied to
update [2]:
0001-libgtp5gnl-Update-to-match-new-linux-gtp.h-entries.patch
6) Be aware that apps/libs should now define their role
specifically (i.e. GTP_ROLE_SGSN, GTP_ROLE_RAN) and not default
thinking that '0' will always be GTP_ROLE_GGSN or GTP_ROLE_UPF.
Both libgtp*nl versions do this.
7) I've only limited test options so cannot guarantee all
will work !!
8) The kernel and tests have been built using Fedora 34.
When building the kernel with Fedora the gtp5g side will hang
when testing. This happens whether I build/load as described in the
https://github.com/free5gc/gtp5g README i.e. untouched by me, or with
my patches. To solve this issue I've commented out some code in
pdr.c pdr_context_free() with a comment:
/* FIXME - Stop crash when kernel built on Fedora 34 */
I'll try and fix this at some stage.
9) The original gtp5g driver 'struct net_device_ops' used:
.ndo_get_stats64 = ip_tunnel_get_stats64,
However this is deprecated so set to:
.ndo_get_stats64 = dev_get_tstats64,
10) Running checkpatch on the kernel patches will show plenty
of warning and check messages, however all 'errors' are fixed.
11) I've patches that add the LSM/SELinux services, however have
not included these as I guess still nfi.
[1] https://osmocom.org/projects/linux-kernel-gtp-u/wiki/Basic_Testing
[2] https://github.com/free5gc/libgtp5gnl
Richard Haines (5):
gtp: Delete current gtp driver
gtp: Split gtp driver into modules
gtp: Add support for PDR services - Part 1
gtp: Add support for PDR services - Part 2
gtp: Add support for PDR services - Part 3
drivers/net/Kconfig | 17 +-
drivers/net/Makefile | 2 +-
drivers/net/gtp.c | 1462 ----------------------------
drivers/net/gtp/Kconfig | 45 +
drivers/net/gtp/Makefile | 8 +
drivers/net/gtp/dev_core.c | 103 ++
drivers/net/gtp/encap.c | 406 ++++++++
drivers/net/gtp/far.c | 596 ++++++++++++
drivers/net/gtp/gtp_core.c | 243 +++++
drivers/net/gtp/include/dev_core.h | 59 ++
drivers/net/gtp/include/encap.h | 27 +
drivers/net/gtp/include/far.h | 64 ++
drivers/net/gtp/include/gtp_core.h | 105 ++
drivers/net/gtp/include/nl_core.h | 18 +
drivers/net/gtp/include/pdp.h | 53 +
drivers/net/gtp/include/pdp_ipv4.h | 31 +
drivers/net/gtp/include/pdr.h | 96 ++
drivers/net/gtp/include/pdr_ipv4.h | 49 +
drivers/net/gtp/include/proc_dbg.h | 85 ++
drivers/net/gtp/include/qer.h | 49 +
drivers/net/gtp/nl_core.c | 444 +++++++++
drivers/net/gtp/pdp.c | 578 +++++++++++
drivers/net/gtp/pdp_ipv4.c | 166 ++++
drivers/net/gtp/pdr.c | 1272 ++++++++++++++++++++++++
drivers/net/gtp/pdr_ipv4.c | 330 +++++++
drivers/net/gtp/proc_dbg.c | 384 ++++++++
drivers/net/gtp/qer.c | 463 +++++++++
include/net/gtp.h | 105 +-
include/uapi/linux/gtp.h | 200 +++-
include/uapi/linux/if_link.h | 5 +
30 files changed, 5981 insertions(+), 1484 deletions(-)
delete mode 100644 drivers/net/gtp.c
create mode 100644 drivers/net/gtp/Kconfig
create mode 100644 drivers/net/gtp/Makefile
create mode 100644 drivers/net/gtp/dev_core.c
create mode 100644 drivers/net/gtp/encap.c
create mode 100644 drivers/net/gtp/far.c
create mode 100644 drivers/net/gtp/gtp_core.c
create mode 100644 drivers/net/gtp/include/dev_core.h
create mode 100644 drivers/net/gtp/include/encap.h
create mode 100644 drivers/net/gtp/include/far.h
create mode 100644 drivers/net/gtp/include/gtp_core.h
create mode 100644 drivers/net/gtp/include/nl_core.h
create mode 100644 drivers/net/gtp/include/pdp.h
create mode 100644 drivers/net/gtp/include/pdp_ipv4.h
create mode 100644 drivers/net/gtp/include/pdr.h
create mode 100644 drivers/net/gtp/include/pdr_ipv4.h
create mode 100644 drivers/net/gtp/include/proc_dbg.h
create mode 100644 drivers/net/gtp/include/qer.h
create mode 100644 drivers/net/gtp/nl_core.c
create mode 100644 drivers/net/gtp/pdp.c
create mode 100644 drivers/net/gtp/pdp_ipv4.c
create mode 100644 drivers/net/gtp/pdr.c
create mode 100644 drivers/net/gtp/pdr_ipv4.c
create mode 100644 drivers/net/gtp/proc_dbg.c
create mode 100644 drivers/net/gtp/qer.c
--
2.31.1