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