]> git.proxmox.com Git - mirror_frr.git/blob - pimd/pim_instance.h
Merge pull request #5145 from Spantik/2796
[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
32 #if defined(HAVE_LINUX_MROUTE_H)
33 #include <linux/mroute.h>
34 #else
35 /*
36 Below: from <linux/mroute.h>
37 */
38
39 #ifndef MAXVIFS
40 #define MAXVIFS (256)
41 #endif
42 #endif
43
44 enum pim_spt_switchover {
45 PIM_SPT_IMMEDIATE,
46 PIM_SPT_INFINITY,
47 };
48
49 struct pim_router {
50 struct thread_master *master;
51
52 uint32_t debugs;
53
54 int t_periodic;
55 struct pim_assert_metric infinite_assert_metric;
56 long rpf_cache_refresh_delay_msec;
57 int32_t register_suppress_time;
58 int packet_process;
59 int32_t register_probe_time;
60
61 /*
62 * What is the default vrf that we work in
63 */
64 vrf_id_t vrf_id;
65
66 enum mlag_role role;
67 };
68
69 /* Per VRF PIM DB */
70 struct pim_instance {
71 vrf_id_t vrf_id;
72 struct vrf *vrf;
73
74 struct {
75 enum pim_spt_switchover switchover;
76 char *plist;
77 } spt;
78
79 struct hash *rpf_hash;
80
81 void *ssm_info; /* per-vrf SSM configuration */
82
83 int send_v6_secondary;
84
85 struct thread *thread;
86 int mroute_socket;
87 int64_t mroute_socket_creation;
88 int64_t mroute_add_events;
89 int64_t mroute_add_last;
90 int64_t mroute_del_events;
91 int64_t mroute_del_last;
92
93 struct interface *regiface;
94
95 // List of static routes;
96 struct list *static_routes;
97
98 // Upstream vrf specific information
99 struct list *upstream_list;
100 struct hash *upstream_hash;
101 struct timer_wheel *upstream_sg_wheel;
102
103 /*
104 * RP information
105 */
106 struct list *rp_list;
107 struct route_table *rp_table;
108
109 int iface_vif_index[MAXVIFS];
110
111 struct list *channel_oil_list;
112 struct hash *channel_oil_hash;
113
114 struct pim_msdp msdp;
115 struct pim_vxlan_instance vxlan;
116
117 struct list *ssmpingd_list;
118 struct in_addr ssmpingd_group_addr;
119
120 unsigned int keep_alive_time;
121 unsigned int rp_keep_alive_time;
122
123 bool ecmp_enable;
124 bool ecmp_rebalance_enable;
125 /* Bsm related */
126 struct bsm_scope global_scope;
127 uint64_t bsm_rcvd;
128 uint64_t bsm_sent;
129 uint64_t bsm_dropped;
130
131 /* If we need to rescan all our upstreams */
132 struct thread *rpf_cache_refresher;
133 int64_t rpf_cache_refresh_requests;
134 int64_t rpf_cache_refresh_events;
135 int64_t rpf_cache_refresh_last;
136 int64_t scan_oil_events;
137 int64_t scan_oil_last;
138
139 int64_t nexthop_lookups;
140 int64_t nexthop_lookups_avoided;
141 int64_t last_route_change_time;
142 };
143
144 void pim_vrf_init(void);
145 void pim_vrf_terminate(void);
146
147 struct pim_instance *pim_get_pim_instance(vrf_id_t vrf_id);
148
149 #endif