Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: anilkaushikwireless@gmail.com
Cc: pablo@netfilter.org, laforge@gnumonks.org,
	donald.hunter@gmail.com, kuba@kernel.org, davem@davemloft.net,
	edumazet@google.com, pabeni@redhat.com, horms@kernel.org,
	andrew+netdev@lunn.ch, shuah@kernel.org,
	osmocom-net-gprs@lists.osmocom.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org
Subject: Re: [PATCH net-next v5 2/3] netlink: specs: add genetlink-legacy spec for GTP
Date: Tue, 13 Oct 2026 02:48:56 +0000	[thread overview]
Message-ID: <179185973624.434549.6410423241897043806@kernel.org> (raw)
In-Reply-To: <20261012024800.400616-3-anilkaushikwireless@gmail.com>

Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] include/uapi/linux/gtp.h defines `enum gtp_version { GTP_V0 = 0,
  GTP_V1, }` for GTPA_VERSION values, and drivers/net/gtp.c compares…
- [Low] The `family` attribute doc in
  Documentation/netlink/specs/gtp.yaml (line 96) reads "Address family…

--

netlink: specs: add genetlink-legacy spec for GTP

This commit adds a genetlink-legacy YAML spec for the existing GTP
generic netlink family. The spec covers the NEWPDP, DELPDP, GETPDP and
ECHOREQ commands, the GTPA_* attribute set and the "gtp" multicast group.
It also adds a CFLAGS_gtp entry to tools/net/ynl/Makefile.deps.

> diff --git a/Documentation/netlink/specs/gtp.yaml b/Documentation/netlink/specs/gtp.yaml
> new file mode 100644
> index 0000000000000..6a6b49ad2f067
> --- /dev/null
> +++ b/Documentation/netlink/specs/gtp.yaml

[ ... ]

> +attribute-sets:
> +  -
> +    name: gtp
> +    name-prefix: gtpa-
> +    attributes:
> +      -
> +        name: link
> +        type: u32
> +        doc: ifindex of the gtp netdevice the context is attached to.
> +      -
> +        name: version
> +        type: u32
> +        doc: GTP version of the context, 0 for GTPv0 or 1 for GTPv1-U.

[Severity: Low]
Should this attribute reference an enum? include/uapi/linux/gtp.h already
defines the values for GTPA_VERSION:

include/uapi/linux/gtp.h:
enum gtp_version {
	GTP_V0 = 0,
	GTP_V1,
};

drivers/net/gtp.c compares against these values, for example in
gtp_pdp_add() and gtp_genl_fill_info():

	switch (pctx->gtp_version) {
	case GTP_V0:
	...
	case GTP_V1:

The spec has no definitions section, so the valid values only appear in
the doc string. That means ynl clients see version as a raw integer and
cannot encode or decode it by name.

Other legacy specs reference their uapi enums like this, for example
fou.yaml uses "enum: encap-type". Would a definitions entry for
gtp-version plus an enum reference on this attribute work here?

[ ... ]

> +      -
> +        name: family
> +        type: u8
> +        doc: Address family (AF_INET or AF_INET6) of the context addresses.

[Severity: Low]
Is this description accurate? In drivers/net/gtp.c, GTPA_FAMILY only
selects the family of the mobile subscriber address, and it defaults to
AF_INET when the attribute is absent.

In gtp_pdp_add(), family only picks between GTPA_MS_ADDRESS and
GTPA_MS_ADDR6. The peer address is checked against the socket family
instead:

drivers/net/gtp.c:gtp_pdp_add() {
    ...
	family = nla_get_u8_default(info->attrs[GTPA_FAMILY], AF_INET);
    ...
	if ((info->attrs[GTPA_PEER_ADDRESS] &&
	     sk->sk_family == AF_INET6) ||
	    (info->attrs[GTPA_PEER_ADDR6] &&
	     sk->sk_family == AF_INET))
		return ERR_PTR(-EAFNOSUPPORT);

	switch (family) {
	case AF_INET:
		if (!info->attrs[GTPA_MS_ADDRESS] ||
    ...
}

The reply side uses the same split. gtp_genl_fill_info() picks the MS
attribute by pctx->af and the peer attribute by pctx->sk->sk_family:

drivers/net/gtp.c:gtp_genl_fill_info() {
    ...
	    nla_put_u8(skb, GTPA_FAMILY, pctx->af))
    ...
	switch (pctx->af) {
	case AF_INET:
		if (nla_put_be32(skb, GTPA_MS_ADDRESS, pctx->ms.addr.s_addr))
    ...
	switch (pctx->sk->sk_family) {
	case AF_INET:
		if (nla_put_be32(skb, GTPA_PEER_ADDRESS, pctx->peer.addr.s_addr))
    ...
}

As a result, a valid context with an IPv4 subscriber over IPv6 transport
reports family=AF_INET together with peer-addr6. "of the context
addresses" does not describe that case.

Could the doc say that family applies to the ms-address / ms-addr6
attribute only, and that it defaults to AF_INET when absent?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261012024800.400616-1-anilkaushikwireless%40gmail.com

  reply	other threads:[~2026-10-13  2:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-12  2:47 [PATCH net-next v5 0/3] gtp: ynl spec for the GTP netlink family, a reply-command fix, and a selftest Anil Kaushik
2026-10-12  2:47 ` [PATCH net-next v5 1/3] gtp: set a valid genl command in PDP context get and dump replies Anil Kaushik
2026-10-12  2:47 ` [PATCH net-next v5 2/3] netlink: specs: add genetlink-legacy spec for GTP Anil Kaushik
2026-10-13  2:48   ` netdev-bot+sashiko [this message]
2026-10-12  2:48 ` [PATCH net-next v5 3/3] selftests: net: add a test for the gtp netlink family Anil Kaushik
2026-10-13  2:48   ` 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=179185973624.434549.6410423241897043806@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=anilkaushikwireless@gmail.com \
    --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