summaryrefslogtreecommitdiffstats
path: root/zebra/zebra_mroute.c
diff options
context:
space:
mode:
authorMobashshera Rasool <mrasool@vmware.com>2022-04-04 12:17:32 +0200
committerMobashshera Rasool <mrasool@vmware.com>2022-04-28 10:10:49 +0200
commit51f4fd9810333976fc307e53bf2440b86f036f7e (patch)
treefae0054348140480ab88177d76beb1399a11f5aa /zebra/zebra_mroute.c
parentzebra: Modify base code to get ipv6 stats from kernel (diff)
downloadfrr-51f4fd9810333976fc307e53bf2440b86f036f7e.tar.xz
frr-51f4fd9810333976fc307e53bf2440b86f036f7e.zip
zebra, pimd: Add a field family in the message ZEBRA_IPMR_ROUTE_STATS
1. Adding a field family in the existing ZEBRA_IPMR_ROUTE_STATS to get the ipv4 as well as ipv6 trafic stats between pim and zebra. 2. Modify the debug to print both v4/v6 prefixes pimd: pim6d: Modify pim_zlookup_sg_statistics to get ipv6 stats Modify the pim_zlookup_sg_statistics api to get ipv4/ipv6 stats from zebra. Making the api common. Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
Diffstat (limited to 'zebra/zebra_mroute.c')
-rw-r--r--zebra/zebra_mroute.c48
1 files changed, 41 insertions, 7 deletions
diff --git a/zebra/zebra_mroute.c b/zebra/zebra_mroute.c
index d9a94bb0c..5d38c3790 100644
--- a/zebra/zebra_mroute.c
+++ b/zebra/zebra_mroute.c
@@ -39,14 +39,37 @@ void zebra_ipmr_route_stats(ZAPI_HANDLER_ARGS)
int suc = -1;
memset(&mroute, 0, sizeof(mroute));
- STREAM_GET(&mroute.src.ipaddr_v4, msg, 4);
- STREAM_GET(&mroute.grp.ipaddr_v4, msg, 4);
+ STREAM_GETL(msg, mroute.family);
+
+ switch (mroute.family) {
+ case AF_INET:
+ SET_IPADDR_V4(&mroute.src);
+ SET_IPADDR_V4(&mroute.grp);
+ STREAM_GET(&mroute.src.ipaddr_v4, msg,
+ sizeof(mroute.src.ipaddr_v4));
+ STREAM_GET(&mroute.grp.ipaddr_v4, msg,
+ sizeof(mroute.grp.ipaddr_v4));
+ break;
+ case AF_INET6:
+ SET_IPADDR_V6(&mroute.src);
+ SET_IPADDR_V6(&mroute.grp);
+ STREAM_GET(&mroute.src.ipaddr_v6, msg,
+ sizeof(mroute.src.ipaddr_v6));
+ STREAM_GET(&mroute.grp.ipaddr_v6, msg,
+ sizeof(mroute.grp.ipaddr_v6));
+ break;
+ default:
+ zlog_warn("%s: Invalid address family received while parsing",
+ __func__);
+ return;
+ }
+
STREAM_GETL(msg, mroute.ifindex);
if (IS_ZEBRA_DEBUG_KERNEL)
- zlog_debug("Asking for (%pI4,%pI4)[%s(%u)] mroute information",
- &mroute.src.ipaddr_v4, &mroute.grp.ipaddr_v4,
- zvrf->vrf->name, zvrf->vrf->vrf_id);
+ zlog_debug("Asking for (%pIA,%pIA)[%s(%u)] mroute information",
+ &mroute.src, &mroute.grp, zvrf->vrf->name,
+ zvrf->vrf->vrf_id);
suc = kernel_get_ipmr_sg_stats(zvrf, &mroute);
@@ -56,8 +79,19 @@ stream_failure:
stream_reset(s);
zclient_create_header(s, ZEBRA_IPMR_ROUTE_STATS, zvrf_id(zvrf));
- stream_put_in_addr(s, &mroute.src.ipaddr_v4);
- stream_put_in_addr(s, &mroute.grp.ipaddr_v4);
+
+ if (mroute.family == AF_INET) {
+ stream_write(s, &mroute.src.ipaddr_v4,
+ sizeof(mroute.src.ipaddr_v4));
+ stream_write(s, &mroute.grp.ipaddr_v4,
+ sizeof(mroute.grp.ipaddr_v4));
+ } else {
+ stream_write(s, &mroute.src.ipaddr_v6,
+ sizeof(mroute.src.ipaddr_v6));
+ stream_write(s, &mroute.grp.ipaddr_v6,
+ sizeof(mroute.grp.ipaddr_v6));
+ }
+
stream_put(s, &mroute.lastused, sizeof(mroute.lastused));
stream_putl(s, (uint32_t)suc);