3 Copyright (C) 2008 Everton da Silva Marques
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.
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.
15 You should have received a copy of the GNU General Public License
16 along with this program; see the file COPYING; if not, write to the
17 Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
23 #include "zebra/rib.h"
40 #include "pim_iface.h"
42 #include "pim_zlookup.h"
43 #include "pim_upstream.h"
44 #include "pim_ifchannel.h"
45 #include "pim_neighbor.h"
47 #include "pim_zebra.h"
49 #include "pim_macro.h"
52 #include "pim_register.h"
54 #include "pim_jp_agg.h"
56 struct hash
*pim_upstream_hash
= NULL
;
57 struct list
*pim_upstream_list
= NULL
;
58 struct timer_wheel
*pim_upstream_sg_wheel
= NULL
;
60 static void join_timer_stop(struct pim_upstream
*up
);
61 static void pim_upstream_update_assert_tracking_desired(struct pim_upstream
*up
);
64 * A (*,G) or a (*,*) is going away
65 * remove the parent pointer from
66 * those pointing at us
69 pim_upstream_remove_children (struct pim_upstream
*up
)
71 struct pim_upstream
*child
;
76 while (!list_isempty (up
->sources
))
78 child
= listnode_head (up
->sources
);
80 listnode_delete (up
->sources
, child
);
85 * A (*,G) or a (*,*) is being created
86 * Find the children that would point
90 pim_upstream_find_new_children (struct pim_upstream
*up
)
92 struct pim_upstream
*child
;
93 struct listnode
*ch_node
;
95 if ((up
->sg
.src
.s_addr
!= INADDR_ANY
) &&
96 (up
->sg
.grp
.s_addr
!= INADDR_ANY
))
99 if ((up
->sg
.src
.s_addr
== INADDR_ANY
) &&
100 (up
->sg
.grp
.s_addr
== INADDR_ANY
))
103 for (ALL_LIST_ELEMENTS_RO (pim_upstream_list
, ch_node
, child
))
105 if ((up
->sg
.grp
.s_addr
!= INADDR_ANY
) &&
106 (child
->sg
.grp
.s_addr
== up
->sg
.grp
.s_addr
) &&
110 listnode_add_sort (up
->sources
, child
);
116 * If we have a (*,*) || (S,*) there is no parent
117 * If we have a (S,G), find the (*,G)
118 * If we have a (*,G), find the (*,*)
120 static struct pim_upstream
*
121 pim_upstream_find_parent (struct pim_upstream
*child
)
123 struct prefix_sg any
= child
->sg
;
124 struct pim_upstream
*up
= NULL
;
127 if ((child
->sg
.src
.s_addr
!= INADDR_ANY
) &&
128 (child
->sg
.grp
.s_addr
!= INADDR_ANY
))
130 any
.src
.s_addr
= INADDR_ANY
;
131 up
= pim_upstream_find (&any
);
134 listnode_add (up
->sources
, child
);
142 void pim_upstream_free(struct pim_upstream
*up
)
144 XFREE(MTYPE_PIM_UPSTREAM
, up
);
147 static void upstream_channel_oil_detach(struct pim_upstream
*up
)
149 if (up
->channel_oil
) {
150 pim_channel_oil_del(up
->channel_oil
);
151 up
->channel_oil
= NULL
;
156 pim_upstream_del(struct pim_upstream
*up
, const char *name
)
158 bool notify_msdp
= false;
161 zlog_debug ("%s(%s): Delete %s ref count: %d",
162 __PRETTY_FUNCTION__
, name
, up
->sg_str
, up
->ref_count
);
166 if (up
->ref_count
>= 1)
169 THREAD_OFF(up
->t_ka_timer
);
170 THREAD_OFF(up
->t_rs_timer
);
171 THREAD_OFF(up
->t_msdp_reg_timer
);
173 if (up
->join_state
== PIM_UPSTREAM_JOINED
) {
174 pim_jp_agg_single_upstream_send (&up
->rpf
, up
, 0);
176 if (up
->sg
.src
.s_addr
== INADDR_ANY
) {
177 /* if a (*, G) entry in the joined state is being deleted we
178 * need to notify MSDP */
184 up
->rpf
.source_nexthop
.interface
= NULL
;
186 if (up
->sg
.src
.s_addr
!= INADDR_ANY
) {
187 wheel_remove_item (pim_upstream_sg_wheel
, up
);
191 pim_upstream_remove_children (up
);
192 pim_mroute_del (up
->channel_oil
, __PRETTY_FUNCTION__
);
193 upstream_channel_oil_detach(up
);
196 list_delete (up
->sources
);
200 notice that listnode_delete() can't be moved
201 into pim_upstream_free() because the later is
202 called by list_delete_all_node()
206 listnode_delete (up
->parent
->sources
, up
);
209 listnode_delete (pim_upstream_list
, up
);
210 hash_release (pim_upstream_hash
, up
);
213 pim_msdp_up_del(&up
->sg
);
215 pim_upstream_free(up
);
219 pim_upstream_send_join (struct pim_upstream
*up
)
221 if (PIM_DEBUG_TRACE
) {
222 char rpf_str
[PREFIX_STRLEN
];
223 pim_addr_dump("<rpf?>", &up
->rpf
.rpf_addr
, rpf_str
, sizeof(rpf_str
));
224 zlog_debug ("%s: RPF'%s=%s(%s) for Interface %s", __PRETTY_FUNCTION__
,
225 up
->sg_str
, rpf_str
, pim_upstream_state2str (up
->join_state
),
226 up
->rpf
.source_nexthop
.interface
->name
);
227 if (pim_rpf_addr_is_inaddr_any(&up
->rpf
)) {
228 zlog_debug("%s: can't send join upstream: RPF'%s=%s",
230 up
->sg_str
, rpf_str
);
235 /* send Join(S,G) to the current upstream neighbor */
236 pim_jp_agg_single_upstream_send(&up
->rpf
, up
, 1 /* join */);
239 static int on_join_timer(struct thread
*t
)
241 struct pim_upstream
*up
;
245 up
->t_join_timer
= NULL
;
248 * In the case of a HFR we will not ahve anyone to send this to.
250 if (PIM_UPSTREAM_FLAG_TEST_FHR(up
->flags
))
254 * Don't send the join if the outgoing interface is a loopback
255 * But since this might change leave the join timer running
257 if (up
->rpf
.source_nexthop
.interface
&&
258 !if_is_loopback (up
->rpf
.source_nexthop
.interface
))
259 pim_upstream_send_join (up
);
261 join_timer_start(up
);
266 static void join_timer_stop(struct pim_upstream
*up
)
268 struct pim_neighbor
*nbr
;
270 nbr
= pim_neighbor_find (up
->rpf
.source_nexthop
.interface
,
271 up
->rpf
.rpf_addr
.u
.prefix4
);
274 pim_jp_agg_remove_group (nbr
->upstream_jp_agg
, up
);
276 THREAD_OFF (up
->t_join_timer
);
280 join_timer_start(struct pim_upstream
*up
)
282 struct pim_neighbor
*nbr
= NULL
;
284 if (up
->rpf
.source_nexthop
.interface
)
286 nbr
= pim_neighbor_find (up
->rpf
.source_nexthop
.interface
,
287 up
->rpf
.rpf_addr
.u
.prefix4
);
289 if (PIM_DEBUG_PIM_EVENTS
) {
290 zlog_debug("%s: starting %d sec timer for upstream (S,G)=%s",
298 pim_jp_agg_add_group (nbr
->upstream_jp_agg
, up
, 1);
301 THREAD_OFF (up
->t_join_timer
);
302 THREAD_TIMER_ON(master
, up
->t_join_timer
,
304 up
, qpim_t_periodic
);
309 * This is only called when we are switching the upstream
310 * J/P from one neighbor to another
312 * As such we need to remove from the old list and
313 * add to the new list.
315 void pim_upstream_join_timer_restart(struct pim_upstream
*up
, struct pim_rpf
*old
)
317 struct pim_neighbor
*nbr
;
319 nbr
= pim_neighbor_find (old
->source_nexthop
.interface
,
320 old
->rpf_addr
.u
.prefix4
);
322 pim_jp_agg_remove_group (nbr
->upstream_jp_agg
, up
);
324 //THREAD_OFF(up->t_join_timer);
325 join_timer_start(up
);
328 static void pim_upstream_join_timer_restart_msec(struct pim_upstream
*up
,
331 if (PIM_DEBUG_PIM_EVENTS
) {
332 zlog_debug("%s: restarting %d msec timer for upstream (S,G)=%s",
338 THREAD_OFF(up
->t_join_timer
);
339 THREAD_TIMER_MSEC_ON(master
, up
->t_join_timer
,
344 void pim_upstream_join_suppress(struct pim_upstream
*up
,
345 struct in_addr rpf_addr
,
348 long t_joinsuppress_msec
;
349 long join_timer_remain_msec
;
351 t_joinsuppress_msec
= MIN(pim_if_t_suppressed_msec(up
->rpf
.source_nexthop
.interface
),
354 join_timer_remain_msec
= pim_time_timer_remain_msec(up
->t_join_timer
);
356 if (PIM_DEBUG_TRACE
) {
357 char rpf_str
[INET_ADDRSTRLEN
];
358 pim_inet4_dump("<rpf?>", rpf_addr
, rpf_str
, sizeof(rpf_str
));
359 zlog_debug("%s %s: detected Join%s to RPF'(S,G)=%s: join_timer=%ld msec t_joinsuppress=%ld msec",
360 __FILE__
, __PRETTY_FUNCTION__
,
363 join_timer_remain_msec
, t_joinsuppress_msec
);
366 if (join_timer_remain_msec
< t_joinsuppress_msec
) {
367 if (PIM_DEBUG_TRACE
) {
368 zlog_debug("%s %s: suppressing Join(S,G)=%s for %ld msec",
369 __FILE__
, __PRETTY_FUNCTION__
,
370 up
->sg_str
, t_joinsuppress_msec
);
373 pim_upstream_join_timer_restart_msec(up
, t_joinsuppress_msec
);
377 void pim_upstream_join_timer_decrease_to_t_override(const char *debug_label
,
378 struct pim_upstream
*up
)
380 long join_timer_remain_msec
;
383 join_timer_remain_msec
= pim_time_timer_remain_msec(up
->t_join_timer
);
384 t_override_msec
= pim_if_t_override_msec(up
->rpf
.source_nexthop
.interface
);
386 if (PIM_DEBUG_TRACE
) {
387 char rpf_str
[INET_ADDRSTRLEN
];
388 pim_inet4_dump("<rpf?>", up
->rpf
.rpf_addr
.u
.prefix4
, rpf_str
, sizeof(rpf_str
));
389 zlog_debug("%s: to RPF'%s=%s: join_timer=%ld msec t_override=%d msec",
392 join_timer_remain_msec
, t_override_msec
);
395 if (join_timer_remain_msec
> t_override_msec
) {
396 if (PIM_DEBUG_TRACE
) {
397 zlog_debug("%s: decreasing (S,G)=%s join timer to t_override=%d msec",
403 pim_upstream_join_timer_restart_msec(up
, t_override_msec
);
407 static void forward_on(struct pim_upstream
*up
)
409 struct listnode
*chnode
;
410 struct listnode
*chnextnode
;
411 struct pim_interface
*pim_ifp
;
412 struct pim_ifchannel
*ch
;
414 /* scan (S,G) state */
415 for (ALL_LIST_ELEMENTS(pim_ifchannel_list
, chnode
, chnextnode
, ch
)) {
416 pim_ifp
= ch
->interface
->info
;
420 if (ch
->upstream
!= up
)
423 if (pim_macro_chisin_oiflist(ch
))
424 pim_forward_start(ch
);
426 } /* scan iface channel list */
429 static void forward_off(struct pim_upstream
*up
)
431 struct listnode
*chnode
;
432 struct listnode
*chnextnode
;
433 struct pim_interface
*pim_ifp
;
434 struct pim_ifchannel
*ch
;
436 /* scan per-interface (S,G) state */
437 for (ALL_LIST_ELEMENTS(pim_ifchannel_list
, chnode
, chnextnode
, ch
)) {
438 pim_ifp
= ch
->interface
->info
;
442 if (ch
->upstream
!= up
)
445 pim_forward_stop(ch
);
447 } /* scan iface channel list */
451 pim_upstream_could_register (struct pim_upstream
*up
)
453 struct pim_interface
*pim_ifp
= up
->rpf
.source_nexthop
.interface
->info
;
455 if (pim_ifp
&& PIM_I_am_DR (pim_ifp
) &&
456 pim_if_connected_to_source (up
->rpf
.source_nexthop
.interface
, up
->sg
.src
))
463 pim_upstream_switch(struct pim_upstream
*up
,
464 enum pim_upstream_state new_state
)
466 enum pim_upstream_state old_state
= up
->join_state
;
468 if (PIM_DEBUG_PIM_EVENTS
) {
469 zlog_debug("%s: PIM_UPSTREAM_%s: (S,G) old: %s new: %s",
472 pim_upstream_state2str (up
->join_state
),
473 pim_upstream_state2str (new_state
));
477 * This code still needs work.
479 switch (up
->join_state
)
481 case PIM_UPSTREAM_PRUNE
:
482 if (!PIM_UPSTREAM_FLAG_TEST_FHR(up
->flags
))
484 up
->join_state
= new_state
;
485 up
->state_transition
= pim_time_monotonic_sec ();
488 case PIM_UPSTREAM_JOIN_PENDING
:
490 case PIM_UPSTREAM_NOTJOINED
:
491 case PIM_UPSTREAM_JOINED
:
492 up
->join_state
= new_state
;
493 if (old_state
!= new_state
)
494 up
->state_transition
= pim_time_monotonic_sec();
499 pim_upstream_update_assert_tracking_desired(up
);
501 if (new_state
== PIM_UPSTREAM_JOINED
) {
502 if (old_state
!= PIM_UPSTREAM_JOINED
)
504 int old_fhr
= PIM_UPSTREAM_FLAG_TEST_FHR(up
->flags
);
506 pim_msdp_up_join_state_changed(up
);
507 if (pim_upstream_could_register (up
))
509 PIM_UPSTREAM_FLAG_SET_FHR(up
->flags
);
510 if (!old_fhr
&& PIM_UPSTREAM_FLAG_TEST_SRC_STREAM(up
->flags
))
512 pim_upstream_keep_alive_timer_start (up
, qpim_keep_alive_time
);
513 pim_channel_add_oif (up
->channel_oil
, pim_regiface
, PIM_OIF_FLAG_PROTO_PIM
);
518 pim_upstream_send_join (up
);
519 join_timer_start (up
);
530 if (old_state
== PIM_UPSTREAM_JOINED
)
531 pim_msdp_up_join_state_changed(up
);
533 pim_jp_agg_single_upstream_send(&up
->rpf
, up
, 0 /* prune */);
539 pim_upstream_compare (void *arg1
, void *arg2
)
541 const struct pim_upstream
*up1
= (const struct pim_upstream
*)arg1
;
542 const struct pim_upstream
*up2
= (const struct pim_upstream
*)arg2
;
544 if (ntohl(up1
->sg
.grp
.s_addr
) < ntohl(up2
->sg
.grp
.s_addr
))
547 if (ntohl(up1
->sg
.grp
.s_addr
) > ntohl(up2
->sg
.grp
.s_addr
))
550 if (ntohl(up1
->sg
.src
.s_addr
) < ntohl(up2
->sg
.src
.s_addr
))
553 if (ntohl(up1
->sg
.src
.s_addr
) > ntohl(up2
->sg
.src
.s_addr
))
559 static struct pim_upstream
*
560 pim_upstream_new (struct prefix_sg
*sg
,
561 struct interface
*incoming
,
564 enum pim_rpf_result rpf_result
;
565 struct pim_interface
*pim_ifp
;
566 struct pim_upstream
*up
;
568 up
= XCALLOC(MTYPE_PIM_UPSTREAM
, sizeof(*up
));
570 zlog_err("%s: PIM XCALLOC(%zu) failure",
571 __PRETTY_FUNCTION__
, sizeof(*up
));
576 pim_str_sg_set (sg
, up
->sg_str
);
577 up
= hash_get (pim_upstream_hash
, up
, hash_alloc_intern
);
578 if (!pim_rp_set_upstream_addr (&up
->upstream_addr
, sg
->src
, sg
->grp
))
581 zlog_debug("%s: Received a (*,G) with no RP configured", __PRETTY_FUNCTION__
);
583 hash_release (pim_upstream_hash
, up
);
584 XFREE (MTYPE_PIM_UPSTREAM
, up
);
588 up
->parent
= pim_upstream_find_parent (up
);
589 if (up
->sg
.src
.s_addr
== INADDR_ANY
)
591 up
->sources
= list_new ();
592 up
->sources
->cmp
= pim_upstream_compare
;
597 pim_upstream_find_new_children (up
);
600 up
->t_join_timer
= NULL
;
601 up
->t_ka_timer
= NULL
;
602 up
->t_rs_timer
= NULL
;
603 up
->t_msdp_reg_timer
= NULL
;
605 up
->state_transition
= pim_time_monotonic_sec();
606 up
->channel_oil
= NULL
;
607 up
->sptbit
= PIM_UPSTREAM_SPTBIT_FALSE
;
609 up
->rpf
.source_nexthop
.interface
= NULL
;
610 up
->rpf
.source_nexthop
.mrib_nexthop_addr
.family
= AF_INET
;
611 up
->rpf
.source_nexthop
.mrib_nexthop_addr
.u
.prefix4
.s_addr
= PIM_NET_INADDR_ANY
;
612 up
->rpf
.source_nexthop
.mrib_metric_preference
= qpim_infinite_assert_metric
.metric_preference
;
613 up
->rpf
.source_nexthop
.mrib_route_metric
= qpim_infinite_assert_metric
.route_metric
;
614 up
->rpf
.rpf_addr
.family
= AF_INET
;
615 up
->rpf
.rpf_addr
.u
.prefix4
.s_addr
= PIM_NET_INADDR_ANY
;
617 if (up
->sg
.src
.s_addr
!= INADDR_ANY
)
618 wheel_add_item (pim_upstream_sg_wheel
, up
);
620 rpf_result
= pim_rpf_update(up
, NULL
);
621 if (rpf_result
== PIM_RPF_FAILURE
) {
623 zlog_debug ("%s: Attempting to create upstream(%s), Unable to RPF for source", __PRETTY_FUNCTION__
,
628 listnode_delete (up
->parent
->sources
, up
);
632 if (up
->sg
.src
.s_addr
!= INADDR_ANY
)
633 wheel_remove_item (pim_upstream_sg_wheel
, up
);
635 pim_upstream_remove_children (up
);
637 list_delete (up
->sources
);
639 hash_release (pim_upstream_hash
, up
);
640 XFREE(MTYPE_PIM_UPSTREAM
, up
);
644 pim_ifp
= up
->rpf
.source_nexthop
.interface
->info
;
646 up
->channel_oil
= pim_channel_oil_add(&up
->sg
, pim_ifp
->mroute_vif_index
);
648 listnode_add_sort(pim_upstream_list
, up
);
651 zlog_debug ("%s: Created Upstream %s", __PRETTY_FUNCTION__
, up
->sg_str
);
656 struct pim_upstream
*pim_upstream_find(struct prefix_sg
*sg
)
658 struct pim_upstream lookup
;
659 struct pim_upstream
*up
= NULL
;
662 up
= hash_lookup (pim_upstream_hash
, &lookup
);
666 static void pim_upstream_ref(struct pim_upstream
*up
, int flags
)
672 struct pim_upstream
*pim_upstream_add(struct prefix_sg
*sg
,
673 struct interface
*incoming
,
674 int flags
, const char *name
)
676 struct pim_upstream
*up
= NULL
;
678 up
= pim_upstream_find(sg
);
680 pim_upstream_ref(up
, flags
);
684 up
= pim_upstream_new(sg
, incoming
, flags
);
690 zlog_debug("%s(%s): %s, found: %d: ref_count: %d",
691 __PRETTY_FUNCTION__
, name
,
695 zlog_debug("%s(%s): (%s) failure to create",
696 __PRETTY_FUNCTION__
, name
,
697 pim_str_sg_dump (sg
));
704 pim_upstream_evaluate_join_desired_interface (struct pim_upstream
*up
,
705 struct pim_ifchannel
*ch
)
707 struct pim_upstream
*parent
= up
->parent
;
709 if (ch
->upstream
== up
)
711 if (!pim_macro_ch_lost_assert(ch
) && pim_macro_chisin_joins_or_include(ch
))
714 if (PIM_IF_FLAG_TEST_S_G_RPT(ch
->flags
))
721 if (parent
&& ch
->upstream
== parent
)
723 if (!pim_macro_ch_lost_assert (ch
) && pim_macro_chisin_joins_or_include (ch
))
731 Evaluate JoinDesired(S,G):
733 JoinDesired(S,G) is true if there is a downstream (S,G) interface I
736 inherited_olist(S,G) =
737 joins(S,G) (+) pim_include(S,G) (-) lost_assert(S,G)
739 JoinDesired(S,G) may be affected by changes in the following:
741 pim_ifp->primary_address
743 ch->ifassert_winner_metric
745 ch->local_ifmembership
747 ch->upstream->rpf.source_nexthop.mrib_metric_preference
748 ch->upstream->rpf.source_nexthop.mrib_route_metric
749 ch->upstream->rpf.source_nexthop.interface
751 See also pim_upstream_update_join_desired() below.
753 int pim_upstream_evaluate_join_desired(struct pim_upstream
*up
)
755 struct listnode
*chnode
;
756 struct listnode
*chnextnode
;
757 struct pim_interface
*pim_ifp
;
758 struct pim_ifchannel
*ch
;
761 /* scan per-interface (S,G) state */
762 for (ALL_LIST_ELEMENTS(pim_ifchannel_list
, chnode
, chnextnode
, ch
))
764 pim_ifp
= ch
->interface
->info
;
768 ret
+= pim_upstream_evaluate_join_desired_interface (up
, ch
);
769 } /* scan iface channel list */
771 return ret
; /* false */
775 See also pim_upstream_evaluate_join_desired() above.
777 void pim_upstream_update_join_desired(struct pim_upstream
*up
)
779 int was_join_desired
; /* boolean */
780 int is_join_desired
; /* boolean */
782 was_join_desired
= PIM_UPSTREAM_FLAG_TEST_DR_JOIN_DESIRED(up
->flags
);
784 is_join_desired
= pim_upstream_evaluate_join_desired(up
);
786 PIM_UPSTREAM_FLAG_SET_DR_JOIN_DESIRED(up
->flags
);
788 PIM_UPSTREAM_FLAG_UNSET_DR_JOIN_DESIRED(up
->flags
);
790 /* switched from false to true */
791 if (is_join_desired
&& !was_join_desired
) {
792 pim_upstream_switch(up
, PIM_UPSTREAM_JOINED
);
796 /* switched from true to false */
797 if (!is_join_desired
&& was_join_desired
) {
798 pim_upstream_switch(up
, PIM_UPSTREAM_NOTJOINED
);
804 RFC 4601 4.5.7. Sending (S,G) Join/Prune Messages
805 Transitions from Joined State
806 RPF'(S,G) GenID changes
808 The upstream (S,G) state machine remains in Joined state. If the
809 Join Timer is set to expire in more than t_override seconds, reset
810 it so that it expires after t_override seconds.
812 void pim_upstream_rpf_genid_changed(struct in_addr neigh_addr
)
814 struct listnode
*up_node
;
815 struct listnode
*up_nextnode
;
816 struct pim_upstream
*up
;
819 * Scan all (S,G) upstreams searching for RPF'(S,G)=neigh_addr
821 for (ALL_LIST_ELEMENTS(pim_upstream_list
, up_node
, up_nextnode
, up
)) {
823 if (PIM_DEBUG_TRACE
) {
824 char neigh_str
[INET_ADDRSTRLEN
];
825 char rpf_addr_str
[PREFIX_STRLEN
];
826 pim_inet4_dump("<neigh?>", neigh_addr
, neigh_str
, sizeof(neigh_str
));
827 pim_addr_dump("<rpf?>", &up
->rpf
.rpf_addr
, rpf_addr_str
, sizeof(rpf_addr_str
));
828 zlog_debug("%s: matching neigh=%s against upstream (S,G)=%s joined=%d rpf_addr=%s",
830 neigh_str
, up
->sg_str
,
831 up
->join_state
== PIM_UPSTREAM_JOINED
,
835 /* consider only (S,G) upstream in Joined state */
836 if (up
->join_state
!= PIM_UPSTREAM_JOINED
)
839 /* match RPF'(S,G)=neigh_addr */
840 if (up
->rpf
.rpf_addr
.u
.prefix4
.s_addr
!= neigh_addr
.s_addr
)
843 pim_upstream_join_timer_decrease_to_t_override("RPF'(S,G) GenID change",
849 void pim_upstream_rpf_interface_changed(struct pim_upstream
*up
,
850 struct interface
*old_rpf_ifp
)
852 struct listnode
*chnode
;
853 struct listnode
*chnextnode
;
854 struct pim_ifchannel
*ch
;
855 struct pim_interface
*pim_ifp
;
857 /* search all ifchannels */
858 for (ALL_LIST_ELEMENTS(pim_ifchannel_list
, chnode
, chnextnode
, ch
)) {
860 pim_ifp
= ch
->interface
->info
;
864 if (ch
->upstream
!= up
)
867 if (ch
->ifassert_state
== PIM_IFASSERT_I_AM_LOSER
) {
869 /* RPF_interface(S) was NOT I */
870 (old_rpf_ifp
== ch
->interface
)
872 /* RPF_interface(S) stopped being I */
873 (ch
->upstream
->rpf
.source_nexthop
.interface
!= ch
->interface
)
875 assert_action_a5(ch
);
877 } /* PIM_IFASSERT_I_AM_LOSER */
879 pim_ifchannel_update_assert_tracking_desired(ch
);
883 void pim_upstream_update_could_assert(struct pim_upstream
*up
)
885 struct listnode
*chnode
;
886 struct listnode
*chnextnode
;
887 struct pim_interface
*pim_ifp
;
888 struct pim_ifchannel
*ch
;
890 /* scan per-interface (S,G) state */
891 for (ALL_LIST_ELEMENTS(pim_ifchannel_list
, chnode
, chnextnode
, ch
)) {
892 pim_ifp
= ch
->interface
->info
;
896 if (ch
->upstream
!= up
)
899 pim_ifchannel_update_could_assert(ch
);
900 } /* scan iface channel list */
903 void pim_upstream_update_my_assert_metric(struct pim_upstream
*up
)
905 struct listnode
*chnode
;
906 struct listnode
*chnextnode
;
907 struct pim_interface
*pim_ifp
;
908 struct pim_ifchannel
*ch
;
910 /* scan per-interface (S,G) state */
911 for (ALL_LIST_ELEMENTS(pim_ifchannel_list
, chnode
, chnextnode
, ch
)) {
912 pim_ifp
= ch
->interface
->info
;
916 if (ch
->upstream
!= up
)
919 pim_ifchannel_update_my_assert_metric(ch
);
921 } /* scan iface channel list */
924 static void pim_upstream_update_assert_tracking_desired(struct pim_upstream
*up
)
926 struct listnode
*chnode
;
927 struct listnode
*chnextnode
;
928 struct pim_interface
*pim_ifp
;
929 struct pim_ifchannel
*ch
;
931 /* scan per-interface (S,G) state */
932 for (ALL_LIST_ELEMENTS(pim_ifchannel_list
, chnode
, chnextnode
, ch
)) {
933 pim_ifp
= ch
->interface
->info
;
937 if (ch
->upstream
!= up
)
940 pim_ifchannel_update_assert_tracking_desired(ch
);
942 } /* scan iface channel list */
945 /* When kat is stopped CouldRegister goes to false so we need to
946 * transition the (S, G) on FHR to NI state and remove reg tunnel
948 static void pim_upstream_fhr_kat_expiry(struct pim_upstream
*up
)
950 if (!PIM_UPSTREAM_FLAG_TEST_FHR(up
->flags
))
954 zlog_debug ("kat expired on %s; clear fhr reg state", up
->sg_str
);
956 /* stop reg-stop timer */
957 THREAD_OFF(up
->t_rs_timer
);
958 /* remove regiface from the OIL if it is there*/
959 pim_channel_del_oif (up
->channel_oil
, pim_regiface
, PIM_OIF_FLAG_PROTO_PIM
);
960 /* move to "not-joined" */
961 up
->join_state
= PIM_UPSTREAM_NOTJOINED
;
962 PIM_UPSTREAM_FLAG_UNSET_FHR(up
->flags
);
965 /* When kat is started CouldRegister can go to true. And if it does we
966 * need to transition the (S, G) on FHR to JOINED state and add reg tunnel
968 static void pim_upstream_fhr_kat_start(struct pim_upstream
*up
)
970 if (pim_upstream_could_register(up
)) {
972 zlog_debug ("kat started on %s; set fhr reg state to joined", up
->sg_str
);
974 PIM_UPSTREAM_FLAG_SET_FHR(up
->flags
);
975 if (up
->join_state
== PIM_UPSTREAM_NOTJOINED
) {
976 pim_channel_add_oif (up
->channel_oil
, pim_regiface
, PIM_OIF_FLAG_PROTO_PIM
);
977 up
->join_state
= PIM_UPSTREAM_JOINED
;
983 * On an RP, the PMBR value must be cleared when the
984 * Keepalive Timer expires
985 * KAT expiry indicates that flow is inactive. If the flow was created or
986 * maintained by activity now is the time to deref it.
989 pim_upstream_keep_alive_timer (struct thread
*t
)
991 struct pim_upstream
*up
;
994 up
->t_ka_timer
= NULL
;
996 if (I_am_RP (up
->sg
.grp
))
998 pim_br_clear_pmbr (&up
->sg
);
1000 * We need to do more here :)
1001 * But this is the start.
1005 /* source is no longer active - pull the SA from MSDP's cache */
1006 pim_msdp_sa_local_del(&up
->sg
);
1008 /* if entry was created because of activity we need to deref it */
1009 if (PIM_UPSTREAM_FLAG_TEST_SRC_STREAM(up
->flags
))
1011 pim_upstream_fhr_kat_expiry(up
);
1012 if (PIM_DEBUG_TRACE
)
1013 zlog_debug ("kat expired on %s; remove stream reference", up
->sg_str
);
1014 PIM_UPSTREAM_FLAG_UNSET_SRC_STREAM(up
->flags
);
1015 pim_upstream_del(up
, __PRETTY_FUNCTION__
);
1022 pim_upstream_keep_alive_timer_start (struct pim_upstream
*up
,
1025 if (!PIM_UPSTREAM_FLAG_TEST_SRC_STREAM(up
->flags
)) {
1026 if (PIM_DEBUG_TRACE
)
1027 zlog_debug ("kat start on %s with no stream reference", up
->sg_str
);
1029 THREAD_OFF (up
->t_ka_timer
);
1030 THREAD_TIMER_ON (master
,
1032 pim_upstream_keep_alive_timer
,
1035 /* any time keepalive is started against a SG we will have to
1036 * re-evaluate our active source database */
1037 pim_msdp_sa_local_update(up
);
1040 /* MSDP on RP needs to know if a source is registerable to this RP */
1042 pim_upstream_msdp_reg_timer(struct thread
*t
)
1044 struct pim_upstream
*up
;
1047 up
->t_msdp_reg_timer
= NULL
;
1049 /* source is no longer active - pull the SA from MSDP's cache */
1050 pim_msdp_sa_local_del(&up
->sg
);
1054 pim_upstream_msdp_reg_timer_start(struct pim_upstream
*up
)
1056 THREAD_OFF(up
->t_msdp_reg_timer
);
1057 THREAD_TIMER_ON(master
, up
->t_msdp_reg_timer
,
1058 pim_upstream_msdp_reg_timer
, up
, PIM_MSDP_REG_RXED_PERIOD
);
1060 pim_msdp_sa_local_update(up
);
1064 * 4.2.1 Last-Hop Switchover to the SPT
1066 * In Sparse-Mode PIM, last-hop routers join the shared tree towards the
1067 * RP. Once traffic from sources to joined groups arrives at a last-hop
1068 * router, it has the option of switching to receive the traffic on a
1069 * shortest path tree (SPT).
1071 * The decision for a router to switch to the SPT is controlled as
1075 * CheckSwitchToSpt(S,G) {
1076 * if ( ( pim_include(*,G) (-) pim_exclude(S,G)
1077 * (+) pim_include(S,G) != NULL )
1078 * AND SwitchToSptDesired(S,G) ) {
1079 * # Note: Restarting the KAT will result in the SPT switch
1080 * set KeepaliveTimer(S,G) to Keepalive_Period
1084 * SwitchToSptDesired(S,G) is a policy function that is implementation
1085 * defined. An "infinite threshold" policy can be implemented by making
1086 * SwitchToSptDesired(S,G) return false all the time. A "switch on
1087 * first packet" policy can be implemented by making
1088 * SwitchToSptDesired(S,G) return true once a single packet has been
1089 * received for the source and group.
1092 pim_upstream_switch_to_spt_desired (struct prefix_sg
*sg
)
1094 if (I_am_RP (sg
->grp
))
1101 pim_upstream_is_sg_rpt (struct pim_upstream
*up
)
1103 struct listnode
*chnode
;
1104 struct pim_ifchannel
*ch
;
1106 for (ALL_LIST_ELEMENTS_RO(pim_ifchannel_list
, chnode
, ch
))
1108 if ((ch
->upstream
== up
) &&
1109 (PIM_IF_FLAG_TEST_S_G_RPT(ch
->flags
)))
1116 * After receiving a packet set SPTbit:
1118 * Update_SPTbit(S,G,iif) {
1119 * if ( iif == RPF_interface(S)
1120 * AND JoinDesired(S,G) == TRUE
1121 * AND ( DirectlyConnected(S) == TRUE
1122 * OR RPF_interface(S) != RPF_interface(RP(G))
1123 * OR inherited_olist(S,G,rpt) == NULL
1124 * OR ( ( RPF'(S,G) == RPF'(*,G) ) AND
1125 * ( RPF'(S,G) != NULL ) )
1126 * OR ( I_Am_Assert_Loser(S,G,iif) ) {
1127 * Set SPTbit(S,G) to TRUE
1132 pim_upstream_set_sptbit (struct pim_upstream
*up
, struct interface
*incoming
)
1134 struct pim_rpf
*grpf
= NULL
;
1136 // iif == RPF_interfvace(S)
1137 if (up
->rpf
.source_nexthop
.interface
!= incoming
)
1139 if (PIM_DEBUG_TRACE
)
1140 zlog_debug ("%s: Incoming Interface: %s is different than RPF_interface(S) %s",
1141 __PRETTY_FUNCTION__
, incoming
->name
, up
->rpf
.source_nexthop
.interface
->name
);
1145 // AND JoinDesired(S,G) == TRUE
1148 // DirectlyConnected(S) == TRUE
1149 if (pim_if_connected_to_source (up
->rpf
.source_nexthop
.interface
, up
->sg
.src
))
1151 if (PIM_DEBUG_TRACE
)
1152 zlog_debug ("%s: %s is directly connected to the source", __PRETTY_FUNCTION__
,
1154 up
->sptbit
= PIM_UPSTREAM_SPTBIT_TRUE
;
1158 // OR RPF_interface(S) != RPF_interface(RP(G))
1159 grpf
= RP(up
->sg
.grp
);
1160 if (!grpf
|| up
->rpf
.source_nexthop
.interface
!= grpf
->source_nexthop
.interface
)
1162 if (PIM_DEBUG_TRACE
)
1163 zlog_debug ("%s: %s RPF_interface(S) != RPF_interface(RP(G))",
1164 __PRETTY_FUNCTION__
, up
->sg_str
);
1165 up
->sptbit
= PIM_UPSTREAM_SPTBIT_TRUE
;
1169 // OR inherited_olist(S,G,rpt) == NULL
1170 if (pim_upstream_is_sg_rpt(up
) && pim_upstream_empty_inherited_olist(up
))
1172 if (PIM_DEBUG_TRACE
)
1173 zlog_debug ("%s: %s OR inherited_olist(S,G,rpt) == NULL", __PRETTY_FUNCTION__
,
1175 up
->sptbit
= PIM_UPSTREAM_SPTBIT_TRUE
;
1179 // OR ( ( RPF'(S,G) == RPF'(*,G) ) AND
1180 // ( RPF'(S,G) != NULL ) )
1181 if (up
->parent
&& pim_rpf_is_same (&up
->rpf
, &up
->parent
->rpf
))
1183 if (PIM_DEBUG_TRACE
)
1184 zlog_debug ("%s: %s RPF'(S,G) is the same as RPF'(*,G)", __PRETTY_FUNCTION__
,
1186 up
->sptbit
= PIM_UPSTREAM_SPTBIT_TRUE
;
1194 pim_upstream_state2str (enum pim_upstream_state join_state
)
1198 case PIM_UPSTREAM_NOTJOINED
:
1201 case PIM_UPSTREAM_JOINED
:
1204 case PIM_UPSTREAM_JOIN_PENDING
:
1205 return "JoinPending";
1207 case PIM_UPSTREAM_PRUNE
:
1215 pim_upstream_register_stop_timer (struct thread
*t
)
1217 struct pim_interface
*pim_ifp
;
1218 struct pim_upstream
*up
;
1219 struct pim_rpf
*rpg
;
1221 up
= THREAD_ARG (t
);
1223 up
->t_rs_timer
= NULL
;
1225 if (PIM_DEBUG_TRACE
)
1227 zlog_debug ("%s: (S,G)=%s upstream register stop timer %s",
1228 __PRETTY_FUNCTION__
, up
->sg_str
,
1229 pim_upstream_state2str(up
->join_state
));
1232 switch (up
->join_state
)
1234 case PIM_UPSTREAM_JOIN_PENDING
:
1235 up
->join_state
= PIM_UPSTREAM_JOINED
;
1236 pim_channel_add_oif (up
->channel_oil
, pim_regiface
, PIM_OIF_FLAG_PROTO_PIM
);
1238 case PIM_UPSTREAM_JOINED
:
1240 case PIM_UPSTREAM_PRUNE
:
1241 pim_ifp
= up
->rpf
.source_nexthop
.interface
->info
;
1244 if (PIM_DEBUG_TRACE
)
1245 zlog_debug ("%s: Interface: %s is not configured for pim",
1246 __PRETTY_FUNCTION__
, up
->rpf
.source_nexthop
.interface
->name
);
1249 up
->join_state
= PIM_UPSTREAM_JOIN_PENDING
;
1250 pim_upstream_start_register_stop_timer (up
, 1);
1252 if (((up
->channel_oil
->cc
.lastused
/100) > PIM_KEEPALIVE_PERIOD
) &&
1253 (I_am_RP (up
->sg
.grp
)))
1255 if (PIM_DEBUG_TRACE
)
1256 zlog_debug ("%s: Stop sending the register, because I am the RP and we haven't seen a packet in a while", __PRETTY_FUNCTION__
);
1259 rpg
= RP (up
->sg
.grp
);
1260 memset (&ip_hdr
, 0, sizeof (struct ip
));
1261 ip_hdr
.ip_p
= PIM_IP_PROTO_PIM
;
1264 ip_hdr
.ip_src
= up
->sg
.src
;
1265 ip_hdr
.ip_dst
= up
->sg
.grp
;
1266 ip_hdr
.ip_len
= htons (20);
1267 // checksum is broken
1268 pim_register_send ((uint8_t *)&ip_hdr
, sizeof (struct ip
),
1269 pim_ifp
->primary_address
, rpg
, 1, up
);
1279 pim_upstream_start_register_stop_timer (struct pim_upstream
*up
, int null_register
)
1285 THREAD_TIMER_OFF (up
->t_rs_timer
);
1286 up
->t_rs_timer
= NULL
;
1291 uint32_t lower
= (0.5 * PIM_REGISTER_SUPPRESSION_PERIOD
);
1292 uint32_t upper
= (1.5 * PIM_REGISTER_SUPPRESSION_PERIOD
);
1293 time
= lower
+ (random () % (upper
- lower
+ 1)) - PIM_REGISTER_PROBE_PERIOD
;
1296 time
= PIM_REGISTER_PROBE_PERIOD
;
1298 if (PIM_DEBUG_TRACE
)
1300 zlog_debug ("%s: (S,G)=%s Starting upstream register stop timer %d",
1301 __PRETTY_FUNCTION__
, up
->sg_str
, time
);
1303 THREAD_TIMER_ON (master
, up
->t_rs_timer
,
1304 pim_upstream_register_stop_timer
,
1309 pim_upstream_inherited_olist_decide (struct pim_upstream
*up
)
1311 struct pim_interface
*pim_ifp
;
1312 struct listnode
*chnextnode
;
1313 struct pim_ifchannel
*ch
;
1314 struct listnode
*chnode
;
1315 int output_intf
= 0;
1317 pim_ifp
= up
->rpf
.source_nexthop
.interface
->info
;
1318 if (pim_ifp
&& !up
->channel_oil
)
1319 up
->channel_oil
= pim_channel_oil_add (&up
->sg
, pim_ifp
->mroute_vif_index
);
1321 for (ALL_LIST_ELEMENTS (pim_ifchannel_list
, chnode
, chnextnode
, ch
))
1323 pim_ifp
= ch
->interface
->info
;
1327 if (pim_upstream_evaluate_join_desired_interface (up
, ch
))
1329 int flag
= PIM_OIF_FLAG_PROTO_PIM
;
1331 if (ch
->sg
.src
.s_addr
== INADDR_ANY
&& ch
->upstream
!= up
)
1332 flag
= PIM_OIF_FLAG_PROTO_STAR
;
1333 pim_channel_add_oif (up
->channel_oil
, ch
->interface
, flag
);
1342 * For a given upstream, determine the inherited_olist
1345 * inherited_olist(S,G,rpt) =
1346 * ( joins(*,*,RP(G)) (+) joins(*,G) (-) prunes(S,G,rpt) )
1347 * (+) ( pim_include(*,G) (-) pim_exclude(S,G))
1348 * (-) ( lost_assert(*,G) (+) lost_assert(S,G,rpt) )
1350 * inherited_olist(S,G) =
1351 * inherited_olist(S,G,rpt) (+)
1352 * joins(S,G) (+) pim_include(S,G) (-) lost_assert(S,G)
1354 * return 1 if there are any output interfaces
1355 * return 0 if there are not any output interfaces
1358 pim_upstream_inherited_olist (struct pim_upstream
*up
)
1360 int output_intf
= pim_upstream_inherited_olist_decide (up
);
1363 * If we have output_intf switch state to Join and work like normal
1364 * If we don't have an output_intf that means we are probably a
1365 * switch on a stick so turn on forwarding to just accept the
1366 * incoming packets so we don't bother the other stuff!
1369 pim_upstream_switch (up
, PIM_UPSTREAM_JOINED
);
1377 pim_upstream_empty_inherited_olist (struct pim_upstream
*up
)
1379 return pim_channel_oil_empty (up
->channel_oil
);
1383 * When we have a new neighbor,
1384 * find upstreams that don't have their rpf_addr
1385 * set and see if the new neighbor allows
1386 * the join to be sent
1389 pim_upstream_find_new_rpf (void)
1391 struct listnode
*up_node
;
1392 struct listnode
*up_nextnode
;
1393 struct pim_upstream
*up
;
1396 * Scan all (S,G) upstreams searching for RPF'(S,G)=neigh_addr
1398 for (ALL_LIST_ELEMENTS(pim_upstream_list
, up_node
, up_nextnode
, up
))
1400 if (pim_rpf_addr_is_inaddr_any(&up
->rpf
))
1402 if (PIM_DEBUG_TRACE
)
1403 zlog_debug ("Upstream %s without a path to send join, checking",
1405 pim_rpf_update (up
, NULL
);
1411 pim_upstream_hash_key (void *arg
)
1413 struct pim_upstream
*up
= (struct pim_upstream
*)arg
;
1415 return jhash_2words (up
->sg
.src
.s_addr
, up
->sg
.grp
.s_addr
, 0);
1418 void pim_upstream_terminate (void)
1420 if (pim_upstream_list
)
1421 list_delete (pim_upstream_list
);
1422 pim_upstream_list
= NULL
;
1424 if (pim_upstream_hash
)
1425 hash_free (pim_upstream_hash
);
1426 pim_upstream_hash
= NULL
;
1430 pim_upstream_equal (const void *arg1
, const void *arg2
)
1432 const struct pim_upstream
*up1
= (const struct pim_upstream
*)arg1
;
1433 const struct pim_upstream
*up2
= (const struct pim_upstream
*)arg2
;
1435 if ((up1
->sg
.grp
.s_addr
== up2
->sg
.grp
.s_addr
) &&
1436 (up1
->sg
.src
.s_addr
== up2
->sg
.src
.s_addr
))
1442 /* rfc4601:section-4.2:"Data Packet Forwarding Rules" defines
1443 * the cases where kat has to be restarted on rxing traffic -
1445 * if( DirectlyConnected(S) == TRUE AND iif == RPF_interface(S) ) {
1446 * set KeepaliveTimer(S,G) to Keepalive_Period
1447 * # Note: a register state transition or UpstreamJPState(S,G)
1448 * # transition may happen as a result of restarting
1449 * # KeepaliveTimer, and must be dealt with here.
1451 * if( iif == RPF_interface(S) AND UpstreamJPState(S,G) == Joined AND
1452 * inherited_olist(S,G) != NULL ) {
1453 * set KeepaliveTimer(S,G) to Keepalive_Period
1456 static bool pim_upstream_kat_start_ok(struct pim_upstream
*up
)
1458 /* "iif == RPF_interface(S)" check has to be done by the kernel or hw
1459 * so we will skip that here */
1460 if (pim_if_connected_to_source(up
->rpf
.source_nexthop
.interface
,
1465 if ((up
->join_state
== PIM_UPSTREAM_JOINED
) &&
1466 !pim_upstream_empty_inherited_olist(up
)) {
1467 /* XXX: I have added this RP check just for 3.2 and it's a digression from
1468 * what rfc-4601 says. Till now we were only running KAT on FHR and RP and
1469 * there is some angst around making the change to run it all routers that
1470 * maintain the (S, G) state. This is tracked via CM-13601 and MUST be
1471 * removed to handle spt turn-arounds correctly in a 3-tier clos */
1472 if (I_am_RP (up
->sg
.grp
))
1480 * Code to check and see if we've received packets on a S,G mroute
1481 * and if so to set the SPT bit appropriately
1484 pim_upstream_sg_running (void *arg
)
1486 struct pim_upstream
*up
= (struct pim_upstream
*)arg
;
1488 // No packet can have arrived here if this is the case
1489 if (!up
->channel_oil
|| !up
->channel_oil
->installed
)
1491 if (PIM_DEBUG_TRACE
)
1492 zlog_debug ("%s: %s is not installed in mroute",
1493 __PRETTY_FUNCTION__
, up
->sg_str
);
1498 * This is a bit of a hack
1499 * We've noted that we should rescan but
1500 * we've missed the window for doing so in
1501 * pim_zebra.c for some reason. I am
1502 * only doing this at this point in time
1503 * to get us up and working for the moment
1505 if (up
->channel_oil
->oil_inherited_rescan
)
1507 if (PIM_DEBUG_TRACE
)
1508 zlog_debug ("%s: Handling unscanned inherited_olist for %s", __PRETTY_FUNCTION__
, up
->sg_str
);
1509 pim_upstream_inherited_olist_decide (up
);
1510 up
->channel_oil
->oil_inherited_rescan
= 0;
1512 pim_mroute_update_counters (up
->channel_oil
);
1514 // Have we seen packets?
1515 if ((up
->channel_oil
->cc
.oldpktcnt
>= up
->channel_oil
->cc
.pktcnt
) &&
1516 (up
->channel_oil
->cc
.lastused
/100 > 30))
1518 if (PIM_DEBUG_TRACE
)
1520 zlog_debug ("%s: %s old packet count is equal or lastused is greater than 30, (%ld,%ld,%lld)",
1521 __PRETTY_FUNCTION__
, up
->sg_str
,
1522 up
->channel_oil
->cc
.oldpktcnt
,
1523 up
->channel_oil
->cc
.pktcnt
,
1524 up
->channel_oil
->cc
.lastused
/100);
1529 if (pim_upstream_kat_start_ok(up
)) {
1530 /* Add a source reference to the stream if
1531 * one doesn't already exist */
1532 if (!PIM_UPSTREAM_FLAG_TEST_SRC_STREAM(up
->flags
))
1534 if (PIM_DEBUG_TRACE
)
1535 zlog_debug ("source reference created on kat restart %s", up
->sg_str
);
1537 pim_upstream_ref(up
, PIM_UPSTREAM_FLAG_MASK_SRC_STREAM
);
1538 PIM_UPSTREAM_FLAG_SET_SRC_STREAM(up
->flags
);
1539 pim_upstream_fhr_kat_start(up
);
1541 pim_upstream_keep_alive_timer_start(up
, qpim_keep_alive_time
);
1544 if (up
->sptbit
!= PIM_UPSTREAM_SPTBIT_TRUE
)
1546 pim_upstream_set_sptbit(up
, up
->rpf
.source_nexthop
.interface
);
1552 pim_upstream_init (void)
1554 pim_upstream_sg_wheel
= wheel_init (master
, 31000, 100,
1555 pim_upstream_hash_key
,
1556 pim_upstream_sg_running
);
1557 pim_upstream_hash
= hash_create_size (8192, pim_upstream_hash_key
,
1558 pim_upstream_equal
);
1560 pim_upstream_list
= list_new ();
1561 pim_upstream_list
->del
= (void (*)(void *)) pim_upstream_free
;
1562 pim_upstream_list
->cmp
= pim_upstream_compare
;