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:
Daniel Walton 2017-05-16 23:58:34 +00:00
parent 10a6a98b0a
commit 501be9875b

View File

@ -108,18 +108,15 @@ zebra_redistribute_default (struct zserv *client, vrf_id_t vrf_id)
/* Redistribute routes. */
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 route_table *table;
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)
continue;
return;
for (rn = route_top (table); rn; rn = route_next (rn))
RNODE_FOREACH_RIB (rn, newrib)
@ -144,7 +141,6 @@ zebra_redistribute (struct zserv *client, int type, u_short instance, vrf_id_t v
zsend_redistribute_route (1, client, &rn->p, newrib);
}
}
}
/* Either advertise a route for redistribution to registered clients or */
/* withdraw redistribution if add cannot be done for client */
@ -262,13 +258,13 @@ zebra_redistribute_add (int command, struct zserv *client, int length,
if (! redist_check_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 {
if (! vrf_bitmap_check (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);
}
}
}