From: Anil Kaushik <anilkaushikwireless@gmail.com>
To: Pablo Neira Ayuso <pablo@netfilter.org>,
Harald Welte <laforge@gnumonks.org>,
Donald Hunter <donald.hunter@gmail.com>,
Jakub Kicinski <kuba@kernel.org>
Cc: "David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
Andrew Lunn <andrew+netdev@lunn.ch>,
Shuah Khan <shuah@kernel.org>,
osmocom-net-gprs@lists.osmocom.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
Anil Kaushik <anilkaushikwireless@gmail.com>
Subject: [PATCH net-next v4 0/3] gtp: ynl spec for the GTP netlink family, a reply-command fix, and a selftest
Date: Sat, 10 Oct 2026 10:57:37 +0000 [thread overview]
Message-ID: <20261010105740.223992-1-anilkaushikwireless@gmail.com> (raw)
This adds a ynl spec for the gtp generic netlink family, a driver fix the
spec exposed, and a selftest that uses it.
While writing a ynl-based selftest for the existing gtp family I found
that the GET and dump replies put the genl family id in the command
field instead of a GTP_CMD_* value. libgtpnl ignores the command so it
never mattered, but ynl rejects the reply as an unknown command and
drops it. Patch 1 fixes the driver; patches 2 and 3 then describe and
test the family.
Patch 1 sets a valid command (GTP_CMD_GETPDP) in the get and dump
replies.
Patch 2 adds a genetlink-legacy ynl spec for the gtp family
(NEWPDP/DELPDP/GETPDP/ECHOREQ). Description only, no uapi change.
Patch 3 adds a selftest built on the spec: it creates a gtp device, adds
PDP contexts with newpdp, checks getpdp dumps them and delpdp removes
them, by TEI and by MS address, and that deleting an unknown context
fails with ENOENT. It skips when the kernel or iproute2 lack GTP
support.
Changes since v3 (thanks to the Sashiko review):
- spec: echoreq request now matches gtp_genl_send_echo_req(): add
ms-address (required by the handler) and net-ns-fd (read by
gtp_find_dev()), drop peer-addr6 and family (never read).
- spec: delpdp request now lists the attributes the lookup in
gtp_find_pdp() reads, the same as the getpdp request, instead of
all the newpdp ones.
- spec: add link to the getpdp reply, gtp_genl_fill_info() always
emits it.
- spec: commit message reworded, the per-command attributes now
follow the handlers.
- selftest: create the gtp device, which loads gtp.ko, before the
family handle: ynl resolves family ids once per process with a dump,
which does not autoload modules, so with CONFIG_GTP=m the test
aborted with a traceback. Without GTP support it now skips.
- selftest: only consider contexts on the test's own gtp device.
- selftest: delete by TEI only, so the GTPv1 TEI lookup is used, and
delete by MS address in the two-contexts case.
- selftest: check that deleting an unknown context fails with ENOENT,
both by TEI and by MS address.
- Patch 1 is unchanged from v3.
v3: https://lore.kernel.org/netdev/20261009060615.4177402-1-anilkaushikwireless@gmail.com/
v2: https://lore.kernel.org/netdev/20261008181031.4129029-1-anilkaushikwireless@gmail.com/
Anil Kaushik (3):
gtp: set a valid genl command in PDP context get and dump replies
netlink: specs: add genetlink-legacy spec for GTP
selftests: net: add a test for the gtp netlink family
Documentation/netlink/specs/gtp.yaml | 171 ++++++++++++++++++
MAINTAINERS | 2 +
drivers/net/gtp.c | 4 +-
tools/testing/selftests/net/Makefile | 1 +
tools/testing/selftests/net/config | 1 +
tools/testing/selftests/net/gtp.py | 115 ++++++++++++
.../testing/selftests/net/lib/py/__init__.py | 5 +-
tools/testing/selftests/net/lib/py/ynl.py | 8 +-
8 files changed, 302 insertions(+), 5 deletions(-)
create mode 100644 Documentation/netlink/specs/gtp.yaml
create mode 100755 tools/testing/selftests/net/gtp.py
--
2.25.1
next reply other threads:[~2026-10-10 10:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-10 10:57 Anil Kaushik [this message]
2026-10-10 10:57 ` [PATCH net-next v4 1/3] gtp: set a valid genl command in PDP context get and dump replies Anil Kaushik
2026-10-10 10:57 ` [PATCH net-next v4 2/3] netlink: specs: add genetlink-legacy spec for GTP Anil Kaushik
2026-10-11 11:20 ` netdev-bot+sashiko
2026-10-10 10:57 ` [PATCH net-next v4 3/3] selftests: net: add a test for the gtp netlink family Anil Kaushik
2026-10-11 11:20 ` netdev-bot+sashiko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261010105740.223992-1-anilkaushikwireless@gmail.com \
--to=anilkaushikwireless@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=donald.hunter@gmail.com \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=laforge@gnumonks.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=osmocom-net-gprs@lists.osmocom.org \
--cc=pabeni@redhat.com \
--cc=pablo@netfilter.org \
--cc=shuah@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®