Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Matt Zagrabelny <mzagrabe@d.umn.edu>
Cc: netfilter <netfilter@vger.kernel.org>
Subject: Re: nft named set address types
Date: Mon, 15 Nov 2021 20:47:06 +0100	[thread overview]
Message-ID: <YZK5OsnQjzhbBOD3@salvia> (raw)
In-Reply-To: <CAOLfK3XJHhm5z6b1MOaMFjK2P2V9jyPgOtSOFZUswPSxuEZLEA@mail.gmail.com>

On Mon, Nov 15, 2021 at 11:40:43AM -0600, Matt Zagrabelny wrote:
> Hello Pablo and others,
> 
> I'm attempting to have a similar ICMP{4,6} ruleset as I have for TCP -
> thanks Pablo for the vmap hint.
> 
> On Tue, Nov 2, 2021 at 3:23 PM Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> 
> > Better split your ruleset in a tree using verdict maps:
> >
> > table inet filter {
> >     chain input_ip4 {
> >         ip saddr 127.0.0.1 accept
> >     }
> >
> >     chain input_ip6 {
> >         ip6 saddr ::1 accept
> >     }
> >
> >     chain input {
> >         type filter hook input priority filter; policy drop;
> >         ct state vmap { established : accept, related : accept, invalid : drop }
> >         # implicit match on 'ct state new,untracked'
> >         tcp dport 22 meta protocol vmap { ip : jump input_ip4, ip6 : jump input_ip6 }
> >     }
> > }
> 
> I see there is an icmpx for reject packets. Is there something
> equivalent for destination packets?
> 
> I've tried:
> 
> table inet filter {
>     chain icmp_ipv4 {
>         ip  saddr $icmp_networks_ipv4 accept
>     }
> 
>     chain icmp_ipv6 {
>         ip6 saddr $icmp_networks_ipv6 accept
>     }
> 
>     chain input {
>         meta protocol {icmp, icmpv6} vmap {
>             icmp: jump icmp_ipv4,
>             icmpv6: jump icmp_ipv6,
>         }
>     }
> }
> 
> Nov 15 11:39:05 watchtower nft[3709857]: In file included from
> /etc/nftables.conf.d/100-include.nft:5:1-48:
> Nov 15 11:39:05 watchtower nft[3709857]:                  from
> /etc/nftables.conf:3:1-37:
> Nov 15 11:39:05 watchtower nft[3709857]:
> /etc/nftables.conf.d/600-host.d/100-icmp.nft:11:38-41: Error: syntax
> error, unexpected vmap, expecting newline or semicolon
> Nov 15 11:39:05 watchtower nft[3709857]:         meta protocol {icmp,
> icmpv6} vmap {
> 
> Is there no vmap for icmp?

instead of:

         meta protocol {icmp, icmpv6} vmap {
             icmp: jump icmp_ipv4,
             icmpv6: jump icmp_ipv6,
         }

this should be:

         meta protocol vmap {
             icmp: jump icmp_ipv4,
             icmpv6: jump icmp_ipv6,
         }

  parent reply	other threads:[~2021-11-15 19:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-01 20:46 nft named set address types Matt Zagrabelny
2021-11-02 19:39 ` Matt Zagrabelny
2021-11-02 20:23   ` Pablo Neira Ayuso
2021-11-02 20:56     ` Matt Zagrabelny
2021-11-15 17:40     ` Matt Zagrabelny
2021-11-15 17:59       ` Eugene Crosser
2021-11-15 19:00       ` Kerin Millar
2021-11-15 19:47       ` Pablo Neira Ayuso [this message]
2021-11-16  2:20         ` Pablo Neira Ayuso
2021-11-16  2:55           ` Matt Zagrabelny
2021-11-16  8:35             ` Pablo Neira Ayuso
2021-11-02 19:53 ` Florian Westphal

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=YZK5OsnQjzhbBOD3@salvia \
    --to=pablo@netfilter.org \
    --cc=mzagrabe@d.umn.edu \
    --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