]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
extensions: libebt_mark: Drop mark_supplied check
authorPhil Sutter <phil@nwl.cc>
Thu, 23 Aug 2018 15:43:25 +0000 (17:43 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 24 Aug 2018 08:05:51 +0000 (10:05 +0200)
Use of this static variable causes trouble as it affects all instances
of this target. So calling xs_init_target() for one instance invalidates
all the others.

Moving the variable into target private data seems not possible since
that would change the target's size and therefore it wouldn't match
anymore with what kernel expects.

So just get rid of it entirely. If a user "forgets" to set a mark value,
the default value of zero applies.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
extensions/libebt_mark.c

index 94f489e37e0191ae1690c39274679a09fa54a05f..423c5c9133d0dceaf628a2d61ceb4060142b0764 100644 (file)
@@ -18,8 +18,6 @@
 #include "iptables/nft.h"
 #include "iptables/nft-bridge.h"
 
-static int mark_supplied;
-
 #define MARK_TARGET  '1'
 #define MARK_SETMARK '2'
 #define MARK_ORMARK  '3'
@@ -54,7 +52,6 @@ static void brmark_init(struct xt_entry_target *target)
 
        info->target = EBT_ACCEPT;
        info->mark = 0;
-       mark_supplied = 0;
 }
 
 #define OPT_MARK_TARGET   0x01
@@ -133,7 +130,6 @@ brmark_parse(int c, char **argv, int invert, unsigned int *flags,
                xtables_error(PARAMETER_PROBLEM, "Bad MARK value '%s'",
                              optarg);
 
-       mark_supplied = 1;
        return 1;
 }
 
@@ -162,9 +158,6 @@ static void brmark_print(const void *ip, const struct xt_entry_target *target,
 
 static void brmark_final_check(unsigned int flags)
 {
-       if (mark_supplied == 0)
-               xtables_error(PARAMETER_PROBLEM, "No mark value supplied");
-
        if (!flags)
                xtables_error(PARAMETER_PROBLEM,
                              "You must specify some option");