back to topotato report
topotato coverage report
Current view: top level - zebra - zebra_ptm_redistribute.c (source / functions) Hit Total Coverage
Test: test_pim6_bootstrap.py::PIM6Bootstrap Lines: 0 44 0.0 %
Date: 2023-02-16 02:07:22 Functions: 0 4 0.0 %

          Line data    Source code
       1             : /**
       2             :  * @copyright Copyright (C) 2015 Cumulus Networks, Inc.
       3             :  *
       4             :  * This file is part of GNU Zebra.
       5             :  *
       6             :  * GNU Zebra is free software; you can redistribute it and/or modify it
       7             :  * under the terms of the GNU General Public License as published by the
       8             :  * Free Software Foundation; either version 2, or (at your option) any
       9             :  * later version.
      10             :  *
      11             :  * GNU Zebra is distributed in the hope that it will be useful, but
      12             :  * WITHOUT ANY WARRANTY; without even the implied warranty of
      13             :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      14             :  * General Public License for more details.
      15             :  *
      16             :  * You should have received a copy of the GNU General Public License along
      17             :  * with this program; see the file COPYING; if not, write to the Free Software
      18             :  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
      19             :  */
      20             : 
      21             : #include <zebra.h>
      22             : #include "prefix.h"
      23             : #include "vty.h"
      24             : #include "stream.h"
      25             : #include "zebra/zebra_router.h"
      26             : #include "zebra/zapi_msg.h"
      27             : #include "zebra/zebra_ptm.h"
      28             : #include "zebra/zebra_ptm_redistribute.h"
      29             : 
      30           0 : static int zsend_interface_bfd_update(int cmd, struct zserv *client,
      31             :                                       struct interface *ifp, struct prefix *dp,
      32             :                                       struct prefix *sp, int status,
      33             :                                       vrf_id_t vrf_id)
      34             : {
      35           0 :         int blen;
      36           0 :         struct stream *s;
      37             : 
      38           0 :         s = stream_new(ZEBRA_MAX_PACKET_SIZ);
      39             : 
      40           0 :         zclient_create_header(s, cmd, vrf_id);
      41           0 :         if (ifp)
      42           0 :                 stream_putl(s, ifp->ifindex);
      43             :         else
      44           0 :                 stream_putl(s, 0);
      45             : 
      46             :         /* BFD destination prefix information. */
      47           0 :         stream_putc(s, dp->family);
      48           0 :         blen = prefix_blen(dp);
      49           0 :         stream_put(s, &dp->u.prefix, blen);
      50           0 :         stream_putc(s, dp->prefixlen);
      51             : 
      52             :         /* BFD status */
      53           0 :         stream_putl(s, status);
      54             : 
      55             :         /* BFD source prefix information. */
      56           0 :         stream_putc(s, sp->family);
      57           0 :         blen = prefix_blen(sp);
      58           0 :         stream_put(s, &sp->u.prefix, blen);
      59           0 :         stream_putc(s, sp->prefixlen);
      60             : 
      61             :         /* c-bit bullshit */
      62           0 :         stream_putc(s, 0);
      63             : 
      64             :         /* Write packet size. */
      65           0 :         stream_putw_at(s, 0, stream_get_endp(s));
      66             : 
      67           0 :         client->if_bfd_cnt++;
      68           0 :         return zserv_send_message(client, s);
      69             : }
      70             : 
      71           0 : void zebra_interface_bfd_update(struct interface *ifp, struct prefix *dp,
      72             :                                 struct prefix *sp, int status, vrf_id_t vrf_id)
      73             : {
      74           0 :         struct listnode *node, *nnode;
      75           0 :         struct zserv *client;
      76             : 
      77           0 :         for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode, client)) {
      78           0 :                 if (!IS_BFD_ENABLED_PROTOCOL(client->proto))
      79           0 :                         continue;
      80             : 
      81             :                 /* Notify to the protocol daemons. */
      82           0 :                 zsend_interface_bfd_update(ZEBRA_INTERFACE_BFD_DEST_UPDATE,
      83             :                                            client, ifp, dp, sp, status, vrf_id);
      84             :         }
      85           0 : }
      86             : 
      87           0 : static int zsend_bfd_peer_replay(int cmd, struct zserv *client)
      88             : {
      89           0 :         struct stream *s;
      90             : 
      91           0 :         s = stream_new(ZEBRA_MAX_PACKET_SIZ);
      92             : 
      93           0 :         zclient_create_header(s, cmd, VRF_DEFAULT);
      94             : 
      95             :         /* Write packet size. */
      96           0 :         stream_putw_at(s, 0, stream_get_endp(s));
      97             : 
      98           0 :         client->bfd_peer_replay_cnt++;
      99           0 :         return zserv_send_message(client, s);
     100             : }
     101             : 
     102           0 : void zebra_bfd_peer_replay_req(void)
     103             : {
     104           0 :         struct listnode *node, *nnode;
     105           0 :         struct zserv *client;
     106             : 
     107           0 :         for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode, client)) {
     108           0 :                 if (!IS_BFD_ENABLED_PROTOCOL(client->proto))
     109           0 :                         continue;
     110             : 
     111             :                 /* Notify to the protocol daemons. */
     112           0 :                 zsend_bfd_peer_replay(ZEBRA_BFD_DEST_REPLAY, client);
     113             :         }
     114           0 : }

Generated by: LCOV version v1.16-topotato