bgpd: Check if the peer is configured as interface when checking NHT

This causes early return. peer->conf is NULL for IPv6 link-local peering,
and the session never establish.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit e9ad26e53f)
This commit is contained in:
Donatas Abraitis 2023-03-07 22:36:15 +02:00 committed by Mergify
parent 9f31d57664
commit 3704fee75d

View File

@ -339,7 +339,7 @@ int bgp_find_or_add_nexthop(struct bgp *bgp_route, struct bgp *bgp_nexthop,
* Gather the ifindex for if up/down events to be * Gather the ifindex for if up/down events to be
* tagged into this fun * tagged into this fun
*/ */
if (afi == AFI_IP6 && if (afi == AFI_IP6 && peer->conf_if &&
IN6_IS_ADDR_LINKLOCAL(&peer->su.sin6.sin6_addr)) { IN6_IS_ADDR_LINKLOCAL(&peer->su.sin6.sin6_addr)) {
ifindex = peer->su.sin6.sin6_scope_id; ifindex = peer->su.sin6.sin6_scope_id;
if (ifindex == 0) { if (ifindex == 0) {