netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phil Sutter <phil@nwl.cc>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org, Florian Westphal <fw@strlen.de>
Subject: [nft PATCH 6/7] parser: json: Support for synproxy objects
Date: Sat,  9 Mar 2024 12:35:26 +0100	[thread overview]
Message-ID: <20240309113527.8723-7-phil@nwl.cc> (raw)
In-Reply-To: <20240309113527.8723-1-phil@nwl.cc>

Parsing code was there already, merely the entry in json_parse_cmd_add()
missing.

To support maps with synproxy target, an entry in string_to_nft_object()
is required. While being at it, add other missing entries as well.

Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 src/parser_json.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/src/parser_json.c b/src/parser_json.c
index bb027448319c5..4fc0479cf4972 100644
--- a/src/parser_json.c
+++ b/src/parser_json.c
@@ -3217,14 +3217,18 @@ static struct cmd *json_parse_cmd_add_rule(struct json_ctx *ctx, json_t *root,
 static int string_to_nft_object(const char *str)
 {
 	const char *obj_tbl[__NFT_OBJECT_MAX] = {
-		[NFT_OBJECT_COUNTER] = "counter",
-		[NFT_OBJECT_QUOTA] = "quota",
-		[NFT_OBJECT_LIMIT] = "limit",
-		[NFT_OBJECT_SECMARK] = "secmark",
+		[NFT_OBJECT_COUNTER]	= "counter",
+		[NFT_OBJECT_QUOTA]	= "quota",
+		[NFT_OBJECT_CT_HELPER]	= "ct helper",
+		[NFT_OBJECT_LIMIT]	= "limit",
+		[NFT_OBJECT_CT_TIMEOUT]	= "ct timeout",
+		[NFT_OBJECT_SECMARK]	= "secmark",
+		[NFT_OBJECT_CT_EXPECT]	= "ct expectation",
+		[NFT_OBJECT_SYNPROXY]	= "synproxy",
 	};
 	unsigned int i;
 
-	for (i = 0; i < NFT_OBJECT_MAX; i++) {
+	for (i = 0; i <= NFT_OBJECT_MAX; i++) {
 		if (obj_tbl[i] && !strcmp(str, obj_tbl[i]))
 			return i;
 	}
@@ -3759,7 +3763,8 @@ static struct cmd *json_parse_cmd_add(struct json_ctx *ctx,
 		{ "ct timeout", NFT_OBJECT_CT_TIMEOUT, json_parse_cmd_add_object },
 		{ "ct expectation", NFT_OBJECT_CT_EXPECT, json_parse_cmd_add_object },
 		{ "limit", CMD_OBJ_LIMIT, json_parse_cmd_add_object },
-		{ "secmark", CMD_OBJ_SECMARK, json_parse_cmd_add_object }
+		{ "secmark", CMD_OBJ_SECMARK, json_parse_cmd_add_object },
+		{ "synproxy", CMD_OBJ_SYNPROXY, json_parse_cmd_add_object }
 	};
 	unsigned int i;
 	json_t *tmp;
-- 
2.43.0


  parent reply	other threads:[~2024-03-09 11:35 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-09 11:35 [nft PATCH 0/7] A bunch of JSON printer/parser fixes Phil Sutter
2024-03-09 11:35 ` [nft PATCH 1/7] tests: shell: maps/named_ct_objects: Fix for recent kernel Phil Sutter
2024-03-09 11:39   ` Florian Westphal
2024-03-09 11:44     ` Phil Sutter
2024-03-09 11:35 ` [nft PATCH 2/7] tests: shell: packetpath/flowtables: Avoid spurious EPERM Phil Sutter
2024-03-09 11:35 ` [nft PATCH 3/7] json: Order output like nft_cmd_expand() Phil Sutter
2024-03-09 11:35 ` [nft PATCH 4/7] tests: shell: Regenerate all json-nft dumps Phil Sutter
2024-03-09 11:35 ` [nft PATCH 5/7] json: Support maps with concatenated data Phil Sutter
2024-03-09 11:35 ` Phil Sutter [this message]
2024-03-09 11:35 ` [nft PATCH 7/7] tests: shell: Add missing json-nft dumps Phil Sutter
2024-03-19 17:26 ` [nft PATCH 0/7] A bunch of JSON printer/parser fixes Phil Sutter
2024-04-24 20:06 ` Pablo Neira Ayuso
2024-04-24 20:08   ` Pablo Neira Ayuso
2024-04-24 20:41     ` Phil Sutter

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=20240309113527.8723-7-phil@nwl.cc \
    --to=phil@nwl.cc \
    --cc=fw@strlen.de \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.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;
as well as URLs for NNTP newsgroup(s).