@@ -70,10 +70,9 @@ static int bgp_isvalid_nexthop_for_ebgp(struct bgp_nexthop_cache *bnc,
70
70
if (nexthop -> type == NEXTHOP_TYPE_IFINDEX ||
71
71
nexthop -> type == NEXTHOP_TYPE_IPV4_IFINDEX ||
72
72
nexthop -> type == NEXTHOP_TYPE_IPV6_IFINDEX ) {
73
- ifp = if_lookup_by_index (bnc -> ifindex_ipv6_ll
74
- ? bnc -> ifindex_ipv6_ll
75
- : nexthop -> ifindex ,
76
- bnc -> bgp -> vrf_id );
73
+ ifp = if_lookup_by_index (
74
+ bnc -> ifindex ? bnc -> ifindex : nexthop -> ifindex ,
75
+ bnc -> bgp -> vrf_id );
77
76
}
78
77
if (!ifp )
79
78
continue ;
@@ -92,10 +91,9 @@ static int bgp_isvalid_nexthop_for_mplsovergre(struct bgp_nexthop_cache *bnc,
92
91
93
92
for (nexthop = bnc -> nexthop ; nexthop ; nexthop = nexthop -> next ) {
94
93
if (nexthop -> type != NEXTHOP_TYPE_BLACKHOLE ) {
95
- ifp = if_lookup_by_index (bnc -> ifindex_ipv6_ll
96
- ? bnc -> ifindex_ipv6_ll
97
- : nexthop -> ifindex ,
98
- bnc -> bgp -> vrf_id );
94
+ ifp = if_lookup_by_index (
95
+ bnc -> ifindex ? bnc -> ifindex : nexthop -> ifindex ,
96
+ bnc -> bgp -> vrf_id );
99
97
if (ifp && (ifp -> ll_type == ZEBRA_LLT_IPGRE ||
100
98
ifp -> ll_type == ZEBRA_LLT_IP6GRE ))
101
99
break ;
@@ -139,8 +137,8 @@ static void bgp_unlink_nexthop_check(struct bgp_nexthop_cache *bnc)
139
137
if (LIST_EMPTY (& (bnc -> paths )) && !bnc -> nht_info ) {
140
138
if (BGP_DEBUG (nht , NHT ))
141
139
zlog_debug ("%s: freeing bnc %pFX(%d)(%u)(%s)" , __func__ ,
142
- & bnc -> prefix , bnc -> ifindex_ipv6_ll ,
143
- bnc -> srte_color , bnc -> bgp -> name_pretty );
140
+ & bnc -> prefix , bnc -> ifindex , bnc -> srte_color ,
141
+ bnc -> bgp -> name_pretty );
144
142
/* only unregister if this is the last nh for this prefix*/
145
143
if (!bnc_existing_for_prefix (bnc ))
146
144
unregister_zebra_rnh (bnc );
@@ -217,7 +215,7 @@ bgp_find_ipv6_nexthop_matching_peer(struct peer *peer)
217
215
if (BGP_DEBUG (nht , NHT )) {
218
216
zlog_debug (
219
217
"Found bnc: %pFX(%u)(%u)(%p) for peer: %s(%s) %p" ,
220
- & bnc -> prefix , bnc -> ifindex_ipv6_ll ,
218
+ & bnc -> prefix , bnc -> ifindex ,
221
219
bnc -> srte_color , bnc , peer -> host ,
222
220
peer -> bgp -> name_pretty , peer );
223
221
}
@@ -364,17 +362,15 @@ int bgp_find_or_add_nexthop(struct bgp *bgp_route, struct bgp *bgp_nexthop,
364
362
bnc -> bgp = bgp_nexthop ;
365
363
if (BGP_DEBUG (nht , NHT ))
366
364
zlog_debug ("Allocated bnc %pFX(%d)(%u)(%s) peer %p" ,
367
- & bnc -> prefix , bnc -> ifindex_ipv6_ll ,
368
- bnc -> srte_color , bnc -> bgp -> name_pretty ,
369
- peer );
365
+ & bnc -> prefix , bnc -> ifindex , bnc -> srte_color ,
366
+ bnc -> bgp -> name_pretty , peer );
370
367
} else {
371
368
if (BGP_DEBUG (nht , NHT ))
372
369
zlog_debug (
373
370
"Found existing bnc %pFX(%d)(%s) flags 0x%x ifindex %d #paths %d peer %p" ,
374
- & bnc -> prefix , bnc -> ifindex_ipv6_ll ,
375
- bnc -> bgp -> name_pretty , bnc -> flags ,
376
- bnc -> ifindex_ipv6_ll , bnc -> path_count ,
377
- bnc -> nht_info );
371
+ & bnc -> prefix , bnc -> ifindex ,
372
+ bnc -> bgp -> name_pretty , bnc -> flags , bnc -> ifindex ,
373
+ bnc -> path_count , bnc -> nht_info );
378
374
}
379
375
380
376
if (pi && is_route_parent_evpn (pi ))
@@ -421,10 +417,10 @@ int bgp_find_or_add_nexthop(struct bgp *bgp_route, struct bgp *bgp_nexthop,
421
417
UNSET_FLAG (bnc -> flags , BGP_NEXTHOP_REGISTERED );
422
418
UNSET_FLAG (bnc -> flags , BGP_NEXTHOP_VALID );
423
419
}
424
- if (peer && (bnc -> ifindex_ipv6_ll != ifindex )) {
420
+ if (peer && (bnc -> ifindex != ifindex )) {
425
421
UNSET_FLAG (bnc -> flags , BGP_NEXTHOP_REGISTERED );
426
422
UNSET_FLAG (bnc -> flags , BGP_NEXTHOP_VALID );
427
- bnc -> ifindex_ipv6_ll = ifindex ;
423
+ bnc -> ifindex = ifindex ;
428
424
}
429
425
if (bgp_route -> inst_type == BGP_INSTANCE_TYPE_VIEW ) {
430
426
SET_FLAG (bnc -> flags , BGP_NEXTHOP_REGISTERED );
@@ -553,8 +549,8 @@ static void bgp_process_nexthop_update(struct bgp_nexthop_cache *bnc,
553
549
zlog_debug (
554
550
"%s(%u): Rcvd NH update %pFX(%u)(%u) - metric %d/%d #nhops %d/%d flags %s" ,
555
551
bnc -> bgp -> name_pretty , bnc -> bgp -> vrf_id , & nhr -> prefix ,
556
- bnc -> ifindex_ipv6_ll , bnc -> srte_color , nhr -> metric ,
557
- bnc -> metric , nhr -> nexthop_num , bnc -> nexthop_num ,
552
+ bnc -> ifindex , bnc -> srte_color , nhr -> metric , bnc -> metric ,
553
+ nhr -> nexthop_num , bnc -> nexthop_num ,
558
554
bgp_nexthop_dump_bnc_flags (bnc , bnc_buf ,
559
555
sizeof (bnc_buf )));
560
556
}
@@ -707,40 +703,9 @@ static void bgp_nht_ifp_table_handle(struct bgp *bgp,
707
703
struct interface * ifp , bool up )
708
704
{
709
705
struct bgp_nexthop_cache * bnc ;
710
- struct nexthop * nhop ;
711
- uint8_t other_nh_count ;
712
- bool nhop_found ;
713
706
714
707
frr_each (bgp_nexthop_cache , table , bnc ) {
715
- other_nh_count = 0 ;
716
- nhop_found = bnc -> ifindex_ipv6_ll == ifp -> ifindex ;
717
- for (nhop = bnc -> nexthop ; nhop ; nhop = nhop -> next ) {
718
- if (nhop -> ifindex == bnc -> ifindex_ipv6_ll )
719
- continue ;
720
-
721
- if (nhop -> ifindex != ifp -> ifindex ) {
722
- other_nh_count ++ ;
723
- continue ;
724
- }
725
- if (nhop -> vrf_id != ifp -> vrf -> vrf_id ) {
726
- other_nh_count ++ ;
727
- continue ;
728
- }
729
- nhop_found = true;
730
- }
731
-
732
- if (!nhop_found )
733
- /* The event interface does not match the nexthop cache
734
- * entry */
735
- continue ;
736
-
737
- if (!up && other_nh_count > 0 )
738
- /* Down event ignored in case of multiple next-hop
739
- * interfaces. The other might interfaces might be still
740
- * up. The cases where all interfaces are down or a bnc
741
- * is invalid are processed by a separate zebra rnh
742
- * messages.
743
- */
708
+ if (bnc -> ifindex != ifp -> ifindex )
744
709
continue ;
745
710
746
711
bnc -> last_update = monotime (NULL );
@@ -848,9 +813,9 @@ void bgp_nht_interface_events(struct peer *peer)
848
813
if (!bnc )
849
814
return ;
850
815
851
- if (bnc -> ifindex_ipv6_ll )
816
+ if (bnc -> ifindex )
852
817
event_add_event (bm -> master , bgp_nht_ifp_initial , bnc -> bgp ,
853
- bnc -> ifindex_ipv6_ll , NULL );
818
+ bnc -> ifindex , NULL );
854
819
}
855
820
856
821
void bgp_parse_nexthop_update (int command , vrf_id_t vrf_id )
@@ -1109,7 +1074,7 @@ static void register_zebra_rnh(struct bgp_nexthop_cache *bnc)
1109
1074
if (bnc -> flags & BGP_NEXTHOP_REGISTERED )
1110
1075
return ;
1111
1076
1112
- if (bnc -> ifindex_ipv6_ll ) {
1077
+ if (bnc -> ifindex ) {
1113
1078
SET_FLAG (bnc -> flags , BGP_NEXTHOP_REGISTERED );
1114
1079
return ;
1115
1080
}
@@ -1130,7 +1095,7 @@ static void unregister_zebra_rnh(struct bgp_nexthop_cache *bnc)
1130
1095
if (!CHECK_FLAG (bnc -> flags , BGP_NEXTHOP_REGISTERED ))
1131
1096
return ;
1132
1097
1133
- if (bnc -> ifindex_ipv6_ll ) {
1098
+ if (bnc -> ifindex ) {
1134
1099
UNSET_FLAG (bnc -> flags , BGP_NEXTHOP_REGISTERED );
1135
1100
return ;
1136
1101
}
@@ -1163,7 +1128,7 @@ void evaluate_paths(struct bgp_nexthop_cache *bnc)
1163
1128
1164
1129
zlog_debug (
1165
1130
"NH update for %pFX(%d)(%u)(%s) - flags %s chgflags %s- evaluate paths" ,
1166
- & bnc -> prefix , bnc -> ifindex_ipv6_ll , bnc -> srte_color ,
1131
+ & bnc -> prefix , bnc -> ifindex , bnc -> srte_color ,
1167
1132
bnc -> bgp -> name_pretty ,
1168
1133
bgp_nexthop_dump_bnc_flags (bnc , bnc_buf ,
1169
1134
sizeof (bnc_buf )),
0 commit comments