netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/12] nftables: generic protocol contexts, "inet" family
@ 2014-01-08 13:08 Patrick McHardy
  2014-01-08 13:08 ` [PATCH 01/12] expr: replace PAYLOAD_PROTOCOL_EXPR by generic flag Patrick McHardy
                   ` (11 more replies)
  0 siblings, 12 replies; 16+ messages in thread
From: Patrick McHardy @ 2014-01-08 13:08 UTC (permalink / raw)
  To: pablo; +Cc: netfilter-devel

The following patches implement the necessary support for the mixed IPv4/IPv6
"inet" family. The patchset consists of two major parts:

- introduction of generic protocol contexts
- support for the inet family and nfproto/l4proto meta expression types

The generic protocol contexts are a generalization of the payload contexts.
Since not only the payload expression, but also the ct and meta expression
can imply higher or lower layer protocols, the context tracking is
generalized. A small patch for the ct expression for context dependant
parsing of ct-src, ct-dst, ct-proto-src and ct-proto-dst is also included.

Support for the inet family mainly consist of adding a mapping for the
parser and netlink support for "inet" <-> NFPROTO_INET and adding support
for the meta nfproto and l4proto types.

With this in place, we can create rules like:

inet filter output tcp dport ssh counter

to match on ssh traffic for both IPv4 and IPv6.

inet filter output nfproto ipv4 tcp dport ssh

to match on ssh traffic for only IPv4.

Sets etc. have been verified to work as expected.

I've rebased the patches on the next-3.14 branch and will push them to
the nftables tree shortly.

Patrick McHardy (12):
      expr: replace PAYLOAD_PROTOCOL_EXPR by generic flag
      nftables: generic procotol contexts
      expr: add protocol context update callback
      proto: add helper function to update protocol context
      proto: add debugging for protocol context updates
      ct expr: protocol context updates and dynamic typing
      include: resync nftables.h with kernel
      nftables: add support for the "inet" family
      netlink_delinearize: remove implied meta expressions
      proto: add support for meta templates
      meta: add nfproto support
      meta: add l4proto support

 include/ct.h                        |   1 +
 include/datatype.h                  |   3 +
 include/expression.h                |  18 +-
 include/exthdr.h                    |   6 +-
 include/linux/netfilter.h           |  22 +-
 include/linux/netfilter/nf_tables.h | 116 ++++-
 include/nftables.h                  |   1 +
 include/payload.h                   | 288 +-----------
 include/proto.h                     | 304 +++++++++++++
 include/rule.h                      |   2 +-
 src/Makefile.in                     |   1 +
 src/ct.c                            |  58 +++
 src/datatype.c                      |  18 +
 src/evaluate.c                      |  47 +-
 src/exthdr.c                        |  26 +-
 src/main.c                          |   6 +-
 src/meta.c                          |  70 +++
 src/netlink_delinearize.c           |  43 +-
 src/parser.y                        |  43 +-
 src/payload.c                       | 855 +++---------------------------------
 src/proto.c                         | 814 ++++++++++++++++++++++++++++++++++
 src/rule.c                          |   3 +
 src/scanner.l                       |   4 +
 23 files changed, 1581 insertions(+), 1168 deletions(-)


^ permalink raw reply	[flat|nested] 16+ messages in thread
* [RFC PATCH 00/12] nftables: generic protocol contexts, "inet" family support
@ 2014-01-06 17:27 Patrick McHardy
  2014-01-06 17:27 ` [PATCH 01/12] expr: replace PAYLOAD_PROTOCOL_EXPR by generic flag Patrick McHardy
  0 siblings, 1 reply; 16+ messages in thread
From: Patrick McHardy @ 2014-01-06 17:27 UTC (permalink / raw)
  To: pablo; +Cc: netfilter-devel

The following patches implement the necessary support for the mixed IPv4/IPv6
"inet" table. The patchset consists of two major parts:

- introduction of generic protocol contexts
- support for the inet family and nfproto/l4proto meta expression types

The generic protocol contexts are a generalization of the payload contexts.
Since not only the payload expression, but also the ct and meta expression
can imply higher or lower layer protocols, the context tracking is
generalized. A small patch for the ct expression for context dependant
parsing of ct-src, ct-dst, ct-proto-src and ct-proto-dst is also included.

Support for the inet family mainly consist of adding a mapping for the
parser and netlink support for "inet" <-> NFPROTO_INET and adding support
for the meta nfproto and l4proto types.

With this in place, we can create rules like:

inet filter output tcp dport ssh counter

to match on ssh traffic for both IPv4 and IPv6.

inet filter output nfproto ipv4 tcp dport ssh

to match on ssh traffic for only IPv4.

Sets etc. have been verified to work as expected.

The only open question (related to the kernel though, but I forgot to
state it in my posting) is handling of autoloading of AF-specific
modules like nf_conntrack_ipv4 and nf_conntrack_ipv6. With NFPROTO_INET
the autoloading fails, so the ct expression can currently not be used.
We basically have two options:

- load both
- load none

Both approaches seem reasonable, but for consistency I'd tend to add
some special handling to load both modules for NFPROTO_INET.

The kernel patches are unchanged, just some minor cleanups in the
changelogs. If there are no objections I'll post a final version of
this patchset and will push it to the nftables repository and will
also post the final version of the kernel patches.

Cheers,
Patrick

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

end of thread, other threads:[~2014-01-09 22:01 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-08 13:08 [PATCH 00/12] nftables: generic protocol contexts, "inet" family Patrick McHardy
2014-01-08 13:08 ` [PATCH 01/12] expr: replace PAYLOAD_PROTOCOL_EXPR by generic flag Patrick McHardy
2014-01-08 13:08 ` [PATCH 02/12] nftables: generic procotol contexts Patrick McHardy
2014-01-08 13:08 ` [PATCH 03/12] expr: add protocol context update callback Patrick McHardy
2014-01-08 13:08 ` [PATCH 04/12] proto: add helper function to update protocol context Patrick McHardy
2014-01-08 13:08 ` [PATCH 05/12] proto: add debugging for protocol context updates Patrick McHardy
2014-01-08 13:08 ` [PATCH 06/12] ct expr: protocol context updates and dynamic typing Patrick McHardy
2014-01-08 13:08 ` [PATCH 07/12] include: resync nftables.h with kernel Patrick McHardy
2014-01-08 13:08 ` [PATCH 08/12] nftables: add support for the "inet" family Patrick McHardy
2014-01-08 13:09 ` [PATCH 09/12] netlink_delinearize: remove implied meta expressions Patrick McHardy
2014-01-09 21:48   ` Arturo Borrero Gonzalez
2014-01-09 22:01     ` Patrick McHardy
2014-01-08 13:09 ` [PATCH 10/12] proto: add support for meta templates Patrick McHardy
2014-01-08 13:09 ` [PATCH 11/12] meta: add nfproto support Patrick McHardy
2014-01-08 13:09 ` [PATCH 12/12] meta: add l4proto support Patrick McHardy
  -- strict thread matches above, loose matches on Subject: below --
2014-01-06 17:27 [RFC PATCH 00/12] nftables: generic protocol contexts, "inet" family support Patrick McHardy
2014-01-06 17:27 ` [PATCH 01/12] expr: replace PAYLOAD_PROTOCOL_EXPR by generic flag Patrick McHardy

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