]> git.proxmox.com Git - mirror_frr.git/blob - zebra/zebra_mroute.c
Merge remote-tracking branch 'origin/stable/2.0'
[mirror_frr.git] / zebra / zebra_mroute.c
1 /* zebra_mroute code
2 * Copyright (C) 2016 Cumulus Networks, Inc.
3 * Donald Sharp
4 *
5 * This file is part of Quagga
6 *
7 * Quagga is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2, or (at your option) any
10 * later version.
11 *
12 * Quagga is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; see the file COPYING; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 #include <zebra.h>
23
24 #include "stream.h"
25 #include "prefix.h"
26 #include "vrf.h"
27 #include "rib.h"
28
29 #include "zebra/zserv.h"
30 #include "zebra/zebra_vrf.h"
31 #include "zebra/zebra_mroute.h"
32 #include "zebra/rt.h"
33
34 int
35 zebra_ipmr_route_stats (struct zserv *client, int fd, u_short length, struct zebra_vrf *zvrf)
36 {
37 struct mcast_route_data mroute;
38 struct stream *s;
39 int suc;
40
41 char sbuf[40];
42 char gbuf[40];
43
44 memset (&mroute, 0, sizeof (mroute));
45 stream_get (&mroute.sg.src, client->ibuf, 4);
46 stream_get (&mroute.sg.grp, client->ibuf, 4);
47 mroute.ifindex = stream_getl (client->ibuf);
48
49 strcpy (sbuf, inet_ntoa (mroute.sg.src));
50 strcpy (gbuf, inet_ntoa (mroute.sg.grp));
51
52 suc = kernel_get_ipmr_sg_stats (&mroute);
53
54 s = client->obuf;
55
56 stream_reset (s);
57
58 zserv_create_header (s, ZEBRA_IPMR_ROUTE_STATS, zvrf_id (zvrf));
59 stream_put_in_addr (s, &mroute.sg.src);
60 stream_put_in_addr (s, &mroute.sg.grp);
61 stream_put (s, &mroute.lastused, sizeof (mroute.lastused));
62 stream_putl (s, suc);
63
64 stream_putw_at (s, 0, stream_get_endp (s));
65 zebra_server_send_message (client);
66 return 0;
67 }