diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-11-10 14:51:34 +0100 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-11-13 20:16:13 +0100 |
commit | ec93aa120e7f1e817cbbe0498a719d5392a049ba (patch) | |
tree | 5a032c21c3dd983adf92fc1dd6f38d1a115f29f9 /zebra/zebra_mroute.c | |
parent | lib: Add STREAM_GETX functions (diff) | |
download | frr-ec93aa120e7f1e817cbbe0498a719d5392a049ba.tar.xz frr-ec93aa120e7f1e817cbbe0498a719d5392a049ba.zip |
lib, zebra: Modify zebra to use STREAM_GET for zapi
This code modifies zebra to use the STREAM_GET functionality.
This will allow zebra to continue functioning in the case of
bad input data from higher level protocols instead of crashing.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'zebra/zebra_mroute.c')
-rw-r--r-- | zebra/zebra_mroute.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/zebra/zebra_mroute.c b/zebra/zebra_mroute.c index 8fa00b83c..519c120a6 100644 --- a/zebra/zebra_mroute.c +++ b/zebra/zebra_mroute.c @@ -37,12 +37,12 @@ int zebra_ipmr_route_stats(struct zserv *client, u_short length, { struct mcast_route_data mroute; struct stream *s; - int suc; + int suc = -1; memset(&mroute, 0, sizeof(mroute)); - stream_get(&mroute.sg.src, client->ibuf, 4); - stream_get(&mroute.sg.grp, client->ibuf, 4); - mroute.ifindex = stream_getl(client->ibuf); + STREAM_GET(&mroute.sg.src, client->ibuf, 4); + STREAM_GET(&mroute.sg.grp, client->ibuf, 4); + STREAM_GETL(client->ibuf, mroute.ifindex); if (IS_ZEBRA_DEBUG_KERNEL) { char sbuf[40]; @@ -56,6 +56,7 @@ int zebra_ipmr_route_stats(struct zserv *client, u_short length, suc = kernel_get_ipmr_sg_stats(zvrf, &mroute); +stream_failure: s = client->obuf; stream_reset(s); |