[chassis][voq] Fix to ignore duplicate nexthop in zebra (#16275)

Why I did it
Fixes #15803

In SONiC chassis, routes have recursive nexthop resolution when the routes are learnt from remote linecard.
In some cases after recursive nexthop resolution the number of nexthop for a route could reach 256.
Zebra ran out of space when filling up 256 nexthops which causes zebra crash.

Work item tracking
Microsoft ADO (24997365):

How I did it
Create a patch to port FRRouting/frr#14096 which has change to ignore duplicate nexthop when filling up fpm message

Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan <arlakshm@microsoft.com>
This commit is contained in:
Arvindsrinivasan Lakshmi Narasimhan 2023-08-31 11:06:33 -07:00 committed by GitHub
parent 0be57803e2
commit 3237b2cfc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,30 @@
From 4aa1aace3e32039b668c04cd682b01e0397144ea Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=81=AD=E7=AE=80?= <gongjian.lhr@alibaba-inc.com>
Date: Wed, 26 Jul 2023 09:51:51 +0800
Subject: [PATCH] zebra: remove duplicated nexthops when sending fpm msg
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
When zebra send msg to fpm client, it doesn't handle duplicated nexthops especially, which means if zebra has a route with NUM1 recursive nexthops, each resolved to the same NUM2 connected nexthops, it will send to fpm client a route with NUM1*NUM2 nexthops. But actually there are only NUM2 useful nexthops, the left NUM1*NUM2-NUM2 nexthops are all duplicated nexthops. By the way, zebra has duplicated nexthop remove logic when sending msg to kernel.
Add duplicated nexthop remove logic to zebra when sending msg to fpm client.
Signed-off-by: 恭简 <gongjian.lhr@alibaba-inc.com>
---
zebra/zebra_fpm_netlink.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/zebra/zebra_fpm_netlink.c b/zebra/zebra_fpm_netlink.c
index 06c45578a..231047143 100644
--- a/zebra/zebra_fpm_netlink.c
+++ b/zebra/zebra_fpm_netlink.c
@@ -305,6 +305,8 @@ static int netlink_route_info_fill(struct netlink_route_info *ri, int cmd,
if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_RECURSIVE))
continue;
+ if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_DUPLICATE))
+ continue;
if (nexthop->type == NEXTHOP_TYPE_BLACKHOLE) {
switch (nexthop->bh_type) {

View File

@ -20,3 +20,4 @@ cross-compile-changes.patch
0018-zebra-Use-zebra-dplane-for-RTM-link-and-addr.patch
0019-zebra-Abstract-dplane_ctx_route_init-to-init-route-w.patch
0020-zebra-Fix-crash-when-dplane_fpm_nl-fails-to-process-.patch
0021-zebra-remove-duplicated-nexthops-when-sending-fpm-msg.patch