All of lore.kernel.org
 help / color / mirror / Atom feed
From: Henning Reich <henning.reich@gmail.com>
To: netfilter@vger.kernel.org
Subject: List and reimport Ruleset fails with "Error: transport protocol mapping is only valid after transport protocol match"
Date: Tue, 6 Apr 2021 17:24:31 +0200	[thread overview]
Message-ID: <CAOAVeL3bSQP8SoaS_SUgr7XVMDAhp9ZtE3tstOHDE4dZBN9AgA@mail.gmail.com> (raw)

Hi,

maybe somebody can give me a hint.

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
       }

       chain output {
               type nat hook output priority -99; policy accept;
               ip daddr != 127.0.0.0/8 oif "lo" dnat ip addr . port to
meta l4proto . th dport map @map_port_ipport
       }

       chain postrouting {
               type nat hook postrouting priority srcnat + 1; policy accept;
               ip saddr @masq_saddr masquerade
       }
}


But trying to import it:

nft -c -f systemd_nat_rules
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



I also tried to store and import the complete ruleset (nft list
ruleset), but with the same error.

Thanks for your help.
Henning

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

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-06 15:24 Henning Reich [this message]
2021-04-06 15:33 ` List and reimport Ruleset fails with "Error: transport protocol mapping is only valid after transport protocol match" Florian Westphal
2021-04-06 16:34   ` [PATCH nft] evaluate: check if nat statement map specifies a transport header expr Florian Westphal
2021-04-06 16:34     ` 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=CAOAVeL3bSQP8SoaS_SUgr7XVMDAhp9ZtE3tstOHDE4dZBN9AgA@mail.gmail.com \
    --to=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.