Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Mark Morgan <morganm.qc@gmail.com>
Cc: netfilter@vger.kernel.org
Subject: Re: Nftables / ipset / multiple tables
Date: Tue, 13 Dec 2016 20:39:34 +0100	[thread overview]
Message-ID: <20161213193934.GA2881@salvia> (raw)
In-Reply-To: <CABAu8hMnZd84Ya-17aK9ERfqp-7TbfuhfWnDz5dydML0Jhdb0A@mail.gmail.com>

On Mon, Dec 12, 2016 at 08:39:47PM -0800, Mark Morgan wrote:
[...]
> For now, I converted some of my ipsets to nftables format. The problem
> I'm having is that while there is an "include" directive which allows
> me to separate out my ipsets into manageable separate files, there is
> no mechanism I can see to actually reference these sets. Example:
> 
> # nftables.conf
> @include "nftables.foobar"
> table inet filter { /* stuff in here */ }
> 
> # nftables.foobar
> table ip foobar { set country_block { /*blah blah*/ } }
> 
> Now I want to reference "set country_block" from my inet filters. I
> can't find any documentation on how to reference a set in another
> table. The "@country_block" reference seems to be scoped to only the
> current table, with no way I can find to have it reference a set in
> another table. I really do not want to store all of my ip sets in a
> single large file/table. That would be worse than what I have today
> with iptables.
> 
> Am I missing an feature that perhaps isn't documented that would make
> this all work, or is there a forth coming feature that might make this
> possible to do in the future?

I'd suggest you use a variable definition, eg.

# cat nftables.conf
include "./nftables.foobar"

table ip filter {
        set country_block {
                type ipv4_addr
                elements = $country_block
        }
}
# cat nftables.foobar
define country_block = { 1.2.3.4, \
                         4.3.2.1 }

Thus you maintain a single file with the address list.

  parent reply	other threads:[~2016-12-13 19:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-13  4:39 Nftables / ipset / multiple tables Mark Morgan
2016-12-13  7:31 ` Leon Merten Lohse
2016-12-13 19:39 ` Pablo Neira Ayuso [this message]
2016-12-14  4:06   ` Mark Morgan
2016-12-14 22:15     ` Pablo Neira Ayuso
2016-12-15  4:22       ` Mark Morgan

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=20161213193934.GA2881@salvia \
    --to=pablo@netfilter.org \
    --cc=morganm.qc@gmail.com \
    --cc=netfilter@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