]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
extensions: libebt_stp: fix range checking
authorFlorian Westphal <fw@strlen.de>
Tue, 23 Jan 2024 16:49:33 +0000 (17:49 +0100)
committerPhil Sutter <phil@nwl.cc>
Thu, 25 Jan 2024 14:34:01 +0000 (15:34 +0100)
This has to either consider ->nvals > 1 or check the values
post-no-range-fixup:

./iptables-test.py  extensions/libebt_stp.t
extensions/libebt_stp.t: ERROR: line 12 (cannot load: ebtables -A INPUT --stp-root-cost 1)

(it tests 0 < 1 and fails, but test should be 1 < 1).

Fixes: dc6efcfeac38 ("extensions: libebt_stp: Use guided option parser")
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Phil Sutter <phil@nwl.cc>
extensions/libebt_stp.c

index 81054b26c1f0fac96364394cbe13da780ac2eda4..371fa04c870fee4b58d0cf620020f44ed90e9cea 100644 (file)
@@ -142,7 +142,7 @@ static void brstp_parse(struct xt_option_call *cb)
 #define RANGE_ASSIGN(name, fname, val) {                                   \
                stpinfo->config.fname##l = val[0];                          \
                stpinfo->config.fname##u = cb->nvals > 1 ? val[1] : val[0]; \
-               if (val[1] < val[0])                                        \
+               if (stpinfo->config.fname##u < stpinfo->config.fname##l)    \
                        xtables_error(PARAMETER_PROBLEM,                    \
                                      "Bad --stp-" name " range");          \
 }