2 * @copyright Copyright (C) 2015 Cumulus Networks, Inc.
4 * This file is part of GNU Zebra.
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
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.
16 * You should have received a copy of the GNU General Public License
17 * along with GNU Zebra; see the file COPYING. If not, write to the Free
18 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
26 #include "zebra/zserv.h"
27 #include "zebra/zebra_ptm_redistribute.h"
29 /* master zebra server structure */
30 extern struct zebra_t zebrad
;
33 zsend_interface_bfd_update (int cmd
, struct zserv
*client
,
34 struct interface
*ifp
, struct prefix
*dp
,
40 /* Check this client need interface information. */
47 zserv_create_header (s
, cmd
);
49 stream_putl (s
, ifp
->ifindex
);
53 /* BFD destination prefix information. */
54 stream_putc (s
, dp
->family
);
55 blen
= prefix_blen (dp
);
56 stream_put (s
, &dp
->u
.prefix
, blen
);
57 stream_putc (s
, dp
->prefixlen
);
59 /* BFD source prefix information. */
60 stream_putc (s
, sp
->family
);
61 blen
= prefix_blen (sp
);
62 stream_put (s
, &sp
->u
.prefix
, blen
);
63 stream_putc (s
, sp
->prefixlen
);
65 /* Write packet size. */
66 stream_putw_at (s
, 0, stream_get_endp (s
));
69 return zebra_server_send_message(client
);
73 zebra_interface_bfd_update (struct interface
*ifp
, struct prefix
*dp
,
76 struct listnode
*node
, *nnode
;
79 for (ALL_LIST_ELEMENTS (zebrad
.client_list
, node
, nnode
, client
))
81 /* Supporting for OSPF and BGP */
82 if (client
->proto
!= ZEBRA_ROUTE_OSPF
&& client
->proto
!= ZEBRA_ROUTE_BGP
83 && client
->proto
!= ZEBRA_ROUTE_OSPF6
)
86 /* Notify to the protocol daemons. */
87 zsend_interface_bfd_update (ZEBRA_INTERFACE_BFD_DEST_DOWN
, client
, ifp
,
93 zsend_bfd_peer_replay (int cmd
, struct zserv
*client
)
100 zserv_create_header (s
, cmd
);
102 /* Write packet size. */
103 stream_putw_at (s
, 0, stream_get_endp (s
));
105 client
->bfd_peer_replay_cnt
++;
106 return zebra_server_send_message(client
);
110 zebra_bfd_peer_replay_req (void)
112 struct listnode
*node
, *nnode
;
113 struct zserv
*client
;
115 for (ALL_LIST_ELEMENTS (zebrad
.client_list
, node
, nnode
, client
))
117 /* Supporting for BGP */
118 if ((client
->proto
!= ZEBRA_ROUTE_BGP
) &&
119 (client
->proto
!= ZEBRA_ROUTE_OSPF
) &&
120 (client
->proto
!= ZEBRA_ROUTE_OSPF6
))
123 /* Notify to the protocol daemons. */
124 zsend_bfd_peer_replay (ZEBRA_BFD_DEST_REPLAY
, client
);