mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-05-30 22:25:41 +00:00
bgpd: fix segfault with '[no] bgp network import-check'
These commands were causing bgpd to crash if a static VPN route was configured. While here, fix a bug in bgp_static_add() and bgp_static_delete(). Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
This commit is contained in:
parent
92a8bd6e7a
commit
7c7f4284cf
@ -4314,7 +4314,7 @@ bgp_static_add (struct bgp *bgp)
|
|||||||
|
|
||||||
for (rm = bgp_table_top (table); rm; rm = bgp_route_next (rm))
|
for (rm = bgp_table_top (table); rm; rm = bgp_route_next (rm))
|
||||||
{
|
{
|
||||||
bgp_static = rn->info;
|
bgp_static = rm->info;
|
||||||
bgp_static_update_safi (bgp, &rm->p, bgp_static, afi, safi);
|
bgp_static_update_safi (bgp, &rm->p, bgp_static, afi, safi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4348,7 +4348,7 @@ bgp_static_delete (struct bgp *bgp)
|
|||||||
|
|
||||||
for (rm = bgp_table_top (table); rm; rm = bgp_route_next (rm))
|
for (rm = bgp_table_top (table); rm; rm = bgp_route_next (rm))
|
||||||
{
|
{
|
||||||
bgp_static = rn->info;
|
bgp_static = rm->info;
|
||||||
bgp_static_withdraw_safi (bgp, &rm->p,
|
bgp_static_withdraw_safi (bgp, &rm->p,
|
||||||
AFI_IP, safi,
|
AFI_IP, safi,
|
||||||
(struct prefix_rd *)&rn->p,
|
(struct prefix_rd *)&rn->p,
|
||||||
@ -4375,6 +4375,8 @@ bgp_static_redo_import_check (struct bgp *bgp)
|
|||||||
afi_t afi;
|
afi_t afi;
|
||||||
safi_t safi;
|
safi_t safi;
|
||||||
struct bgp_node *rn;
|
struct bgp_node *rn;
|
||||||
|
struct bgp_node *rm;
|
||||||
|
struct bgp_table *table;
|
||||||
struct bgp_static *bgp_static;
|
struct bgp_static *bgp_static;
|
||||||
|
|
||||||
/* Use this flag to force reprocessing of the route */
|
/* Use this flag to force reprocessing of the route */
|
||||||
@ -4383,10 +4385,23 @@ bgp_static_redo_import_check (struct bgp *bgp)
|
|||||||
for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++)
|
for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++)
|
||||||
for (rn = bgp_table_top (bgp->route[afi][safi]); rn; rn = bgp_route_next (rn))
|
for (rn = bgp_table_top (bgp->route[afi][safi]); rn; rn = bgp_route_next (rn))
|
||||||
if (rn->info != NULL)
|
if (rn->info != NULL)
|
||||||
|
{
|
||||||
|
if ((safi == SAFI_MPLS_VPN) || (safi == SAFI_ENCAP) || (safi == SAFI_EVPN))
|
||||||
|
{
|
||||||
|
table = rn->info;
|
||||||
|
|
||||||
|
for (rm = bgp_table_top (table); rm; rm = bgp_route_next (rm))
|
||||||
|
{
|
||||||
|
bgp_static = rm->info;
|
||||||
|
bgp_static_update_safi (bgp, &rm->p, bgp_static, afi, safi);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
bgp_static = rn->info;
|
bgp_static = rn->info;
|
||||||
bgp_static_update (bgp, &rn->p, bgp_static, afi, safi);
|
bgp_static_update (bgp, &rn->p, bgp_static, afi, safi);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
bgp_flag_unset(bgp, BGP_FLAG_FORCE_STATIC_PROCESS);
|
bgp_flag_unset(bgp, BGP_FLAG_FORCE_STATIC_PROCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user