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: Wed, 14 Dec 2016 23:15:28 +0100	[thread overview]
Message-ID: <20161214221528.GA1972@salvia> (raw)
In-Reply-To: <CABAu8hPR=S+jpFtuOn3mNByWEiZmgOSnvyiazrurjNhxg787WQ@mail.gmail.com>

On Tue, Dec 13, 2016 at 08:06:27PM -0800, Mark Morgan wrote:
> Great ideas, thank you both. I tried Pablo's suggestion and have an
> error. Here's what it looks like:
> 
> # nftables.conf
> include "/etc/nftables.country-block"
> table inet filter {
>   set country-block {
>     type ipv4_addr; flags interval;
>     elements = $country_block_list
>   }
> }
> 
> # nftables.country-block
> define country_block_list = {
>           1.160.0.0/12, 1.192.0.0/13, 1.200.0.0/16, 1.202.0.0/15, 1.204.0.0/14,
>           # .... many lines here
>         223.240.0.0/13, 223.4.0.0/14, 223.64.0.0/11
>     }
> 
> And when I try to reload nftables, I receive the error:
> 
> Dec 13 19:56:18 ip-172-31-46-95 nft[563]: /etc/nftables.conf:82:16-16:
> Error: syntax error, unexpected '$', expecting '{'
> Dec 13 19:56:18 ip-172-31-46-95 nft[563]:     elements = $country_block_list
> Dec 13 19:56:18 ip-172-31-46-95 nft[563]:                ^
> 
> Did I do something wrong? Versions if it matters (Arch Linux):
>
> > uname -r -m
> 4.4.36-1-ec2-lts x86_64
> > nft --version
> nftables v0.6 (Support Edward Snowden)

This is fixed at git.netfilter.org, it would be great if you can test
this and confirm. We're preparing a release soon.

What I sent you works here.

> I tried Leon's suggested approach and it just coredumps:
> 
> # nftables.conf
> table inet filter {
>   set country-block {
>     type ipv4_addr; flags interval;
>   }
> }
> include "/etc/nftables.country-block"
> 
> # nftables.country-block
> add element inet filter country-block {
>         1.160.0.0/12, 1.192.0.0/13, 1.200.0.0/16, 1.202.0.0/15, 1.204.0.0/14,
>         # ... blah blah
>         223.240.0.0/13, 223.4.0.0/14, 223.64.0.0/11
>     }
> 
> -- Unit nftables.service has begun starting up.
> Dec 13 20:00:35 ip-172-31-46-95 kernel: nft[616]: segfault at 70 ip
> 000000000041d662 sp 00007ffc1b3f8db0 error 4 in nft[400000+56000]
> Dec 13 20:00:35 ip-172-31-46-95 systemd[1]: Started Process Core Dump
> (PID 618/UID 0).
> -- Subject: Unit systemd-coredump@2-618-0.service has finished start-up
> 
> Also in case size is a possible issue, here's word count on my
> country-block file:
> 
> > wc nftables.country-block
>   213   952 16532 nftables.country-block
> 
> Skipping 10-15 words of meta information, that's approximately ~940
> CIDR blocks in the list.
> 
> Should I try different versions of nftables or a newer kernel?  Or for
> the core dumping issue, feel free to point me at some docs for how to
> capture useful debug information for the devs and I'm happy to read up
> and submit a bug report.

Yes, try newer libnftnl and nftables at git.netfilter.org and get back
to us if you still have problems.

  reply	other threads:[~2016-12-14 22:15 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
2016-12-14  4:06   ` Mark Morgan
2016-12-14 22:15     ` Pablo Neira Ayuso [this message]
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=20161214221528.GA1972@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