back to topotato report
topotato coverage report
Current view: top level - zebra - zebra_mroute.c (source / functions) Hit Total Coverage
Test: test_pim_bfd.py::PIMBFDTest Lines: 0 37 0.0 %
Date: 2023-02-24 18:39:40 Functions: 0 1 0.0 %

          Line data    Source code
       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             : #include "zebra/debug.h"
      34             : 
      35           0 : void zebra_ipmr_route_stats(ZAPI_HANDLER_ARGS)
      36             : {
      37           0 :         struct mcast_route_data mroute;
      38           0 :         struct stream *s;
      39           0 :         int suc = -1;
      40             : 
      41           0 :         memset(&mroute, 0, sizeof(mroute));
      42           0 :         STREAM_GETL(msg, mroute.family);
      43             : 
      44           0 :         switch (mroute.family) {
      45           0 :         case AF_INET:
      46           0 :                 SET_IPADDR_V4(&mroute.src);
      47           0 :                 SET_IPADDR_V4(&mroute.grp);
      48           0 :                 STREAM_GET(&mroute.src.ipaddr_v4, msg,
      49             :                            sizeof(mroute.src.ipaddr_v4));
      50           0 :                 STREAM_GET(&mroute.grp.ipaddr_v4, msg,
      51             :                            sizeof(mroute.grp.ipaddr_v4));
      52             :                 break;
      53           0 :         case AF_INET6:
      54           0 :                 SET_IPADDR_V6(&mroute.src);
      55           0 :                 SET_IPADDR_V6(&mroute.grp);
      56           0 :                 STREAM_GET(&mroute.src.ipaddr_v6, msg,
      57             :                            sizeof(mroute.src.ipaddr_v6));
      58           0 :                 STREAM_GET(&mroute.grp.ipaddr_v6, msg,
      59             :                            sizeof(mroute.grp.ipaddr_v6));
      60             :                 break;
      61           0 :         default:
      62           0 :                 zlog_warn("%s: Invalid address family received while parsing",
      63             :                           __func__);
      64           0 :                 return;
      65             :         }
      66             : 
      67           0 :         STREAM_GETL(msg, mroute.ifindex);
      68             : 
      69           0 :         if (IS_ZEBRA_DEBUG_KERNEL)
      70           0 :                 zlog_debug("Asking for (%pIA,%pIA)[%s(%u)] mroute information",
      71             :                            &mroute.src, &mroute.grp, zvrf->vrf->name,
      72             :                            zvrf->vrf->vrf_id);
      73             : 
      74           0 :         suc = kernel_get_ipmr_sg_stats(zvrf, &mroute);
      75             : 
      76           0 : stream_failure:
      77           0 :         s = stream_new(ZEBRA_MAX_PACKET_SIZ);
      78             : 
      79           0 :         stream_reset(s);
      80             : 
      81           0 :         zclient_create_header(s, ZEBRA_IPMR_ROUTE_STATS, zvrf_id(zvrf));
      82             : 
      83           0 :         if (mroute.family == AF_INET) {
      84           0 :                 stream_write(s, &mroute.src.ipaddr_v4,
      85             :                              sizeof(mroute.src.ipaddr_v4));
      86           0 :                 stream_write(s, &mroute.grp.ipaddr_v4,
      87             :                              sizeof(mroute.grp.ipaddr_v4));
      88             :         } else {
      89           0 :                 stream_write(s, &mroute.src.ipaddr_v6,
      90             :                              sizeof(mroute.src.ipaddr_v6));
      91           0 :                 stream_write(s, &mroute.grp.ipaddr_v6,
      92             :                              sizeof(mroute.grp.ipaddr_v6));
      93             :         }
      94             : 
      95           0 :         stream_put(s, &mroute.lastused, sizeof(mroute.lastused));
      96           0 :         stream_putl(s, (uint32_t)suc);
      97             : 
      98           0 :         stream_putw_at(s, 0, stream_get_endp(s));
      99           0 :         zserv_send_message(client, s);
     100             : }

Generated by: LCOV version v1.16-topotato