netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phil Sutter <phil@nwl.cc>
To: netfilter-devel@vger.kernel.org
Subject: [iptables PATCH 08/12] ebtables: Drop append_entry() wrapper
Date: Wed, 22 Nov 2023 14:02:18 +0100	[thread overview]
Message-ID: <20231122130222.29453-9-phil@nwl.cc> (raw)
In-Reply-To: <20231122130222.29453-1-phil@nwl.cc>

There is no point in having it when there is no code to share.

Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 iptables/xtables-eb.c | 26 ++++----------------------
 1 file changed, 4 insertions(+), 22 deletions(-)

diff --git a/iptables/xtables-eb.c b/iptables/xtables-eb.c
index a8ad57c735cc5..3fa5c179ba4b1 100644
--- a/iptables/xtables-eb.c
+++ b/iptables/xtables-eb.c
@@ -112,24 +112,6 @@ static int parse_rule_number(const char *rule)
 	return rule_nr;
 }
 
-static int
-append_entry(struct nft_handle *h,
-	     const char *chain,
-	     const char *table,
-	     struct iptables_command_state *cs,
-	     int rule_nr,
-	     bool verbose, bool append)
-{
-	int ret = 1;
-
-	if (append)
-		ret = nft_cmd_rule_append(h, chain, table, cs, verbose);
-	else
-		ret = nft_cmd_rule_insert(h, chain, table, cs, rule_nr, verbose);
-
-	return ret;
-}
-
 static int
 delete_entry(struct nft_handle *h,
 	     const char *chain,
@@ -1178,11 +1160,11 @@ int do_commandeb(struct nft_handle *h, int argc, char *argv[], char **table,
 	} else if (command == 'F') {
 		ret = nft_cmd_rule_flush(h, chain, *table, flags & OPT_VERBOSE);
 	} else if (command == 'A') {
-		ret = append_entry(h, chain, *table, &cs, 0,
-				   flags & OPT_VERBOSE, true);
+		ret = nft_cmd_rule_append(h, chain, *table, &cs,
+					  flags & OPT_VERBOSE);
 	} else if (command == 'I') {
-		ret = append_entry(h, chain, *table, &cs, rule_nr - 1,
-				   flags & OPT_VERBOSE, false);
+		ret = nft_cmd_rule_insert(h, chain, *table, &cs,
+					  rule_nr - 1, flags & OPT_VERBOSE);
 	} else if (command == 'D') {
 		ret = delete_entry(h, chain, *table, &cs, rule_nr - 1,
 				   rule_nr_end, flags & OPT_VERBOSE);
-- 
2.41.0


  parent reply	other threads:[~2023-11-22 12:54 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-22 13:02 [iptables PATCH 00/12] Misc fixes (more or less) Phil Sutter
2023-11-22 13:02 ` [iptables PATCH 01/12] Makefile: Install arptables-translate link and man page Phil Sutter
2023-11-22 13:02 ` [iptables PATCH 02/12] nft-bridge: nft_bridge_add() uses wrong flags Phil Sutter
2023-11-22 13:02 ` [iptables PATCH 03/12] xshared: struct xt_cmd_parse::xlate is unused Phil Sutter
2023-11-22 13:02 ` [iptables PATCH 04/12] xshared: All variants support -v Phil Sutter
2023-11-22 13:02 ` [iptables PATCH 05/12] xshared: Drop needless assignment in --help case Phil Sutter
2023-11-22 13:02 ` [iptables PATCH 06/12] xshared: Drop pointless CMD_REPLACE check Phil Sutter
2023-11-22 13:02 ` [iptables PATCH 07/12] tests: xlate: Print failing command line Phil Sutter
2023-11-22 13:02 ` Phil Sutter [this message]
2023-11-22 13:02 ` [iptables PATCH 09/12] ebtables: Make ebt_load_match_extensions() static Phil Sutter
2023-11-22 13:02 ` [iptables PATCH 10/12] ebtables: Align line number formatting with legacy Phil Sutter
2023-11-22 13:02 ` [iptables PATCH 11/12] xshared: do_parse: Ignore '-j CONTINUE' Phil Sutter
2023-11-22 13:02 ` [iptables PATCH 12/12] ebtables: Implement --change-counters command Phil Sutter
2023-11-23 16:55 ` [iptables PATCH 00/12] Misc fixes (more or less) 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=20231122130222.29453-9-phil@nwl.cc \
    --to=phil@nwl.cc \
    --cc=netfilter-devel@vger.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;
as well as URLs for NNTP newsgroup(s).