From: Jacek Tomasiak <jacek.tomasiak@gmail.com>
To: netfilter-devel@vger.kernel.org
Cc: Jacek Tomasiak <jacek.tomasiak@gmail.com>,
Jacek Tomasiak <jtomasiak@arista.com>
Subject: [conntrack-tools PATCH] conntrack: Don't override mark in non-list mode
Date: Wed, 14 Jun 2023 18:24:05 +0200 [thread overview]
Message-ID: <20230614162405.30885-1-jacek.tomasiak@gmail.com> (raw)
When creating new rules with (e.g. with `conntrack -I -m 123 -u UNSET ...`),
the mark from `-m` was overriden by value from `-u`. Additional
condition ensures that this happens only in list mode.
This behavior was introduced in 1a5828f491c6a1593f30cb5f1551fe9f9cf76a8d
("conntrack: enable kernel-based status filtering with -L -u STATUS") for
filtering the output of `-L` option but caused a regression in other cases.
Signed-off-by: Jacek Tomasiak <jtomasiak@arista.com>
Signed-off-by: Jacek Tomasiak <jacek.tomasiak@gmail.com>
---
src/conntrack.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/conntrack.c b/src/conntrack.c
index bf72739..78d3a07 100644
--- a/src/conntrack.c
+++ b/src/conntrack.c
@@ -3007,7 +3007,9 @@ static void do_parse(struct ct_cmd *ct_cmd, int argc, char *argv[])
if (tmpl->filter_status_kernel.mask == 0)
tmpl->filter_status_kernel.mask = status;
- tmpl->mark.value = status;
+ // set mark only in list mode to not override value from -m
+ if (command & CT_LIST)
+ tmpl->mark.value = status;
tmpl->filter_status_kernel.val = tmpl->mark.value;
tmpl->filter_status_kernel_set = true;
break;
--
2.35.3
next reply other threads:[~2023-06-14 16:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-14 16:24 Jacek Tomasiak [this message]
2023-06-15 11:29 ` [conntrack-tools PATCH] conntrack: Don't override mark in non-list mode Pablo Neira Ayuso
2023-06-15 13:36 ` Florian Westphal
2023-06-15 13:45 ` 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=20230614162405.30885-1-jacek.tomasiak@gmail.com \
--to=jacek.tomasiak@gmail.com \
--cc=jtomasiak@arista.com \
--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).