Linux Netfilter development
 help / color / mirror / Atom feed
* [PATCH libnftnl] expr: use NFTA_* netlink attributes to build fields, not NFTNL_EXPR_*
@ 2024-07-05 15:21 Pablo Neira Ayuso
  0 siblings, 0 replies; only message in thread
From: Pablo Neira Ayuso @ 2024-07-05 15:21 UTC (permalink / raw)
  To: netfilter-devel

Coincidentally NFTNL_EXPR_BASE starts at 1 which comes right after
NFTA_*_UNSPEC which is zero. And NFTNL_EXPR_ attribute values were
mapping to NFTA_* attributes.

Use NFTA_* for netlink attribute types instead.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 src/expr/osf.c      | 6 +++---
 src/expr/synproxy.c | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/expr/osf.c b/src/expr/osf.c
index 060394b30329..293a81420a32 100644
--- a/src/expr/osf.c
+++ b/src/expr/osf.c
@@ -89,12 +89,12 @@ nftnl_expr_osf_build(struct nlmsghdr *nlh, const struct nftnl_expr *e)
 	struct nftnl_expr_osf *osf = nftnl_expr_data(e);
 
 	if (e->flags & (1 << NFTNL_EXPR_OSF_DREG))
-		mnl_attr_put_u32(nlh, NFTNL_EXPR_OSF_DREG, htonl(osf->dreg));
+		mnl_attr_put_u32(nlh, NFTA_OSF_DREG, htonl(osf->dreg));
 	if (e->flags & (1 << NFTNL_EXPR_OSF_TTL))
-		mnl_attr_put_u8(nlh, NFTNL_EXPR_OSF_TTL, osf->ttl);
+		mnl_attr_put_u8(nlh, NFTA_OSF_TTL, osf->ttl);
 	if (e->flags & (1 << NFTNL_EXPR_OSF_FLAGS))
 		if (osf->flags)
-			mnl_attr_put_u32(nlh, NFTNL_EXPR_OSF_FLAGS, htonl(osf->flags));
+			mnl_attr_put_u32(nlh, NFTA_OSF_FLAGS, htonl(osf->flags));
 }
 
 static int
diff --git a/src/expr/synproxy.c b/src/expr/synproxy.c
index 97c321b994fe..b5a1fef9f406 100644
--- a/src/expr/synproxy.c
+++ b/src/expr/synproxy.c
@@ -90,13 +90,13 @@ nftnl_expr_synproxy_build(struct nlmsghdr *nlh, const struct nftnl_expr *e)
 	struct nftnl_expr_synproxy *synproxy = nftnl_expr_data(e);
 
 	if (e->flags & (1 << NFTNL_EXPR_SYNPROXY_MSS))
-		mnl_attr_put_u16(nlh, NFTNL_EXPR_SYNPROXY_MSS,
+		mnl_attr_put_u16(nlh, NFTA_SYNPROXY_MSS,
 				 htons(synproxy->mss));
 	if (e->flags & (1 << NFTNL_EXPR_SYNPROXY_WSCALE))
-		mnl_attr_put_u8(nlh, NFTNL_EXPR_SYNPROXY_WSCALE,
+		mnl_attr_put_u8(nlh, NFTA_SYNPROXY_WSCALE,
 				synproxy->wscale);
 	if (e->flags & (1 << NFTNL_EXPR_SYNPROXY_FLAGS))
-		mnl_attr_put_u32(nlh, NFTNL_EXPR_SYNPROXY_FLAGS,
+		mnl_attr_put_u32(nlh, NFTA_SYNPROXY_FLAGS,
 				 htonl(synproxy->flags));
 }
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2024-07-05 15:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-05 15:21 [PATCH libnftnl] expr: use NFTA_* netlink attributes to build fields, not NFTNL_EXPR_* Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox