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 2/5] ebtables: Eliminate OPT_TABLE
Date: Wed, 28 Sep 2022 00:15:09 +0200	[thread overview]
Message-ID: <20220927221512.7400-3-phil@nwl.cc> (raw)
In-Reply-To: <20220927221512.7400-1-phil@nwl.cc>

The flag is used for duplicate option checking only and there is a
boolean indicating the same already. So copy the error message from
EBT_CHECK_OPTION() in situ and just take care not to disturb restore
mode handling.

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

diff --git a/iptables/xtables-eb.c b/iptables/xtables-eb.c
index 3887ea1a39f27..9aab35977396f 100644
--- a/iptables/xtables-eb.c
+++ b/iptables/xtables-eb.c
@@ -158,7 +158,6 @@ int ebt_get_current_chain(const char *chain)
 #define OPT_COMMANDS (flags & OPT_COMMAND || flags & OPT_ZERO)
 
 #define OPT_COMMAND	0x01
-#define OPT_TABLE	0x02
 #define OPT_IN		0x04
 #define OPT_OUT		0x08
 #define OPT_JUMP	0x10
@@ -894,11 +893,13 @@ print_zero:
 			}
 			break;
 		case 't': /* Table */
-			ebt_check_option2(&flags, OPT_TABLE);
 			if (restore && table_set)
 				xtables_error(PARAMETER_PROBLEM,
 					      "The -t option cannot be used in %s.\n",
 					      xt_params->program_name);
+			else if (table_set)
+				xtables_error(PARAMETER_PROBLEM,
+					      "Multiple use of same option not allowed");
 			if (!nft_table_builtin_find(h, optarg))
 				xtables_error(VERSION_PROBLEM,
 					      "table '%s' does not exist",
-- 
2.34.1


  parent reply	other threads:[~2022-09-27 22:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-27 22:15 [iptables PATCH 0/5] Fixes around ebtables' --proto match Phil Sutter
2022-09-27 22:15 ` [iptables PATCH 1/5] ebtables: Drop unused OPT_* defines Phil Sutter
2022-09-27 22:15 ` Phil Sutter [this message]
2022-09-27 22:15 ` [iptables PATCH 3/5] ebtables: Merge OPT_* flags with xshared ones Phil Sutter
2022-09-27 22:15 ` [iptables PATCH 4/5] nft-shared: Introduce __get_cmp_data() Phil Sutter
2022-09-27 22:15 ` [iptables PATCH 5/5] ebtables: Support '-p Length' Phil Sutter
2022-09-28 17:20   ` Phil Sutter
2022-09-28 11:42 ` [iptables PATCH 0/5] Fixes around ebtables' --proto match Florian Westphal

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=20220927221512.7400-3-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).