/src/frr/pimd/pim_upstream.h
Line | Count | Source |
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 | 106k | #define PIM_UPSTREAM_FLAG_MASK_DR_JOIN_DESIRED (1 << 0) |
19 | 0 | #define PIM_UPSTREAM_FLAG_MASK_DR_JOIN_DESIRED_UPDATED (1 << 1) |
20 | 13.6M | #define PIM_UPSTREAM_FLAG_MASK_FHR (1 << 2) |
21 | 103k | #define PIM_UPSTREAM_FLAG_MASK_SRC_IGMP (1 << 3) |
22 | 117k | #define PIM_UPSTREAM_FLAG_MASK_SRC_PIM (1 << 4) |
23 | 0 | #define PIM_UPSTREAM_FLAG_MASK_SRC_STREAM (1 << 5) |
24 | 0 | #define PIM_UPSTREAM_FLAG_MASK_SRC_MSDP (1 << 6) |
25 | 0 | #define PIM_UPSTREAM_FLAG_MASK_SEND_SG_RPT_PRUNE (1 << 7) |
26 | 0 | #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 | 0 | #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 | 133k | #define PIM_UPSTREAM_FLAG_MASK_STATIC_IIF (1 << 10) |
38 | 0 | #define PIM_UPSTREAM_FLAG_MASK_ALLOW_IIF_IN_OIL (1 << 11) |
39 | | /* Disable pimreg encasulation for a flow */ |
40 | 0 | #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 | 0 | #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 | 0 | #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 | 780 | #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 | 291k | #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 | 0 | #define PIM_UPSTREAM_FLAG_MASK_MLAG_NON_DF (1 << 17) |
64 | | /* MLAG mroute rxed from the peer MLAG switch */ |
65 | 0 | #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 | 44.6k | #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 | 40.8M | #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 | 495k | #define PIM_UPSTREAM_FLAG_MASK_MLAG_INTERFACE (1 << 21) |
83 | | |
84 | | |
85 | | #define PIM_UPSTREAM_FLAG_ALL 0xFFFFFFFF |
86 | | |
87 | 53.1k | #define PIM_UPSTREAM_FLAG_TEST_DR_JOIN_DESIRED(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_DR_JOIN_DESIRED) |
88 | 0 | #define PIM_UPSTREAM_FLAG_TEST_DR_JOIN_DESIRED_UPDATED(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_DR_JOIN_DESIRED_UPDATED) |
89 | 27.2M | #define PIM_UPSTREAM_FLAG_TEST_FHR(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_FHR) |
90 | 0 | #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 | 0 | #define PIM_UPSTREAM_FLAG_TEST_SRC_STREAM(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_SRC_STREAM) |
93 | 0 | #define PIM_UPSTREAM_FLAG_TEST_SRC_MSDP(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_SRC_MSDP) |
94 | 0 | #define PIM_UPSTREAM_FLAG_TEST_SEND_SG_RPT_PRUNE(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_SEND_SG_RPT_PRUNE) |
95 | 0 | #define PIM_UPSTREAM_FLAG_TEST_SRC_LHR(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_SRC_LHR) |
96 | 0 | #define PIM_UPSTREAM_FLAG_TEST_DISABLE_KAT_EXPIRY(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_DISABLE_KAT_EXPIRY) |
97 | 178k | #define PIM_UPSTREAM_FLAG_TEST_STATIC_IIF(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_STATIC_IIF) |
98 | 0 | #define PIM_UPSTREAM_FLAG_TEST_ALLOW_IIF_IN_OIL(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_ALLOW_IIF_IN_OIL) |
99 | 0 | #define PIM_UPSTREAM_FLAG_TEST_NO_PIMREG_DATA(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_NO_PIMREG_DATA) |
100 | 0 | #define PIM_UPSTREAM_FLAG_TEST_FORCE_PIMREG(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_FORCE_PIMREG) |
101 | 0 | #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 | 88.4k | #define PIM_UPSTREAM_FLAG_TEST_MLAG_VXLAN(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_MLAG_VXLAN) |
105 | 0 | #define PIM_UPSTREAM_FLAG_TEST_MLAG_NON_DF(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_MLAG_NON_DF) |
106 | 0 | #define PIM_UPSTREAM_FLAG_TEST_MLAG_PEER(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_MLAG_PEER) |
107 | 44.6k | #define PIM_UPSTREAM_FLAG_TEST_SRC_NOCACHE(flags) ((flags) &PIM_UPSTREAM_FLAG_MASK_SRC_NOCACHE) |
108 | 27.2M | #define PIM_UPSTREAM_FLAG_TEST_USE_RPT(flags) ((flags) & PIM_UPSTREAM_FLAG_MASK_USE_RPT) |
109 | 780 | #define PIM_UPSTREAM_FLAG_TEST_CAN_BE_LHR(flags) ((flags) & (PIM_UPSTREAM_FLAG_MASK_SRC_IGMP | PIM_UPSTREAM_FLAG_MASK_SRC_VXLAN_TERM)) |
110 | 88.6k | #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) \ |
113 | 4.94k | ((flags) |= (typeof((flags)))PIM_UPSTREAM_FLAG_MASK_DR_JOIN_DESIRED) |
114 | | #define PIM_UPSTREAM_FLAG_SET_DR_JOIN_DESIRED_UPDATED(flags) \ |
115 | 0 | ((flags) |= \ |
116 | 0 | (typeof((flags)))PIM_UPSTREAM_FLAG_MASK_DR_JOIN_DESIRED_UPDATED) |
117 | | #define PIM_UPSTREAM_FLAG_SET_FHR(flags) \ |
118 | 0 | ((flags) |= (typeof((flags)))PIM_UPSTREAM_FLAG_MASK_FHR) |
119 | | #define PIM_UPSTREAM_FLAG_SET_SRC_IGMP(flags) \ |
120 | | ((flags) |= (typeof((flags)))PIM_UPSTREAM_FLAG_MASK_SRC_IGMP) |
121 | | #define PIM_UPSTREAM_FLAG_SET_SRC_PIM(flags) \ |
122 | | ((flags) |= (typeof((flags)))PIM_UPSTREAM_FLAG_MASK_SRC_PIM) |
123 | | #define PIM_UPSTREAM_FLAG_SET_SRC_STREAM(flags) \ |
124 | 0 | ((flags) |= (typeof((flags)))PIM_UPSTREAM_FLAG_MASK_SRC_STREAM) |
125 | | #define PIM_UPSTREAM_FLAG_SET_SRC_MSDP(flags) \ |
126 | 0 | ((flags) |= (typeof((flags)))PIM_UPSTREAM_FLAG_MASK_SRC_MSDP) |
127 | | #define PIM_UPSTREAM_FLAG_SET_SEND_SG_RPT_PRUNE(flags) \ |
128 | 0 | ((flags) |= (typeof((flags)))PIM_UPSTREAM_FLAG_MASK_SEND_SG_RPT_PRUNE) |
129 | | #define PIM_UPSTREAM_FLAG_SET_SRC_LHR(flags) \ |
130 | | ((flags) |= (typeof((flags)))PIM_UPSTREAM_FLAG_MASK_SRC_LHR) |
131 | | #define PIM_UPSTREAM_FLAG_SET_DISABLE_KAT_EXPIRY(flags) \ |
132 | 0 | ((flags) |= (typeof((flags)))PIM_UPSTREAM_FLAG_MASK_DISABLE_KAT_EXPIRY) |
133 | | #define PIM_UPSTREAM_FLAG_SET_STATIC_IIF(flags) \ |
134 | 0 | ((flags) |= (typeof((flags)))PIM_UPSTREAM_FLAG_MASK_STATIC_IIF) |
135 | | #define PIM_UPSTREAM_FLAG_SET_ALLOW_IIF_IN_OIL(flags) \ |
136 | 0 | ((flags) |= (typeof((flags)))PIM_UPSTREAM_FLAG_MASK_ALLOW_IIF_IN_OIL) |
137 | | #define PIM_UPSTREAM_FLAG_SET_NO_PIMREG_DATA(flags) \ |
138 | 0 | ((flags) |= (typeof((flags)))PIM_UPSTREAM_FLAG_MASK_NO_PIMREG_DATA) |
139 | | #define PIM_UPSTREAM_FLAG_SET_FORCE_PIMREG(flags) \ |
140 | 0 | ((flags) |= (typeof((flags)))PIM_UPSTREAM_FLAG_MASK_FORCE_PIMREG) |
141 | | #define PIM_UPSTREAM_FLAG_SET_SRC_VXLAN_ORIG(flags) \ |
142 | 0 | ((flags) |= (typeof((flags)))PIM_UPSTREAM_FLAG_MASK_SRC_VXLAN_ORIG) |
143 | | #define PIM_UPSTREAM_FLAG_SET_SRC_VXLAN_TERM(flags) \ |
144 | 0 | ((flags) |= (typeof((flags)))PIM_UPSTREAM_FLAG_MASK_SRC_VXLAN_TERM) |
145 | | #define PIM_UPSTREAM_FLAG_SET_MLAG_VXLAN(flags) \ |
146 | 0 | ((flags) |= (typeof((flags)))PIM_UPSTREAM_FLAG_MASK_MLAG_VXLAN) |
147 | | #define PIM_UPSTREAM_FLAG_SET_MLAG_NON_DF(flags) \ |
148 | 0 | ((flags) |= (typeof((flags)))PIM_UPSTREAM_FLAG_MASK_MLAG_NON_DF) |
149 | | #define PIM_UPSTREAM_FLAG_SET_MLAG_PEER(flags) \ |
150 | 0 | ((flags) |= (typeof((flags)))PIM_UPSTREAM_FLAG_MASK_MLAG_PEER) |
151 | | #define PIM_UPSTREAM_FLAG_SET_USE_RPT(flags) \ |
152 | 13.5M | ((flags) |= (typeof((flags)))PIM_UPSTREAM_FLAG_MASK_USE_RPT) |
153 | | #define PIM_UPSTREAM_FLAG_SET_MLAG_INTERFACE(flags) \ |
154 | 0 | ((flags) |= (typeof((flags)))PIM_UPSTREAM_FLAG_MASK_MLAG_INTERFACE) |
155 | | |
156 | | #define PIM_UPSTREAM_FLAG_UNSET_DR_JOIN_DESIRED(flags) \ |
157 | 48.2k | ((flags) &= (typeof((flags))) ~PIM_UPSTREAM_FLAG_MASK_DR_JOIN_DESIRED) |
158 | | #define PIM_UPSTREAM_FLAG_UNSET_DR_JOIN_DESIRED_UPDATED(flags) \ |
159 | 0 | ((flags) &= \ |
160 | 0 | (typeof((flags))) ~PIM_UPSTREAM_FLAG_MASK_DR_JOIN_DESIRED_UPDATED) |
161 | | #define PIM_UPSTREAM_FLAG_UNSET_FHR(flags) \ |
162 | 0 | ((flags) &= (typeof((flags))) ~PIM_UPSTREAM_FLAG_MASK_FHR) |
163 | | #define PIM_UPSTREAM_FLAG_UNSET_SRC_IGMP(flags) \ |
164 | 0 | ((flags) &= (typeof((flags))) ~PIM_UPSTREAM_FLAG_MASK_SRC_IGMP) |
165 | | #define PIM_UPSTREAM_FLAG_UNSET_SRC_PIM(flags) \ |
166 | | ((flags) &= (typeof((flags))) ~PIM_UPSTREAM_FLAG_MASK_SRC_PIM) |
167 | | #define PIM_UPSTREAM_FLAG_UNSET_SRC_STREAM(flags) \ |
168 | 0 | ((flags) &= (typeof((flags))) ~PIM_UPSTREAM_FLAG_MASK_SRC_STREAM) |
169 | | #define PIM_UPSTREAM_FLAG_UNSET_SRC_MSDP(flags) \ |
170 | 0 | ((flags) &= (typeof((flags))) ~PIM_UPSTREAM_FLAG_MASK_SRC_MSDP) |
171 | | #define PIM_UPSTREAM_FLAG_UNSET_SEND_SG_RPT_PRUNE(flags) \ |
172 | 0 | ((flags) &= (typeof((flags))) ~PIM_UPSTREAM_FLAG_MASK_SEND_SG_RPT_PRUNE) |
173 | | #define PIM_UPSTREAM_FLAG_UNSET_SRC_LHR(flags) \ |
174 | 0 | ((flags) &= (typeof((flags))) ~PIM_UPSTREAM_FLAG_MASK_SRC_LHR) |
175 | | #define PIM_UPSTREAM_FLAG_UNSET_DISABLE_KAT_EXPIRY(flags) \ |
176 | | ((flags) &= \ |
177 | | (typeof((flags))) ~PIM_UPSTREAM_FLAG_MASK_DISABLE_KAT_EXPIRY) |
178 | | #define PIM_UPSTREAM_FLAG_UNSET_STATIC_IIF(flags) \ |
179 | | ((flags) &= (typeof((flags))) ~PIM_UPSTREAM_FLAG_MASK_STATIC_IIF) |
180 | | #define PIM_UPSTREAM_FLAG_UNSET_ALLOW_IIF_IN_OIL(flags) \ |
181 | | ((flags) &= (typeof((flags))) ~PIM_UPSTREAM_FLAG_MASK_ALLOW_IIF_IN_OIL) |
182 | | #define PIM_UPSTREAM_FLAG_UNSET_NO_PIMREG_DATA(flags) \ |
183 | | ((flags) &= (typeof((flags))) ~PIM_UPSTREAM_FLAG_MASK_NO_PIMREG_DATA) |
184 | | #define PIM_UPSTREAM_FLAG_UNSET_FORCE_PIMREG(flags) \ |
185 | | ((flags) &= (typeof((flags))) ~PIM_UPSTREAM_FLAG_MASK_FORCE_PIMREG) |
186 | | #define PIM_UPSTREAM_FLAG_UNSET_SRC_VXLAN_ORIG(flags) \ |
187 | | ((flags) &= (typeof((flags))) ~PIM_UPSTREAM_FLAG_MASK_SRC_VXLAN_ORIG) |
188 | | #define PIM_UPSTREAM_FLAG_UNSET_SRC_VXLAN_TERM(flags) \ |
189 | | ((flags) &= (typeof((flags))) ~PIM_UPSTREAM_FLAG_MASK_SRC_VXLAN_TERM) |
190 | | #define PIM_UPSTREAM_FLAG_UNSET_MLAG_VXLAN(flags) \ |
191 | | ((flags) &= (typeof((flags))) ~PIM_UPSTREAM_FLAG_MASK_MLAG_VXLAN) |
192 | | #define PIM_UPSTREAM_FLAG_UNSET_MLAG_NON_DF(flags) \ |
193 | 0 | ((flags) &= (typeof((flags))) ~PIM_UPSTREAM_FLAG_MASK_MLAG_NON_DF) |
194 | | #define PIM_UPSTREAM_FLAG_UNSET_MLAG_PEER(flags) \ |
195 | 0 | ((flags) &= (typeof((flags))) ~PIM_UPSTREAM_FLAG_MASK_MLAG_PEER) |
196 | | #define PIM_UPSTREAM_FLAG_UNSET_SRC_NOCACHE(flags) \ |
197 | 0 | ((flags) &= (typeof((flags))) ~PIM_UPSTREAM_FLAG_MASK_SRC_NOCACHE) |
198 | | #define PIM_UPSTREAM_FLAG_UNSET_USE_RPT(flags) \ |
199 | 68.5k | ((flags) &= (typeof((flags))) ~PIM_UPSTREAM_FLAG_MASK_USE_RPT) |
200 | | #define PIM_UPSTREAM_FLAG_UNSET_MLAG_INTERFACE(flags) \ |
201 | 0 | ((flags) &= (typeof((flags))) ~PIM_UPSTREAM_FLAG_MASK_MLAG_INTERFACE) |
202 | | |
203 | | |
204 | | /* The RPF cost is incremented by 10 if the RPF interface is the peerlink-rif. |
205 | | * This is used to force the MLAG switch with the lowest cost to the RPF |
206 | | * to become the MLAG DF. |
207 | | */ |
208 | 0 | #define PIM_UPSTREAM_MLAG_PEERLINK_PLUS_METRIC 10 |
209 | | |
210 | | enum pim_upstream_state { |
211 | | PIM_UPSTREAM_NOTJOINED, |
212 | | PIM_UPSTREAM_JOINED, |
213 | | }; |
214 | | |
215 | | enum pim_reg_state { |
216 | | PIM_REG_NOINFO, |
217 | | PIM_REG_JOIN, |
218 | | PIM_REG_JOIN_PENDING, |
219 | | PIM_REG_PRUNE, |
220 | | }; |
221 | | |
222 | | enum pim_upstream_sptbit { |
223 | | PIM_UPSTREAM_SPTBIT_FALSE, |
224 | | PIM_UPSTREAM_SPTBIT_TRUE |
225 | | }; |
226 | | |
227 | | struct pim_up_mlag { |
228 | | /* MRIB.metric(S) from the peer switch. This is used for DF election |
229 | | * and switch with the lowest cost wins. |
230 | | */ |
231 | | uint32_t peer_mrib_metric; |
232 | | }; |
233 | | |
234 | | PREDECL_RBTREE_UNIQ(rb_pim_upstream); |
235 | | /* |
236 | | Upstream (S,G) channel in Joined state |
237 | | (S,G) in the "Not Joined" state is not represented |
238 | | See RFC 4601: 4.5.7. Sending (S,G) Join/Prune Message |
239 | | |
240 | | upstream_addr : Who we are talking to. |
241 | | For (*, G), upstream_addr is RP address or INADDR_ANY(if RP not configured) |
242 | | For (S, G), upstream_addr is source address |
243 | | |
244 | | rpf: contains the nexthop information to whom we are talking to. |
245 | | |
246 | | join_state: JOINED/NOTJOINED |
247 | | |
248 | | In the case when FRR receives IGMP/PIM (*, G) join for group G and RP is not |
249 | | configured, then create a pim_upstream with the below information. |
250 | | pim_upstream->upstream address: INADDR_ANY |
251 | | pim_upstream->rpf: Unknown |
252 | | pim_upstream->state: NOTJOINED |
253 | | |
254 | | When a new RP gets configured for G, find the corresponding pim upstream (*,G) |
255 | | entries and update the upstream address as new RP address if it the better one |
256 | | for the group G. |
257 | | |
258 | | When RP becomes reachable, populate the nexthop information in |
259 | | pim_upstream->rpf and update the state to JOINED. |
260 | | |
261 | | */ |
262 | | struct pim_upstream { |
263 | | struct pim_instance *pim; |
264 | | struct rb_pim_upstream_item upstream_rb; |
265 | | struct pim_upstream *parent; |
266 | | pim_addr upstream_addr; /* Who we are talking to */ |
267 | | pim_addr upstream_register; /*Who we received a register from*/ |
268 | | pim_sgaddr sg; /* (S,G) group key */ |
269 | | char sg_str[PIM_SG_LEN]; |
270 | | uint32_t flags; |
271 | | struct channel_oil *channel_oil; |
272 | | struct list *sources; |
273 | | struct list *ifchannels; |
274 | | /* Counter for Dual active ifchannels*/ |
275 | | uint32_t dualactive_ifchannel_count; |
276 | | |
277 | | enum pim_upstream_state join_state; |
278 | | enum pim_reg_state reg_state; |
279 | | enum pim_upstream_sptbit sptbit; |
280 | | |
281 | | int ref_count; |
282 | | |
283 | | struct pim_rpf rpf; |
284 | | |
285 | | struct pim_up_mlag mlag; |
286 | | |
287 | | struct event *t_join_timer; |
288 | | |
289 | | /* |
290 | | * RST(S,G) |
291 | | */ |
292 | | struct event *t_rs_timer; |
293 | | #define PIM_REGISTER_SUPPRESSION_PERIOD (60) |
294 | | #define PIM_REGISTER_PROBE_PERIOD (5) |
295 | | |
296 | | /* |
297 | | * KAT(S,G) |
298 | | */ |
299 | | struct event *t_ka_timer; |
300 | 1 | #define PIM_KEEPALIVE_PERIOD (210) |
301 | | #define PIM_RP_KEEPALIVE_PERIOD \ |
302 | 1 | (3 * router->register_suppress_time + router->register_probe_time) |
303 | | |
304 | | /* on the RP we restart a timer to indicate if registers are being rxed |
305 | | * for |
306 | | * SG. This is needed by MSDP to determine its local SA cache */ |
307 | | struct event *t_msdp_reg_timer; |
308 | | #define PIM_MSDP_REG_RXED_PERIOD (3 * (1.5 * router->register_suppress_time)) |
309 | | |
310 | | int64_t state_transition; /* Record current state uptime */ |
311 | | }; |
312 | | |
313 | | static inline bool pim_upstream_is_kat_running(struct pim_upstream *up) |
314 | 0 | { |
315 | 0 | return (up->t_ka_timer != NULL); |
316 | 0 | } Unexecuted instantiation: pim_assert.c:pim_upstream_is_kat_running Unexecuted instantiation: pim_bfd.c:pim_upstream_is_kat_running Unexecuted instantiation: pim_bsm.c:pim_upstream_is_kat_running Unexecuted instantiation: pim_cmd_common.c:pim_upstream_is_kat_running Unexecuted instantiation: pim_hello.c:pim_upstream_is_kat_running Unexecuted instantiation: pim_iface.c:pim_upstream_is_kat_running Unexecuted instantiation: pim_ifchannel.c:pim_upstream_is_kat_running Unexecuted instantiation: pim_instance.c:pim_upstream_is_kat_running Unexecuted instantiation: pim_join.c:pim_upstream_is_kat_running Unexecuted instantiation: pim_jp_agg.c:pim_upstream_is_kat_running Unexecuted instantiation: pim_macro.c:pim_upstream_is_kat_running Unexecuted instantiation: pim_mroute.c:pim_upstream_is_kat_running Unexecuted instantiation: pim_msg.c:pim_upstream_is_kat_running Unexecuted instantiation: pim_nb_config.c:pim_upstream_is_kat_running Unexecuted instantiation: pim_neighbor.c:pim_upstream_is_kat_running Unexecuted instantiation: pim_nht.c:pim_upstream_is_kat_running Unexecuted instantiation: pim_oil.c:pim_upstream_is_kat_running Unexecuted instantiation: pim_pim.c:pim_upstream_is_kat_running Unexecuted instantiation: pim_rp.c:pim_upstream_is_kat_running Unexecuted instantiation: pim_rpf.c:pim_upstream_is_kat_running Unexecuted instantiation: pim_sock.c:pim_upstream_is_kat_running Unexecuted instantiation: pim_ssm.c:pim_upstream_is_kat_running Unexecuted instantiation: pim_ssmpingd.c:pim_upstream_is_kat_running Unexecuted instantiation: pim_static.c:pim_upstream_is_kat_running Unexecuted instantiation: pim_tib.c:pim_upstream_is_kat_running Unexecuted instantiation: pim_tlv.c:pim_upstream_is_kat_running Unexecuted instantiation: pim_upstream.c:pim_upstream_is_kat_running Unexecuted instantiation: pim_util.c:pim_upstream_is_kat_running Unexecuted instantiation: pim_vty.c:pim_upstream_is_kat_running Unexecuted instantiation: pim_zebra.c:pim_upstream_is_kat_running Unexecuted instantiation: pim_zlookup.c:pim_upstream_is_kat_running Unexecuted instantiation: pim_vxlan.c:pim_upstream_is_kat_running Unexecuted instantiation: pim_register.c:pim_upstream_is_kat_running Unexecuted instantiation: pimd.c:pim_upstream_is_kat_running Unexecuted instantiation: pim_cmd.c:pim_upstream_is_kat_running Unexecuted instantiation: pim_igmp.c:pim_upstream_is_kat_running Unexecuted instantiation: pim_igmp_mtrace.c:pim_upstream_is_kat_running Unexecuted instantiation: pim_igmpv2.c:pim_upstream_is_kat_running Unexecuted instantiation: pim_igmpv3.c:pim_upstream_is_kat_running Unexecuted instantiation: pim_main.c:pim_upstream_is_kat_running Unexecuted instantiation: pim_mlag.c:pim_upstream_is_kat_running Unexecuted instantiation: pim_msdp.c:pim_upstream_is_kat_running Unexecuted instantiation: pim_msdp_packet.c:pim_upstream_is_kat_running Unexecuted instantiation: pim_msdp_socket.c:pim_upstream_is_kat_running Unexecuted instantiation: pim_zpthread.c:pim_upstream_is_kat_running |
317 | | |
318 | | static inline bool pim_up_mlag_is_local(struct pim_upstream *up) |
319 | 247k | { |
320 | | /* XXX: extend this to also return true if the channel-oil has |
321 | | * any AA devices |
322 | | */ |
323 | 247k | return (up->flags & (PIM_UPSTREAM_FLAG_MASK_MLAG_VXLAN |
324 | 247k | | PIM_UPSTREAM_FLAG_MASK_MLAG_INTERFACE)); |
325 | 247k | } Unexecuted instantiation: pim_assert.c:pim_up_mlag_is_local Unexecuted instantiation: pim_bfd.c:pim_up_mlag_is_local Unexecuted instantiation: pim_bsm.c:pim_up_mlag_is_local Unexecuted instantiation: pim_cmd_common.c:pim_up_mlag_is_local Unexecuted instantiation: pim_hello.c:pim_up_mlag_is_local Unexecuted instantiation: pim_iface.c:pim_up_mlag_is_local Unexecuted instantiation: pim_ifchannel.c:pim_up_mlag_is_local Unexecuted instantiation: pim_instance.c:pim_up_mlag_is_local Unexecuted instantiation: pim_join.c:pim_up_mlag_is_local Unexecuted instantiation: pim_jp_agg.c:pim_up_mlag_is_local Unexecuted instantiation: pim_macro.c:pim_up_mlag_is_local Unexecuted instantiation: pim_mroute.c:pim_up_mlag_is_local Unexecuted instantiation: pim_msg.c:pim_up_mlag_is_local Unexecuted instantiation: pim_nb_config.c:pim_up_mlag_is_local Unexecuted instantiation: pim_neighbor.c:pim_up_mlag_is_local Unexecuted instantiation: pim_nht.c:pim_up_mlag_is_local Unexecuted instantiation: pim_oil.c:pim_up_mlag_is_local Unexecuted instantiation: pim_pim.c:pim_up_mlag_is_local Unexecuted instantiation: pim_rp.c:pim_up_mlag_is_local Unexecuted instantiation: pim_rpf.c:pim_up_mlag_is_local Unexecuted instantiation: pim_sock.c:pim_up_mlag_is_local Unexecuted instantiation: pim_ssm.c:pim_up_mlag_is_local Unexecuted instantiation: pim_ssmpingd.c:pim_up_mlag_is_local Unexecuted instantiation: pim_static.c:pim_up_mlag_is_local Unexecuted instantiation: pim_tib.c:pim_up_mlag_is_local Unexecuted instantiation: pim_tlv.c:pim_up_mlag_is_local pim_upstream.c:pim_up_mlag_is_local Line | Count | Source | 319 | 247k | { | 320 | | /* XXX: extend this to also return true if the channel-oil has | 321 | | * any AA devices | 322 | | */ | 323 | 247k | return (up->flags & (PIM_UPSTREAM_FLAG_MASK_MLAG_VXLAN | 324 | 247k | | PIM_UPSTREAM_FLAG_MASK_MLAG_INTERFACE)); | 325 | 247k | } |
Unexecuted instantiation: pim_util.c:pim_up_mlag_is_local Unexecuted instantiation: pim_vty.c:pim_up_mlag_is_local Unexecuted instantiation: pim_zebra.c:pim_up_mlag_is_local Unexecuted instantiation: pim_zlookup.c:pim_up_mlag_is_local Unexecuted instantiation: pim_vxlan.c:pim_up_mlag_is_local Unexecuted instantiation: pim_register.c:pim_up_mlag_is_local Unexecuted instantiation: pimd.c:pim_up_mlag_is_local Unexecuted instantiation: pim_cmd.c:pim_up_mlag_is_local Unexecuted instantiation: pim_igmp.c:pim_up_mlag_is_local Unexecuted instantiation: pim_igmp_mtrace.c:pim_up_mlag_is_local Unexecuted instantiation: pim_igmpv2.c:pim_up_mlag_is_local Unexecuted instantiation: pim_igmpv3.c:pim_up_mlag_is_local Unexecuted instantiation: pim_main.c:pim_up_mlag_is_local Unexecuted instantiation: pim_mlag.c:pim_up_mlag_is_local Unexecuted instantiation: pim_msdp.c:pim_up_mlag_is_local Unexecuted instantiation: pim_msdp_packet.c:pim_up_mlag_is_local Unexecuted instantiation: pim_msdp_socket.c:pim_up_mlag_is_local Unexecuted instantiation: pim_zpthread.c:pim_up_mlag_is_local |
326 | | |
327 | | struct pim_upstream *pim_upstream_find(struct pim_instance *pim, |
328 | | pim_sgaddr *sg); |
329 | | struct pim_upstream *pim_upstream_find_or_add(pim_sgaddr *sg, |
330 | | struct interface *ifp, int flags, |
331 | | const char *name); |
332 | | struct pim_upstream *pim_upstream_add(struct pim_instance *pim, pim_sgaddr *sg, |
333 | | struct interface *ifp, int flags, |
334 | | const char *name, |
335 | | struct pim_ifchannel *ch); |
336 | | void pim_upstream_ref(struct pim_upstream *up, |
337 | | int flags, const char *name); |
338 | | struct pim_upstream *pim_upstream_del(struct pim_instance *pim, |
339 | | struct pim_upstream *up, |
340 | | const char *name); |
341 | | |
342 | | bool pim_upstream_evaluate_join_desired(struct pim_instance *pim, |
343 | | struct pim_upstream *up); |
344 | | int pim_upstream_evaluate_join_desired_interface(struct pim_upstream *up, |
345 | | struct pim_ifchannel *ch, |
346 | | struct pim_ifchannel *starch); |
347 | | int pim_upstream_eval_inherit_if(struct pim_upstream *up, |
348 | | struct pim_ifchannel *ch, |
349 | | struct pim_ifchannel *starch); |
350 | | void pim_upstream_update_join_desired(struct pim_instance *pim, |
351 | | struct pim_upstream *up); |
352 | | |
353 | | void pim_update_suppress_timers(uint32_t suppress_time); |
354 | | void pim_upstream_join_suppress(struct pim_upstream *up, pim_addr rpf, |
355 | | int holdtime); |
356 | | |
357 | | void pim_upstream_join_timer_decrease_to_t_override(const char *debug_label, |
358 | | struct pim_upstream *up); |
359 | | |
360 | | void pim_upstream_join_timer_restart(struct pim_upstream *up, |
361 | | struct pim_rpf *old); |
362 | | void pim_upstream_rpf_genid_changed(struct pim_instance *pim, |
363 | | pim_addr neigh_addr); |
364 | | void pim_upstream_rpf_interface_changed(struct pim_upstream *up, |
365 | | struct interface *old_rpf_ifp); |
366 | | |
367 | | void pim_upstream_update_could_assert(struct pim_upstream *up); |
368 | | void pim_upstream_update_my_assert_metric(struct pim_upstream *up); |
369 | | |
370 | | void pim_upstream_keep_alive_timer_start(struct pim_upstream *up, |
371 | | uint32_t time); |
372 | | |
373 | | int pim_upstream_switch_to_spt_desired_on_rp(struct pim_instance *pim, |
374 | | pim_sgaddr *sg); |
375 | 0 | #define SwitchToSptDesiredOnRp(pim, sg) pim_upstream_switch_to_spt_desired_on_rp (pim, sg) |
376 | | int pim_upstream_is_sg_rpt(struct pim_upstream *up); |
377 | | |
378 | | void pim_upstream_set_sptbit(struct pim_upstream *up, |
379 | | struct interface *incoming); |
380 | | |
381 | | void pim_upstream_start_register_stop_timer(struct pim_upstream *up, |
382 | | int null_register); |
383 | | |
384 | | void pim_upstream_send_join(struct pim_upstream *up); |
385 | | |
386 | | void pim_upstream_switch(struct pim_instance *pim, struct pim_upstream *up, |
387 | | enum pim_upstream_state new_state); |
388 | | |
389 | | const char *pim_upstream_state2str(enum pim_upstream_state join_state); |
390 | | #define PIM_REG_STATE_STR_LEN 12 |
391 | | const char *pim_reg_state2str(enum pim_reg_state state, char *state_str, |
392 | | size_t state_str_len); |
393 | | |
394 | | int pim_upstream_inherited_olist_decide(struct pim_instance *pim, |
395 | | struct pim_upstream *up); |
396 | | int pim_upstream_inherited_olist(struct pim_instance *pim, |
397 | | struct pim_upstream *up); |
398 | | int pim_upstream_empty_inherited_olist(struct pim_upstream *up); |
399 | | |
400 | | void pim_upstream_find_new_rpf(struct pim_instance *pim); |
401 | | void pim_upstream_msdp_reg_timer_start(struct pim_upstream *up); |
402 | | |
403 | | void pim_upstream_init(struct pim_instance *pim); |
404 | | void pim_upstream_terminate(struct pim_instance *pim); |
405 | | |
406 | | void join_timer_start(struct pim_upstream *up); |
407 | | int pim_upstream_compare(const struct pim_upstream *up1, |
408 | | const struct pim_upstream *up2); |
409 | | DECLARE_RBTREE_UNIQ(rb_pim_upstream, struct pim_upstream, upstream_rb, Unexecuted instantiation: pim_nht.c:rb_pim_upstream_const_first pim_nht.c:rb_pim_upstream_const_next Line | Count | Source | 409 | | DECLARE_RBTREE_UNIQ(rb_pim_upstream, struct pim_upstream, upstream_rb, |
Unexecuted instantiation: pim_rp.c:rb_pim_upstream_const_first pim_rp.c:rb_pim_upstream_const_next Line | Count | Source | 409 | | DECLARE_RBTREE_UNIQ(rb_pim_upstream, struct pim_upstream, upstream_rb, |
Unexecuted instantiation: pim_upstream.c:rb_pim_upstream_del pim_upstream.c:rb_pim_upstream_const_first Line | Count | Source | 409 | | DECLARE_RBTREE_UNIQ(rb_pim_upstream, struct pim_upstream, upstream_rb, |
pim_upstream.c:rb_pim_upstream_const_next Line | Count | Source | 409 | | DECLARE_RBTREE_UNIQ(rb_pim_upstream, struct pim_upstream, upstream_rb, |
pim_upstream.c:rb_pim_upstream_const_find Line | Count | Source | 409 | | DECLARE_RBTREE_UNIQ(rb_pim_upstream, struct pim_upstream, upstream_rb, |
pim_upstream.c:rb_pim_upstream_add Line | Count | Source | 409 | | DECLARE_RBTREE_UNIQ(rb_pim_upstream, struct pim_upstream, upstream_rb, |
pim_register.c:rb_pim_upstream_const_first Line | Count | Source | 409 | | DECLARE_RBTREE_UNIQ(rb_pim_upstream, struct pim_upstream, upstream_rb, |
pim_register.c:rb_pim_upstream_const_next Line | Count | Source | 409 | | DECLARE_RBTREE_UNIQ(rb_pim_upstream, struct pim_upstream, upstream_rb, |
|
410 | | pim_upstream_compare); |
411 | | |
412 | | void pim_upstream_register_reevaluate(struct pim_instance *pim); |
413 | | |
414 | | void pim_upstream_add_lhr_star_pimreg(struct pim_instance *pim); |
415 | | void pim_upstream_remove_lhr_star_pimreg(struct pim_instance *pim, |
416 | | const char *nlist); |
417 | | |
418 | | void pim_upstream_spt_prefix_list_update(struct pim_instance *pim, |
419 | | struct prefix_list *pl); |
420 | | |
421 | | unsigned int pim_upstream_hash_key(const void *arg); |
422 | | bool pim_upstream_equal(const void *arg1, const void *arg2); |
423 | | struct pim_upstream *pim_upstream_keep_alive_timer_proc( |
424 | | struct pim_upstream *up); |
425 | | void pim_upstream_fill_static_iif(struct pim_upstream *up, |
426 | | struct interface *incoming); |
427 | | void pim_upstream_update_use_rpt(struct pim_upstream *up, |
428 | | bool update_mroute); |
429 | | uint32_t pim_up_mlag_local_cost(struct pim_upstream *up); |
430 | | uint32_t pim_up_mlag_peer_cost(struct pim_upstream *up); |
431 | | void pim_upstream_reeval_use_rpt(struct pim_instance *pim); |
432 | | int pim_upstream_could_register(struct pim_upstream *up); |
433 | | #endif /* PIM_UPSTREAM_H */ |