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 v6] netfilter: ctnetlink: add kernel side filtering for dump
Date: Thu, 28 May 2020 00:24:13 +0200	[thread overview]
Message-ID: <20200527222413.GA1332@salvia> (raw)
In-Reply-To: <20200504193429.24125-1-romain.bellan@wifirst.fr>

On Mon, May 04, 2020 at 09:34:29PM +0200, 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 as an "AND" operator. For example, when flags
> PROTO_SRC_PORT, PROTO_NUM and IP_SRC are sets, only entries matching all
> values are dumped.
> 
> Changes since v1:
>   Set NLM_F_DUMP_FILTERED in nlm flags if entries are filtered
> 
> Changes since v2:
>   Move several constants to nf_internals.h
>   Move a fix on netlink values check in a separate patch
>   Add a check on not-supported flags
>   Return EOPNOTSUPP if CDA_FILTER is set in ctnetlink_flush_conntrack
>   (not yet implemented)
>   Code style issues
> 
> Changes since v3:
>   Fix compilation warning reported by kbuild test robot
> 
> Changes since v4:
>   Fix a regression introduced in v3 (returned EINVAL for valid netlink
>   messages without CTA_MARK)
> 
> Changes since v5:
>   Change definition of CTA_FILTER_F_ALL
>   Fix a regression when CTA_TUPLE_ZONE is not set

Applied, thanks for your patience.

      reply	other threads:[~2020-05-27 22:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-04 19:34 [PATCH nf-next v6] netfilter: ctnetlink: add kernel side filtering for dump Romain Bellan
2020-05-27 22:24 ` Pablo Neira Ayuso [this message]

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=20200527222413.GA1332@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).