mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-07 22:29:23 +00:00
bgpd: 'redistribute' triggers both IPv4 and IPv6 code paths
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> Whenever you did "redistribute" zebra would kick this off for ipv4 and ipv6. No real issue other than this is sub-optimal
This commit is contained in:
parent
10a6a98b0a
commit
501be9875b
@ -108,42 +108,38 @@ zebra_redistribute_default (struct zserv *client, vrf_id_t vrf_id)
|
|||||||
|
|
||||||
/* Redistribute routes. */
|
/* Redistribute routes. */
|
||||||
static void
|
static void
|
||||||
zebra_redistribute (struct zserv *client, int type, u_short instance, vrf_id_t vrf_id)
|
zebra_redistribute (struct zserv *client, int type, u_short instance, vrf_id_t vrf_id, int afi)
|
||||||
{
|
{
|
||||||
struct rib *newrib;
|
struct rib *newrib;
|
||||||
struct route_table *table;
|
struct route_table *table;
|
||||||
struct route_node *rn;
|
struct route_node *rn;
|
||||||
int afi;
|
|
||||||
|
|
||||||
for (afi = AFI_IP; afi <= AFI_IP6; afi++)
|
table = zebra_vrf_table (afi, SAFI_UNICAST, vrf_id);
|
||||||
{
|
if (! table)
|
||||||
table = zebra_vrf_table (afi, SAFI_UNICAST, vrf_id);
|
return;
|
||||||
if (! table)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
for (rn = route_top (table); rn; rn = route_next (rn))
|
for (rn = route_top (table); rn; rn = route_next (rn))
|
||||||
RNODE_FOREACH_RIB (rn, newrib)
|
RNODE_FOREACH_RIB (rn, newrib)
|
||||||
{
|
{
|
||||||
if (IS_ZEBRA_DEBUG_EVENT)
|
if (IS_ZEBRA_DEBUG_EVENT)
|
||||||
zlog_debug("%s: checking: selected=%d, type=%d, distance=%d, "
|
zlog_debug("%s: checking: selected=%d, type=%d, distance=%d, "
|
||||||
"zebra_check_addr=%d", __func__,
|
"zebra_check_addr=%d", __func__,
|
||||||
CHECK_FLAG (newrib->flags, ZEBRA_FLAG_SELECTED),
|
CHECK_FLAG (newrib->flags, ZEBRA_FLAG_SELECTED),
|
||||||
newrib->type, newrib->distance,
|
newrib->type, newrib->distance,
|
||||||
zebra_check_addr (&rn->p));
|
zebra_check_addr (&rn->p));
|
||||||
|
|
||||||
if (! CHECK_FLAG (newrib->flags, ZEBRA_FLAG_SELECTED))
|
if (! CHECK_FLAG (newrib->flags, ZEBRA_FLAG_SELECTED))
|
||||||
continue;
|
continue;
|
||||||
if ((type != ZEBRA_ROUTE_ALL &&
|
if ((type != ZEBRA_ROUTE_ALL &&
|
||||||
(newrib->type != type || newrib->instance != instance)))
|
(newrib->type != type || newrib->instance != instance)))
|
||||||
continue;
|
continue;
|
||||||
if (newrib->distance == DISTANCE_INFINITY)
|
if (newrib->distance == DISTANCE_INFINITY)
|
||||||
continue;
|
continue;
|
||||||
if (! zebra_check_addr (&rn->p))
|
if (! zebra_check_addr (&rn->p))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
zsend_redistribute_route (1, client, &rn->p, newrib);
|
zsend_redistribute_route (1, client, &rn->p, newrib);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Either advertise a route for redistribution to registered clients or */
|
/* Either advertise a route for redistribution to registered clients or */
|
||||||
@ -262,13 +258,13 @@ zebra_redistribute_add (int command, struct zserv *client, int length,
|
|||||||
if (! redist_check_instance (&client->mi_redist[afi][type], instance))
|
if (! redist_check_instance (&client->mi_redist[afi][type], instance))
|
||||||
{
|
{
|
||||||
redist_add_instance (&client->mi_redist[afi][type], instance);
|
redist_add_instance (&client->mi_redist[afi][type], instance);
|
||||||
zebra_redistribute (client, type, instance, zvrf_id (zvrf));
|
zebra_redistribute (client, type, instance, zvrf_id (zvrf), afi);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (! vrf_bitmap_check (client->redist[afi][type], zvrf_id (zvrf)))
|
if (! vrf_bitmap_check (client->redist[afi][type], zvrf_id (zvrf)))
|
||||||
{
|
{
|
||||||
vrf_bitmap_set (client->redist[afi][type], zvrf_id (zvrf));
|
vrf_bitmap_set (client->redist[afi][type], zvrf_id (zvrf));
|
||||||
zebra_redistribute (client, type, 0, zvrf_id (zvrf));
|
zebra_redistribute (client, type, 0, zvrf_id (zvrf), afi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user