]> git.proxmox.com Git - mirror_frr.git/blame - pimd/pim_instance.h
Merge pull request #9496 from idryzhov/vrf-cmd-init-unused-arg
[mirror_frr.git] / pimd / pim_instance.h
CommitLineData
c2cf4b02
DS
1/*
2 * PIM for FRR - PIM Instance
3 * Copyright (C) 2017 Cumulus Networks, Inc.
4 * Donald Sharp
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program 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
17 * along with this program; see the file COPYING; if not, write to the
18 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
19 * MA 02110-1301 USA
20 */
21#ifndef __PIM_INSTANCE_H__
22#define __PIM_INSTANCE_H__
23
d6749d74
DS
24#include <mlag.h>
25
2ad78035
DS
26#include "pim_str.h"
27#include "pim_msdp.h"
d17612dd 28#include "pim_assert.h"
361b5843 29#include "pim_bsm.h"
b583b035 30#include "pim_vxlan_instance.h"
7315ecda 31#include "pim_oil.h"
dd3364cb 32#include "pim_upstream.h"
2ad78035 33
f88df3a6
DS
34#if defined(HAVE_LINUX_MROUTE_H)
35#include <linux/mroute.h>
36#else
37/*
38 Below: from <linux/mroute.h>
39*/
40
41#ifndef MAXVIFS
42#define MAXVIFS (256)
43#endif
44#endif
d17612dd 45
c2cf4b02
DS
46enum pim_spt_switchover {
47 PIM_SPT_IMMEDIATE,
48 PIM_SPT_INFINITY,
49};
50
05ca004b
AK
51/* stats for updates rxed from the MLAG component during the life of a
52 * session
53 */
54struct pim_mlag_msg_stats {
55 uint32_t mroute_add_rx;
56 uint32_t mroute_add_tx;
57 uint32_t mroute_del_rx;
58 uint32_t mroute_del_tx;
59 uint32_t mlag_status_updates;
60 uint32_t pim_status_updates;
61 uint32_t vxlan_updates;
62 uint32_t peer_zebra_status_updates;
63};
64
65struct pim_mlag_stats {
66 /* message stats are reset when the connection to mlagd flaps */
67 struct pim_mlag_msg_stats msg;
68 uint32_t mlagd_session_downs;
69 uint32_t peer_session_downs;
70 uint32_t peer_zebra_downs;
71};
72
73enum pim_mlag_flags {
74 PIM_MLAGF_NONE = 0,
75 /* connection to the local MLAG daemon is up */
76 PIM_MLAGF_LOCAL_CONN_UP = (1 << 0),
77 /* connection to the MLAG daemon on the peer switch is up. note
78 * that there is no direct connection between FRR and the peer MLAG
79 * daemon. this is just a peer-session status provided by the local
80 * MLAG daemon.
81 */
82 PIM_MLAGF_PEER_CONN_UP = (1 << 1),
83 /* status update rxed from the local daemon */
84 PIM_MLAGF_STATUS_RXED = (1 << 2),
85 /* initial dump of data done post peerlink flap */
86 PIM_MLAGF_PEER_REPLAY_DONE = (1 << 3),
87 /* zebra is up on the peer */
88 PIM_MLAGF_PEER_ZEBRA_UP = (1 << 4)
89};
90
36417fcc
DS
91struct pim_router {
92 struct thread_master *master;
046b1aa7
DS
93
94 uint32_t debugs;
5b45753e
DS
95
96 int t_periodic;
d17612dd 97 struct pim_assert_metric infinite_assert_metric;
da03883e 98 long rpf_cache_refresh_delay_msec;
e8b7548c 99 uint32_t register_suppress_time;
75373cca 100 int packet_process;
e8b7548c 101 uint32_t register_probe_time;
4dfe9ad2
DS
102
103 /*
104 * What is the default vrf that we work in
105 */
106 vrf_id_t vrf_id;
d6749d74 107
05ca004b 108 enum mlag_role mlag_role;
36b5b98f
SK
109 uint32_t pim_mlag_intf_cnt;
110 /* if true we have registered with MLAG */
111 bool mlag_process_register;
112 /* if true local MLAG process reported that it is connected
113 * with the peer MLAG process
114 */
115 bool connected_to_mlag;
116 /* Holds the client data(unencoded) that need to be pushed to MCLAGD*/
117 struct stream_fifo *mlag_fifo;
118 struct stream *mlag_stream;
119 struct thread *zpthread_mlag_write;
05ca004b
AK
120 struct in_addr anycast_vtep_ip;
121 struct in_addr local_vtep_ip;
122 struct pim_mlag_stats mlag_stats;
123 enum pim_mlag_flags mlag_flags;
124 char peerlink_rif[INTERFACE_NAMSIZ];
125 struct interface *peerlink_rif_p;
36417fcc
DS
126};
127
c2cf4b02
DS
128/* Per VRF PIM DB */
129struct pim_instance {
d3cc1e45 130 // vrf_id_t vrf_id;
c2cf4b02
DS
131 struct vrf *vrf;
132
133 struct {
134 enum pim_spt_switchover switchover;
135 char *plist;
136 } spt;
137
f4e74bd0
DS
138 /* The name of the register-accept prefix-list */
139 char *register_plist;
140
c2cf4b02
DS
141 struct hash *rpf_hash;
142
143 void *ssm_info; /* per-vrf SSM configuration */
144
145 int send_v6_secondary;
146
147 struct thread *thread;
148 int mroute_socket;
149 int64_t mroute_socket_creation;
150 int64_t mroute_add_events;
151 int64_t mroute_add_last;
152 int64_t mroute_del_events;
153 int64_t mroute_del_last;
154
155 struct interface *regiface;
4e0bc0f0
DS
156
157 // List of static routes;
158 struct list *static_routes;
9b29ea95
DS
159
160 // Upstream vrf specific information
dd3364cb 161 struct rb_pim_upstream_head upstream_head;
9b29ea95 162 struct timer_wheel *upstream_sg_wheel;
d9c9a9ee 163
89b68082
DS
164 /*
165 * RP information
166 */
d9c9a9ee 167 struct list *rp_list;
89b68082 168 struct route_table *rp_table;
f88df3a6 169
f88df3a6 170 int iface_vif_index[MAXVIFS];
ccf696e8 171 int mcast_if_count;
611925dc 172
7315ecda 173 struct rb_pim_oil_head channel_oil_head;
2ad78035
DS
174
175 struct pim_msdp msdp;
b583b035 176 struct pim_vxlan_instance vxlan;
71ad9915
DS
177
178 struct list *ssmpingd_list;
179 struct in_addr ssmpingd_group_addr;
19b807ca 180
339f7695 181 unsigned int igmp_group_count;
182 unsigned int igmp_watermark_limit;
19b807ca
DS
183 unsigned int keep_alive_time;
184 unsigned int rp_keep_alive_time;
da11e325 185
4795fff7
DS
186 bool ecmp_enable;
187 bool ecmp_rebalance_enable;
36b5b98f
SK
188 /* No. of Dual active I/fs in pim_instance */
189 uint32_t inst_mlag_intf_cnt;
190
361b5843 191 /* Bsm related */
192 struct bsm_scope global_scope;
193 uint64_t bsm_rcvd;
194 uint64_t bsm_sent;
195 uint64_t bsm_dropped;
4795fff7 196
da11e325
DS
197 /* If we need to rescan all our upstreams */
198 struct thread *rpf_cache_refresher;
bfc92019
DS
199 int64_t rpf_cache_refresh_requests;
200 int64_t rpf_cache_refresh_events;
201 int64_t rpf_cache_refresh_last;
202 int64_t scan_oil_events;
203 int64_t scan_oil_last;
204
205 int64_t nexthop_lookups;
206 int64_t nexthop_lookups_avoided;
207 int64_t last_route_change_time;
c2cf4b02
DS
208};
209
210void pim_vrf_init(void);
211void pim_vrf_terminate(void);
212
213struct pim_instance *pim_get_pim_instance(vrf_id_t vrf_id);
214
215#endif