forked from Mirror/frr
Merge pull request #16967 from donaldsharp/nexthop_fixes
lib: nexthop code should use uint16_t for nexthop counting
This commit is contained in:
commit
3fa917044e
|
@ -70,10 +70,10 @@ static struct nexthop *nexthop_group_tail(const struct nexthop_group *nhg)
|
||||||
return nexthop;
|
return nexthop;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t nexthop_group_nexthop_num(const struct nexthop_group *nhg)
|
uint16_t nexthop_group_nexthop_num(const struct nexthop_group *nhg)
|
||||||
{
|
{
|
||||||
struct nexthop *nhop;
|
struct nexthop *nhop;
|
||||||
uint8_t num = 0;
|
uint16_t num = 0;
|
||||||
|
|
||||||
for (ALL_NEXTHOPS_PTR(nhg, nhop))
|
for (ALL_NEXTHOPS_PTR(nhg, nhop))
|
||||||
num++;
|
num++;
|
||||||
|
@ -81,11 +81,10 @@ uint8_t nexthop_group_nexthop_num(const struct nexthop_group *nhg)
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t
|
static uint16_t nexthop_group_nexthop_num_no_recurse(const struct nexthop_group *nhg)
|
||||||
nexthop_group_nexthop_num_no_recurse(const struct nexthop_group *nhg)
|
|
||||||
{
|
{
|
||||||
struct nexthop *nhop;
|
struct nexthop *nhop;
|
||||||
uint8_t num = 0;
|
uint16_t num = 0;
|
||||||
|
|
||||||
for (nhop = nhg->nexthop; nhop; nhop = nhop->next)
|
for (nhop = nhg->nexthop; nhop; nhop = nhop->next)
|
||||||
num++;
|
num++;
|
||||||
|
@ -93,10 +92,10 @@ nexthop_group_nexthop_num_no_recurse(const struct nexthop_group *nhg)
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t nexthop_group_active_nexthop_num(const struct nexthop_group *nhg)
|
uint16_t nexthop_group_active_nexthop_num(const struct nexthop_group *nhg)
|
||||||
{
|
{
|
||||||
struct nexthop *nhop;
|
struct nexthop *nhop;
|
||||||
uint8_t num = 0;
|
uint16_t num = 0;
|
||||||
|
|
||||||
for (ALL_NEXTHOPS_PTR(nhg, nhop)) {
|
for (ALL_NEXTHOPS_PTR(nhg, nhop)) {
|
||||||
if (CHECK_FLAG(nhop->flags, NEXTHOP_FLAG_ACTIVE))
|
if (CHECK_FLAG(nhop->flags, NEXTHOP_FLAG_ACTIVE))
|
||||||
|
@ -184,11 +183,9 @@ static struct nexthop *nhg_nh_find(const struct nexthop_group *nhg,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool nexthop_group_equal_common(
|
||||||
nexthop_group_equal_common(const struct nexthop_group *nhg1,
|
const struct nexthop_group *nhg1, const struct nexthop_group *nhg2,
|
||||||
const struct nexthop_group *nhg2,
|
uint16_t (*nexthop_group_nexthop_num_func)(const struct nexthop_group *nhg))
|
||||||
uint8_t (*nexthop_group_nexthop_num_func)(
|
|
||||||
const struct nexthop_group *nhg))
|
|
||||||
{
|
{
|
||||||
if (nhg1 && !nhg2)
|
if (nhg1 && !nhg2)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -149,9 +149,8 @@ extern void nexthop_group_json_nexthop(json_object *j,
|
||||||
const struct nexthop *nh);
|
const struct nexthop *nh);
|
||||||
|
|
||||||
/* Return the number of nexthops in this nhg */
|
/* Return the number of nexthops in this nhg */
|
||||||
extern uint8_t nexthop_group_nexthop_num(const struct nexthop_group *nhg);
|
extern uint16_t nexthop_group_nexthop_num(const struct nexthop_group *nhg);
|
||||||
extern uint8_t
|
extern uint16_t nexthop_group_active_nexthop_num(const struct nexthop_group *nhg);
|
||||||
nexthop_group_active_nexthop_num(const struct nexthop_group *nhg);
|
|
||||||
|
|
||||||
extern bool nexthop_group_has_label(const struct nexthop_group *nhg);
|
extern bool nexthop_group_has_label(const struct nexthop_group *nhg);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue