Skip to contentSkip to conversation

mnl: do not set flowtable flags twice

PATCH New Pablo Neira Ayuso 1 participant 2 messages Mar 31, 2021 netfilter

lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/2 mnl: do not set flowtable flags twice

Flags are already set on from mnl_nft_flowtable_add(), remove duplicated code.

Fixes e6cc9f37385 ("nftables: add flags offload to flowtable")
---
 src/mnl.c | 5 -----
 1 file changed, 5 deletions(-)
src/mnl.c +0 -5
index ffbfe48158de..deea586f9b00 100644
@@ -1779,11 +1779,6 @@ int mnl_nft_flowtable_add(struct netlink_ctx *ctx, struct cmd *cmd,
 		nftnl_flowtable_set_u32(flo, NFTNL_FLOWTABLE_PRIO, 0);
 	}
 
-	if (cmd->flowtable->flags & FLOWTABLE_F_HW_OFFLOAD) {
-		nftnl_flowtable_set_u32(flo, NFTNL_FLOWTABLE_FLAGS,
-				    NFT_FLOWTABLE_HW_OFFLOAD);
-	}
-
 	if (cmd->flowtable->dev_expr) {
 		dev_array = nft_flowtable_dev_array(cmd);
 		nftnl_flowtable_set_data(flo, NFTNL_FLOWTABLE_DEVICES,
Signature · 1 line
2.20.1
author maintainer
#1 lore raw

PATCH 2/2 parser_bison: simplify flowtable offload flag parser

Remove ft_flags_spec rule.

---
 src/parser_bison.y | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
src/parser_bison.y +4 -7
index abe117814db0..cc477e65672a 100644
@@ -1996,7 +1996,6 @@ flowtable_block_alloc	:	/* empty */
 flowtable_block		:	/* empty */	{ $$ = $<flowtable>-1; }
 			|	flowtable_block	common_block
 			|	flowtable_block	stmt_separator
-			|	flowtable_block	ft_flags_spec	stmt_separator
 			|	flowtable_block	HOOK		STRING	prio_spec	stmt_separator
 			{
 				$$->hook.loc = @3;
@@ -2019,6 +2018,10 @@ flowtable_block		:	/* empty */	{ $$ = $<flowtable>-1; }
 			{
 				$$->flags |= NFT_FLOWTABLE_COUNTER;
 			}
+			|	flowtable_block	FLAGS	OFFLOAD	stmt_separator
+			{
+				$$->flags |= FLOWTABLE_F_HW_OFFLOAD;
+			}
 			;
 
 flowtable_expr		:	'{'	flowtable_list_expr	'}'
@@ -2379,12 +2382,6 @@ flags_spec		:	FLAGS		OFFLOAD
 			}
 			;
 
-ft_flags_spec		:	FLAGS		OFFLOAD
-			{
-				$<flowtable>0->flags |= FLOWTABLE_F_HW_OFFLOAD;
-			}
-			;
-
 policy_spec		:	POLICY		policy_expr
 			{
 				if ($<chain>0->policy) {
Signature · 1 line
2.20.1