forked from Mirror/frr
*: Fix up improper handling of nexthops for nexthop tracking
Currently FRR needs to send a uint16_t value for the number of nexthops as well it needs the ability to properly decode all of this. Find and handle all the places that this happens. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
parent
0aef4e4041
commit
645a9e4f83
|
@ -2374,7 +2374,7 @@ static bool zapi_nexthop_update_decode(struct stream *s, struct prefix *match,
|
|||
STREAM_GETW(s, nhr->instance);
|
||||
STREAM_GETC(s, nhr->distance);
|
||||
STREAM_GETL(s, nhr->metric);
|
||||
STREAM_GETC(s, nhr->nexthop_num);
|
||||
STREAM_GETW(s, nhr->nexthop_num);
|
||||
|
||||
for (i = 0; i < nhr->nexthop_num; i++) {
|
||||
if (zapi_nexthop_decode(s, &(nhr->nexthops[i]), 0, 0) != 0)
|
||||
|
|
|
@ -193,7 +193,7 @@ static int zclient_read_nexthop(struct pim_instance *pim,
|
|||
|
||||
distance = stream_getc(s);
|
||||
metric = stream_getl(s);
|
||||
nexthop_num = stream_getc(s);
|
||||
nexthop_num = stream_getw(s);
|
||||
|
||||
if (nexthop_num < 1 || nexthop_num > router->multipath) {
|
||||
if (PIM_DEBUG_PIM_NHT_DETAIL)
|
||||
|
|
|
@ -43,7 +43,7 @@ struct static_nht_data {
|
|||
vrf_id_t nh_vrf_id;
|
||||
|
||||
uint32_t refcount;
|
||||
uint8_t nh_num;
|
||||
uint16_t nh_num;
|
||||
bool registered;
|
||||
};
|
||||
|
||||
|
|
|
@ -647,7 +647,7 @@ static int zsend_nexthop_lookup_mrib(struct zserv *client, struct ipaddr *addr,
|
|||
{
|
||||
struct stream *s;
|
||||
unsigned long nump;
|
||||
uint8_t num;
|
||||
uint16_t num;
|
||||
struct nexthop *nexthop;
|
||||
|
||||
/* Get output stream. */
|
||||
|
@ -667,7 +667,7 @@ static int zsend_nexthop_lookup_mrib(struct zserv *client, struct ipaddr *addr,
|
|||
/* remember position for nexthop_num */
|
||||
nump = stream_get_endp(s);
|
||||
/* reserve room for nexthop_num */
|
||||
stream_putc(s, 0);
|
||||
stream_putw(s, 0);
|
||||
nhg = rib_get_fib_nhg(re);
|
||||
for (ALL_NEXTHOPS_PTR(nhg, nexthop)) {
|
||||
if (rnh_nexthop_valid(re, nexthop))
|
||||
|
@ -675,11 +675,11 @@ static int zsend_nexthop_lookup_mrib(struct zserv *client, struct ipaddr *addr,
|
|||
}
|
||||
|
||||
/* store nexthop_num */
|
||||
stream_putc_at(s, nump, num);
|
||||
stream_putw_at(s, nump, num);
|
||||
} else {
|
||||
stream_putc(s, 0); /* distance */
|
||||
stream_putl(s, 0); /* metric */
|
||||
stream_putc(s, 0); /* nexthop_num */
|
||||
stream_putw(s, 0); /* nexthop_num */
|
||||
}
|
||||
|
||||
stream_putw_at(s, 0, stream_get_endp(s));
|
||||
|
|
|
@ -1141,7 +1141,7 @@ int zebra_send_rnh_update(struct rnh *rnh, struct zserv *client,
|
|||
struct stream *s = NULL;
|
||||
struct route_entry *re;
|
||||
unsigned long nump;
|
||||
uint8_t num;
|
||||
uint16_t num;
|
||||
struct nexthop *nh;
|
||||
struct route_node *rn;
|
||||
int ret;
|
||||
|
@ -1212,7 +1212,7 @@ int zebra_send_rnh_update(struct rnh *rnh, struct zserv *client,
|
|||
stream_putl(s, re->metric);
|
||||
num = 0;
|
||||
nump = stream_get_endp(s);
|
||||
stream_putc(s, 0);
|
||||
stream_putw(s, 0);
|
||||
|
||||
nhg = rib_get_fib_nhg(re);
|
||||
for (ALL_NEXTHOPS_PTR(nhg, nh))
|
||||
|
@ -1240,13 +1240,13 @@ int zebra_send_rnh_update(struct rnh *rnh, struct zserv *client,
|
|||
}
|
||||
}
|
||||
|
||||
stream_putc_at(s, nump, num);
|
||||
stream_putw_at(s, nump, num);
|
||||
} else {
|
||||
stream_putc(s, 0); // type
|
||||
stream_putw(s, 0); // instance
|
||||
stream_putc(s, 0); // distance
|
||||
stream_putl(s, 0); // metric
|
||||
stream_putc(s, 0); // nexthops
|
||||
stream_putw(s, 0); // nexthops
|
||||
}
|
||||
stream_putw_at(s, 0, stream_get_endp(s));
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ static int zebra_sr_policy_notify_update_client(struct zebra_sr_policy *policy,
|
|||
stream_putc(s, nhlfe->distance);
|
||||
stream_putl(s, 0); /* metric - not available */
|
||||
nump = stream_get_endp(s);
|
||||
stream_putc(s, 0);
|
||||
stream_putw(s, 0);
|
||||
}
|
||||
|
||||
zapi_nexthop_from_nexthop(&znh, nhlfe->nexthop);
|
||||
|
@ -155,7 +155,7 @@ static int zebra_sr_policy_notify_update_client(struct zebra_sr_policy *policy,
|
|||
|
||||
num++;
|
||||
}
|
||||
stream_putc_at(s, nump, num);
|
||||
stream_putw_at(s, nump, num);
|
||||
stream_putw_at(s, 0, stream_get_endp(s));
|
||||
|
||||
client->nh_last_upd_time = monotime(NULL);
|
||||
|
|
Loading…
Reference in a new issue