@@ -58,8 +58,7 @@ void bnc_nexthop_free(struct bgp_nexthop_cache *bnc)
58
58
59
59
struct bgp_nexthop_cache * bnc_new (struct bgp_nexthop_cache_head * tree ,
60
60
struct prefix * prefix , uint32_t srte_color ,
61
- ifindex_t ifindex , bool import_check_table ,
62
- bool nexthop_check_table )
61
+ ifindex_t ifindex )
63
62
{
64
63
struct bgp_nexthop_cache * bnc ;
65
64
@@ -69,9 +68,6 @@ struct bgp_nexthop_cache *bnc_new(struct bgp_nexthop_cache_head *tree,
69
68
bnc -> ifindex_ipv6_ll = ifindex ;
70
69
bnc -> srte_color = srte_color ;
71
70
bnc -> tree = tree ;
72
- bnc -> import_check_table = import_check_table ;
73
- bnc -> nexthop_check_table = nexthop_check_table ;
74
-
75
71
LIST_INIT (& (bnc -> paths ));
76
72
bgp_nexthop_cache_add (tree , bnc );
77
73
@@ -972,7 +968,7 @@ static void bgp_show_nexthops_detail(struct vty *vty, struct bgp *bgp,
972
968
973
969
static void bgp_show_nexthop (struct vty * vty , struct bgp * bgp ,
974
970
struct bgp_nexthop_cache * bnc , bool specific ,
975
- bool import_check_table , json_object * json )
971
+ json_object * json )
976
972
{
977
973
char buf [PREFIX2STR_BUFFER ];
978
974
time_t tbuf ;
@@ -981,12 +977,6 @@ static void bgp_show_nexthop(struct vty *vty, struct bgp *bgp,
981
977
json_object * json_last_update = NULL ;
982
978
json_object * json_nexthop = NULL ;
983
979
984
- if (bnc -> import_check_table && !import_check_table )
985
- return ;
986
-
987
- if (bnc -> nexthop_check_table && import_check_table )
988
- return ;
989
-
990
980
peer = (struct peer * )bnc -> nht_info ;
991
981
992
982
if (json )
@@ -1113,14 +1103,16 @@ static void bgp_show_nexthops(struct vty *vty, struct bgp *bgp,
1113
1103
else
1114
1104
vty_out (vty , "Current BGP nexthop cache:\n" );
1115
1105
}
1106
+ if (import_table )
1107
+ tree = & bgp -> import_check_table ;
1108
+ else
1109
+ tree = & bgp -> nexthop_cache_table ;
1116
1110
1117
- tree = & bgp -> nexthop_cache_table ;
1118
1111
if (afi == AFI_IP || afi == AFI_IP6 ) {
1119
1112
if (json )
1120
1113
json_afi = json_object_new_object ();
1121
1114
frr_each (bgp_nexthop_cache , & (* tree )[afi ], bnc ) {
1122
- bgp_show_nexthop (vty , bgp , bnc , detail , import_table ,
1123
- json_afi );
1115
+ bgp_show_nexthop (vty , bgp , bnc , detail , json_afi );
1124
1116
found = true;
1125
1117
}
1126
1118
if (found && json )
@@ -1134,8 +1126,7 @@ static void bgp_show_nexthops(struct vty *vty, struct bgp *bgp,
1134
1126
if (json && (afi == AFI_IP || afi == AFI_IP6 ))
1135
1127
json_afi = json_object_new_object ();
1136
1128
frr_each (bgp_nexthop_cache , & (* tree )[afi ], bnc )
1137
- bgp_show_nexthop (vty , bgp , bnc , detail , import_table ,
1138
- json_afi );
1129
+ bgp_show_nexthop (vty , bgp , bnc , detail , json_afi );
1139
1130
if (json && (afi == AFI_IP || afi == AFI_IP6 ))
1140
1131
json_object_object_add (
1141
1132
json , (afi == AFI_IP ) ? "ipv4" : "ipv6" ,
@@ -1171,15 +1162,15 @@ static int show_ip_bgp_nexthop_table(struct vty *vty, const char *name,
1171
1162
vty_out (vty , "nexthop address is malformed\n" );
1172
1163
return CMD_WARNING ;
1173
1164
}
1174
- tree = & bgp -> nexthop_cache_table ;
1165
+ tree = import_table ? & bgp -> import_check_table
1166
+ : & bgp -> nexthop_cache_table ;
1175
1167
if (json )
1176
1168
json_afi = json_object_new_object ();
1177
1169
frr_each (bgp_nexthop_cache , & (* tree )[family2afi (nhop .family )],
1178
1170
bnc ) {
1179
1171
if (prefix_cmp (& bnc -> prefix , & nhop ))
1180
1172
continue ;
1181
- bgp_show_nexthop (vty , bgp , bnc , true, import_table ,
1182
- json_afi );
1173
+ bgp_show_nexthop (vty , bgp , bnc , true, json_afi );
1183
1174
found = true;
1184
1175
}
1185
1176
if (json )
@@ -1322,6 +1313,7 @@ void bgp_scan_init(struct bgp *bgp)
1322
1313
1323
1314
for (afi = AFI_IP ; afi < AFI_MAX ; afi ++ ) {
1324
1315
bgp_nexthop_cache_init (& bgp -> nexthop_cache_table [afi ]);
1316
+ bgp_nexthop_cache_init (& bgp -> import_check_table [afi ]);
1325
1317
bgp -> connected_table [afi ] = bgp_table_init (bgp , afi ,
1326
1318
SAFI_UNICAST );
1327
1319
}
@@ -1341,6 +1333,7 @@ void bgp_scan_finish(struct bgp *bgp)
1341
1333
for (afi = AFI_IP ; afi < AFI_MAX ; afi ++ ) {
1342
1334
/* Only the current one needs to be reset. */
1343
1335
bgp_nexthop_cache_reset (& bgp -> nexthop_cache_table [afi ]);
1336
+ bgp_nexthop_cache_reset (& bgp -> import_check_table [afi ]);
1344
1337
1345
1338
bgp -> connected_table [afi ]-> route_table -> cleanup =
1346
1339
bgp_connected_cleanup ;
0 commit comments