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