All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: "Christian Göttsche" <cgzones@googlemail.com>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: nftables: secmark support
Date: Tue, 19 Nov 2019 20:40:13 +0100	[thread overview]
Message-ID: <20191119194013.fobvb5wfxz327esl@salvia> (raw)
In-Reply-To: <CAJ2a_Dd5NTOorEuPHzsUvj8kOTQmGWw6z6fUydMqCYibgHo8QQ@mail.gmail.com>

On Tue, Nov 19, 2019 at 08:02:10PM +0100, Christian Göttsche wrote:
> > > 1) I would replace secmark_raw by secmark instead. I think we should
> > >    hide this assymmetry to the user. I would suggest you also extend
> > >    the evaluation phase, ie. expr_evaluate_meta() and expr_evaluate_ct()
> > >    to bail out in case the user tries to match on the raw packet / ct
> > >    secmark ID. IIRC, the only usecase for this raw ID is to save and
> > >    to restore the secmark from/to the packet to/from the conntrack
> > >    object.
> > >
> > > And a few minor issues:
> > >
> > > 2) Please remove meta_key_unqualified chunk.
> > >
> > >         meta_key_unqualified    SET stmt_expr
> >
> > I mean, this update (moving the location of this rule) is not
> > necessary, right? Thanks.
>
> Without these, I am stuck with
>
> $ ./src/nft -c -f files/examples/secmark.nft
> files/examples/secmark.nft:64:49-58: Error: Counter expression must be constant
>                 ct state established,related meta secmark set ct secmark
>                                                               ^^^^^^^^^^

meta_stmt               :       META    meta_key        SET stmt_expr
                        {
                                switch ($2) {
                                case NFT_META_SECMARK:
                                        $$ = objref_stmt_alloc(&@$);
                                        $$->objref.type = NFT_OBJECT_SECMARK;
                                        $$->objref.expr = $4;

Check for what type of expression you have on $4 from the parser code.
If this is EXPR_META or EXPR_CT, then this is restoring a value. If
that is the case, then you have to use meta_stmt_alloc(), not
objref_stmt_alloc(), since this is not a reference to object.

      reply	other threads:[~2019-11-19 19:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-22 15:57 nftables: secmark support Christian Göttsche
2019-10-22 17:34 ` Pablo Neira Ayuso
2019-10-28 14:27   ` Christian Göttsche
2019-11-18 16:44     ` Christian Göttsche
2019-11-18 18:18       ` Pablo Neira Ayuso
2019-11-18 18:30         ` Pablo Neira Ayuso
2019-11-19 19:02           ` Christian Göttsche
2019-11-19 19:40             ` 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=20191119194013.fobvb5wfxz327esl@salvia \
    --to=pablo@netfilter.org \
    --cc=cgzones@googlemail.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.