Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*: Fix up improper handling of nexthops for nexthop tracking #17076

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/zclient.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pimd/pim_zlookup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion staticd/static_zebra.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand Down
8 changes: 4 additions & 4 deletions zebra/zapi_msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand All @@ -667,19 +667,19 @@ 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))
num += zserv_encode_nexthop(s, nexthop);
}

/* 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));
Expand Down
8 changes: 4 additions & 4 deletions zebra/zebra_rnh.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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));

Expand Down
Loading