netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Romain Bellan <romain.bellan@wifirst.fr>
Cc: netfilter-devel@vger.kernel.org,
	Florent Fourcot <florent.fourcot@wifirst.fr>
Subject: Re: [PATCH nf-next v4 1/2] netfilter: ctnetlink: add kernel side filtering for dump
Date: Mon, 30 Mar 2020 02:10:47 +0200	[thread overview]
Message-ID: <20200330001047.w22ppmvkrw4uisda@salvia> (raw)
In-Reply-To: <20200329150821.j6pg42dtbw55ff7s@salvia>

On Sun, Mar 29, 2020 at 05:08:21PM +0200, Pablo Neira Ayuso wrote:
> On Fri, Mar 27, 2020 at 09:26:31AM +0100, Romain Bellan wrote:
> > Conntrack dump does not support kernel side filtering (only get exists,
> > but it returns only one entry. And user has to give a full valid tuple)
> > 
> > It means that userspace has to implement filtering after receiving many
> > irrelevant entries, consuming resources (conntrack table is sometimes
> > very huge, much more than a routing table for example).
> > 
> > This patch adds filtering in kernel side. To achieve this goal, we:
> > 
> >  * Add a new CTA_FILTER netlink attributes, actually a flag list to
> >    parametize filtering
> >  * Convert some *nlattr_to_tuple() functions, to allow a partial parsing
> >    of CTA_TUPLE_ORIG and CTA_TUPLE_REPLY (so nf_conntrack_tuple it not
> >    fully set)
> > 
> > Filtering is now possible on:
> >  * IP SRC/DST values
> >  * Ports for TCP and UDP flows
> >  * IMCP(v6) codes types and IDs
> > 
> > Filtering is done has an "AND" operator. For example, when flags
> > PROTO_SRC_PORT, PROTO_NUM and IP_SRC are sets, only entries matching all
> > values are dumped.
> 
> Applied, thanks.

I'm sorry, I have to keep back this patch.

        # conntrack -L

breaks after this patch, and conntrack-tools/test/conntrack.c shows
several:

        conntrack v1.4.5 (conntrack-tools): Operation failed: invalid parameters

I tried to fix it here but I would need a bit more time, I think this
is on the right track. However, the new flags logic makes ctnetlink
hit EINVAL in a number of cases.

Please, revamp and send v5. Thanks.

  reply	other threads:[~2020-03-30  0:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-27  8:26 [PATCH nf-next v4 1/2] netfilter: ctnetlink: add kernel side filtering for dump Romain Bellan
2020-03-27  8:26 ` [PATCH nf-next v4 2/2] netfilter: ctnetlink: be more strict when NF_CONNTRACK_MARK is not set Romain Bellan
2020-03-29 15:08   ` Pablo Neira Ayuso
2020-03-29 15:08 ` [PATCH nf-next v4 1/2] netfilter: ctnetlink: add kernel side filtering for dump Pablo Neira Ayuso
2020-03-30  0:10   ` Pablo Neira Ayuso [this message]
2020-03-30 20:53     ` Florent Fourcot

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=20200330001047.w22ppmvkrw4uisda@salvia \
    --to=pablo@netfilter.org \
    --cc=florent.fourcot@wifirst.fr \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=romain.bellan@wifirst.fr \
    /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).