Quagga: vrf_id not being set correctly

Several routing protocols use the zapi_ipv[4|6] api to talk to
zebra.  There are some instances where the api.vrf_id was not
being set.  Since the practice is to declare the api structure
on the stack, the data inside is not being set to 0.  As
such random vrf_id values were being passed to zebrad
causing rage and confusion.

Ticket: CM-8287
Reviewed-by: CCR-3841
Testing:  Test suites no longer crashing and burning

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2015-11-20 11:36:46 -08:00
parent f1121188c7
commit 1a1f4efab3
4 changed files with 7 additions and 2 deletions

View File

@ -177,6 +177,7 @@ kernel_route_v4(int add,
quagga_prefix.prefixlen = plen - 96; /* our plen is for v4mapped's addr */
apply_mask_ipv4(&quagga_prefix);
api.vrf_id = VRF_DEFAULT;
api.type = ZEBRA_ROUTE_BABEL;
api.flags = 0;
api.message = 0;
@ -229,6 +230,7 @@ kernel_route_v6(int add, const unsigned char *pref, unsigned short plen,
quagga_prefix.prefixlen = plen;
apply_mask_ipv6(&quagga_prefix);
api.vrf_id = VRF_DEFAULT;
api.type = ZEBRA_ROUTE_BABEL;
api.flags = 0;
api.message = 0;

View File

@ -517,6 +517,7 @@ ospf6_zebra_add_discard (struct ospf6_route *request)
{
if (!CHECK_FLAG (request->flag, OSPF6_ROUTE_BLACKHOLE_ADDED))
{
api.vrf_id = VRF_DEFAULT;
api.type = ZEBRA_ROUTE_OSPF6;
api.flags = ZEBRA_FLAG_BLACKHOLE;
api.instance = 0;
@ -561,7 +562,7 @@ ospf6_zebra_delete_discard (struct ospf6_route *request)
{
if (CHECK_FLAG (request->flag, OSPF6_ROUTE_BLACKHOLE_ADDED))
{
api.vrf_id = VRF_DEFAULT;
api.type = ZEBRA_ROUTE_OSPF6;
api.flags = ZEBRA_FLAG_BLACKHOLE;
api.instance = 0;

View File

@ -70,13 +70,14 @@ rip_zebra_ipv4_add (struct prefix_ipv4 *p, struct in_addr *nexthop,
}
void
rip_zebra_ipv4_delete (struct prefix_ipv4 *p, struct in_addr *nexthop,
rip_zebra_ipv4_delete (struct prefix_ipv4 *p, struct in_addr *nexthop,
u_int32_t metric)
{
struct zapi_ipv4 api;
if (vrf_bitmap_check (zclient->redist[AFI_IP][ZEBRA_ROUTE_RIP], VRF_DEFAULT))
{
api.vrf_id = VRF_DEFAULT;
api.type = ZEBRA_ROUTE_RIP;
api.instance = 0;
api.flags = 0;

View File

@ -69,6 +69,7 @@ ripng_zebra_ipv6_delete (struct prefix_ipv6 *p, struct in6_addr *nexthop,
if (vrf_bitmap_check (zclient->redist[AFI_IP6][ZEBRA_ROUTE_RIPNG], VRF_DEFAULT))
{
api.vrf_id = VRF_DEFAULT;
api.type = ZEBRA_ROUTE_RIPNG;
api.instance = 0;
api.flags = 0;