netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] doc/netlink: Fix typos in operation attributes
@ 2025-09-13 14:05 Remy D. Farley
  2025-09-16  1:26 ` Jakub Kicinski
  2025-09-16 23:40 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Remy D. Farley @ 2025-09-13 14:05 UTC (permalink / raw)
  To: Donald Hunter, Jakub Kicinski, netdev; +Cc: Remy D. Farley

I'm trying to generate Rust bindings for netlink using the yaml spec.

It looks like there's a typo in conntrack spec: attribute set conntrack-attrs
defines attributes "counters-{orig,reply}" (plural), while get operation
references "counter-{orig,reply}" (singular). The latter should be fixed, as it
denotes multiple counters (packet and byte). The corresonding C define is
CTA_COUNTERS_ORIG.

Also, dump request references "nfgen-family" attribute, which neither exists in
conntrack-attrs attrset nor ctattr_type enum. There's member of nfgenmsg struct
with the same name, which is where family value is actually taken from.

> static int ctnetlink_dump_exp_ct(struct net *net, struct sock *ctnl,
>                struct sk_buff *skb,
>                const struct nlmsghdr *nlh,
>                const struct nlattr * const cda[],
>                struct netlink_ext_ack *extack)
> {
>   int err;
>   struct nfgenmsg *nfmsg = nlmsg_data(nlh);
>   u_int8_t u3 = nfmsg->nfgen_family;
                         ^^^^^^^^^^^^

Signed-off-by: Remy D. Farley <one-d-wide@protonmail.com>
---
 Documentation/netlink/specs/conntrack.yaml | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/Documentation/netlink/specs/conntrack.yaml b/Documentation/netlink/specs/conntrack.yaml
index c6832633a..591e22a2e 100644
--- a/Documentation/netlink/specs/conntrack.yaml
+++ b/Documentation/netlink/specs/conntrack.yaml
@@ -575,8 +575,8 @@ operations:
             - nat-dst
             - timeout
             - mark
-            - counter-orig
-            - counter-reply
+            - counters-orig
+            - counters-reply
             - use
             - id
             - nat-dst
@@ -591,7 +591,6 @@ operations:
         request:
           value: 0x101
           attributes:
-            - nfgen-family
             - mark
             - filter
             - status
@@ -608,8 +607,8 @@ operations:
             - nat-dst
             - timeout
             - mark
-            - counter-orig
-            - counter-reply
+            - counters-orig
+            - counters-reply
             - use
             - id
             - nat-dst
-- 
2.49.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] doc/netlink: Fix typos in operation attributes
  2025-09-13 14:05 [PATCH] doc/netlink: Fix typos in operation attributes Remy D. Farley
@ 2025-09-16  1:26 ` Jakub Kicinski
  2025-09-16 23:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2025-09-16  1:26 UTC (permalink / raw)
  To: Remy D. Farley; +Cc: Donald Hunter, netdev, fw

On Sat, 13 Sep 2025 14:05:28 +0000 Remy D. Farley wrote:
> I'm trying to generate Rust bindings for netlink using the yaml spec.
> 
> It looks like there's a typo in conntrack spec: attribute set conntrack-attrs
> defines attributes "counters-{orig,reply}" (plural), while get operation
> references "counter-{orig,reply}" (singular). The latter should be fixed, as it
> denotes multiple counters (packet and byte). The corresonding C define is
> CTA_COUNTERS_ORIG.
> 
> Also, dump request references "nfgen-family" attribute, which neither exists in
> conntrack-attrs attrset nor ctattr_type enum. There's member of nfgenmsg struct
> with the same name, which is where family value is actually taken from.
> 
> > static int ctnetlink_dump_exp_ct(struct net *net, struct sock *ctnl,
> >                struct sk_buff *skb,
> >                const struct nlmsghdr *nlh,
> >                const struct nlattr * const cda[],
> >                struct netlink_ext_ack *extack)
> > {
> >   int err;
> >   struct nfgenmsg *nfmsg = nlmsg_data(nlh);
> >   u_int8_t u3 = nfmsg->nfgen_family;  
>                          ^^^^^^^^^^^^

cc: fw@strlen.de
Fixes: 23fc9311a526 ("netlink: specs: add conntrack dump and stats dump support")
Reviewed-by: Jakub Kicinski <kuba@kernel.org>

>  Documentation/netlink/specs/conntrack.yaml | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/Documentation/netlink/specs/conntrack.yaml b/Documentation/netlink/specs/conntrack.yaml
> index c6832633a..591e22a2e 100644
> --- a/Documentation/netlink/specs/conntrack.yaml
> +++ b/Documentation/netlink/specs/conntrack.yaml
> @@ -575,8 +575,8 @@ operations:
>              - nat-dst
>              - timeout
>              - mark
> -            - counter-orig
> -            - counter-reply
> +            - counters-orig
> +            - counters-reply
>              - use
>              - id
>              - nat-dst
> @@ -591,7 +591,6 @@ operations:
>          request:
>            value: 0x101
>            attributes:
> -            - nfgen-family
>              - mark
>              - filter
>              - status
> @@ -608,8 +607,8 @@ operations:
>              - nat-dst
>              - timeout
>              - mark
> -            - counter-orig
> -            - counter-reply
> +            - counters-orig
> +            - counters-reply
>              - use
>              - id
>              - nat-dst


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] doc/netlink: Fix typos in operation attributes
  2025-09-13 14:05 [PATCH] doc/netlink: Fix typos in operation attributes Remy D. Farley
  2025-09-16  1:26 ` Jakub Kicinski
@ 2025-09-16 23:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-09-16 23:40 UTC (permalink / raw)
  To: Remy D. Farley; +Cc: donald.hunter, kuba, netdev

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Sat, 13 Sep 2025 14:05:28 +0000 you wrote:
> I'm trying to generate Rust bindings for netlink using the yaml spec.
> 
> It looks like there's a typo in conntrack spec: attribute set conntrack-attrs
> defines attributes "counters-{orig,reply}" (plural), while get operation
> references "counter-{orig,reply}" (singular). The latter should be fixed, as it
> denotes multiple counters (packet and byte). The corresonding C define is
> CTA_COUNTERS_ORIG.
> 
> [...]

Here is the summary with links:
  - doc/netlink: Fix typos in operation attributes
    https://git.kernel.org/netdev/net/c/109f8b51543d

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-09-16 23:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-13 14:05 [PATCH] doc/netlink: Fix typos in operation attributes Remy D. Farley
2025-09-16  1:26 ` Jakub Kicinski
2025-09-16 23:40 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).