From 871d78e90ffb1c44229c76051f8b83ad95174206 Mon Sep 17 00:00:00 2001 From: anlan_cs Date: Mon, 5 Jun 2023 16:23:16 +0800 Subject: [PATCH] bgpd: ignore the wrong interface for nht procedure `bnc->ifindex` should not be with 0 ( IFINDEX_INTERNAL ), so we can ignore the wrong interface to make it safe. Signed-off-by: anlan_cs --- bgpd/bgp_nht.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c index a46616803c..5a511eac1c 100644 --- a/bgpd/bgp_nht.c +++ b/bgpd/bgp_nht.c @@ -714,6 +714,11 @@ static void bgp_nht_ifp_table_handle(struct bgp *bgp, { struct bgp_nexthop_cache *bnc; + if (ifp->ifindex == IFINDEX_INTERNAL) { + zlog_warn("%s: The interface %s ignored", __func__, ifp->name); + return; + } + frr_each (bgp_nexthop_cache, table, bnc) { if (bnc->ifindex != ifp->ifindex) continue;