zebra: Allow the collection of sg stats on more platforms.

The code to collect the sg stats was written for linux.
Abstract the call to allow it to work on all platforms.
I have not implemented the call for non-linux systems.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2017-01-17 22:01:36 -05:00
parent 8175a54649
commit 1498c0593a
6 changed files with 12 additions and 4 deletions

View file

@ -60,3 +60,5 @@ int kernel_neigh_update (int a, int b, uint32_t c, char *d, int e)
void kernel_init (struct zebra_ns *zns) { return; }
void kernel_terminate (struct zebra_ns *zns) { return; }
void route_read (struct zebra_ns *zns) { return; }
int kernel_get_ipmr_sg_stats (void *m) { return 0; }

View file

@ -40,4 +40,5 @@ extern int kernel_upd_lsp (zebra_lsp_t *);
extern int kernel_del_lsp (zebra_lsp_t *);
extern int mpls_kernel_init (void);
extern int kernel_get_ipmr_sg_stats (void *mroute);
#endif /* _ZEBRA_RT_H */

View file

@ -1526,7 +1526,7 @@ skip:
}
int
netlink_get_ipmr_sg_stats (void *in)
kernel_get_ipmr_sg_stats (void *in)
{
int suc = 0;
struct mcast_route_data *mr = (struct mcast_route_data *)in;

View file

@ -37,7 +37,6 @@ extern int netlink_route_change (struct sockaddr_nl *snl, struct nlmsghdr *h,
ns_id_t ns_id);
extern int netlink_route_read (struct zebra_ns *zns);
extern int netlink_get_ipmr_sg_stats (void *mroute);
#endif /* HAVE_NETLINK */
#endif /* _ZEBRA_RT_NETLINK_H */

View file

@ -416,3 +416,9 @@ kernel_neigh_update (int add, int ifindex, uint32_t addr, char *lla, int llalen)
/* TODO */
return 0;
}
extern void
kernel_get_ipmr_sg_stats (void *mroute)
{
return;
}

View file

@ -30,7 +30,7 @@
#include "zebra/zserv.h"
#include "zebra/zebra_vrf.h"
#include "zebra/zebra_mroute.h"
#include "zebra/rt_netlink.h"
#include "zebra/rt.h"
int
zebra_ipmr_route_stats (struct zserv *client, int fd, u_short length, struct zebra_vrf *zvrf)
@ -50,7 +50,7 @@ zebra_ipmr_route_stats (struct zserv *client, int fd, u_short length, struct zeb
strcpy (sbuf, inet_ntoa (mroute.sg.src));
strcpy (gbuf, inet_ntoa (mroute.sg.grp));
suc = netlink_get_ipmr_sg_stats (&mroute);
suc = kernel_get_ipmr_sg_stats (&mroute);
s = client->obuf;