]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
ebtables: Eliminate OPT_TABLE
authorPhil Sutter <phil@nwl.cc>
Tue, 27 Sep 2022 17:03:47 +0000 (19:03 +0200)
committerPhil Sutter <phil@nwl.cc>
Wed, 28 Sep 2022 12:21:13 +0000 (14:21 +0200)
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

index 3887ea1a39f279cd3d7c443fa12ddcc2218b1cc6..9aab35977396f09026d6ff75c18cb15e5ca765ec 100644 (file)
@@ -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",