Re: [PATCH 5.4 60/67] ipv4: Fix incorrect route flushing when source address is deleted

Shaoying Xu
2023-02-05T05:31:36Z

On Mon, 12 Dec 2022 14:17:35 +0100 Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:

> From: Ido Schimmel <idosch@nvidia.com>
>
> [ Upstream commit f96a3d74554df537b6db5c99c27c80e7afadc8d1 ]
>
> Cited commit added the table ID to the FIB info structure, but did not
> prevent structures with different table IDs from being consolidated.
> This can lead to routes being flushed from a VRF when an address is
> deleted from a different VRF.
>
> Fix by taking the table ID into account when looking for a matching FIB
> info. This is already done for FIB info structures backed by a nexthop
> object in fib_find_info_nh().
>
> Add test cases that fail before the fix:
>
> # ./fib_tests.sh -t ipv4_del_addr
>
> IPv4 delete address route tests
> Regular FIB info
> TEST: Route removed from VRF when source address deleted [ OK ]
> TEST: Route in default VRF not removed [ OK ]
> TEST: Route removed in default VRF when source address deleted [ OK ]
> TEST: Route in VRF is not removed by address delete [ OK ]
> Identical FIB info with different table ID
> TEST: Route removed from VRF when source address deleted [FAIL]
> TEST: Route in default VRF not removed [ OK ]
> RTNETLINK answers: File exists
> TEST: Route removed in default VRF when source address deleted [ OK ]
> TEST: Route in VRF is not removed by address delete [FAIL]
>
> Tests passed: 6
> Tests failed: 2
>
> And pass after:
>
> # ./fib_tests.sh -t ipv4_del_addr
>
> IPv4 delete address route tests
> Regular FIB info
> TEST: Route removed from VRF when source address deleted [ OK ]
> TEST: Route in default VRF not removed [ OK ]
> TEST: Route removed in default VRF when source address deleted [ OK ]
> TEST: Route in VRF is not removed by address delete [ OK ]
> Identical FIB info with different table ID
> TEST: Route removed from VRF when source address deleted [ OK ]
> TEST: Route in default VRF not removed [ OK ]
> TEST: Route removed in default VRF when source address deleted [ OK ]
> TEST: Route in VRF is not removed by address delete [ OK ]
>
> Tests passed: 8
> Tests failed: 0
>
> Fixes: 5a56a0b3a45d ("net: Don't delete routes in different VRFs")
> Signed-off-by: Ido Schimmel <idosch@nvidia.com>
> Reviewed-by: David Ahern <dsahern@kernel.org>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
> net/ipv4/fib_semantics.c | 1 +
> tools/testing/selftests/net/fib_tests.sh | 1727 ----------------------
> 2 files changed, 1 insertion(+), 1727 deletions(-)
> delete mode 100755 tools/testing/selftests/net/fib_tests.sh

Hi Greg,

Sorry for last unclear message without context. I found this commit deleted
the whole fib_tests.sh that causes new failure in kselftests run. Looking at
the upstream patch [1] and given the context that ipv4_del_addr test is not
available to kernel 5.4, I added the revert patch and new backport of this
commit to resolve the potential mistake.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=f96a3d74554df537b6db5c99c27c80e7afadc8d1

Thanks,
Shaoying

Ido Schimmel (1):
ipv4: Fix incorrect route flushing when source address is deleted

Shaoying Xu (1):
Revert "ipv4: Fix incorrect route flushing when source address is
deleted"

tools/testing/selftests/net/fib_tests.sh | 1727 ++++++++++++++++++++++
1 file changed, 1727 insertions(+)
create mode 100755 tools/testing/selftests/net/fib_tests.sh

--
2.38.1