mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-06 16:20:08 +00:00
Merge pull request #5095 from donaldsharp/static_fix_for_ROUTE_ALL
ZEBRA_ROUTE_ALL fix
This commit is contained in:
commit
6d7b7e4257
@ -205,6 +205,15 @@ static int route_notify_owner(ZAPI_CALLBACK_ARGS)
|
||||
static void zebra_connected(struct zclient *zclient)
|
||||
{
|
||||
zclient_send_reg_requests(zclient, VRF_DEFAULT);
|
||||
|
||||
/*
|
||||
* Do not actually turn this on yet
|
||||
* This is just the start of the infrastructure needed here
|
||||
* This can be fixed at a later time.
|
||||
*
|
||||
* zebra_redistribute_send(ZEBRA_REDISTRIBUTE_ADD, zclient, AFI_IP,
|
||||
* ZEBRA_ROUTE_ALL, 0, VRF_DEFAULT);
|
||||
*/
|
||||
}
|
||||
|
||||
void vrf_label_add(vrf_id_t vrf_id, afi_t afi, mpls_label_t label)
|
||||
@ -300,28 +309,13 @@ void sharp_zebra_nexthop_watch(struct prefix *p, vrf_id_t vrf_id, bool import,
|
||||
__PRETTY_FUNCTION__);
|
||||
}
|
||||
|
||||
static int sharp_nexthop_update(ZAPI_CALLBACK_ARGS)
|
||||
static int sharp_debug_nexthops(struct zapi_route *api)
|
||||
{
|
||||
struct sharp_nh_tracker *nht;
|
||||
struct zapi_route nhr;
|
||||
char buf[PREFIX_STRLEN];
|
||||
int i;
|
||||
char buf[PREFIX_STRLEN];
|
||||
|
||||
if (!zapi_nexthop_update_decode(zclient->ibuf, &nhr)) {
|
||||
zlog_warn("%s: Decode of update failed", __PRETTY_FUNCTION__);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
zlog_debug("Received update for %s",
|
||||
prefix2str(&nhr.prefix, buf, sizeof(buf)));
|
||||
|
||||
nht = sharp_nh_tracker_get(&nhr.prefix);
|
||||
nht->nhop_num = nhr.nexthop_num;
|
||||
nht->updates++;
|
||||
|
||||
for (i = 0; i < nhr.nexthop_num; i++) {
|
||||
struct zapi_nexthop *znh = &nhr.nexthops[i];
|
||||
for (i = 0; i < api->nexthop_num; i++) {
|
||||
struct zapi_nexthop *znh = &api->nexthops[i];
|
||||
|
||||
switch (znh->type) {
|
||||
case NEXTHOP_TYPE_IPV4_IFINDEX:
|
||||
@ -351,6 +345,45 @@ static int sharp_nexthop_update(ZAPI_CALLBACK_ARGS)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
static int sharp_nexthop_update(ZAPI_CALLBACK_ARGS)
|
||||
{
|
||||
struct sharp_nh_tracker *nht;
|
||||
struct zapi_route nhr;
|
||||
|
||||
if (!zapi_nexthop_update_decode(zclient->ibuf, &nhr)) {
|
||||
zlog_warn("%s: Decode of update failed", __PRETTY_FUNCTION__);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
zlog_debug("Received update for %pFX", &nhr.prefix);
|
||||
|
||||
nht = sharp_nh_tracker_get(&nhr.prefix);
|
||||
nht->nhop_num = nhr.nexthop_num;
|
||||
nht->updates++;
|
||||
|
||||
sharp_debug_nexthops(&nhr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sharp_redistribute_route(ZAPI_CALLBACK_ARGS)
|
||||
{
|
||||
struct zapi_route api;
|
||||
|
||||
if (zapi_route_decode(zclient->ibuf, &api) < 0)
|
||||
zlog_warn("%s: Decode of redistribute failed: %d",
|
||||
__PRETTY_FUNCTION__,
|
||||
ZEBRA_REDISTRIBUTE_ROUTE_ADD);
|
||||
|
||||
zlog_debug("%s: %pFX (%s)", zserv_command_string(cmd),
|
||||
&api.prefix, zebra_route_string(api.type));
|
||||
|
||||
sharp_debug_nexthops(&api);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -372,4 +405,7 @@ void sharp_zebra_init(void)
|
||||
zclient->route_notify_owner = route_notify_owner;
|
||||
zclient->nexthop_update = sharp_nexthop_update;
|
||||
zclient->import_check_update = sharp_nexthop_update;
|
||||
|
||||
zclient->redistribute_route_add = sharp_redistribute_route;
|
||||
zclient->redistribute_route_del = sharp_redistribute_route;
|
||||
}
|
||||
|
@ -263,8 +263,11 @@ void redistribute_delete(const struct prefix *p, const struct prefix *src_p,
|
||||
}
|
||||
|
||||
/* Add DISTANCE_INFINITY check. */
|
||||
if (old_re && (old_re->distance == DISTANCE_INFINITY))
|
||||
if (old_re && (old_re->distance == DISTANCE_INFINITY)) {
|
||||
if (IS_ZEBRA_DEBUG_RIB)
|
||||
zlog_debug("\tSkipping due to Infinite Distance");
|
||||
return;
|
||||
}
|
||||
|
||||
afi = family2afi(p->family);
|
||||
if (!afi) {
|
||||
@ -310,14 +313,14 @@ void redistribute_delete(const struct prefix *p, const struct prefix *src_p,
|
||||
|
||||
/* Send a delete for the 'old' re to any subscribed client. */
|
||||
if (old_re
|
||||
&& ((old_re->instance
|
||||
&& redist_check_instance(
|
||||
&client->mi_redist[afi]
|
||||
[old_re->type],
|
||||
old_re->instance))
|
||||
|| vrf_bitmap_check(
|
||||
client->redist[afi][old_re->type],
|
||||
old_re->vrf_id))) {
|
||||
&& (vrf_bitmap_check(client->redist[afi][ZEBRA_ROUTE_ALL],
|
||||
old_re->vrf_id)
|
||||
|| (old_re->instance
|
||||
&& redist_check_instance(
|
||||
&client->mi_redist[afi][old_re->type],
|
||||
old_re->instance))
|
||||
|| vrf_bitmap_check(client->redist[afi][old_re->type],
|
||||
old_re->vrf_id))) {
|
||||
zsend_redistribute_route(ZEBRA_REDISTRIBUTE_ROUTE_DEL,
|
||||
client, p, src_p, old_re);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user