summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2021-01-25 16:29:04 +0100
committerGitHub <noreply@github.com>2021-01-25 16:29:04 +0100
commit431deca7ea1bba67d4eef442117ed3255982e066 (patch)
treea5000a9391a705afd95854420b3694940b287706 /lib
parentMerge pull request #7922 from ton31337/fix/bgpd_blackhole_community_ibgp (diff)
parentzebra: send async nhg update results (diff)
downloadfrr-431deca7ea1bba67d4eef442117ed3255982e066.tar.xz
frr-431deca7ea1bba67d4eef442117ed3255982e066.zip
Merge pull request #7905 from mjstapp/fix_zapi_nhg
zebra, sharpd: async results for NHGs
Diffstat (limited to 'lib')
-rw-r--r--lib/zclient.c10
-rw-r--r--lib/zclient.h4
2 files changed, 9 insertions, 5 deletions
diff --git a/lib/zclient.c b/lib/zclient.c
index f16c94369..bfdf4971b 100644
--- a/lib/zclient.c
+++ b/lib/zclient.c
@@ -996,7 +996,7 @@ done:
return ret;
}
-int zapi_nhg_encode(struct stream *s, int cmd, struct zapi_nhg *api_nhg)
+static int zapi_nhg_encode(struct stream *s, int cmd, struct zapi_nhg *api_nhg)
{
int i;
@@ -1007,6 +1007,13 @@ int zapi_nhg_encode(struct stream *s, int cmd, struct zapi_nhg *api_nhg)
return -1;
}
+ if (api_nhg->nexthop_num >= MULTIPATH_NUM ||
+ api_nhg->backup_nexthop_num >= MULTIPATH_NUM) {
+ flog_err(EC_LIB_ZAPI_ENCODE,
+ "%s: zapi NHG encode with invalid input\n", __func__);
+ return -1;
+ }
+
stream_reset(s);
zclient_create_header(s, cmd, VRF_DEFAULT);
@@ -1024,7 +1031,6 @@ int zapi_nhg_encode(struct stream *s, int cmd, struct zapi_nhg *api_nhg)
zapi_nexthop_encode(s, &api_nhg->nexthops[i], 0, 0);
/* Backup nexthops */
-
stream_putw(s, api_nhg->backup_nexthop_num);
for (i = 0; i < api_nhg->backup_nexthop_num; i++)
diff --git a/lib/zclient.h b/lib/zclient.h
index 57bad7c2e..cf52ea91a 100644
--- a/lib/zclient.h
+++ b/lib/zclient.h
@@ -1021,9 +1021,7 @@ bool zapi_ipset_notify_decode(struct stream *s,
uint32_t *unique,
enum zapi_ipset_notify_owner *note);
-
-extern int zapi_nhg_encode(struct stream *s, int cmd, struct zapi_nhg *api_nhg);
-extern int zapi_nhg_decode(struct stream *s, int cmd, struct zapi_nhg *api_nhg);
+/* Nexthop-group message apis */
extern enum zclient_send_status
zclient_nhg_send(struct zclient *zclient, int cmd, struct zapi_nhg *api_nhg);