summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2024-10-11 20:01:10 +0200
committerDonald Sharp <sharpd@nvidia.com>2024-10-15 17:57:23 +0200
commit645a9e4f8389226227af24088b8b55a4246aaed6 (patch)
tree8f4fdb9caf630c3b90ec4ba422517396e92cba53
parentMerge pull request #17106 from louis-6wind/fix-bmp-converity (diff)
downloadfrr-645a9e4f8389226227af24088b8b55a4246aaed6.tar.xz
frr-645a9e4f8389226227af24088b8b55a4246aaed6.zip
*: 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>
-rw-r--r--lib/zclient.c2
-rw-r--r--pimd/pim_zlookup.c2
-rw-r--r--staticd/static_zebra.c2
-rw-r--r--zebra/zapi_msg.c8
-rw-r--r--zebra/zebra_rnh.c8
-rw-r--r--zebra/zebra_srte.c4
6 files changed, 13 insertions, 13 deletions
diff --git a/lib/zclient.c b/lib/zclient.c
index 0e832f0d8..557d9c3eb 100644
--- a/lib/zclient.c
+++ b/lib/zclient.c
@@ -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)
diff --git a/pimd/pim_zlookup.c b/pimd/pim_zlookup.c
index c19119fa4..5d344f1f6 100644
--- a/pimd/pim_zlookup.c
+++ b/pimd/pim_zlookup.c
@@ -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)
diff --git a/staticd/static_zebra.c b/staticd/static_zebra.c
index 420ed7903..d76befc13 100644
--- a/staticd/static_zebra.c
+++ b/staticd/static_zebra.c
@@ -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;
};
diff --git a/zebra/zapi_msg.c b/zebra/zapi_msg.c
index 7dae75bac..10acee9be 100644
--- a/zebra/zapi_msg.c
+++ b/zebra/zapi_msg.c
@@ -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));
diff --git a/zebra/zebra_rnh.c b/zebra/zebra_rnh.c
index 89317be74..483a79164 100644
--- a/zebra/zebra_rnh.c
+++ b/zebra/zebra_rnh.c
@@ -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));
diff --git a/zebra/zebra_srte.c b/zebra/zebra_srte.c
index c0b83382c..bb8d4b3b4 100644
--- a/zebra/zebra_srte.c
+++ b/zebra/zebra_srte.c
@@ -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);