From: Laura Garcia <nevola@gmail.com>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Florian Westphal <fw@strlen.de>, netfilter-devel@vger.kernel.org
Subject: Re: [PATCH v2] netfilter: nft_nth: match every n packets
Date: Tue, 9 Aug 2016 16:13:40 +0200 [thread overview]
Message-ID: <20160809141339.GA6805@sonyv> (raw)
In-Reply-To: <20160809105253.GA11493@salvia>
On Tue, Aug 09, 2016 at 12:52:53PM +0200, Pablo Neira Ayuso wrote:
> On Thu, Jul 28, 2016 at 11:20:59AM +0200, Florian Westphal wrote:
> > Laura Garcia <nevola@gmail.com> wrote:
> > > On Thu, Jul 28, 2016 at 01:01:05AM +0200, Florian Westphal wrote:
> > > > How exactly is this used by nftables?
> > > >
> > > > AFAIU usespace will check if ->dreg is 0 or not, but does that make
> > > > sense?
> > > >
> > > > Seems to me it would be more straightforward to not use a dreg at all
> > > > and just NFT_BREAK if nval != 0?
> > > >
> > >
> > > The main idea is to provide a round robin like scheduling method, for
> > > example:
> > >
> > > ip daddr <ipsaddr> dnat nth 3 map {
> > > 0: <ipdaddrA>,
> > > 1: <ipdaddrB>,
> > > 2: <ipdaddrC>
> > > }
> > >
> >
> > That makes sense, would be nice to place a small blurb in the commit
> > message.
>
> I'd suggest you rename this to nft_numgen.c where numgen stands for
> 'number generator', then rename 'every' to 'until' (this sets the
> upper limit in the generator) and add support for random too, so we
> provide incremental and random number generators to start with and we
> leave room to extend this with more number generators in the future if
> needed.
>
> Florian added random to meta, but I don't see an easy way to reuse
> this with maps unless we introduce another modulus/scale expression,
> and we should skip oversplitting expressions in way too basic
> operations.
So, do you mean something like this?
ip daddr <ipsaddr> dnat numgen nth 3 map {
0: <ipdaddrA>,
1: <ipdaddrB>,
2: <ipdaddrC>
}
and
ip daddr <ipsaddr> dnat numgen random 3 map {
0: <ipdaddrA>,
1: <ipdaddrB>,
2: <ipdaddrC>
}
Maybe _math_ could be a better name?
The counter expression could be included as well.
next prev parent reply other threads:[~2016-08-09 14:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-27 22:00 [PATCH v2] netfilter: nft_nth: match every n packets Laura Garcia Liebana
2016-07-27 23:01 ` Florian Westphal
2016-07-28 7:42 ` Laura Garcia
2016-07-28 9:20 ` Florian Westphal
2016-08-09 10:52 ` Pablo Neira Ayuso
2016-08-09 14:13 ` Laura Garcia [this message]
2016-08-09 14:26 ` Pablo Neira Ayuso
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=20160809141339.GA6805@sonyv \
--to=nevola@gmail.com \
--cc=fw@strlen.de \
--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).