From: Mikhail Sennikovsky <mikhail.sennikovskii@cloud.ionos.com>
To: netfilter-devel@vger.kernel.org, pablo@netfilter.org, fw@strlen.de
Cc: Mikhail Sennikovsky <mikhail.sennikovskii@cloud.ionos.com>
Subject: [PATCH 1/2] conntrack: -L/-D both ipv4/6 if no family is given
Date: Tue, 29 Sep 2020 13:20:16 +0200 [thread overview]
Message-ID: <20200929112017.18582-2-mikhail.sennikovskii@cloud.ionos.com> (raw)
In-Reply-To: <20200929112017.18582-1-mikhail.sennikovskii@cloud.ionos.com>
Starting commit 2bcbae4c14b253176d7570e6f6acc56e521ceb5e
conntrack -L as well as conntrack -D list/delete
IPv4 entries only if no family is specified.
Restore original behavior to list/delete both IPv4 and IPv6
entries if no family is specified.
Signed-off-by: Mikhail Sennikovsky <mikhail.sennikovskii@cloud.ionos.com>
---
src/conntrack.c | 35 ++++++++++++++++++++++++++++-------
1 file changed, 28 insertions(+), 7 deletions(-)
diff --git a/src/conntrack.c b/src/conntrack.c
index a11958b..3f5eb37 100644
--- a/src/conntrack.c
+++ b/src/conntrack.c
@@ -1578,6 +1578,11 @@ nfct_filter_network_direction(const struct nf_conntrack *ct, enum ct_direction d
enum nf_conntrack_attr attr;
struct ct_network *net = &dir2network[dir];
+ if (family == AF_UNSPEC) {
+ exit_error(OTHER_PROBLEM,
+ "Internal Error: unspecified Family!");
+ }
+
if (nfct_get_attr_u8(ct, ATTR_ORIG_L3PROTO) != family)
return 1;
@@ -2433,6 +2438,10 @@ nfct_filter_init(const int family)
{
filter_family = family;
if (options & CT_OPT_MASK_SRC) {
+ if (family == AF_UNSPEC) {
+ exit_error(OTHER_PROBLEM,
+ "Internal Error: unspecified Family!");
+ }
if (!(options & CT_OPT_ORIG_SRC))
exit_error(PARAMETER_PROBLEM,
"Can't use --mask-src without --src");
@@ -2440,6 +2449,10 @@ nfct_filter_init(const int family)
}
if (options & CT_OPT_MASK_DST) {
+ if (family == AF_UNSPEC) {
+ exit_error(OTHER_PROBLEM,
+ "Internal Error: unspecified Family!");
+ }
if (!(options & CT_OPT_ORIG_DST))
exit_error(PARAMETER_PROBLEM,
"Can't use --mask-dst without --dst");
@@ -2894,7 +2907,9 @@ parse_opts:
}
/* default family */
- if (family == AF_UNSPEC)
+ if (family == AF_UNSPEC
+ && command != CT_LIST
+ && command != CT_DELETE)
family = AF_INET;
/* we cannot check this combination with generic_opt_check. */
@@ -2993,9 +3008,12 @@ parse_opts:
NFCT_FILTER_DUMP_MARK,
&tmpl.filter_mark_kernel);
}
- nfct_filter_dump_set_attr_u8(filter_dump,
- NFCT_FILTER_DUMP_L3NUM,
- family);
+
+ if (family != AF_UNSPEC) {
+ nfct_filter_dump_set_attr_u8(filter_dump,
+ NFCT_FILTER_DUMP_L3NUM,
+ family);
+ }
if (options & CT_OPT_ZERO)
res = nfct_query(cth, NFCT_Q_DUMP_FILTER_RESET,
@@ -3104,9 +3122,12 @@ parse_opts:
NFCT_FILTER_DUMP_MARK,
&tmpl.filter_mark_kernel);
}
- nfct_filter_dump_set_attr_u8(filter_dump,
- NFCT_FILTER_DUMP_L3NUM,
- family);
+
+ if (family != AF_UNSPEC) {
+ nfct_filter_dump_set_attr_u8(filter_dump,
+ NFCT_FILTER_DUMP_L3NUM,
+ family);
+ }
res = nfct_query(cth, NFCT_Q_DUMP_FILTER, filter_dump);
--
2.25.1
next prev parent reply other threads:[~2020-09-29 12:37 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-25 12:49 [PATCH 0/8] Fast bulk transfers of large sets of ct entries Mikhail Sennikovsky
2020-09-25 12:49 ` [PATCH 1/8] tests: icmp entry create/delete Mikhail Sennikovsky
2020-10-13 18:28 ` Pablo Neira Ayuso
2020-09-25 12:49 ` [PATCH 2/8] conntrack: fix icmp entry creation Mikhail Sennikovsky
2020-10-13 18:29 ` Pablo Neira Ayuso
2020-09-25 12:49 ` [PATCH 3/8] conntrack: accept parameters from stdin Mikhail Sennikovsky
2020-11-04 13:56 ` Pablo Neira Ayuso
2020-09-25 12:49 ` [PATCH 4/8] conntrack.8: man update for stdin params support Mikhail Sennikovsky
2020-09-25 12:49 ` [PATCH 5/8] tests: conntrack parameters from stdin Mikhail Sennikovsky
2020-09-25 12:49 ` [PATCH 6/8] conntrack: implement options output format Mikhail Sennikovsky
2020-10-22 12:36 ` Pablo Neira Ayuso
2020-10-22 12:37 ` Pablo Neira Ayuso
2020-10-23 11:07 ` Mikhail Sennikovsky
2020-09-25 12:49 ` [PATCH 7/8] conntrack.8: man update for opts format support Mikhail Sennikovsky
2020-09-25 12:49 ` [PATCH 8/8] tests: dumping ct entries in opts format Mikhail Sennikovsky
2020-09-25 13:28 ` [PATCH 0/8] Fast bulk transfers of large sets of ct entries Florian Westphal
2020-09-26 18:19 ` Pablo Neira Ayuso
2020-09-29 11:20 ` [PATCH 0/2] conntrack: -L/-D both ipv4/6 if no family is given Mikhail Sennikovsky
2020-09-29 11:20 ` Mikhail Sennikovsky [this message]
2020-09-29 11:20 ` [PATCH 2/2] tests: conntrack -L/-D ip family filtering Mikhail Sennikovsky
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=20200929112017.18582-2-mikhail.sennikovskii@cloud.ionos.com \
--to=mikhail.sennikovskii@cloud.ionos.com \
--cc=fw@strlen.de \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.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).