]> git.proxmox.com Git - mirror_frr.git/blob - pimd/pim_instance.h
yang/lib: add filter model to code
[mirror_frr.git] / pimd / pim_instance.h
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
24 #include <mlag.h>
25
26 #include "pim_str.h"
27 #include "pim_msdp.h"
28 #include "pim_assert.h"
29 #include "pim_bsm.h"
30 #include "pim_vxlan_instance.h"
31 #include "pim_oil.h"
32 #include "pim_upstream.h"
33
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
45
46 enum pim_spt_switchover {
47 PIM_SPT_IMMEDIATE,
48 PIM_SPT_INFINITY,
49 };
50
51 struct pim_router {
52 struct thread_master *master;
53
54 uint32_t debugs;
55
56 int t_periodic;
57 struct pim_assert_metric infinite_assert_metric;
58 long rpf_cache_refresh_delay_msec;
59 int32_t register_suppress_time;
60 int packet_process;
61 int32_t register_probe_time;
62
63 /*
64 * What is the default vrf that we work in
65 */
66 vrf_id_t vrf_id;
67
68 enum mlag_role role;
69 uint32_t pim_mlag_intf_cnt;
70 /* if true we have registered with MLAG */
71 bool mlag_process_register;
72 /* if true local MLAG process reported that it is connected
73 * with the peer MLAG process
74 */
75 bool connected_to_mlag;
76 /* Holds the client data(unencoded) that need to be pushed to MCLAGD*/
77 struct stream_fifo *mlag_fifo;
78 struct stream *mlag_stream;
79 struct thread *zpthread_mlag_write;
80 };
81
82 /* Per VRF PIM DB */
83 struct pim_instance {
84 vrf_id_t vrf_id;
85 struct vrf *vrf;
86
87 struct {
88 enum pim_spt_switchover switchover;
89 char *plist;
90 } spt;
91
92 struct hash *rpf_hash;
93
94 void *ssm_info; /* per-vrf SSM configuration */
95
96 int send_v6_secondary;
97
98 struct thread *thread;
99 int mroute_socket;
100 int64_t mroute_socket_creation;
101 int64_t mroute_add_events;
102 int64_t mroute_add_last;
103 int64_t mroute_del_events;
104 int64_t mroute_del_last;
105
106 struct interface *regiface;
107
108 // List of static routes;
109 struct list *static_routes;
110
111 // Upstream vrf specific information
112 struct rb_pim_upstream_head upstream_head;
113 struct timer_wheel *upstream_sg_wheel;
114
115 /*
116 * RP information
117 */
118 struct list *rp_list;
119 struct route_table *rp_table;
120
121 int iface_vif_index[MAXVIFS];
122
123 struct rb_pim_oil_head channel_oil_head;
124
125 struct pim_msdp msdp;
126 struct pim_vxlan_instance vxlan;
127
128 struct list *ssmpingd_list;
129 struct in_addr ssmpingd_group_addr;
130
131 unsigned int keep_alive_time;
132 unsigned int rp_keep_alive_time;
133
134 bool ecmp_enable;
135 bool ecmp_rebalance_enable;
136 /* No. of Dual active I/fs in pim_instance */
137 uint32_t inst_mlag_intf_cnt;
138
139 /* Bsm related */
140 struct bsm_scope global_scope;
141 uint64_t bsm_rcvd;
142 uint64_t bsm_sent;
143 uint64_t bsm_dropped;
144
145 /* If we need to rescan all our upstreams */
146 struct thread *rpf_cache_refresher;
147 int64_t rpf_cache_refresh_requests;
148 int64_t rpf_cache_refresh_events;
149 int64_t rpf_cache_refresh_last;
150 int64_t scan_oil_events;
151 int64_t scan_oil_last;
152
153 int64_t nexthop_lookups;
154 int64_t nexthop_lookups_avoided;
155 int64_t last_route_change_time;
156 };
157
158 void pim_vrf_init(void);
159 void pim_vrf_terminate(void);
160
161 struct pim_instance *pim_get_pim_instance(vrf_id_t vrf_id);
162
163 #endif