2 * bgp_updgrp_adv.c: BGP update group advertisement and adjacency
6 * @copyright Copyright (C) 2014 Cumulus Networks, Inc.
8 * @author Avneesh Sachdev <avneesh@sproute.net>
9 * @author Rajesh Varadarajan <rajesh@sproute.net>
10 * @author Pradosh Mohapatra <pradosh@sproute.net>
12 * This file is part of GNU Zebra.
14 * GNU Zebra is free software; you can redistribute it and/or modify it
15 * under the terms of the GNU General Public License as published by the
16 * Free Software Foundation; either version 2, or (at your option) any
19 * GNU Zebra is distributed in the hope that it will be useful, but
20 * WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * General Public License for more details.
24 * You should have received a copy of the GNU General Public License along
25 * with this program; see the file COPYING; if not, write to the Free Software
26 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
40 #include "bgpd/bgpd.h"
41 #include "bgpd/bgp_table.h"
42 #include "bgpd/bgp_debug.h"
43 #include "bgpd/bgp_route.h"
44 #include "bgpd/bgp_advertise.h"
45 #include "bgpd/bgp_attr.h"
46 #include "bgpd/bgp_aspath.h"
47 #include "bgpd/bgp_packet.h"
48 #include "bgpd/bgp_fsm.h"
49 #include "bgpd/bgp_mplsvpn.h"
50 #include "bgpd/bgp_updgrp.h"
51 #include "bgpd/bgp_advertise.h"
52 #include "bgpd/bgp_addpath.h"
59 static inline struct bgp_adj_out
*adj_lookup(struct bgp_node
*rn
,
60 struct update_subgroup
*subgrp
,
61 uint32_t addpath_tx_id
)
63 struct bgp_adj_out
*adj
;
72 peer
= SUBGRP_PEER(subgrp
);
73 afi
= SUBGRP_AFI(subgrp
);
74 safi
= SUBGRP_SAFI(subgrp
);
75 addpath_capable
= bgp_addpath_encode_tx(peer
, afi
, safi
);
77 /* update-groups that do not support addpath will pass 0 for
78 * addpath_tx_id so do not both matching against it */
79 for (adj
= rn
->adj_out
; adj
; adj
= adj
->next
) {
80 if (adj
->subgroup
== subgrp
) {
81 if (addpath_capable
) {
82 if (adj
->addpath_tx_id
== addpath_tx_id
) {
94 static void adj_free(struct bgp_adj_out
*adj
)
96 TAILQ_REMOVE(&(adj
->subgroup
->adjq
), adj
, subgrp_adj_train
);
97 SUBGRP_DECR_STAT(adj
->subgroup
, adj_count
);
98 XFREE(MTYPE_BGP_ADJ_OUT
, adj
);
101 static void subgrp_withdraw_stale_addpath(struct updwalk_context
*ctx
,
102 struct update_subgroup
*subgrp
)
104 struct bgp_adj_out
*adj
, *adj_next
;
106 struct bgp_path_info
*pi
;
107 afi_t afi
= SUBGRP_AFI(subgrp
);
108 safi_t safi
= SUBGRP_SAFI(subgrp
);
109 struct peer
*peer
= SUBGRP_PEER(subgrp
);
111 /* Look through all of the paths we have advertised for this rn and send
112 * a withdraw for the ones that are no longer present */
113 for (adj
= ctx
->rn
->adj_out
; adj
; adj
= adj_next
) {
114 adj_next
= adj
->next
;
116 if (adj
->subgroup
== subgrp
) {
117 for (pi
= bgp_node_get_bgp_path_info(ctx
->rn
);
119 id
= bgp_addpath_id_for_peer(peer
, afi
, safi
,
122 if (id
== adj
->addpath_tx_id
) {
128 subgroup_process_announce_selected(
129 subgrp
, NULL
, ctx
->rn
,
136 static int group_announce_route_walkcb(struct update_group
*updgrp
, void *arg
)
138 struct updwalk_context
*ctx
= arg
;
139 struct update_subgroup
*subgrp
;
140 struct bgp_path_info
*pi
;
144 struct bgp_adj_out
*adj
, *adj_next
;
147 afi
= UPDGRP_AFI(updgrp
);
148 safi
= UPDGRP_SAFI(updgrp
);
149 peer
= UPDGRP_PEER(updgrp
);
150 addpath_capable
= bgp_addpath_encode_tx(peer
, afi
, safi
);
152 if (BGP_DEBUG(update
, UPDATE_OUT
)) {
153 char buf_prefix
[PREFIX_STRLEN
];
154 prefix2str(&ctx
->rn
->p
, buf_prefix
, sizeof(buf_prefix
));
155 zlog_debug("%s: afi=%s, safi=%s, p=%s", __func__
, afi2str(afi
),
156 safi2str(safi
), buf_prefix
);
160 UPDGRP_FOREACH_SUBGRP (updgrp
, subgrp
) {
163 * Skip the subgroups that have coalesce timer running. We will
164 * walk the entire prefix table for those subgroups when the
165 * coalesce timer fires.
167 if (!subgrp
->t_coalesce
) {
168 /* An update-group that uses addpath */
169 if (addpath_capable
) {
170 subgrp_withdraw_stale_addpath(ctx
, subgrp
);
172 for (pi
= bgp_node_get_bgp_path_info(ctx
->rn
);
174 /* Skip the bestpath for now */
178 subgroup_process_announce_selected(
180 bgp_addpath_id_for_peer(
185 /* Process the bestpath last so the "show [ip]
186 * bgp neighbor x.x.x.x advertised"
187 * output shows the attributes from the bestpath
190 subgroup_process_announce_selected(
191 subgrp
, ctx
->pi
, ctx
->rn
,
192 bgp_addpath_id_for_peer(
194 &ctx
->pi
->tx_addpath
));
197 /* An update-group that does not use addpath */
200 subgroup_process_announce_selected(
201 subgrp
, ctx
->pi
, ctx
->rn
,
202 bgp_addpath_id_for_peer(
204 &ctx
->pi
->tx_addpath
));
206 /* Find the addpath_tx_id of the path we
209 for (adj
= ctx
->rn
->adj_out
; adj
;
211 adj_next
= adj
->next
;
213 if (adj
->subgroup
== subgrp
) {
214 subgroup_process_announce_selected(
225 return UPDWALK_CONTINUE
;
228 static void subgrp_show_adjq_vty(struct update_subgroup
*subgrp
,
229 struct vty
*vty
, uint8_t flags
)
231 struct bgp_table
*table
;
232 struct bgp_adj_out
*adj
;
233 unsigned long output_count
;
239 bgp
= SUBGRP_INST(subgrp
);
243 table
= bgp
->rib
[SUBGRP_AFI(subgrp
)][SUBGRP_SAFI(subgrp
)];
247 for (rn
= bgp_table_top(table
); rn
; rn
= bgp_route_next(rn
))
248 for (adj
= rn
->adj_out
; adj
; adj
= adj
->next
)
249 if (adj
->subgroup
== subgrp
) {
252 "BGP table version is %" PRIu64
253 ", local router ID is %s\n",
255 inet_ntoa(bgp
->router_id
));
256 vty_out(vty
, BGP_SHOW_SCODE_HEADER
);
257 vty_out(vty
, BGP_SHOW_OCODE_HEADER
);
261 vty_out(vty
, BGP_SHOW_HEADER
);
264 if ((flags
& UPDWALK_FLAGS_ADVQUEUE
) && adj
->adv
266 route_vty_out_tmp(vty
, &rn
->p
,
272 if ((flags
& UPDWALK_FLAGS_ADVERTISED
)
275 vty
, &rn
->p
, adj
->attr
,
276 SUBGRP_SAFI(subgrp
), 0, NULL
);
280 if (output_count
!= 0)
281 vty_out(vty
, "\nTotal number of prefixes %ld\n", output_count
);
284 static int updgrp_show_adj_walkcb(struct update_group
*updgrp
, void *arg
)
286 struct updwalk_context
*ctx
= arg
;
287 struct update_subgroup
*subgrp
;
291 UPDGRP_FOREACH_SUBGRP (updgrp
, subgrp
) {
292 if (ctx
->subgrp_id
&& (ctx
->subgrp_id
!= subgrp
->id
))
294 vty_out(vty
, "update group %" PRIu64
", subgroup %" PRIu64
"\n",
295 updgrp
->id
, subgrp
->id
);
296 subgrp_show_adjq_vty(subgrp
, vty
, ctx
->flags
);
298 return UPDWALK_CONTINUE
;
301 static void updgrp_show_adj(struct bgp
*bgp
, afi_t afi
, safi_t safi
,
302 struct vty
*vty
, uint64_t id
, uint8_t flags
)
304 struct updwalk_context ctx
;
305 memset(&ctx
, 0, sizeof(ctx
));
310 update_group_af_walk(bgp
, afi
, safi
, updgrp_show_adj_walkcb
, &ctx
);
313 static int subgroup_coalesce_timer(struct thread
*thread
)
315 struct update_subgroup
*subgrp
;
317 subgrp
= THREAD_ARG(thread
);
318 if (bgp_debug_update(NULL
, NULL
, subgrp
->update_group
, 0))
319 zlog_debug("u%" PRIu64
":s%" PRIu64
320 " announcing routes upon coalesce timer expiry",
321 (SUBGRP_UPDGRP(subgrp
))->id
, subgrp
->id
);
322 subgrp
->t_coalesce
= NULL
;
323 subgrp
->v_coalesce
= 0;
324 subgroup_announce_route(subgrp
);
327 /* While the announce_route() may kick off the route advertisement timer
329 * the members of the subgroup, we'd like to send the initial updates
331 * faster (i.e., without enforcing MRAI). Also, if there were no routes
333 * announce, this is the method currently employed to trigger the EOR.
335 if (!bgp_update_delay_active(SUBGRP_INST(subgrp
))) {
339 SUBGRP_FOREACH_PEER (subgrp
, paf
) {
340 peer
= PAF_PEER(paf
);
341 BGP_TIMER_OFF(peer
->t_routeadv
);
342 BGP_TIMER_ON(peer
->t_routeadv
, bgp_routeadv_timer
, 0);
349 static int update_group_announce_walkcb(struct update_group
*updgrp
, void *arg
)
351 struct update_subgroup
*subgrp
;
353 UPDGRP_FOREACH_SUBGRP (updgrp
, subgrp
) {
354 subgroup_announce_all(subgrp
);
357 return UPDWALK_CONTINUE
;
360 static int update_group_announce_rrc_walkcb(struct update_group
*updgrp
,
363 struct update_subgroup
*subgrp
;
368 afi
= UPDGRP_AFI(updgrp
);
369 safi
= UPDGRP_SAFI(updgrp
);
370 peer
= UPDGRP_PEER(updgrp
);
372 /* Only announce if this is a group of route-reflector-clients */
373 if (CHECK_FLAG(peer
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
)) {
374 UPDGRP_FOREACH_SUBGRP (updgrp
, subgrp
) {
375 subgroup_announce_all(subgrp
);
379 return UPDWALK_CONTINUE
;
382 /********************
384 ********************/
387 * Allocate an adj-out object. Do proper initialization of its fields,
388 * primarily its association with the subgroup and the prefix.
390 struct bgp_adj_out
*bgp_adj_out_alloc(struct update_subgroup
*subgrp
,
392 uint32_t addpath_tx_id
)
394 struct bgp_adj_out
*adj
;
396 adj
= XCALLOC(MTYPE_BGP_ADJ_OUT
, sizeof(struct bgp_adj_out
));
397 adj
->subgroup
= subgrp
;
399 BGP_ADJ_OUT_ADD(rn
, adj
);
404 adj
->addpath_tx_id
= addpath_tx_id
;
405 TAILQ_INSERT_TAIL(&(subgrp
->adjq
), adj
, subgrp_adj_train
);
406 SUBGRP_INCR_STAT(subgrp
, adj_count
);
411 struct bgp_advertise
*
412 bgp_advertise_clean_subgroup(struct update_subgroup
*subgrp
,
413 struct bgp_adj_out
*adj
)
415 struct bgp_advertise
*adv
;
416 struct bgp_advertise_attr
*baa
;
417 struct bgp_advertise
*next
;
418 struct bgp_advertise_fifo
*fhead
;
425 fhead
= &subgrp
->sync
->update
;
427 /* Unlink myself from advertise attribute FIFO. */
428 bgp_advertise_delete(baa
, adv
);
430 /* Fetch next advertise candidate. */
433 /* Unintern BGP advertise attribute. */
434 bgp_advertise_unintern(subgrp
->hash
, baa
);
436 fhead
= &subgrp
->sync
->withdraw
;
439 /* Unlink myself from advertisement FIFO. */
440 BGP_ADV_FIFO_DEL(fhead
, adv
);
443 bgp_advertise_free(adj
->adv
);
449 void bgp_adj_out_set_subgroup(struct bgp_node
*rn
,
450 struct update_subgroup
*subgrp
, struct attr
*attr
,
451 struct bgp_path_info
*path
)
453 struct bgp_adj_out
*adj
= NULL
;
454 struct bgp_advertise
*adv
;
459 peer
= SUBGRP_PEER(subgrp
);
460 afi
= SUBGRP_AFI(subgrp
);
461 safi
= SUBGRP_SAFI(subgrp
);
463 if (DISABLE_BGP_ANNOUNCE
)
466 /* Look for adjacency information. */
469 bgp_addpath_id_for_peer(peer
, afi
, safi
, &path
->tx_addpath
));
472 adj
= bgp_adj_out_alloc(
474 bgp_addpath_id_for_peer(peer
, afi
, safi
,
481 bgp_advertise_clean_subgroup(subgrp
, adj
);
482 adj
->adv
= bgp_advertise_new();
486 assert(adv
->pathi
== NULL
);
487 /* bgp_path_info adj_out reference */
488 adv
->pathi
= bgp_path_info_lock(path
);
491 adv
->baa
= bgp_advertise_intern(subgrp
->hash
, attr
);
493 adv
->baa
= baa_new();
496 /* Add new advertisement to advertisement attribute list. */
497 bgp_advertise_add(adv
->baa
, adv
);
500 * If the update adv list is empty, trigger the member peers'
501 * mrai timers so the socket writes can happen.
503 if (BGP_ADV_FIFO_EMPTY(&subgrp
->sync
->update
)) {
506 SUBGRP_FOREACH_PEER (subgrp
, paf
) {
507 bgp_adjust_routeadv(PAF_PEER(paf
));
511 BGP_ADV_FIFO_ADD(&subgrp
->sync
->update
, &adv
->fifo
);
513 subgrp
->version
= max(subgrp
->version
, rn
->version
);
516 /* The only time 'withdraw' will be false is if we are sending
517 * the "neighbor x.x.x.x default-originate" default and need to clear
518 * bgp_adj_out for the 0.0.0.0/0 route in the BGP table.
520 void bgp_adj_out_unset_subgroup(struct bgp_node
*rn
,
521 struct update_subgroup
*subgrp
, char withdraw
,
522 uint32_t addpath_tx_id
)
524 struct bgp_adj_out
*adj
;
525 struct bgp_advertise
*adv
;
528 if (DISABLE_BGP_ANNOUNCE
)
531 /* Lookup existing adjacency */
532 if ((adj
= adj_lookup(rn
, subgrp
, addpath_tx_id
)) != NULL
) {
533 /* Clean up previous advertisement. */
535 bgp_advertise_clean_subgroup(subgrp
, adj
);
537 if (adj
->attr
&& withdraw
) {
538 /* We need advertisement structure. */
539 adj
->adv
= bgp_advertise_new();
544 /* Note if we need to trigger a packet write */
546 BGP_ADV_FIFO_EMPTY(&subgrp
->sync
->withdraw
);
548 /* Add to synchronization entry for withdraw
550 BGP_ADV_FIFO_ADD(&subgrp
->sync
->withdraw
, &adv
->fifo
);
553 subgroup_trigger_write(subgrp
);
555 /* Remove myself from adjacency. */
556 BGP_ADJ_OUT_DEL(rn
, adj
);
558 /* Free allocated information. */
565 subgrp
->version
= max(subgrp
->version
, rn
->version
);
568 void bgp_adj_out_remove_subgroup(struct bgp_node
*rn
, struct bgp_adj_out
*adj
,
569 struct update_subgroup
*subgrp
)
572 bgp_attr_unintern(&adj
->attr
);
575 bgp_advertise_clean_subgroup(subgrp
, adj
);
577 BGP_ADJ_OUT_DEL(rn
, adj
);
582 * Go through all the routes and clean up the adj/adv structures corresponding
585 void subgroup_clear_table(struct update_subgroup
*subgrp
)
587 struct bgp_adj_out
*aout
, *taout
;
589 SUBGRP_FOREACH_ADJ_SAFE (subgrp
, aout
, taout
) {
590 struct bgp_node
*rn
= aout
->rn
;
591 bgp_adj_out_remove_subgroup(rn
, aout
, subgrp
);
597 * subgroup_announce_table
599 void subgroup_announce_table(struct update_subgroup
*subgrp
,
600 struct bgp_table
*table
)
603 struct bgp_path_info
*ri
;
610 peer
= SUBGRP_PEER(subgrp
);
611 afi
= SUBGRP_AFI(subgrp
);
612 safi
= SUBGRP_SAFI(subgrp
);
613 addpath_capable
= bgp_addpath_encode_tx(peer
, afi
, safi
);
615 if (safi
== SAFI_LABELED_UNICAST
)
619 table
= peer
->bgp
->rib
[afi
][safi
];
621 if (safi
!= SAFI_MPLS_VPN
&& safi
!= SAFI_ENCAP
&& safi
!= SAFI_EVPN
622 && CHECK_FLAG(peer
->af_flags
[afi
][safi
],
623 PEER_FLAG_DEFAULT_ORIGINATE
))
624 subgroup_default_originate(subgrp
, 0);
626 for (rn
= bgp_table_top(table
); rn
; rn
= bgp_route_next(rn
))
627 for (ri
= bgp_node_get_bgp_path_info(rn
); ri
; ri
= ri
->next
)
629 if (CHECK_FLAG(ri
->flags
, BGP_PATH_SELECTED
)
631 && bgp_addpath_tx_path(
632 peer
->addpath_type
[afi
][safi
],
634 if (subgroup_announce_check(rn
, ri
, subgrp
,
636 bgp_adj_out_set_subgroup(rn
, subgrp
,
639 bgp_adj_out_unset_subgroup(
641 bgp_addpath_id_for_peer(
647 * We walked through the whole table -- make sure our version number
648 * is consistent with the one on the table. This should allow
649 * subgroups to merge sooner if a peer comes up when the route node
650 * with the largest version is no longer in the table. This also
651 * covers the pathological case where all routes in the table have
654 subgrp
->version
= max(subgrp
->version
, table
->version
);
657 * Start a task to merge the subgroup if necessary.
659 update_subgroup_trigger_merge_check(subgrp
, 0);
663 * subgroup_announce_route
665 * Refresh all routes out to a subgroup.
667 void subgroup_announce_route(struct update_subgroup
*subgrp
)
670 struct bgp_table
*table
;
671 struct peer
*onlypeer
;
673 if (update_subgroup_needs_refresh(subgrp
)) {
674 update_subgroup_set_needs_refresh(subgrp
, 0);
678 * First update is deferred until ORF or ROUTE-REFRESH is received
680 onlypeer
= ((SUBGRP_PCOUNT(subgrp
) == 1) ? (SUBGRP_PFIRST(subgrp
))->peer
682 if (onlypeer
&& CHECK_FLAG(onlypeer
->af_sflags
[SUBGRP_AFI(subgrp
)]
683 [SUBGRP_SAFI(subgrp
)],
684 PEER_STATUS_ORF_WAIT_REFRESH
))
687 if (SUBGRP_SAFI(subgrp
) != SAFI_MPLS_VPN
688 && SUBGRP_SAFI(subgrp
) != SAFI_ENCAP
689 && SUBGRP_SAFI(subgrp
) != SAFI_EVPN
)
690 subgroup_announce_table(subgrp
, NULL
);
692 for (rn
= bgp_table_top(update_subgroup_rib(subgrp
)); rn
;
693 rn
= bgp_route_next(rn
)) {
694 table
= bgp_node_get_bgp_table_info(rn
);
697 subgroup_announce_table(subgrp
, table
);
701 void subgroup_default_originate(struct update_subgroup
*subgrp
, int withdraw
)
705 struct aspath
*aspath
;
706 struct bgp_path_info tmp_info
;
710 struct bgp_path_info
*ri
;
712 int ret
= RMAP_DENYMATCH
;
719 peer
= SUBGRP_PEER(subgrp
);
720 afi
= SUBGRP_AFI(subgrp
);
721 safi
= SUBGRP_SAFI(subgrp
);
723 if (!(afi
== AFI_IP
|| afi
== AFI_IP6
))
727 from
= bgp
->peer_self
;
729 bgp_attr_default_set(&attr
, BGP_ORIGIN_IGP
);
730 aspath
= attr
.aspath
;
732 attr
.local_pref
= bgp
->default_local_pref
;
734 memset(&p
, 0, sizeof(p
));
735 p
.family
= afi2family(afi
);
738 if ((afi
== AFI_IP6
) || peer_cap_enhe(peer
, afi
, safi
)) {
739 /* IPv6 global nexthop must be included. */
740 attr
.mp_nexthop_len
= BGP_ATTR_NHLEN_IPV6_GLOBAL
;
742 /* If the peer is on shared nextwork and we have link-local
744 if (peer
->shared_network
745 && !IN6_IS_ADDR_UNSPECIFIED(&peer
->nexthop
.v6_local
))
746 attr
.mp_nexthop_len
= BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL
;
749 if (peer
->default_rmap
[afi
][safi
].name
) {
750 SET_FLAG(bgp
->peer_self
->rmap_type
, PEER_RMAP_TYPE_DEFAULT
);
751 for (rn
= bgp_table_top(bgp
->rib
[afi
][safi
]); rn
;
752 rn
= bgp_route_next(rn
)) {
753 for (ri
= bgp_node_get_bgp_path_info(rn
);
755 struct attr dummy_attr
;
757 /* Provide dummy so the route-map can't modify
759 bgp_attr_dup(&dummy_attr
, ri
->attr
);
760 tmp_info
.peer
= ri
->peer
;
761 tmp_info
.attr
= &dummy_attr
;
763 ret
= route_map_apply(
764 peer
->default_rmap
[afi
][safi
].map
,
765 &rn
->p
, RMAP_BGP
, &tmp_info
);
767 /* The route map might have set attributes. If
768 * we don't flush them
769 * here, they will be leaked. */
770 bgp_attr_flush(&dummy_attr
);
771 if (ret
!= RMAP_DENYMATCH
)
774 if (ret
!= RMAP_DENYMATCH
)
777 bgp
->peer_self
->rmap_type
= 0;
779 if (ret
== RMAP_DENYMATCH
)
784 if (CHECK_FLAG(subgrp
->sflags
, SUBGRP_STATUS_DEFAULT_ORIGINATE
))
785 subgroup_default_withdraw_packet(subgrp
);
786 UNSET_FLAG(subgrp
->sflags
, SUBGRP_STATUS_DEFAULT_ORIGINATE
);
788 if (!CHECK_FLAG(subgrp
->sflags
,
789 SUBGRP_STATUS_DEFAULT_ORIGINATE
)) {
791 if (bgp_flag_check(bgp
, BGP_FLAG_GRACEFUL_SHUTDOWN
)) {
792 bgp_attr_add_gshut_community(&attr
);
795 SET_FLAG(subgrp
->sflags
,
796 SUBGRP_STATUS_DEFAULT_ORIGINATE
);
797 subgroup_default_update_packet(subgrp
, &attr
, from
);
799 /* The 'neighbor x.x.x.x default-originate' default will
801 * implicit withdraw for any previous UPDATEs sent for
803 * clear adj_out for the 0.0.0.0/0 prefix in the BGP
806 memset(&p
, 0, sizeof(p
));
807 p
.family
= afi2family(afi
);
810 rn
= bgp_afi_node_get(bgp
->rib
[afi
][safi
], afi
, safi
,
812 bgp_adj_out_unset_subgroup(
814 BGP_ADDPATH_TX_ID_FOR_DEFAULT_ORIGINATE
);
818 aspath_unintern(&aspath
);
822 * Announce the BGP table to a subgroup.
824 * At startup, we try to optimize route announcement by coalescing the
825 * peer-up events. This is done only the first time - from then on,
826 * subgrp->v_coalesce will be set to zero and the normal logic
829 void subgroup_announce_all(struct update_subgroup
*subgrp
)
835 * If coalesce timer value is not set, announce routes immediately.
837 if (!subgrp
->v_coalesce
) {
838 if (bgp_debug_update(NULL
, NULL
, subgrp
->update_group
, 0))
839 zlog_debug("u%" PRIu64
":s%" PRIu64
840 " announcing all routes",
841 subgrp
->update_group
->id
, subgrp
->id
);
842 subgroup_announce_route(subgrp
);
847 * We should wait for the coalesce timer. Arm the timer if not done.
849 if (!subgrp
->t_coalesce
) {
850 thread_add_timer_msec(bm
->master
, subgroup_coalesce_timer
,
851 subgrp
, subgrp
->v_coalesce
,
852 &subgrp
->t_coalesce
);
857 * Go through all update subgroups and set up the adv queue for the
860 void group_announce_route(struct bgp
*bgp
, afi_t afi
, safi_t safi
,
861 struct bgp_node
*rn
, struct bgp_path_info
*pi
)
863 struct updwalk_context ctx
;
866 update_group_af_walk(bgp
, afi
, safi
, group_announce_route_walkcb
, &ctx
);
869 void update_group_show_adj_queue(struct bgp
*bgp
, afi_t afi
, safi_t safi
,
870 struct vty
*vty
, uint64_t id
)
872 updgrp_show_adj(bgp
, afi
, safi
, vty
, id
, UPDWALK_FLAGS_ADVQUEUE
);
875 void update_group_show_advertised(struct bgp
*bgp
, afi_t afi
, safi_t safi
,
876 struct vty
*vty
, uint64_t id
)
878 updgrp_show_adj(bgp
, afi
, safi
, vty
, id
, UPDWALK_FLAGS_ADVERTISED
);
881 void update_group_announce(struct bgp
*bgp
)
883 update_group_walk(bgp
, update_group_announce_walkcb
, NULL
);
886 void update_group_announce_rrclients(struct bgp
*bgp
)
888 update_group_walk(bgp
, update_group_announce_rrc_walkcb
, NULL
);