]> git.proxmox.com Git - mirror_frr.git/blame - pimd/pim_upstream.h
Merge pull request #12795 from pguibert6WIND/vpnv6_nexthop_encoding
[mirror_frr.git] / pimd / pim_upstream.h
CommitLineData
acddc0ed 1// SPDX-License-Identifier: GPL-2.0-or-later
12e41d03 2/*
896014f4
DL
3 * PIM for Quagga
4 * Copyright (C) 2008 Everton da Silva Marques
896014f4 5 */
12e41d03
DL
6
7#ifndef PIM_UPSTREAM_H
8#define PIM_UPSTREAM_H
9
10#include <zebra.h>
05e451f8 11#include <prefix.h>
ba4eb1bc 12#include "plist.h"
12e41d03 13
e34e07e6 14#include "pim_rpf.h"
ba4eb1bc
CS
15#include "pim_str.h"
16#include "pim_ifchannel.h"
bfea315d 17
12e41d03 18#define PIM_UPSTREAM_FLAG_MASK_DR_JOIN_DESIRED (1 << 0)
ca973133
DS
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)
1bf16443 24#define PIM_UPSTREAM_FLAG_MASK_SRC_MSDP (1 << 6)
54179a37 25#define PIM_UPSTREAM_FLAG_MASK_SEND_SG_RPT_PRUNE (1 << 7)
850a9f99 26#define PIM_UPSTREAM_FLAG_MASK_SRC_LHR (1 << 8)
820b4a40
AK
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)
6a5de0ad
AK
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)
7d973323 38#define PIM_UPSTREAM_FLAG_MASK_ALLOW_IIF_IN_OIL (1 << 11)
76e4825a
AK
39/* Disable pimreg encasulation for a flow */
40#define PIM_UPSTREAM_FLAG_MASK_NO_PIMREG_DATA (1 << 12)
8eeaef9b
AK
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)
e12fa762
AK
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)
f376b701
AK
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)
05ca004b
AK
64/* MLAG mroute rxed from the peer MLAG switch */
65#define PIM_UPSTREAM_FLAG_MASK_MLAG_PEER (1 << 18)
02434c43
DS
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)
69e3538c
AK
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)
f80427e9
AK
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
02434c43 84
850a9f99 85#define PIM_UPSTREAM_FLAG_ALL 0xFFFFFFFF
12e41d03
DL
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)
69ff3706 89#define PIM_UPSTREAM_FLAG_TEST_FHR(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_FHR)
1d3a62cd
DS
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)
7667c556 93#define PIM_UPSTREAM_FLAG_TEST_SRC_MSDP(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_SRC_MSDP)
54179a37 94#define PIM_UPSTREAM_FLAG_TEST_SEND_SG_RPT_PRUNE(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_SEND_SG_RPT_PRUNE)
850a9f99 95#define PIM_UPSTREAM_FLAG_TEST_SRC_LHR(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_SRC_LHR)
820b4a40 96#define PIM_UPSTREAM_FLAG_TEST_DISABLE_KAT_EXPIRY(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_DISABLE_KAT_EXPIRY)
6a5de0ad 97#define PIM_UPSTREAM_FLAG_TEST_STATIC_IIF(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_STATIC_IIF)
7d973323 98#define PIM_UPSTREAM_FLAG_TEST_ALLOW_IIF_IN_OIL(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_ALLOW_IIF_IN_OIL)
76e4825a 99#define PIM_UPSTREAM_FLAG_TEST_NO_PIMREG_DATA(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_NO_PIMREG_DATA)
8eeaef9b 100#define PIM_UPSTREAM_FLAG_TEST_FORCE_PIMREG(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_FORCE_PIMREG)
e12fa762
AK
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))
f376b701
AK
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)
05ca004b 106#define PIM_UPSTREAM_FLAG_TEST_MLAG_PEER(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_MLAG_PEER)
02434c43 107#define PIM_UPSTREAM_FLAG_TEST_SRC_NOCACHE(flags) ((flags) &PIM_UPSTREAM_FLAG_MASK_SRC_NOCACHE)
69e3538c 108#define PIM_UPSTREAM_FLAG_TEST_USE_RPT(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_USE_RPT)
448139e7 109#define PIM_UPSTREAM_FLAG_TEST_CAN_BE_LHR(flags) ((flags) & (PIM_UPSTREAM_FLAG_MASK_SRC_IGMP | PIM_UPSTREAM_FLAG_MASK_SRC_VXLAN_TERM))
f80427e9 110#define PIM_UPSTREAM_FLAG_TEST_MLAG_INTERFACE(flags) ((flags)&PIM_UPSTREAM_FLAG_MASK_MLAG_INTERFACE)
12e41d03
DL
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)
69ff3706 114#define PIM_UPSTREAM_FLAG_SET_FHR(flags) ((flags) |= PIM_UPSTREAM_FLAG_MASK_FHR)
1d3a62cd
DS
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)
7667c556 118#define PIM_UPSTREAM_FLAG_SET_SRC_MSDP(flags) ((flags) |= PIM_UPSTREAM_FLAG_MASK_SRC_MSDP)
54179a37 119#define PIM_UPSTREAM_FLAG_SET_SEND_SG_RPT_PRUNE(flags) ((flags) |= PIM_UPSTREAM_FLAG_MASK_SEND_SG_RPT_PRUNE)
850a9f99 120#define PIM_UPSTREAM_FLAG_SET_SRC_LHR(flags) ((flags) |= PIM_UPSTREAM_FLAG_MASK_SRC_LHR)
820b4a40 121#define PIM_UPSTREAM_FLAG_SET_DISABLE_KAT_EXPIRY(flags) ((flags) |= PIM_UPSTREAM_FLAG_MASK_DISABLE_KAT_EXPIRY)
6a5de0ad 122#define PIM_UPSTREAM_FLAG_SET_STATIC_IIF(flags) ((flags) |= PIM_UPSTREAM_FLAG_MASK_STATIC_IIF)
7d973323 123#define PIM_UPSTREAM_FLAG_SET_ALLOW_IIF_IN_OIL(flags) ((flags) |= PIM_UPSTREAM_FLAG_MASK_ALLOW_IIF_IN_OIL)
76e4825a 124#define PIM_UPSTREAM_FLAG_SET_NO_PIMREG_DATA(flags) ((flags) |= PIM_UPSTREAM_FLAG_MASK_NO_PIMREG_DATA)
8eeaef9b 125#define PIM_UPSTREAM_FLAG_SET_FORCE_PIMREG(flags) ((flags) |= PIM_UPSTREAM_FLAG_MASK_FORCE_PIMREG)
e12fa762
AK
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)
f376b701
AK
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)
05ca004b 130#define PIM_UPSTREAM_FLAG_SET_MLAG_PEER(flags) ((flags) |= PIM_UPSTREAM_FLAG_MASK_MLAG_PEER)
69e3538c 131#define PIM_UPSTREAM_FLAG_SET_USE_RPT(flags) ((flags) |= PIM_UPSTREAM_FLAG_MASK_USE_RPT)
f80427e9 132#define PIM_UPSTREAM_FLAG_SET_MLAG_INTERFACE(flags) ((flags) |= PIM_UPSTREAM_FLAG_MASK_MLAG_INTERFACE)
12e41d03
DL
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)
69ff3706 136#define PIM_UPSTREAM_FLAG_UNSET_FHR(flags) ((flags) &= ~PIM_UPSTREAM_FLAG_MASK_FHR)
1d3a62cd
DS
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)
7667c556 140#define PIM_UPSTREAM_FLAG_UNSET_SRC_MSDP(flags) ((flags) &= ~PIM_UPSTREAM_FLAG_MASK_SRC_MSDP)
54179a37 141#define PIM_UPSTREAM_FLAG_UNSET_SEND_SG_RPT_PRUNE(flags) ((flags) &= ~PIM_UPSTREAM_FLAG_MASK_SEND_SG_RPT_PRUNE)
850a9f99 142#define PIM_UPSTREAM_FLAG_UNSET_SRC_LHR(flags) ((flags) &= ~PIM_UPSTREAM_FLAG_MASK_SRC_LHR)
820b4a40 143#define PIM_UPSTREAM_FLAG_UNSET_DISABLE_KAT_EXPIRY(flags) ((flags) &= ~PIM_UPSTREAM_FLAG_MASK_DISABLE_KAT_EXPIRY)
6a5de0ad 144#define PIM_UPSTREAM_FLAG_UNSET_STATIC_IIF(flags) ((flags) &= ~PIM_UPSTREAM_FLAG_MASK_STATIC_IIF)
7d973323 145#define PIM_UPSTREAM_FLAG_UNSET_ALLOW_IIF_IN_OIL(flags) ((flags) &= ~PIM_UPSTREAM_FLAG_MASK_ALLOW_IIF_IN_OIL)
76e4825a 146#define PIM_UPSTREAM_FLAG_UNSET_NO_PIMREG_DATA(flags) ((flags) &= ~PIM_UPSTREAM_FLAG_MASK_NO_PIMREG_DATA)
8eeaef9b 147#define PIM_UPSTREAM_FLAG_UNSET_FORCE_PIMREG(flags) ((flags) &= ~PIM_UPSTREAM_FLAG_MASK_FORCE_PIMREG)
e12fa762
AK
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)
f376b701
AK
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)
05ca004b 152#define PIM_UPSTREAM_FLAG_UNSET_MLAG_PEER(flags) ((flags) &= ~PIM_UPSTREAM_FLAG_MASK_MLAG_PEER)
02434c43 153#define PIM_UPSTREAM_FLAG_UNSET_SRC_NOCACHE(flags) ((flags) &= ~PIM_UPSTREAM_FLAG_MASK_SRC_NOCACHE)
69e3538c 154#define PIM_UPSTREAM_FLAG_UNSET_USE_RPT(flags) ((flags) &= ~PIM_UPSTREAM_FLAG_MASK_USE_RPT)
f80427e9 155#define PIM_UPSTREAM_FLAG_UNSET_MLAG_INTERFACE(flags) ((flags) &= ~PIM_UPSTREAM_FLAG_MASK_MLAG_INTERFACE)
12e41d03 156
f03999ca
AK
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
12e41d03 163enum pim_upstream_state {
d62a17ae 164 PIM_UPSTREAM_NOTJOINED,
165 PIM_UPSTREAM_JOINED,
12e41d03
DL
166};
167
0c2ebf00 168enum pim_reg_state {
d62a17ae 169 PIM_REG_NOINFO,
170 PIM_REG_JOIN,
171 PIM_REG_JOIN_PENDING,
172 PIM_REG_PRUNE,
0c2ebf00 173};
174
d99764f6 175enum pim_upstream_sptbit {
d62a17ae 176 PIM_UPSTREAM_SPTBIT_FALSE,
177 PIM_UPSTREAM_SPTBIT_TRUE
d99764f6
DS
178};
179
05ca004b
AK
180struct 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
dd3364cb 187PREDECL_RBTREE_UNIQ(rb_pim_upstream);
12e41d03
DL
188/*
189 Upstream (S,G) channel in Joined state
12e41d03 190 (S,G) in the "Not Joined" state is not represented
12e41d03 191 See RFC 4601: 4.5.7. Sending (S,G) Join/Prune Message
bbe598df
SP
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
12e41d03
DL
214*/
215struct pim_upstream {
69e3538c 216 struct pim_instance *pim;
dd3364cb 217 struct rb_pim_upstream_item upstream_rb;
d62a17ae 218 struct pim_upstream *parent;
b7ed98e9 219 pim_addr upstream_addr; /* Who we are talking to */
220 pim_addr upstream_register; /*Who we received a register from*/
6fff2cc6 221 pim_sgaddr sg; /* (S,G) group key */
d62a17ae 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;
22c35834
SK
227 /* Counter for Dual active ifchannels*/
228 uint32_t dualactive_ifchannel_count;
d62a17ae 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
05ca004b
AK
238 struct pim_up_mlag mlag;
239
d62a17ae 240 struct thread *t_join_timer;
241
242 /*
243 * RST(S,G)
244 */
245 struct thread *t_rs_timer;
2ddab288 246#define PIM_REGISTER_SUPPRESSION_PERIOD (60)
38de2445 247#define PIM_REGISTER_PROBE_PERIOD (5)
2ddab288 248
d62a17ae 249 /*
250 * KAT(S,G)
251 */
252 struct thread *t_ka_timer;
4a4c4a07 253#define PIM_KEEPALIVE_PERIOD (210)
2925dff5 254#define PIM_RP_KEEPALIVE_PERIOD \
a6c5db59 255 (3 * router->register_suppress_time + router->register_probe_time)
4a4c4a07 256
d62a17ae 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 thread *t_msdp_reg_timer;
2925dff5 261#define PIM_MSDP_REG_RXED_PERIOD (3 * (1.5 * router->register_suppress_time))
1bf16443 262
d62a17ae 263 int64_t state_transition; /* Record current state uptime */
12e41d03
DL
264};
265
ec836533
AK
266static inline bool pim_upstream_is_kat_running(struct pim_upstream *up)
267{
268 return (up->t_ka_timer != NULL);
269}
270
05ca004b
AK
271static 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 */
df94b33a
DS
276 return (up->flags & (PIM_UPSTREAM_FLAG_MASK_MLAG_VXLAN
277 | PIM_UPSTREAM_FLAG_MASK_MLAG_INTERFACE));
05ca004b
AK
278}
279
9b29ea95 280struct pim_upstream *pim_upstream_find(struct pim_instance *pim,
6fff2cc6
DL
281 pim_sgaddr *sg);
282struct pim_upstream *pim_upstream_find_or_add(pim_sgaddr *sg,
d62a17ae 283 struct interface *ifp, int flags,
284 const char *name);
6fff2cc6 285struct pim_upstream *pim_upstream_add(struct pim_instance *pim, pim_sgaddr *sg,
d62a17ae 286 struct interface *ifp, int flags,
0885a9f1
DS
287 const char *name,
288 struct pim_ifchannel *ch);
05ca004b
AK
289void pim_upstream_ref(struct pim_upstream *up,
290 int flags, const char *name);
9b29ea95
DS
291struct pim_upstream *pim_upstream_del(struct pim_instance *pim,
292 struct pim_upstream *up,
d62a17ae 293 const char *name);
12e41d03 294
286bbbec
DA
295bool pim_upstream_evaluate_join_desired(struct pim_instance *pim,
296 struct pim_upstream *up);
9f44d042 297int pim_upstream_evaluate_join_desired_interface(struct pim_upstream *up,
d62a17ae 298 struct pim_ifchannel *ch,
a53a9b3e
AK
299 struct pim_ifchannel *starch);
300int pim_upstream_eval_inherit_if(struct pim_upstream *up,
301 struct pim_ifchannel *ch,
d62a17ae 302 struct pim_ifchannel *starch);
9b29ea95
DS
303void pim_upstream_update_join_desired(struct pim_instance *pim,
304 struct pim_upstream *up);
12e41d03 305
3f1f8641 306void pim_update_suppress_timers(uint32_t suppress_time);
028583e9 307void pim_upstream_join_suppress(struct pim_upstream *up, pim_addr rpf,
fd3af229 308 int holdtime);
c48a612c 309
12e41d03 310void pim_upstream_join_timer_decrease_to_t_override(const char *debug_label,
d62a17ae 311 struct pim_upstream *up);
c48a612c 312
d62a17ae 313void pim_upstream_join_timer_restart(struct pim_upstream *up,
314 struct pim_rpf *old);
9b29ea95 315void pim_upstream_rpf_genid_changed(struct pim_instance *pim,
101b3104 316 pim_addr neigh_addr);
12e41d03
DL
317void pim_upstream_rpf_interface_changed(struct pim_upstream *up,
318 struct interface *old_rpf_ifp);
319
320void pim_upstream_update_could_assert(struct pim_upstream *up);
321void pim_upstream_update_my_assert_metric(struct pim_upstream *up);
322
d62a17ae 323void pim_upstream_keep_alive_timer_start(struct pim_upstream *up,
324 uint32_t time);
cb40b272 325
2ef4ed70 326int pim_upstream_switch_to_spt_desired_on_rp(struct pim_instance *pim,
6fff2cc6 327 pim_sgaddr *sg);
2ef4ed70 328#define SwitchToSptDesiredOnRp(pim, sg) pim_upstream_switch_to_spt_desired_on_rp (pim, sg)
d62a17ae 329int pim_upstream_is_sg_rpt(struct pim_upstream *up);
cb40b272 330
d62a17ae 331void pim_upstream_set_sptbit(struct pim_upstream *up,
332 struct interface *incoming);
3a66b17b 333
d62a17ae 334void pim_upstream_start_register_stop_timer(struct pim_upstream *up,
335 int null_register);
627ed2a3 336
d62a17ae 337void pim_upstream_send_join(struct pim_upstream *up);
56638739 338
1eca8576 339void pim_upstream_switch(struct pim_instance *pim, struct pim_upstream *up,
d62a17ae 340 enum pim_upstream_state new_state);
7fcdfb34 341
d62a17ae 342const char *pim_upstream_state2str(enum pim_upstream_state join_state);
e0e127b0 343#define PIM_REG_STATE_STR_LEN 12
c35b7e6b
QY
344const char *pim_reg_state2str(enum pim_reg_state state, char *state_str,
345 size_t state_str_len);
4fdc8f36 346
9b29ea95
DS
347int pim_upstream_inherited_olist_decide(struct pim_instance *pim,
348 struct pim_upstream *up);
349int pim_upstream_inherited_olist(struct pim_instance *pim,
350 struct pim_upstream *up);
d62a17ae 351int pim_upstream_empty_inherited_olist(struct pim_upstream *up);
d3dd1804 352
9b29ea95 353void pim_upstream_find_new_rpf(struct pim_instance *pim);
1bf16443 354void pim_upstream_msdp_reg_timer_start(struct pim_upstream *up);
d3dd1804 355
9b29ea95
DS
356void pim_upstream_init(struct pim_instance *pim);
357void pim_upstream_terminate(struct pim_instance *pim);
982bff89 358
d62a17ae 359void join_timer_start(struct pim_upstream *up);
dd3364cb
DS
360int pim_upstream_compare(const struct pim_upstream *up1,
361 const struct pim_upstream *up2);
362DECLARE_RBTREE_UNIQ(rb_pim_upstream, struct pim_upstream, upstream_rb,
960b9a53 363 pim_upstream_compare);
dd3364cb 364
9b29ea95 365void pim_upstream_register_reevaluate(struct pim_instance *pim);
a7b2b1e2 366
9b29ea95
DS
367void pim_upstream_add_lhr_star_pimreg(struct pim_instance *pim);
368void pim_upstream_remove_lhr_star_pimreg(struct pim_instance *pim,
369 const char *nlist);
df94f9a9 370
9b29ea95
DS
371void pim_upstream_spt_prefix_list_update(struct pim_instance *pim,
372 struct prefix_list *pl);
7c591950 373
d8b87afe 374unsigned int pim_upstream_hash_key(const void *arg);
74df8d6d 375bool pim_upstream_equal(const void *arg1, const void *arg2);
ff459c36
AK
376struct pim_upstream *pim_upstream_keep_alive_timer_proc(
377 struct pim_upstream *up);
6a5de0ad
AK
378void pim_upstream_fill_static_iif(struct pim_upstream *up,
379 struct interface *incoming);
69e3538c
AK
380void pim_upstream_update_use_rpt(struct pim_upstream *up,
381 bool update_mroute);
05ca004b
AK
382uint32_t pim_up_mlag_local_cost(struct pim_upstream *up);
383uint32_t pim_up_mlag_peer_cost(struct pim_upstream *up);
a749b900 384void pim_upstream_reeval_use_rpt(struct pim_instance *pim);
46a9ea8b 385int pim_upstream_could_register(struct pim_upstream *up);
12e41d03 386#endif /* PIM_UPSTREAM_H */