Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Henning Reich <henning.reich@gmail.com>
Cc: netfilter@vger.kernel.org
Subject: Re: List and reimport Ruleset fails with "Error: transport protocol mapping is only valid after transport protocol match"
Date: Tue, 6 Apr 2021 17:33:38 +0200	[thread overview]
Message-ID: <20210406153338.GO13699@breakpoint.cc> (raw)
In-Reply-To: <CAOAVeL3bSQP8SoaS_SUgr7XVMDAhp9ZtE3tstOHDE4dZBN9AgA@mail.gmail.com>

Henning Reich <henning.reich@gmail.com> wrote:
> I'm using some systemd-nspawn containers with exposed Port.
> Systemd creates automatically some masquerading rules and all works fine.
> But if I restart nft.service, these rules are gone (obviously). So I
> want to store and re-import them.
> 
> so this
> nft list table ip io.systemd.nat | tee systemd_nat_rules
> shows me:
> 
> table ip io.systemd.nat {
>        set masq_saddr {
>                type ipv4_addr
>                flags interval
>                elements = { 192.168.162.112/28 }
>        }
> 
>        map map_port_ipport {
>                type inet_proto . inet_service : ipv4_addr . inet_service
>                elements = { tcp . 8088 : 192.168.162.117 . 80 }
>        }
> 
>        chain prerouting {
>                type nat hook prerouting priority dstnat + 1; policy accept;
>                fib daddr type local dnat ip addr . port to meta
> l4proto . th dport map @map_port_ipport

> results in:
> ruleset:9:48-59: Error: transport protocol mapping is only valid after
> transport protocol match
>                type inet_proto . inet_service : ipv4_addr . inet_service

nft is too dumb and doesn't realize the protocol match is in the map
lookup.

I'll take a look.

  reply	other threads:[~2021-04-06 15:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-06 15:24 List and reimport Ruleset fails with "Error: transport protocol mapping is only valid after transport protocol match" Henning Reich
2021-04-06 15:33 ` Florian Westphal [this message]
2021-04-06 16:34   ` [PATCH nft] evaluate: check if nat statement map specifies a transport header expr 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=20210406153338.GO13699@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=henning.reich@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