From: Eugene Crosser <crosser@average.org>
To: Florian Westphal <fw@strlen.de>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: In raw prerouting, `iif` matches different interfaces in different kernels when enslaved in a vrf
Date: Wed, 6 Oct 2021 14:11:00 +0200 [thread overview]
Message-ID: <dc693a0b-cb3f-877e-1352-cfeb97f2f092@average.org> (raw)
In-Reply-To: <20211002185036.GJ2935@breakpoint.cc>
[-- Attachment #1.1: Type: text/plain, Size: 3195 bytes --]
Hello Florian,
On 02/10/2021 20:50, Florian Westphal wrote:
> Eugene Crosser <crosser@average.org> wrote:
>> Is this a known situation? Which behavior is "correct"?
>
> No idea, your reproducer gives this on my laptop:
>
> unshare -n bash repro.sh
> net.ipv4.conf.veout.accept_local = 1
> 5.14.9-200.fc34.x86_64
> conntrack v1.4.5 (conntrack-tools): connection tracking table has
been emptied.
> PING 172.30.30.2 (172.30.30.2) from 172.30.30.1 vein: 56(84) bytes of
data.
>
> --- 172.30.30.2 ping statistics ---
> 1 packets transmitted, 0 received, 100% packet loss, time 0ms
>
> conntrack v1.4.5 (conntrack-tools): 0 flow entries have been shown.
It would seem that you have an existing filter that drops packets and
prevents creation of conntrack entries? I can reproduce the behaviour on
freshly installed Debian and Ubuntu VMs without any modifications, with
and without `unshare`.
>
> A bisection is needed to figure out what introduced a change.
>
> However, if this is already changeed for a few releases then we can't
> revert it again.
I think that behaviour change is not benign though. If you have several
interfaces enslaved in one VRF, (which is a normal configuration), you
can no longer create rules that depend on the specific interface from
which the packet arrived.
So far I was able to prove that it depends on the kernel version and
nothing else. I've installed debian bullseye on a fresh VM, and upgraded
it to debian sid. The VM now has two kernels: 5.10.0-8 and 5.14.0-2
(debian builds). When booted with the older kernel, my reproducer shows
"correct" behaviour (rule matches the original veth), when booted with
the newer kernel, behaviour is altered (rule matches VRF instead).
I also updated the reproducer to write nftrace, and it looks
"interesting". I am including the new reproducer below, and I can send
nftrace files if needed.
Now I am trying to bisect upstream kernel.
Thanks.
==========
#!/bin/sh
IPIN=172.30.30.1
IPOUT=172.30.30.2
PFXL=30
ip li sh vein >/dev/null 2>&1 && ip li del vein
ip li sh tvrf >/dev/null 2>&1 && ip li del tvrf
nft list table testct >/dev/null 2>&1 && nft delete table testct
ip li add vein type veth peer veout
ip li add tvrf type vrf table 9876
ip li set veout master tvrf
ip li set vein up
ip li set veout up
ip li set tvrf up
/sbin/sysctl -w net.ipv4.conf.veout.accept_local=1
ip addr add $IPIN/$PFXL dev vein
ip addr add $IPOUT/$PFXL dev veout
nft -f - <<__END__
table testct {
chain rawpre {
type filter hook prerouting priority raw;
iif { veout, tvrf } meta nftrace set 1
iif veout ct zone set 1 return
iif tvrf ct zone set 2 return
notrack
}
chain rawout {
type filter hook output priority raw;
notrack
}
}
__END__
uname -rv
conntrack -F
stdbuf -o0 nft monitor trace >nftrace.`uname -r`.txt &
monpid=$!
ping -W 1 -c 1 -I vein $IPOUT
conntrack -L
sleep 1
kill -15 $monpid
wait
========
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2021-10-06 12:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-01 15:19 In raw prerouting, `iif` matches different interfaces in different kernels when enslaved in a vrf Eugene Crosser
2021-10-02 18:50 ` Florian Westphal
2021-10-06 12:11 ` Eugene Crosser [this message]
2021-10-06 14:48 ` Eugene Crosser
2021-10-06 15:03 ` Florian Westphal
2021-10-06 15:09 ` Eugene Crosser
2021-10-07 9:31 ` Florian Westphal
2021-10-07 9:29 ` 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=dc693a0b-cb3f-877e-1352-cfeb97f2f092@average.org \
--to=crosser@average.org \
--cc=fw@strlen.de \
--cc=netfilter-devel@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;
as well as URLs for NNTP newsgroup(s).