netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nf-next 0/4] Add nf_tables ingress hook for the inet family
Date: Thu, 8 Oct 2020 01:22:23 +0200	[thread overview]
Message-ID: <20201007232223.GA27414@salvia> (raw)
In-Reply-To: <20201007231448.27346-1-pablo@netfilter.org>

On Thu, Oct 08, 2020 at 01:14:44AM +0200, Pablo Neira Ayuso wrote:
> Hi,
> 
> The following patchset adds support for the inet ingress hook:
> 
> Patch #1 adds nf_static_key_inc() and nf_static_key_dec() helper functions.
> Patch #2 adds nf_ingress_hook() helper function.
> Patch #3 adds inet ingress hook support to the core.
> Patch #4 adds inet ingress hook support for nf_tables.
> 
> The following example shows how to place offenders into the 'blackhole'
> set. Offenders in this case are those that connect to the local SSH port
> over the specified rate limit. The inet ingress chain is used to
> shortcircuit the evaluation of the traffic coming from the offender at
> early stage in the packet processing receive path.
> 
>   table inet filter {
>         set blackhole {
>                 type ipv4_addr
>                 size 65535
>                 flags dynamic,timeout
>                 timeout 5m
>         }
> 
>         chain input {
>                 type filter hook input priority filter; policy accept;
>                 ct state new tcp dport 22 update @blackhole { ip saddr limit rate over 4/minute } counter packets 0 bytes 0

Actually, this should be:

                  ct state new tcp dport 22 limit rate over 4/minute update @blackhole { ip saddr } counter packets 0 bytes 0

maybe this example is not that useful...

... But the overall idea is to share sets with the ingress hook, which
was not possible so far :-)

>         }
> 
>         chain ingress {
>                 type filter hook unknown device "enp0s25" priority filter; policy accept;
>                 ip saddr @blackhole counter packets 0 bytes 0 drop
>         }
>   }
> 
> Pablo Neira Ayuso (4):
>   netfilter: add nf_static_key_{inc,dec}
>   netfilter: add nf_ingress_hook() helper function
>   netfilter: add inet ingress support
>   netfilter: nf_tables: add inet ingress support
> 
>  include/net/netfilter/nf_tables.h      |   6 ++
>  include/net/netfilter/nf_tables_ipv4.h |  33 +++++++
>  include/net/netfilter/nf_tables_ipv6.h |  46 +++++++++
>  include/uapi/linux/netfilter.h         |   1 +
>  net/netfilter/core.c                   | 127 ++++++++++++++++++++-----
>  net/netfilter/nf_tables_api.c          |  14 +--
>  net/netfilter/nft_chain_filter.c       |  35 ++++++-
>  7 files changed, 228 insertions(+), 34 deletions(-)
> 
> --
> 2.20.1
> 

      parent reply	other threads:[~2020-10-07 23:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-07 23:14 [PATCH nf-next 0/4] Add nf_tables ingress hook for the inet family Pablo Neira Ayuso
2020-10-07 23:14 ` [PATCH nf-next 1/4] netfilter: add nf_static_key_{inc,dec} Pablo Neira Ayuso
2020-10-07 23:14 ` [PATCH nf-next 2/4] netfilter: add nf_ingress_hook() helper function Pablo Neira Ayuso
2020-10-07 23:14 ` [PATCH nf-next 3/4] netfilter: add inet ingress support Pablo Neira Ayuso
2020-10-08  1:04   ` kernel test robot
2020-10-08  2:23   ` kernel test robot
2020-10-07 23:14 ` [PATCH nf-next 4/4] netfilter: nf_tables: " Pablo Neira Ayuso
2020-10-07 23:22 ` 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=20201007232223.GA27414@salvia \
    --to=pablo@netfilter.org \
    --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).