]> git.proxmox.com Git - mirror_frr.git/blame - zebra/zebra_mroute.c
pimd: Note when a S,G stream should be a FHR as well
[mirror_frr.git] / zebra / zebra_mroute.c
CommitLineData
e3be0432
DS
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
18 * along with GNU Zebra; see the file COPYING. If not, write to the Free
19 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
20 * 02111-1307, USA.
21 */
22
23#include <zebra.h>
24
25#include "stream.h"
26#include "prefix.h"
27#include "vrf.h"
28#include "rib.h"
29
30#include "zebra/zserv.h"
31#include "zebra/zebra_vrf.h"
32#include "zebra/zebra_mroute.h"
1498c059 33#include "zebra/rt.h"
e3be0432
DS
34
35int
36zebra_ipmr_route_stats (struct zserv *client, int fd, u_short length, struct zebra_vrf *zvrf)
37{
38 struct mcast_route_data mroute;
39 struct stream *s;
9a5aa742 40 int suc;
e3be0432
DS
41
42 char sbuf[40];
43 char gbuf[40];
44
45 memset (&mroute, 0, sizeof (mroute));
46 stream_get (&mroute.sg.src, client->ibuf, 4);
47 stream_get (&mroute.sg.grp, client->ibuf, 4);
48 mroute.ifindex = stream_getl (client->ibuf);
49
50 strcpy (sbuf, inet_ntoa (mroute.sg.src));
51 strcpy (gbuf, inet_ntoa (mroute.sg.grp));
52
1498c059 53 suc = kernel_get_ipmr_sg_stats (&mroute);
e3be0432
DS
54
55 s = client->obuf;
56
57 stream_reset (s);
58
59 zserv_create_header (s, ZEBRA_IPMR_ROUTE_STATS, zvrf_id (zvrf));
60 stream_put_in_addr (s, &mroute.sg.src);
61 stream_put_in_addr (s, &mroute.sg.grp);
62 stream_put (s, &mroute.lastused, sizeof (mroute.lastused));
9a5aa742 63 stream_putl (s, suc);
e3be0432
DS
64
65 stream_putw_at (s, 0, stream_get_endp (s));
66 zebra_server_send_message (client);
67 return 0;
68}