From: Florian Westphal <fw@strlen.de>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Florian Westphal <fw@strlen.de>,
netfilter-devel@vger.kernel.org, christophe.leroy@c-s.fr
Subject: Re: nftables conntrack set ops for zone, helper assignment, etc.
Date: Thu, 12 Jan 2017 14:29:30 +0100 [thread overview]
Message-ID: <20170112132930.GA24985@breakpoint.cc> (raw)
In-Reply-To: <20170112130035.GA1816@salvia>
Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> On Thu, Jan 12, 2017 at 12:01:41AM +0100, Florian Westphal wrote:
> > ct zone set meta mark # as per my proposal -- set template
> > ct eventmask set new # as per my proposal -- lookup&change real conntrack
> > ct helper set "foo" # as per my proposal, lookup and change real
> > conntrack if its unconfirmed, EXCEPT helper is not looked up based on skb
> > payload and name "foo" but instead taken from objref infrastructure.
> > Same for timeout.
>
> Yes, something like the one above. By look&change, you refer to this?
>
> ct = nf_ct_get(...);
> if (!ct || !nf_ct_unconfirmed(ct))
> return;
>
> /*
> * ... update ct with helper here.
> */
No, I meant more intrusive version:
ct = nf_ct_get(...);
if (!ct || nf_ct_is_template(ct))))
nf_conntrack_in(net, info->pf, hook, skb);
ct = nf_ct_get(...);
if (!ct)
return;
switch (priv->key) {
case NFT_CT_MARK:
ct->mark = sreg32;
break;
case NFT_CT_HELPER:
if (nf_ct_is_confirmed(ct))
return; /* too late */
/* update helper here. sreg contains name of objectref,
* so we'd use that to obtain a helper template, then set/add
* helper extension to ct based on that.
* But we don't set skb->nfct to the template, we only use
* it as source to get the needed helper information.
*/
break;
case NFT_CT_EVENTMASK:
struct nf_conntrack_ecache *e = nf_ct_ecache_find(ct);
if (!e) {
if (!nf_ct_is_confirmed(ct))
nf_ct_ecache_ext_add(ct, sreg16, ~0, GFP_ATOMIC);
return;
}
e->ctmask = sreg16;
break;
case ...
}
NFT_CT_ZONE would have its own eval() version that doesn't
call nf_conntrack_in but instead sets up skb->nfct to a percpu template
that will then be used to transport the zoneinfo until nf_conntrack_in
is called (either by later hook or by later call via 'ct foo set bar').
[ unless skb->nfct is != NULL, then its a no-op ]
> For timeouts, after a second look I think this is more complicated: we
> set them from nf_conntrack_in() via l4proto->packet(). Thus, if we add
> the conntrack extension to store timeouts later on, the first
> conntrack state will not get refreshed with the right timeout.
>
> Assuming this is the first packet of a flow, that should be easy to
> amend later. But if we pickup a flow from the middle, timeout
> amendment gets a bit more tricky. Calling l4proto->packet() is not
> possible either since this sets packets as invalid, so we can drop it
> from the ruleset.
Ok. However I don't see why this isn't solveable in some way.
We could e.g. add a new l4proto callback, something like
l4proto->update_timeouts(ct, timeouts);
> Back to helpers, users are familiar with the current way to attach
> helpers, ie. from the raw chain.
>
> Am I missing anything? I'm starting to think we can't escape the
> conntrack template.
For Helpers? Why not? As long as ct isn't in the main table it should
be fine afaics? (Unless you mean "can't escape conntrack template to
read to helper info that we need to assign to ct from".
For zones, yes, I don't see a way to avoid a template for them.
But thats the only ct key where I think that a template has to be used.
next prev parent reply other threads:[~2017-01-12 13:29 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-11 9:17 nftables conntrack set ops for zone, helper assignment, etc Florian Westphal
2017-01-11 20:07 ` Pablo Neira Ayuso
2017-01-11 23:01 ` Florian Westphal
2017-01-12 13:00 ` Pablo Neira Ayuso
2017-01-12 13:29 ` Florian Westphal [this message]
2017-01-12 14:28 ` Pablo Neira Ayuso
2017-01-12 14:53 ` Florian Westphal
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=20170112132930.GA24985@breakpoint.cc \
--to=fw@strlen.de \
--cc=christophe.leroy@c-s.fr \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.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).