netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Karuna Grewal <karunagrewal98@gmail.com>
Cc: Florian Westphal <fw@strlen.de>, netfilter-devel@vger.kernel.org
Subject: Re: [PATCH] netfilter: nft_meta: Extend support for NFT_META_TSTAMP_NS
Date: Tue, 5 Mar 2019 11:12:25 +0100	[thread overview]
Message-ID: <20190305101225.u72vgdapppkl24ce@breakpoint.cc> (raw)
In-Reply-To: <CAHRz_yZ4esKR2TJ=9AqtYbc5awDaNKHW6iuLXVLFZcuFAWLW1Q@mail.gmail.com>

Karuna Grewal <karunagrewal98@gmail.com> wrote:
> I've a doubt in the nftables implementation for implementing the `-m
> time` support.

Full -m time is complicated, do not worry about this yet.

> I'm unable to get a proper idea of where the start and
> stop time comparison with the dest register's value takes place.

Via the nftables evaluation loop.  You only need to worry about placing
the value (timestamp) in the dst register (on kernel side), so your
patch looks pretty complete aside from the missing 'break'.

Its userspace (nftables) responsibility to tell kernel to do something
with the register, such as a compare or range.

Have a look at
http://git.netfilter.org/nftables/commit/src/meta.c?id=512795a673f999fb04b84dbbbe41174e9c581430

It should be enough to follow this approach, adding e.g.
META_TEMPLATE("timestamp", ..

we have TYPE_TIME already, even though its a relative one, it
would/should work for a quick prototype.

> From my understanding of implementation, I've noticed that after
> parsing the rule and the meta expression is allocated, expression's
> primary evaluation function is invoked.
> Meanwhile, the kernel has the nft_meta_get_eval  function setting the
> register with the relevant field and in nf_tables_core.h  the
> registering of different nft_expr_types is accomplished.
> Could someone please give me some pointers about where this processing
> of the data set in the meta registers takes place?

For instance in nft_cmp.c, but thats just one possibility, there
are other consumers, such as nft_range.c, nft_lookup.c, and so on.

  reply	other threads:[~2019-03-05 10:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-01 10:43 [PATCH] netfilter: nft_meta: Extend support for NFT_META_TSTAMP_NS Karuna Grewal
2019-03-01 11:00 ` Florian Westphal
2019-03-05  8:23   ` Karuna Grewal
2019-03-05 10:12     ` Florian Westphal [this message]
2019-03-20 17:46       ` Karuna Grewal
2019-03-20 18:17         ` Karuna Grewal
  -- strict thread matches above, loose matches on Subject: below --
2019-03-01  9:24 Karuna Grewal
2019-03-01 10:43 ` Karuna Grewal
2019-03-04 14:57 ` Dan Carpenter

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=20190305101225.u72vgdapppkl24ce@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=karunagrewal98@gmail.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 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).