]> git.proxmox.com Git - mirror_frr.git/blame - pimd/pim_iface.h
*: manual SPDX License ID conversions
[mirror_frr.git] / pimd / pim_iface.h
CommitLineData
12e41d03 1/*
896014f4
DL
2 * PIM for Quagga
3 * Copyright (C) 2008 Everton da Silva Marques
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; see the file COPYING; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
83190a40 18 */
12e41d03
DL
19
20#ifndef PIM_IFACE_H
21#define PIM_IFACE_H
22
23#include <zebra.h>
24
25#include "if.h"
26#include "vty.h"
ba4eb1bc
CS
27#include "vrf.h"
28#include "zclient.h"
37664928 29#include "ferr.h"
12e41d03
DL
30
31#include "pim_igmp.h"
32#include "pim_upstream.h"
ba4eb1bc 33#include "bfd.h"
568b78b5 34#include "pim_str.h"
12e41d03 35
12e41d03
DL
36#define PIM_IF_IS_DELETED(ifp) ((ifp)->ifindex == IFINDEX_INTERNAL)
37
883052c6
DL
38#define PIM_I_am_DR(pim_ifp) \
39 !pim_addr_cmp((pim_ifp)->pim_dr_addr, (pim_ifp)->primary_address)
22c35834 40#define PIM_I_am_DualActive(pim_ifp) (pim_ifp)->activeactive == true
84366c7e 41
79992e8a
MR
42/* Macros for interface flags */
43
44/*
45 * PIM needs to know if hello is required to send before other PIM messages
46 * like Join, prune, assert would go out
47 */
48#define PIM_IF_FLAG_HELLO_SENT (1 << 0)
49
50#define PIM_IF_FLAG_TEST_HELLO_SENT(flags) ((flags)&PIM_IF_FLAG_HELLO_SENT)
51
52#define PIM_IF_FLAG_SET_HELLO_SENT(flags) ((flags) |= PIM_IF_FLAG_HELLO_SENT)
53
54#define PIM_IF_FLAG_UNSET_HELLO_SENT(flags) ((flags) &= ~PIM_IF_FLAG_HELLO_SENT)
55
982bff89 56struct pim_iface_upstream_switch {
568b78b5 57 pim_addr address;
d62a17ae 58 struct list *us;
982bff89
DS
59};
60
7176984f 61enum pim_secondary_addr_flags {
d62a17ae 62 PIM_SEC_ADDRF_NONE = 0,
63 PIM_SEC_ADDRF_STALE = (1 << 0)
7176984f 64};
65
66struct pim_secondary_addr {
d62a17ae 67 struct prefix addr;
68 enum pim_secondary_addr_flags flags;
7176984f 69};
70
5e5034b0
DL
71struct gm_if;
72
12e41d03 73struct pim_interface {
b6fcc0b7
DL
74 bool pim_enable : 1;
75 bool pim_can_disable_join_suppression : 1;
78039cb2 76 bool pim_passive_enable : 1;
b6fcc0b7 77
4fecac21 78 bool gm_enable : 1;
b6fcc0b7 79
d62a17ae 80 ifindex_t mroute_vif_index;
c3bd5a10 81 struct pim_instance *pim;
cfef6155
DL
82
83#if PIM_IPV == 6
84 /* link-locals: MLD uses lowest addr, PIM uses highest... */
85 pim_addr ll_lowest;
86 pim_addr ll_highest;
87#endif
88
12e76340 89 pim_addr primary_address; /* remember addr to detect change */
d62a17ae 90 struct list *sec_addr_list; /* list of struct pim_secondary_addr */
12e76340 91 pim_addr update_source; /* user can statically set the primary
d62a17ae 92 * address of the interface */
18adcff1
SG
93
94 int igmp_version; /* IGMP version */
5e5034b0 95 int mld_version;
18adcff1
SG
96 int gm_default_robustness_variable; /* IGMP or MLD QRV */
97 int gm_default_query_interval; /* IGMP or MLD secs between general
98 queries */
99 int gm_query_max_response_time_dsec; /* IGMP or MLD Max Response Time in
d62a17ae 100 dsecs for general queries */
18adcff1
SG
101 int gm_specific_query_max_response_time_dsec; /* IGMP or MLD Max
102 Response Time in dsecs
103 called as last member
104 query interval, defines
105 the maximum response
106 time advertised in IGMP
107 group-specific
108 queries */
109 int gm_last_member_query_count; /* IGMP or MLD last member
110 query count
111 */
112 struct list *gm_socket_list; /* list of struct IGMP or MLD sock */
113 struct list *gm_join_list; /* list of struct IGMP or MLD join */
114 struct list *gm_group_list; /* list of struct IGMP or MLD group */
115 struct hash *gm_group_hash;
d62a17ae 116
5e5034b0
DL
117 struct gm_if *mld;
118
d62a17ae 119 int pim_sock_fd; /* PIM socket file descriptor */
120 struct thread *t_pim_sock_read; /* thread for reading PIM socket */
121 int64_t pim_sock_creation; /* timestamp of PIM socket creation */
122
123 struct thread *t_pim_hello_timer;
124 int pim_hello_period;
125 int pim_default_holdtime;
126 int pim_triggered_hello_delay;
127 uint32_t pim_generation_id;
128 uint16_t pim_propagation_delay_msec; /* config */
129 uint16_t pim_override_interval_msec; /* config */
130 struct list *pim_neighbor_list; /* list of struct pim_neighbor */
131 struct list *upstream_switch_list;
ad7b74c4 132 struct pim_ifchannel_rb ifchannel_rb;
d62a17ae 133
134 /* neighbors without lan_delay */
135 int pim_number_of_nonlandelay_neighbors;
136 uint16_t pim_neighbors_highest_propagation_delay_msec;
137 uint16_t pim_neighbors_highest_override_interval_msec;
138
139 /* DR Election */
140 int64_t pim_dr_election_last; /* timestamp */
141 int pim_dr_election_count;
142 int pim_dr_election_changes;
12e76340 143 pim_addr pim_dr_addr;
d62a17ae 144 uint32_t pim_dr_priority; /* config */
145 int pim_dr_num_nondrpri_neighbors; /* neighbors without dr_pri */
146
b0f525a8
QY
147 /* boundary prefix-list */
148 char *boundary_oil_plist;
149
414d885a
DS
150 /* Turn on Active-Active for this interface */
151 bool activeactive;
46a9ea8b 152 bool am_i_dr;
414d885a 153
d62a17ae 154 int64_t pim_ifstat_start; /* start timestamp for stats */
8a4dfb5d 155 uint64_t pim_ifstat_bsm_rx;
156 uint64_t pim_ifstat_bsm_tx;
d62a17ae 157 uint32_t pim_ifstat_hello_sent;
158 uint32_t pim_ifstat_hello_sendfail;
159 uint32_t pim_ifstat_hello_recv;
160 uint32_t pim_ifstat_hello_recvfail;
161 uint32_t pim_ifstat_join_recv;
162 uint32_t pim_ifstat_join_send;
163 uint32_t pim_ifstat_prune_recv;
164 uint32_t pim_ifstat_prune_send;
165 uint32_t pim_ifstat_reg_recv;
166 uint32_t pim_ifstat_reg_send;
167 uint32_t pim_ifstat_reg_stop_recv;
168 uint32_t pim_ifstat_reg_stop_send;
169 uint32_t pim_ifstat_assert_recv;
170 uint32_t pim_ifstat_assert_send;
8a4dfb5d 171 uint32_t pim_ifstat_bsm_cfg_miss;
172 uint32_t pim_ifstat_ucast_bsm_cfg_miss;
173 uint32_t pim_ifstat_bsm_invalid_sz;
79992e8a 174 uint8_t flags;
8a4dfb5d 175 bool bsm_enable; /* bsm processing enable */
176 bool ucast_bsm_accept; /* ucast bsm processing */
1f3e6bf5 177
f2058cb4
DA
178 uint32_t igmp_ifstat_joins_sent;
179 uint32_t igmp_ifstat_joins_failed;
3e5d8665 180 uint32_t igmp_peak_group_count;
f2058cb4 181
1f3e6bf5
RZ
182 struct {
183 bool enabled;
184 uint32_t min_rx;
185 uint32_t min_tx;
186 uint8_t detection_multiplier;
745b8d4a 187 char *profile;
1f3e6bf5 188 } bfd_config;
12e41d03
DL
189};
190
191/*
18adcff1
SG
192 * if default_holdtime is set (>= 0), use it;
193 * otherwise default_holdtime is 3.5 * hello_period
12e41d03 194 */
d62a17ae 195#define PIM_IF_DEFAULT_HOLDTIME(pim_ifp) \
196 (((pim_ifp)->pim_default_holdtime < 0) \
197 ? ((pim_ifp)->pim_hello_period * 7 / 2) \
198 : ((pim_ifp)->pim_default_holdtime))
12e41d03 199
f88df3a6
DS
200void pim_if_init(struct pim_instance *pim);
201void pim_if_terminate(struct pim_instance *pim);
12e41d03 202
85a13586 203struct pim_interface *pim_if_new(struct interface *ifp, bool igmp, bool pim,
b1891fa0 204 bool ispimreg, bool is_vxlan_term);
d62a17ae 205void pim_if_delete(struct interface *ifp);
12e41d03
DL
206void pim_if_addr_add(struct connected *ifc);
207void pim_if_addr_del(struct connected *ifc, int force_prim_as_any);
208void pim_if_addr_add_all(struct interface *ifp);
209void pim_if_addr_del_all(struct interface *ifp);
210void pim_if_addr_del_all_igmp(struct interface *ifp);
12e41d03 211
b1891fa0 212int pim_if_add_vif(struct interface *ifp, bool ispimreg, bool is_vxlan_term);
12e41d03 213int pim_if_del_vif(struct interface *ifp);
f88df3a6
DS
214void pim_if_add_vif_all(struct pim_instance *pim);
215void pim_if_del_vif_all(struct pim_instance *pim);
12e41d03 216
7cfc7bcf
DS
217struct interface *pim_if_find_by_vif_index(struct pim_instance *pim,
218 ifindex_t vif_index);
219int pim_if_find_vifindex_by_ifindex(struct pim_instance *pim,
220 ifindex_t ifindex);
12e41d03
DL
221
222int pim_if_lan_delay_enabled(struct interface *ifp);
223uint16_t pim_if_effective_propagation_delay_msec(struct interface *ifp);
224uint16_t pim_if_effective_override_interval_msec(struct interface *ifp);
225uint16_t pim_if_jp_override_interval_msec(struct interface *ifp);
9bb93fa0 226struct pim_neighbor *pim_if_find_neighbor(struct interface *ifp, pim_addr addr);
12e41d03
DL
227
228long pim_if_t_suppressed_msec(struct interface *ifp);
229int pim_if_t_override_msec(struct interface *ifp);
230
034db86b 231pim_addr pim_find_primary_addr(struct interface *ifp);
12e41d03 232
37664928
DS
233ferr_r pim_if_igmp_join_add(struct interface *ifp, struct in_addr group_addr,
234 struct in_addr source_addr);
d62a17ae 235int pim_if_igmp_join_del(struct interface *ifp, struct in_addr group_addr,
12e41d03
DL
236 struct in_addr source_addr);
237
238void pim_if_update_could_assert(struct interface *ifp);
239
9bb93fa0 240void pim_if_assert_on_neighbor_down(struct interface *ifp, pim_addr neigh_addr);
12e41d03
DL
241
242void pim_if_rpf_interface_changed(struct interface *old_rpf_ifp,
243 struct pim_upstream *up);
244
245void pim_if_update_join_desired(struct pim_interface *pim_ifp);
246
247void pim_if_update_assert_tracking_desired(struct interface *ifp);
248
43e40fdf 249void pim_if_create_pimreg(struct pim_instance *pim);
3565202d 250
034db86b
DL
251struct prefix *pim_if_connected_to_source(struct interface *ifp, pim_addr src);
252int pim_update_source_set(struct interface *ifp, pim_addr source);
3fdfd943 253
e55a43d4 254bool pim_if_is_vrf_device(struct interface *ifp);
ad7b74c4
DS
255
256int pim_if_ifchannel_count(struct pim_interface *pim_ifp);
138c5a74 257
6b88faa7 258void pim_iface_init(void);
138c5a74 259
12e41d03 260#endif /* PIM_IFACE_H */