mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-10 16:42:44 +00:00
zebra: fix processing of redistribute messages
We should not check/modify client->redist[] when the requested instance is different than zero. In the same way, we should not check/modify client->mi_redist[] when the requested instance is zero. Failure to respect these conditions can lead to unexpected behavior in the client daemons. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
This commit is contained in:
parent
fbf4aeaae6
commit
4e1cadf011
@ -257,17 +257,21 @@ zebra_redistribute_add (int command, struct zserv *client, int length,
|
|||||||
if (type == 0 || type >= ZEBRA_ROUTE_MAX)
|
if (type == 0 || type >= ZEBRA_ROUTE_MAX)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (instance && !redist_check_instance(&client->mi_redist[afi][type], instance))
|
if (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->vrf_id);
|
zebra_redistribute (client, type, instance, zvrf->vrf_id);
|
||||||
}
|
}
|
||||||
else if (! vrf_bitmap_check (client->redist[afi][type], zvrf->vrf_id))
|
} else {
|
||||||
|
if (! vrf_bitmap_check (client->redist[afi][type], zvrf->vrf_id))
|
||||||
{
|
{
|
||||||
vrf_bitmap_set (client->redist[afi][type], zvrf->vrf_id);
|
vrf_bitmap_set (client->redist[afi][type], zvrf->vrf_id);
|
||||||
zebra_redistribute (client, type, 0, zvrf->vrf_id);
|
zebra_redistribute (client, type, 0, zvrf->vrf_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
zebra_redistribute_delete (int command, struct zserv *client, int length,
|
zebra_redistribute_delete (int command, struct zserv *client, int length,
|
||||||
@ -284,11 +288,17 @@ zebra_redistribute_delete (int command, struct zserv *client, int length,
|
|||||||
if (type == 0 || type >= ZEBRA_ROUTE_MAX)
|
if (type == 0 || type >= ZEBRA_ROUTE_MAX)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (instance && redist_check_instance(&client->mi_redist[afi][type], instance))
|
/*
|
||||||
|
* NOTE: no need to withdraw the previously advertised routes. The clients
|
||||||
|
* themselves should keep track of the received routes from zebra and
|
||||||
|
* withdraw them when necessary.
|
||||||
|
*/
|
||||||
|
if (instance)
|
||||||
{
|
{
|
||||||
|
if (redist_check_instance (&client->mi_redist[afi][type], instance))
|
||||||
redist_del_instance (&client->mi_redist[afi][type], instance);
|
redist_del_instance (&client->mi_redist[afi][type], instance);
|
||||||
//Pending: why no reaction here?
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
vrf_bitmap_unset (client->redist[afi][type], zvrf->vrf_id);
|
vrf_bitmap_unset (client->redist[afi][type], zvrf->vrf_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user