From: David Ahern <dsahern@kernel.org>
To: "Ziyang Xuan (William)" <william.xuanziyang@huawei.com>,
David Miller <davem@davemloft.net>,
yoshfuji@linux-ipv6.org, Jakub Kicinski <kuba@kernel.org>,
netdev <netdev@vger.kernel.org>,
ja@ssi.bg
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: IPv4 saddr do not match with selected output device in double default gateways scene
Date: Wed, 9 Mar 2022 19:57:03 -0700 [thread overview]
Message-ID: <0f97539a-439f-d584-9ba3-f4bd5a302bc0@kernel.org> (raw)
In-Reply-To: <58c15089-f1c7-675e-db4b-b6dfdad4b497@huawei.com>
On 3/7/22 11:41 PM, Ziyang Xuan (William) wrote:
> Create VLAN devices and add default gateways with following commands:
>
> # ip link add link eth2 dev eth2.71 type vlan id 71
> # ip link add link eth2 dev eth2.72 type vlan id 72
> # ip addr add 192.168.71.41/24 dev eth2.71
> # ip addr add 192.168.72.41/24 dev eth2.72
> # ip link set eth2.71 up
> # ip link set eth2.72 up
> # route add -net default gw 192.168.71.1 dev eth2.71
> # route add -net default gw 192.168.72.1 dev eth2.72
>
...
> We can find that IPv4 saddr "192.168.72.41" do not match with selected VLAN device "eth2.71".
>
> I tracked the related processes, and found that user space program uses connect() firstly, then sends UDP packet.
>
...
> Deep tracking, it because fa->fa_default has changed in fib_select_default() after first __ip_route_output_key() process,
> and a new fib_nh is selected in fib_select_default() within the second __ip_route_output_key() process but not update flowi4.
> So the phenomenon described at the beginning happens.
>
> Does it a kernel bug or a user problem? If it is a kernel bug, is there any good solution?
That is a known problem with multipath routes.
next prev parent reply other threads:[~2022-03-10 2:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-08 6:41 Ziyang Xuan (William)
2022-03-10 1:51 ` Ziyang Xuan (William)
2022-03-10 2:57 ` David Ahern [this message]
2022-03-10 3:20 ` Ziyang Xuan (William)
2022-03-10 3:51 ` David Ahern
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=0f97539a-439f-d584-9ba3-f4bd5a302bc0@kernel.org \
--to=dsahern@kernel.org \
--cc=davem@davemloft.net \
--cc=ja@ssi.bg \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=william.xuanziyang@huawei.com \
--cc=yoshfuji@linux-ipv6.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
all inboxes | Powered by JetHome®