mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-05 15:10:38 +00:00
zebra: Remove nexthop_active_num from route entry
The nexthop_active_num data structure is a property of the nexthop group. Move the keeping of this data to that. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
parent
eecacedc3b
commit
9a0d4dd39b
@ -135,9 +135,6 @@ struct route_entry {
|
||||
/* Route has Failed installation into the Data Plane in some manner */
|
||||
#define ROUTE_ENTRY_FAILED 0x20
|
||||
|
||||
/* Nexthop information. */
|
||||
uint8_t nexthop_active_num;
|
||||
|
||||
/* Sequence value incremented for each dataplane operation */
|
||||
uint32_t dplane_sequence;
|
||||
|
||||
|
@ -522,7 +522,7 @@ int zsend_redistribute_route(int cmd, struct zserv *client,
|
||||
struct zapi_route api;
|
||||
struct zapi_nexthop *api_nh;
|
||||
struct nexthop *nexthop;
|
||||
int count = 0;
|
||||
uint8_t count = 0;
|
||||
afi_t afi;
|
||||
size_t stream_size =
|
||||
MAX(ZEBRA_MAX_PACKET_SIZ, sizeof(struct zapi_route));
|
||||
@ -559,11 +559,6 @@ int zsend_redistribute_route(int cmd, struct zserv *client,
|
||||
memcpy(&api.src_prefix, src_p, sizeof(api.src_prefix));
|
||||
}
|
||||
|
||||
/* Nexthops. */
|
||||
if (re->nexthop_active_num) {
|
||||
SET_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP);
|
||||
api.nexthop_num = re->nexthop_active_num;
|
||||
}
|
||||
for (nexthop = re->ng->nexthop; nexthop; nexthop = nexthop->next) {
|
||||
if (!CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_ACTIVE))
|
||||
continue;
|
||||
@ -595,6 +590,12 @@ int zsend_redistribute_route(int cmd, struct zserv *client,
|
||||
count++;
|
||||
}
|
||||
|
||||
/* Nexthops. */
|
||||
if (count) {
|
||||
SET_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP);
|
||||
api.nexthop_num = count;
|
||||
}
|
||||
|
||||
/* Attributes. */
|
||||
SET_FLAG(api.message, ZAPI_MESSAGE_DISTANCE);
|
||||
api.distance = re->distance;
|
||||
|
@ -90,7 +90,7 @@ static int zfpm_dt_find_route(rib_dest_t **dest_p, struct route_entry **re_p)
|
||||
if (!re)
|
||||
continue;
|
||||
|
||||
if (re->nexthop_active_num <= 0)
|
||||
if (nexthop_group_active_nexthop_num(re->ng) == 0)
|
||||
continue;
|
||||
|
||||
*dest_p = dest;
|
||||
|
@ -644,9 +644,8 @@ static unsigned nexthop_active_check(struct route_node *rn,
|
||||
|
||||
/*
|
||||
* Iterate over all nexthops of the given RIB entry and refresh their
|
||||
* ACTIVE flag. re->nexthop_active_num is updated accordingly. If any
|
||||
* nexthop is found to toggle the ACTIVE flag, the whole re structure
|
||||
* is flagged with ROUTE_ENTRY_CHANGED.
|
||||
* ACTIVE flag. If any nexthop is found to toggle the ACTIVE flag,
|
||||
* the whole re structure is flagged with ROUTE_ENTRY_CHANGED.
|
||||
*
|
||||
* Return value is the new number of active nexthops.
|
||||
*/
|
||||
@ -656,8 +655,8 @@ int nexthop_active_update(struct route_node *rn, struct route_entry *re)
|
||||
union g_addr prev_src;
|
||||
unsigned int prev_active, new_active;
|
||||
ifindex_t prev_index;
|
||||
uint8_t curr_active = 0;
|
||||
|
||||
re->nexthop_active_num = 0;
|
||||
UNSET_FLAG(re->status, ROUTE_ENTRY_CHANGED);
|
||||
|
||||
for (nexthop = re->ng->nexthop; nexthop; nexthop = nexthop->next) {
|
||||
@ -674,12 +673,15 @@ int nexthop_active_update(struct route_node *rn, struct route_entry *re)
|
||||
*/
|
||||
new_active = nexthop_active_check(rn, re, nexthop);
|
||||
if (new_active
|
||||
&& re->nexthop_active_num >= zrouter.multipath_num) {
|
||||
&& nexthop_group_active_nexthop_num(re->ng)
|
||||
>= zrouter.multipath_num) {
|
||||
UNSET_FLAG(nexthop->flags, NEXTHOP_FLAG_ACTIVE);
|
||||
new_active = 0;
|
||||
}
|
||||
|
||||
if (new_active)
|
||||
re->nexthop_active_num++;
|
||||
curr_active++;
|
||||
|
||||
/* Don't allow src setting on IPv6 addr for now */
|
||||
if (prev_active != new_active || prev_index != nexthop->ifindex
|
||||
|| ((nexthop->type >= NEXTHOP_TYPE_IFINDEX
|
||||
@ -694,5 +696,5 @@ int nexthop_active_update(struct route_node *rn, struct route_entry *re)
|
||||
SET_FLAG(re->status, ROUTE_ENTRY_CHANGED);
|
||||
}
|
||||
|
||||
return re->nexthop_active_num;
|
||||
return curr_active;
|
||||
}
|
||||
|
@ -2481,7 +2481,8 @@ void _route_entry_dump(const char *func, union prefixconstptr pp,
|
||||
"%s: metric == %u, mtu == %u, distance == %u, flags == %u, status == %u",
|
||||
straddr, re->metric, re->mtu, re->distance, re->flags, re->status);
|
||||
zlog_debug("%s: nexthop_num == %u, nexthop_active_num == %u", straddr,
|
||||
nexthop_group_nexthop_num(re->ng), re->nexthop_active_num);
|
||||
nexthop_group_nexthop_num(re->ng),
|
||||
nexthop_group_active_nexthop_num(re->ng));
|
||||
|
||||
for (ALL_NEXTHOPS_PTR(re->ng, nexthop)) {
|
||||
struct interface *ifp;
|
||||
|
Loading…
Reference in New Issue
Block a user