netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH nf-next 0/4] Add nf_tables ingress hook for the inet family
@ 2020-10-07 23:14 Pablo Neira Ayuso
  2020-10-07 23:14 ` [PATCH nf-next 1/4] netfilter: add nf_static_key_{inc,dec} Pablo Neira Ayuso
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Pablo Neira Ayuso @ 2020-10-07 23:14 UTC (permalink / raw)
  To: netfilter-devel

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
        }

        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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-10-08  2:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH nf-next 0/4] Add nf_tables ingress hook for the inet family Pablo Neira Ayuso

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).