]> git.proxmox.com Git - mirror_frr.git/blob - pimd/pim_upstream.h
Merge pull request #13060 from opensourcerouting/feature/allow_peering_with_127.0.0.1
[mirror_frr.git] / pimd / pim_upstream.h
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * PIM for Quagga
4 * Copyright (C) 2008 Everton da Silva Marques
5 */
6
7 #ifndef PIM_UPSTREAM_H
8 #define PIM_UPSTREAM_H
9
10 #include <zebra.h>
11 #include <prefix.h>
12 #include "plist.h"
13
14 #include "pim_rpf.h"
15 #include "pim_str.h"
16 #include "pim_ifchannel.h"
17
18 #define PIM_UPSTREAM_FLAG_MASK_DR_JOIN_DESIRED (1 << 0)
19 #define PIM_UPSTREAM_FLAG_MASK_DR_JOIN_DESIRED_UPDATED (1 << 1)
20 #define PIM_UPSTREAM_FLAG_MASK_FHR (1 << 2)
21 #define PIM_UPSTREAM_FLAG_MASK_SRC_IGMP (1 << 3)
22 #define PIM_UPSTREAM_FLAG_MASK_SRC_PIM (1 << 4)
23 #define PIM_UPSTREAM_FLAG_MASK_SRC_STREAM (1 << 5)
24 #define PIM_UPSTREAM_FLAG_MASK_SRC_MSDP (1 << 6)
25 #define PIM_UPSTREAM_FLAG_MASK_SEND_SG_RPT_PRUNE (1 << 7)
26 #define PIM_UPSTREAM_FLAG_MASK_SRC_LHR (1 << 8)
27 /* In the case of pim vxlan we prime the pump by registering the
28 * vxlan source and keeping the SPT (FHR-RP) alive by sending periodic
29 * NULL registers. So we need to prevent KAT expiry because of the
30 * lack of BUM traffic.
31 */
32 #define PIM_UPSTREAM_FLAG_MASK_DISABLE_KAT_EXPIRY (1 << 9)
33 /* for pim vxlan we need to pin the IIF to lo or MLAG-ISL on the
34 * originating VTEP. This flag allows that by setting IIF to the
35 * value specified and preventing next-hop-tracking on the entry
36 */
37 #define PIM_UPSTREAM_FLAG_MASK_STATIC_IIF (1 << 10)
38 #define PIM_UPSTREAM_FLAG_MASK_ALLOW_IIF_IN_OIL (1 << 11)
39 /* Disable pimreg encasulation for a flow */
40 #define PIM_UPSTREAM_FLAG_MASK_NO_PIMREG_DATA (1 << 12)
41 /* For some MDTs we need to register the router as a source even
42 * if the not DR or directly connected on the IIF. This is typically
43 * needed on a VxLAN-AA (MLAG) setup.
44 */
45 #define PIM_UPSTREAM_FLAG_MASK_FORCE_PIMREG (1 << 13)
46 /* VxLAN origination mroute - SG was registered by EVPN where S is the
47 * local VTEP IP and G is the BUM multicast group address
48 */
49 #define PIM_UPSTREAM_FLAG_MASK_SRC_VXLAN_ORIG (1 << 14)
50 /* VxLAN termination mroute - *G entry where G is the BUM multicast group
51 * address
52 */
53 #define PIM_UPSTREAM_FLAG_MASK_SRC_VXLAN_TERM (1 << 15)
54 /* MLAG mroute - synced to the MLAG peer and subject to DF (designated
55 * forwarder) election
56 */
57 #define PIM_UPSTREAM_FLAG_MASK_MLAG_VXLAN (1 << 16)
58 /* MLAG mroute that lost the DF election with peer and is installed in
59 * a dormant state i.e. MLAG OIFs are removed from the MFC.
60 * In most cases the OIL is empty (but not not always) simply
61 * blackholing the traffic pulled down to the LHR.
62 */
63 #define PIM_UPSTREAM_FLAG_MASK_MLAG_NON_DF (1 << 17)
64 /* MLAG mroute rxed from the peer MLAG switch */
65 #define PIM_UPSTREAM_FLAG_MASK_MLAG_PEER (1 << 18)
66 /*
67 * We are creating a non-joined upstream data structure
68 * for this S,G as that we want to have a channel oil
69 * associated with an upstream
70 */
71 #define PIM_UPSTREAM_FLAG_MASK_SRC_NOCACHE (1 << 19)
72 /* By default as SG entry will use the SPT for forwarding traffic
73 * unless it was setup as a result of a Prune(S,G,rpt) from a
74 * downstream router and has JoinDesired(S,G) as False.
75 * This flag is only relevant for (S,G) entries.
76 */
77 #define PIM_UPSTREAM_FLAG_MASK_USE_RPT (1 << 20)
78 /* PIM Syncs upstream entries to peer Nodes via MLAG in 2 cases.
79 * one is to support plain PIM Redundancy and another one is to support
80 * PIM REdundancy.
81 */
82 #define PIM_UPSTREAM_FLAG_MASK_MLAG_INTERFACE (1 << 21)
83
84
85 #define PIM_UPSTREAM_FLAG_ALL 0xFFFFFFFF
86
87 #define PIM_UPSTREAM_FLAG_TEST_DR_JOIN_DESIRED(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_DR_JOIN_DESIRED)
88 #define PIM_UPSTREAM_FLAG_TEST_DR_JOIN_DESIRED_UPDATED(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_DR_JOIN_DESIRED_UPDATED)
89 #define PIM_UPSTREAM_FLAG_TEST_FHR(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_FHR)
90 #define PIM_UPSTREAM_FLAG_TEST_SRC_IGMP(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_SRC_IGMP)
91 #define PIM_UPSTREAM_FLAG_TEST_SRC_PIM(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_SRC_PIM)
92 #define PIM_UPSTREAM_FLAG_TEST_SRC_STREAM(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_SRC_STREAM)
93 #define PIM_UPSTREAM_FLAG_TEST_SRC_MSDP(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_SRC_MSDP)
94 #define PIM_UPSTREAM_FLAG_TEST_SEND_SG_RPT_PRUNE(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_SEND_SG_RPT_PRUNE)
95 #define PIM_UPSTREAM_FLAG_TEST_SRC_LHR(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_SRC_LHR)
96 #define PIM_UPSTREAM_FLAG_TEST_DISABLE_KAT_EXPIRY(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_DISABLE_KAT_EXPIRY)
97 #define PIM_UPSTREAM_FLAG_TEST_STATIC_IIF(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_STATIC_IIF)
98 #define PIM_UPSTREAM_FLAG_TEST_ALLOW_IIF_IN_OIL(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_ALLOW_IIF_IN_OIL)
99 #define PIM_UPSTREAM_FLAG_TEST_NO_PIMREG_DATA(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_NO_PIMREG_DATA)
100 #define PIM_UPSTREAM_FLAG_TEST_FORCE_PIMREG(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_FORCE_PIMREG)
101 #define PIM_UPSTREAM_FLAG_TEST_SRC_VXLAN_ORIG(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_SRC_VXLAN_ORIG)
102 #define PIM_UPSTREAM_FLAG_TEST_SRC_VXLAN_TERM(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_SRC_VXLAN_TERM)
103 #define PIM_UPSTREAM_FLAG_TEST_SRC_VXLAN(flags) ((flags) & (PIM_UPSTREAM_FLAG_MASK_SRC_VXLAN_ORIG | PIM_UPSTREAM_FLAG_MASK_SRC_VXLAN_TERM))
104 #define PIM_UPSTREAM_FLAG_TEST_MLAG_VXLAN(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_MLAG_VXLAN)
105 #define PIM_UPSTREAM_FLAG_TEST_MLAG_NON_DF(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_MLAG_NON_DF)
106 #define PIM_UPSTREAM_FLAG_TEST_MLAG_PEER(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_MLAG_PEER)
107 #define PIM_UPSTREAM_FLAG_TEST_SRC_NOCACHE(flags) ((flags) &PIM_UPSTREAM_FLAG_MASK_SRC_NOCACHE)
108 #define PIM_UPSTREAM_FLAG_TEST_USE_RPT(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_USE_RPT)
109 #define PIM_UPSTREAM_FLAG_TEST_CAN_BE_LHR(flags) ((flags) & (PIM_UPSTREAM_FLAG_MASK_SRC_IGMP | PIM_UPSTREAM_FLAG_MASK_SRC_VXLAN_TERM))
110 #define PIM_UPSTREAM_FLAG_TEST_MLAG_INTERFACE(flags) ((flags)&PIM_UPSTREAM_FLAG_MASK_MLAG_INTERFACE)
111
112 #define PIM_UPSTREAM_FLAG_SET_DR_JOIN_DESIRED(flags) ((flags) |= PIM_UPSTREAM_FLAG_MASK_DR_JOIN_DESIRED)
113 #define PIM_UPSTREAM_FLAG_SET_DR_JOIN_DESIRED_UPDATED(flags) ((flags) |= PIM_UPSTREAM_FLAG_MASK_DR_JOIN_DESIRED_UPDATED)
114 #define PIM_UPSTREAM_FLAG_SET_FHR(flags) ((flags) |= PIM_UPSTREAM_FLAG_MASK_FHR)
115 #define PIM_UPSTREAM_FLAG_SET_SRC_IGMP(flags) ((flags) |= PIM_UPSTREAM_FLAG_MASK_SRC_IGMP)
116 #define PIM_UPSTREAM_FLAG_SET_SRC_PIM(flags) ((flags) |= PIM_UPSTREAM_FLAG_MASK_SRC_PIM)
117 #define PIM_UPSTREAM_FLAG_SET_SRC_STREAM(flags) ((flags) |= PIM_UPSTREAM_FLAG_MASK_SRC_STREAM)
118 #define PIM_UPSTREAM_FLAG_SET_SRC_MSDP(flags) ((flags) |= PIM_UPSTREAM_FLAG_MASK_SRC_MSDP)
119 #define PIM_UPSTREAM_FLAG_SET_SEND_SG_RPT_PRUNE(flags) ((flags) |= PIM_UPSTREAM_FLAG_MASK_SEND_SG_RPT_PRUNE)
120 #define PIM_UPSTREAM_FLAG_SET_SRC_LHR(flags) ((flags) |= PIM_UPSTREAM_FLAG_MASK_SRC_LHR)
121 #define PIM_UPSTREAM_FLAG_SET_DISABLE_KAT_EXPIRY(flags) ((flags) |= PIM_UPSTREAM_FLAG_MASK_DISABLE_KAT_EXPIRY)
122 #define PIM_UPSTREAM_FLAG_SET_STATIC_IIF(flags) ((flags) |= PIM_UPSTREAM_FLAG_MASK_STATIC_IIF)
123 #define PIM_UPSTREAM_FLAG_SET_ALLOW_IIF_IN_OIL(flags) ((flags) |= PIM_UPSTREAM_FLAG_MASK_ALLOW_IIF_IN_OIL)
124 #define PIM_UPSTREAM_FLAG_SET_NO_PIMREG_DATA(flags) ((flags) |= PIM_UPSTREAM_FLAG_MASK_NO_PIMREG_DATA)
125 #define PIM_UPSTREAM_FLAG_SET_FORCE_PIMREG(flags) ((flags) |= PIM_UPSTREAM_FLAG_MASK_FORCE_PIMREG)
126 #define PIM_UPSTREAM_FLAG_SET_SRC_VXLAN_ORIG(flags) ((flags) |= PIM_UPSTREAM_FLAG_MASK_SRC_VXLAN_ORIG)
127 #define PIM_UPSTREAM_FLAG_SET_SRC_VXLAN_TERM(flags) ((flags) |= PIM_UPSTREAM_FLAG_MASK_SRC_VXLAN_TERM)
128 #define PIM_UPSTREAM_FLAG_SET_MLAG_VXLAN(flags) ((flags) |= PIM_UPSTREAM_FLAG_MASK_MLAG_VXLAN)
129 #define PIM_UPSTREAM_FLAG_SET_MLAG_NON_DF(flags) ((flags) |= PIM_UPSTREAM_FLAG_MASK_MLAG_NON_DF)
130 #define PIM_UPSTREAM_FLAG_SET_MLAG_PEER(flags) ((flags) |= PIM_UPSTREAM_FLAG_MASK_MLAG_PEER)
131 #define PIM_UPSTREAM_FLAG_SET_USE_RPT(flags) ((flags) |= PIM_UPSTREAM_FLAG_MASK_USE_RPT)
132 #define PIM_UPSTREAM_FLAG_SET_MLAG_INTERFACE(flags) ((flags) |= PIM_UPSTREAM_FLAG_MASK_MLAG_INTERFACE)
133
134 #define PIM_UPSTREAM_FLAG_UNSET_DR_JOIN_DESIRED(flags) ((flags) &= ~PIM_UPSTREAM_FLAG_MASK_DR_JOIN_DESIRED)
135 #define PIM_UPSTREAM_FLAG_UNSET_DR_JOIN_DESIRED_UPDATED(flags) ((flags) &= ~PIM_UPSTREAM_FLAG_MASK_DR_JOIN_DESIRED_UPDATED)
136 #define PIM_UPSTREAM_FLAG_UNSET_FHR(flags) ((flags) &= ~PIM_UPSTREAM_FLAG_MASK_FHR)
137 #define PIM_UPSTREAM_FLAG_UNSET_SRC_IGMP(flags) ((flags) &= ~PIM_UPSTREAM_FLAG_MASK_SRC_IGMP)
138 #define PIM_UPSTREAM_FLAG_UNSET_SRC_PIM(flags) ((flags) &= ~PIM_UPSTREAM_FLAG_MASK_SRC_PIM)
139 #define PIM_UPSTREAM_FLAG_UNSET_SRC_STREAM(flags) ((flags) &= ~PIM_UPSTREAM_FLAG_MASK_SRC_STREAM)
140 #define PIM_UPSTREAM_FLAG_UNSET_SRC_MSDP(flags) ((flags) &= ~PIM_UPSTREAM_FLAG_MASK_SRC_MSDP)
141 #define PIM_UPSTREAM_FLAG_UNSET_SEND_SG_RPT_PRUNE(flags) ((flags) &= ~PIM_UPSTREAM_FLAG_MASK_SEND_SG_RPT_PRUNE)
142 #define PIM_UPSTREAM_FLAG_UNSET_SRC_LHR(flags) ((flags) &= ~PIM_UPSTREAM_FLAG_MASK_SRC_LHR)
143 #define PIM_UPSTREAM_FLAG_UNSET_DISABLE_KAT_EXPIRY(flags) ((flags) &= ~PIM_UPSTREAM_FLAG_MASK_DISABLE_KAT_EXPIRY)
144 #define PIM_UPSTREAM_FLAG_UNSET_STATIC_IIF(flags) ((flags) &= ~PIM_UPSTREAM_FLAG_MASK_STATIC_IIF)
145 #define PIM_UPSTREAM_FLAG_UNSET_ALLOW_IIF_IN_OIL(flags) ((flags) &= ~PIM_UPSTREAM_FLAG_MASK_ALLOW_IIF_IN_OIL)
146 #define PIM_UPSTREAM_FLAG_UNSET_NO_PIMREG_DATA(flags) ((flags) &= ~PIM_UPSTREAM_FLAG_MASK_NO_PIMREG_DATA)
147 #define PIM_UPSTREAM_FLAG_UNSET_FORCE_PIMREG(flags) ((flags) &= ~PIM_UPSTREAM_FLAG_MASK_FORCE_PIMREG)
148 #define PIM_UPSTREAM_FLAG_UNSET_SRC_VXLAN_ORIG(flags) ((flags) &= ~PIM_UPSTREAM_FLAG_MASK_SRC_VXLAN_ORIG)
149 #define PIM_UPSTREAM_FLAG_UNSET_SRC_VXLAN_TERM(flags) ((flags) &= ~PIM_UPSTREAM_FLAG_MASK_SRC_VXLAN_TERM)
150 #define PIM_UPSTREAM_FLAG_UNSET_MLAG_VXLAN(flags) ((flags) &= ~PIM_UPSTREAM_FLAG_MASK_MLAG_VXLAN)
151 #define PIM_UPSTREAM_FLAG_UNSET_MLAG_NON_DF(flags) ((flags) &= ~PIM_UPSTREAM_FLAG_MASK_MLAG_NON_DF)
152 #define PIM_UPSTREAM_FLAG_UNSET_MLAG_PEER(flags) ((flags) &= ~PIM_UPSTREAM_FLAG_MASK_MLAG_PEER)
153 #define PIM_UPSTREAM_FLAG_UNSET_SRC_NOCACHE(flags) ((flags) &= ~PIM_UPSTREAM_FLAG_MASK_SRC_NOCACHE)
154 #define PIM_UPSTREAM_FLAG_UNSET_USE_RPT(flags) ((flags) &= ~PIM_UPSTREAM_FLAG_MASK_USE_RPT)
155 #define PIM_UPSTREAM_FLAG_UNSET_MLAG_INTERFACE(flags) ((flags) &= ~PIM_UPSTREAM_FLAG_MASK_MLAG_INTERFACE)
156
157 /* The RPF cost is incremented by 10 if the RPF interface is the peerlink-rif.
158 * This is used to force the MLAG switch with the lowest cost to the RPF
159 * to become the MLAG DF.
160 */
161 #define PIM_UPSTREAM_MLAG_PEERLINK_PLUS_METRIC 10
162
163 enum pim_upstream_state {
164 PIM_UPSTREAM_NOTJOINED,
165 PIM_UPSTREAM_JOINED,
166 };
167
168 enum pim_reg_state {
169 PIM_REG_NOINFO,
170 PIM_REG_JOIN,
171 PIM_REG_JOIN_PENDING,
172 PIM_REG_PRUNE,
173 };
174
175 enum pim_upstream_sptbit {
176 PIM_UPSTREAM_SPTBIT_FALSE,
177 PIM_UPSTREAM_SPTBIT_TRUE
178 };
179
180 struct pim_up_mlag {
181 /* MRIB.metric(S) from the peer switch. This is used for DF election
182 * and switch with the lowest cost wins.
183 */
184 uint32_t peer_mrib_metric;
185 };
186
187 PREDECL_RBTREE_UNIQ(rb_pim_upstream);
188 /*
189 Upstream (S,G) channel in Joined state
190 (S,G) in the "Not Joined" state is not represented
191 See RFC 4601: 4.5.7. Sending (S,G) Join/Prune Message
192
193 upstream_addr : Who we are talking to.
194 For (*, G), upstream_addr is RP address or INADDR_ANY(if RP not configured)
195 For (S, G), upstream_addr is source address
196
197 rpf: contains the nexthop information to whom we are talking to.
198
199 join_state: JOINED/NOTJOINED
200
201 In the case when FRR receives IGMP/PIM (*, G) join for group G and RP is not
202 configured, then create a pim_upstream with the below information.
203 pim_upstream->upstream address: INADDR_ANY
204 pim_upstream->rpf: Unknown
205 pim_upstream->state: NOTJOINED
206
207 When a new RP gets configured for G, find the corresponding pim upstream (*,G)
208 entries and update the upstream address as new RP address if it the better one
209 for the group G.
210
211 When RP becomes reachable, populate the nexthop information in
212 pim_upstream->rpf and update the state to JOINED.
213
214 */
215 struct pim_upstream {
216 struct pim_instance *pim;
217 struct rb_pim_upstream_item upstream_rb;
218 struct pim_upstream *parent;
219 pim_addr upstream_addr; /* Who we are talking to */
220 pim_addr upstream_register; /*Who we received a register from*/
221 pim_sgaddr sg; /* (S,G) group key */
222 char sg_str[PIM_SG_LEN];
223 uint32_t flags;
224 struct channel_oil *channel_oil;
225 struct list *sources;
226 struct list *ifchannels;
227 /* Counter for Dual active ifchannels*/
228 uint32_t dualactive_ifchannel_count;
229
230 enum pim_upstream_state join_state;
231 enum pim_reg_state reg_state;
232 enum pim_upstream_sptbit sptbit;
233
234 int ref_count;
235
236 struct pim_rpf rpf;
237
238 struct pim_up_mlag mlag;
239
240 struct event *t_join_timer;
241
242 /*
243 * RST(S,G)
244 */
245 struct event *t_rs_timer;
246 #define PIM_REGISTER_SUPPRESSION_PERIOD (60)
247 #define PIM_REGISTER_PROBE_PERIOD (5)
248
249 /*
250 * KAT(S,G)
251 */
252 struct event *t_ka_timer;
253 #define PIM_KEEPALIVE_PERIOD (210)
254 #define PIM_RP_KEEPALIVE_PERIOD \
255 (3 * router->register_suppress_time + router->register_probe_time)
256
257 /* on the RP we restart a timer to indicate if registers are being rxed
258 * for
259 * SG. This is needed by MSDP to determine its local SA cache */
260 struct event *t_msdp_reg_timer;
261 #define PIM_MSDP_REG_RXED_PERIOD (3 * (1.5 * router->register_suppress_time))
262
263 int64_t state_transition; /* Record current state uptime */
264 };
265
266 static inline bool pim_upstream_is_kat_running(struct pim_upstream *up)
267 {
268 return (up->t_ka_timer != NULL);
269 }
270
271 static inline bool pim_up_mlag_is_local(struct pim_upstream *up)
272 {
273 /* XXX: extend this to also return true if the channel-oil has
274 * any AA devices
275 */
276 return (up->flags & (PIM_UPSTREAM_FLAG_MASK_MLAG_VXLAN
277 | PIM_UPSTREAM_FLAG_MASK_MLAG_INTERFACE));
278 }
279
280 struct pim_upstream *pim_upstream_find(struct pim_instance *pim,
281 pim_sgaddr *sg);
282 struct pim_upstream *pim_upstream_find_or_add(pim_sgaddr *sg,
283 struct interface *ifp, int flags,
284 const char *name);
285 struct pim_upstream *pim_upstream_add(struct pim_instance *pim, pim_sgaddr *sg,
286 struct interface *ifp, int flags,
287 const char *name,
288 struct pim_ifchannel *ch);
289 void pim_upstream_ref(struct pim_upstream *up,
290 int flags, const char *name);
291 struct pim_upstream *pim_upstream_del(struct pim_instance *pim,
292 struct pim_upstream *up,
293 const char *name);
294
295 bool pim_upstream_evaluate_join_desired(struct pim_instance *pim,
296 struct pim_upstream *up);
297 int pim_upstream_evaluate_join_desired_interface(struct pim_upstream *up,
298 struct pim_ifchannel *ch,
299 struct pim_ifchannel *starch);
300 int pim_upstream_eval_inherit_if(struct pim_upstream *up,
301 struct pim_ifchannel *ch,
302 struct pim_ifchannel *starch);
303 void pim_upstream_update_join_desired(struct pim_instance *pim,
304 struct pim_upstream *up);
305
306 void pim_update_suppress_timers(uint32_t suppress_time);
307 void pim_upstream_join_suppress(struct pim_upstream *up, pim_addr rpf,
308 int holdtime);
309
310 void pim_upstream_join_timer_decrease_to_t_override(const char *debug_label,
311 struct pim_upstream *up);
312
313 void pim_upstream_join_timer_restart(struct pim_upstream *up,
314 struct pim_rpf *old);
315 void pim_upstream_rpf_genid_changed(struct pim_instance *pim,
316 pim_addr neigh_addr);
317 void pim_upstream_rpf_interface_changed(struct pim_upstream *up,
318 struct interface *old_rpf_ifp);
319
320 void pim_upstream_update_could_assert(struct pim_upstream *up);
321 void pim_upstream_update_my_assert_metric(struct pim_upstream *up);
322
323 void pim_upstream_keep_alive_timer_start(struct pim_upstream *up,
324 uint32_t time);
325
326 int pim_upstream_switch_to_spt_desired_on_rp(struct pim_instance *pim,
327 pim_sgaddr *sg);
328 #define SwitchToSptDesiredOnRp(pim, sg) pim_upstream_switch_to_spt_desired_on_rp (pim, sg)
329 int pim_upstream_is_sg_rpt(struct pim_upstream *up);
330
331 void pim_upstream_set_sptbit(struct pim_upstream *up,
332 struct interface *incoming);
333
334 void pim_upstream_start_register_stop_timer(struct pim_upstream *up,
335 int null_register);
336
337 void pim_upstream_send_join(struct pim_upstream *up);
338
339 void pim_upstream_switch(struct pim_instance *pim, struct pim_upstream *up,
340 enum pim_upstream_state new_state);
341
342 const char *pim_upstream_state2str(enum pim_upstream_state join_state);
343 #define PIM_REG_STATE_STR_LEN 12
344 const char *pim_reg_state2str(enum pim_reg_state state, char *state_str,
345 size_t state_str_len);
346
347 int pim_upstream_inherited_olist_decide(struct pim_instance *pim,
348 struct pim_upstream *up);
349 int pim_upstream_inherited_olist(struct pim_instance *pim,
350 struct pim_upstream *up);
351 int pim_upstream_empty_inherited_olist(struct pim_upstream *up);
352
353 void pim_upstream_find_new_rpf(struct pim_instance *pim);
354 void pim_upstream_msdp_reg_timer_start(struct pim_upstream *up);
355
356 void pim_upstream_init(struct pim_instance *pim);
357 void pim_upstream_terminate(struct pim_instance *pim);
358
359 void join_timer_start(struct pim_upstream *up);
360 int pim_upstream_compare(const struct pim_upstream *up1,
361 const struct pim_upstream *up2);
362 DECLARE_RBTREE_UNIQ(rb_pim_upstream, struct pim_upstream, upstream_rb,
363 pim_upstream_compare);
364
365 void pim_upstream_register_reevaluate(struct pim_instance *pim);
366
367 void pim_upstream_add_lhr_star_pimreg(struct pim_instance *pim);
368 void pim_upstream_remove_lhr_star_pimreg(struct pim_instance *pim,
369 const char *nlist);
370
371 void pim_upstream_spt_prefix_list_update(struct pim_instance *pim,
372 struct prefix_list *pl);
373
374 unsigned int pim_upstream_hash_key(const void *arg);
375 bool pim_upstream_equal(const void *arg1, const void *arg2);
376 struct pim_upstream *pim_upstream_keep_alive_timer_proc(
377 struct pim_upstream *up);
378 void pim_upstream_fill_static_iif(struct pim_upstream *up,
379 struct interface *incoming);
380 void pim_upstream_update_use_rpt(struct pim_upstream *up,
381 bool update_mroute);
382 uint32_t pim_up_mlag_local_cost(struct pim_upstream *up);
383 uint32_t pim_up_mlag_peer_cost(struct pim_upstream *up);
384 void pim_upstream_reeval_use_rpt(struct pim_instance *pim);
385 int pim_upstream_could_register(struct pim_upstream *up);
386 #endif /* PIM_UPSTREAM_H */