]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
extensions: libxt_NFLOG: remove extra space when saving targets with prefixes
authorJeremy Sowden <jeremy@azazel.net>
Fri, 1 Oct 2021 17:41:40 +0000 (18:41 +0100)
committerFlorian Westphal <fw@strlen.de>
Tue, 18 Jan 2022 12:22:57 +0000 (13:22 +0100)
When printing out NFLOG targets an extra space was inserted between
`--nflog-prefix` and the prefix itself:

  $ sudo /usr/sbin/iptables -A INPUT -j NFLOG --nflog-prefix test
  $ sudo /usr/sbin/iptables-save | grep NFLOG
  -A INPUT -j NFLOG --nflog-prefix  test
                                  ^^
Fixes: 73866357e4a7 ("iptables: do not print trailing whitespaces")
Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
Signed-off-by: Florian Westphal <fw@strlen.de>
extensions/libxt_NFLOG.c
extensions/libxt_NFLOG.t

index 2b78e27808f886c3c907c877c04830568d7d5bed..6137a68f8cd237bb738f53a32717aae470b7467f 100644 (file)
@@ -83,7 +83,7 @@ static void NFLOG_check(struct xt_fcheck_call *cb)
 static void nflog_print(const struct xt_nflog_info *info, char *prefix)
 {
        if (info->prefix[0] != '\0') {
-               printf(" %snflog-prefix ", prefix);
+               printf(" %snflog-prefix", prefix);
                xtables_save_string(info->prefix);
        }
        if (info->group)
index 13bbf2bfc5a5adea3acecaf6476e04cddc4c4413..561ec8c776501284436fc82edd22e8eef7cdb338 100644 (file)
@@ -14,8 +14,8 @@
 -j NFLOG --nflog-size 4294967295;=;OK
 -j NFLOG --nflog-size 4294967296;;FAIL
 -j NFLOG --nflog-size -1;;FAIL
--j NFLOG --nflog-prefix  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;=;OK
--j NFLOG --nflog-prefix  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;-j NFLOG --nflog-prefix  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;OK
+-j NFLOG --nflog-prefix xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;=;OK
+-j NFLOG --nflog-prefix xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;-j NFLOG --nflog-prefix xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;OK
 -j NFLOG --nflog-threshold 1;=;OK
 # ERROR: line 13 (should fail: iptables -A INPUT -j NFLOG --nflog-threshold 0
 # -j NFLOG --nflog-threshold 0;;FAIL