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
= ctx
->rn
->info
; pi
; pi
= pi
->next
) {
118 id
= bgp_addpath_id_for_peer(peer
, afi
, safi
,
121 if (id
== adj
->addpath_tx_id
) {
127 subgroup_process_announce_selected(
128 subgrp
, NULL
, ctx
->rn
,
135 static int group_announce_route_walkcb(struct update_group
*updgrp
, void *arg
)
137 struct updwalk_context
*ctx
= arg
;
138 struct update_subgroup
*subgrp
;
139 struct bgp_path_info
*pi
;
143 struct bgp_adj_out
*adj
, *adj_next
;
146 afi
= UPDGRP_AFI(updgrp
);
147 safi
= UPDGRP_SAFI(updgrp
);
148 peer
= UPDGRP_PEER(updgrp
);
149 addpath_capable
= bgp_addpath_encode_tx(peer
, afi
, safi
);
151 if (BGP_DEBUG(update
, UPDATE_OUT
)) {
152 char buf_prefix
[PREFIX_STRLEN
];
153 prefix2str(&ctx
->rn
->p
, buf_prefix
, sizeof(buf_prefix
));
154 zlog_debug("%s: afi=%s, safi=%s, p=%s", __func__
, afi2str(afi
),
155 safi2str(safi
), buf_prefix
);
159 UPDGRP_FOREACH_SUBGRP (updgrp
, subgrp
) {
162 * Skip the subgroups that have coalesce timer running. We will
163 * walk the entire prefix table for those subgroups when the
164 * coalesce timer fires.
166 if (!subgrp
->t_coalesce
) {
167 /* An update-group that uses addpath */
168 if (addpath_capable
) {
169 subgrp_withdraw_stale_addpath(ctx
, subgrp
);
171 for (pi
= ctx
->rn
->info
; pi
; pi
= pi
->next
) {
172 /* Skip the bestpath for now */
176 subgroup_process_announce_selected(
178 bgp_addpath_id_for_peer(
183 /* Process the bestpath last so the "show [ip]
184 * bgp neighbor x.x.x.x advertised"
185 * output shows the attributes from the bestpath
188 subgroup_process_announce_selected(
189 subgrp
, ctx
->pi
, ctx
->rn
,
190 bgp_addpath_id_for_peer(
192 &ctx
->pi
->tx_addpath
));
195 /* An update-group that does not use addpath */
198 subgroup_process_announce_selected(
199 subgrp
, ctx
->pi
, ctx
->rn
,
200 bgp_addpath_id_for_peer(
202 &ctx
->pi
->tx_addpath
));
204 /* Find the addpath_tx_id of the path we
207 for (adj
= ctx
->rn
->adj_out
; adj
;
209 adj_next
= adj
->next
;
211 if (adj
->subgroup
== subgrp
) {
212 subgroup_process_announce_selected(
223 return UPDWALK_CONTINUE
;
226 static void subgrp_show_adjq_vty(struct update_subgroup
*subgrp
,
227 struct vty
*vty
, uint8_t flags
)
229 struct bgp_table
*table
;
230 struct bgp_adj_out
*adj
;
231 unsigned long output_count
;
237 bgp
= SUBGRP_INST(subgrp
);
241 table
= bgp
->rib
[SUBGRP_AFI(subgrp
)][SUBGRP_SAFI(subgrp
)];
245 for (rn
= bgp_table_top(table
); rn
; rn
= bgp_route_next(rn
))
246 for (adj
= rn
->adj_out
; adj
; adj
= adj
->next
)
247 if (adj
->subgroup
== subgrp
) {
250 "BGP table version is %" PRIu64
251 ", local router ID is %s\n",
253 inet_ntoa(bgp
->router_id
));
254 vty_out(vty
, BGP_SHOW_SCODE_HEADER
);
255 vty_out(vty
, BGP_SHOW_OCODE_HEADER
);
259 vty_out(vty
, BGP_SHOW_HEADER
);
262 if ((flags
& UPDWALK_FLAGS_ADVQUEUE
) && adj
->adv
264 route_vty_out_tmp(vty
, &rn
->p
,
270 if ((flags
& UPDWALK_FLAGS_ADVERTISED
)
273 vty
, &rn
->p
, adj
->attr
,
274 SUBGRP_SAFI(subgrp
), 0, NULL
);
278 if (output_count
!= 0)
279 vty_out(vty
, "\nTotal number of prefixes %ld\n", output_count
);
282 static int updgrp_show_adj_walkcb(struct update_group
*updgrp
, void *arg
)
284 struct updwalk_context
*ctx
= arg
;
285 struct update_subgroup
*subgrp
;
289 UPDGRP_FOREACH_SUBGRP (updgrp
, subgrp
) {
290 if (ctx
->subgrp_id
&& (ctx
->subgrp_id
!= subgrp
->id
))
292 vty_out(vty
, "update group %" PRIu64
", subgroup %" PRIu64
"\n",
293 updgrp
->id
, subgrp
->id
);
294 subgrp_show_adjq_vty(subgrp
, vty
, ctx
->flags
);
296 return UPDWALK_CONTINUE
;
299 static void updgrp_show_adj(struct bgp
*bgp
, afi_t afi
, safi_t safi
,
300 struct vty
*vty
, uint64_t id
, uint8_t flags
)
302 struct updwalk_context ctx
;
303 memset(&ctx
, 0, sizeof(ctx
));
308 update_group_af_walk(bgp
, afi
, safi
, updgrp_show_adj_walkcb
, &ctx
);
311 static int subgroup_coalesce_timer(struct thread
*thread
)
313 struct update_subgroup
*subgrp
;
315 subgrp
= THREAD_ARG(thread
);
316 if (bgp_debug_update(NULL
, NULL
, subgrp
->update_group
, 0))
317 zlog_debug("u%" PRIu64
":s%" PRIu64
318 " announcing routes upon coalesce timer expiry",
319 (SUBGRP_UPDGRP(subgrp
))->id
, subgrp
->id
);
320 subgrp
->t_coalesce
= NULL
;
321 subgrp
->v_coalesce
= 0;
322 subgroup_announce_route(subgrp
);
325 /* While the announce_route() may kick off the route advertisement timer
327 * the members of the subgroup, we'd like to send the initial updates
329 * faster (i.e., without enforcing MRAI). Also, if there were no routes
331 * announce, this is the method currently employed to trigger the EOR.
333 if (!bgp_update_delay_active(SUBGRP_INST(subgrp
))) {
337 SUBGRP_FOREACH_PEER (subgrp
, paf
) {
338 peer
= PAF_PEER(paf
);
339 BGP_TIMER_OFF(peer
->t_routeadv
);
340 BGP_TIMER_ON(peer
->t_routeadv
, bgp_routeadv_timer
, 0);
347 static int update_group_announce_walkcb(struct update_group
*updgrp
, void *arg
)
349 struct update_subgroup
*subgrp
;
351 UPDGRP_FOREACH_SUBGRP (updgrp
, subgrp
) {
352 subgroup_announce_all(subgrp
);
355 return UPDWALK_CONTINUE
;
358 static int update_group_announce_rrc_walkcb(struct update_group
*updgrp
,
361 struct update_subgroup
*subgrp
;
366 afi
= UPDGRP_AFI(updgrp
);
367 safi
= UPDGRP_SAFI(updgrp
);
368 peer
= UPDGRP_PEER(updgrp
);
370 /* Only announce if this is a group of route-reflector-clients */
371 if (CHECK_FLAG(peer
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
)) {
372 UPDGRP_FOREACH_SUBGRP (updgrp
, subgrp
) {
373 subgroup_announce_all(subgrp
);
377 return UPDWALK_CONTINUE
;
380 /********************
382 ********************/
385 * Allocate an adj-out object. Do proper initialization of its fields,
386 * primarily its association with the subgroup and the prefix.
388 struct bgp_adj_out
*bgp_adj_out_alloc(struct update_subgroup
*subgrp
,
390 uint32_t addpath_tx_id
)
392 struct bgp_adj_out
*adj
;
394 adj
= XCALLOC(MTYPE_BGP_ADJ_OUT
, sizeof(struct bgp_adj_out
));
395 adj
->subgroup
= subgrp
;
397 BGP_ADJ_OUT_ADD(rn
, adj
);
402 adj
->addpath_tx_id
= addpath_tx_id
;
403 TAILQ_INSERT_TAIL(&(subgrp
->adjq
), adj
, subgrp_adj_train
);
404 SUBGRP_INCR_STAT(subgrp
, adj_count
);
409 struct bgp_advertise
*
410 bgp_advertise_clean_subgroup(struct update_subgroup
*subgrp
,
411 struct bgp_adj_out
*adj
)
413 struct bgp_advertise
*adv
;
414 struct bgp_advertise_attr
*baa
;
415 struct bgp_advertise
*next
;
416 struct bgp_advertise_fifo
*fhead
;
423 fhead
= &subgrp
->sync
->update
;
425 /* Unlink myself from advertise attribute FIFO. */
426 bgp_advertise_delete(baa
, adv
);
428 /* Fetch next advertise candidate. */
431 /* Unintern BGP advertise attribute. */
432 bgp_advertise_unintern(subgrp
->hash
, baa
);
434 fhead
= &subgrp
->sync
->withdraw
;
437 /* Unlink myself from advertisement FIFO. */
438 BGP_ADV_FIFO_DEL(fhead
, adv
);
441 bgp_advertise_free(adj
->adv
);
447 void bgp_adj_out_set_subgroup(struct bgp_node
*rn
,
448 struct update_subgroup
*subgrp
, struct attr
*attr
,
449 struct bgp_path_info
*path
)
451 struct bgp_adj_out
*adj
= NULL
;
452 struct bgp_advertise
*adv
;
457 peer
= SUBGRP_PEER(subgrp
);
458 afi
= SUBGRP_AFI(subgrp
);
459 safi
= SUBGRP_SAFI(subgrp
);
461 if (DISABLE_BGP_ANNOUNCE
)
464 /* Look for adjacency information. */
467 bgp_addpath_id_for_peer(peer
, afi
, safi
, &path
->tx_addpath
));
470 adj
= bgp_adj_out_alloc(
472 bgp_addpath_id_for_peer(peer
, afi
, safi
,
479 bgp_advertise_clean_subgroup(subgrp
, adj
);
480 adj
->adv
= bgp_advertise_new();
484 assert(adv
->pathi
== NULL
);
485 /* bgp_path_info adj_out reference */
486 adv
->pathi
= bgp_path_info_lock(path
);
489 adv
->baa
= bgp_advertise_intern(subgrp
->hash
, attr
);
491 adv
->baa
= baa_new();
494 /* Add new advertisement to advertisement attribute list. */
495 bgp_advertise_add(adv
->baa
, adv
);
498 * If the update adv list is empty, trigger the member peers'
499 * mrai timers so the socket writes can happen.
501 if (BGP_ADV_FIFO_EMPTY(&subgrp
->sync
->update
)) {
504 SUBGRP_FOREACH_PEER (subgrp
, paf
) {
505 bgp_adjust_routeadv(PAF_PEER(paf
));
509 BGP_ADV_FIFO_ADD(&subgrp
->sync
->update
, &adv
->fifo
);
511 subgrp
->version
= max(subgrp
->version
, rn
->version
);
514 /* The only time 'withdraw' will be false is if we are sending
515 * the "neighbor x.x.x.x default-originate" default and need to clear
516 * bgp_adj_out for the 0.0.0.0/0 route in the BGP table.
518 void bgp_adj_out_unset_subgroup(struct bgp_node
*rn
,
519 struct update_subgroup
*subgrp
, char withdraw
,
520 uint32_t addpath_tx_id
)
522 struct bgp_adj_out
*adj
;
523 struct bgp_advertise
*adv
;
526 if (DISABLE_BGP_ANNOUNCE
)
529 /* Lookup existing adjacency */
530 if ((adj
= adj_lookup(rn
, subgrp
, addpath_tx_id
)) != NULL
) {
531 /* Clean up previous advertisement. */
533 bgp_advertise_clean_subgroup(subgrp
, adj
);
535 if (adj
->attr
&& withdraw
) {
536 /* We need advertisement structure. */
537 adj
->adv
= bgp_advertise_new();
542 /* Note if we need to trigger a packet write */
544 BGP_ADV_FIFO_EMPTY(&subgrp
->sync
->withdraw
);
546 /* Add to synchronization entry for withdraw
548 BGP_ADV_FIFO_ADD(&subgrp
->sync
->withdraw
, &adv
->fifo
);
551 subgroup_trigger_write(subgrp
);
553 /* Remove myself from adjacency. */
554 BGP_ADJ_OUT_DEL(rn
, adj
);
556 /* Free allocated information. */
563 subgrp
->version
= max(subgrp
->version
, rn
->version
);
566 void bgp_adj_out_remove_subgroup(struct bgp_node
*rn
, struct bgp_adj_out
*adj
,
567 struct update_subgroup
*subgrp
)
570 bgp_attr_unintern(&adj
->attr
);
573 bgp_advertise_clean_subgroup(subgrp
, adj
);
575 BGP_ADJ_OUT_DEL(rn
, adj
);
580 * Go through all the routes and clean up the adj/adv structures corresponding
583 void subgroup_clear_table(struct update_subgroup
*subgrp
)
585 struct bgp_adj_out
*aout
, *taout
;
587 SUBGRP_FOREACH_ADJ_SAFE (subgrp
, aout
, taout
) {
588 struct bgp_node
*rn
= aout
->rn
;
589 bgp_adj_out_remove_subgroup(rn
, aout
, subgrp
);
595 * subgroup_announce_table
597 void subgroup_announce_table(struct update_subgroup
*subgrp
,
598 struct bgp_table
*table
)
601 struct bgp_path_info
*ri
;
608 peer
= SUBGRP_PEER(subgrp
);
609 afi
= SUBGRP_AFI(subgrp
);
610 safi
= SUBGRP_SAFI(subgrp
);
611 addpath_capable
= bgp_addpath_encode_tx(peer
, afi
, safi
);
613 if (safi
== SAFI_LABELED_UNICAST
)
617 table
= peer
->bgp
->rib
[afi
][safi
];
619 if (safi
!= SAFI_MPLS_VPN
&& safi
!= SAFI_ENCAP
&& safi
!= SAFI_EVPN
620 && CHECK_FLAG(peer
->af_flags
[afi
][safi
],
621 PEER_FLAG_DEFAULT_ORIGINATE
))
622 subgroup_default_originate(subgrp
, 0);
624 for (rn
= bgp_table_top(table
); rn
; rn
= bgp_route_next(rn
))
625 for (ri
= rn
->info
; ri
; ri
= ri
->next
)
627 if (CHECK_FLAG(ri
->flags
, BGP_PATH_SELECTED
)
629 && bgp_addpath_tx_path(
630 peer
->addpath_type
[afi
][safi
],
632 if (subgroup_announce_check(rn
, ri
, subgrp
,
634 bgp_adj_out_set_subgroup(rn
, subgrp
,
637 bgp_adj_out_unset_subgroup(
639 bgp_addpath_id_for_peer(
645 * We walked through the whole table -- make sure our version number
646 * is consistent with the one on the table. This should allow
647 * subgroups to merge sooner if a peer comes up when the route node
648 * with the largest version is no longer in the table. This also
649 * covers the pathological case where all routes in the table have
652 subgrp
->version
= max(subgrp
->version
, table
->version
);
655 * Start a task to merge the subgroup if necessary.
657 update_subgroup_trigger_merge_check(subgrp
, 0);
661 * subgroup_announce_route
663 * Refresh all routes out to a subgroup.
665 void subgroup_announce_route(struct update_subgroup
*subgrp
)
668 struct bgp_table
*table
;
669 struct peer
*onlypeer
;
671 if (update_subgroup_needs_refresh(subgrp
)) {
672 update_subgroup_set_needs_refresh(subgrp
, 0);
676 * First update is deferred until ORF or ROUTE-REFRESH is received
678 onlypeer
= ((SUBGRP_PCOUNT(subgrp
) == 1) ? (SUBGRP_PFIRST(subgrp
))->peer
680 if (onlypeer
&& CHECK_FLAG(onlypeer
->af_sflags
[SUBGRP_AFI(subgrp
)]
681 [SUBGRP_SAFI(subgrp
)],
682 PEER_STATUS_ORF_WAIT_REFRESH
))
685 if (SUBGRP_SAFI(subgrp
) != SAFI_MPLS_VPN
686 && SUBGRP_SAFI(subgrp
) != SAFI_ENCAP
687 && SUBGRP_SAFI(subgrp
) != SAFI_EVPN
)
688 subgroup_announce_table(subgrp
, NULL
);
690 for (rn
= bgp_table_top(update_subgroup_rib(subgrp
)); rn
;
691 rn
= bgp_route_next(rn
))
692 if ((table
= (rn
->info
)) != NULL
)
693 subgroup_announce_table(subgrp
, table
);
696 void subgroup_default_originate(struct update_subgroup
*subgrp
, int withdraw
)
700 struct aspath
*aspath
;
701 struct bgp_path_info tmp_info
;
705 struct bgp_path_info
*ri
;
707 int ret
= RMAP_DENYMATCH
;
714 peer
= SUBGRP_PEER(subgrp
);
715 afi
= SUBGRP_AFI(subgrp
);
716 safi
= SUBGRP_SAFI(subgrp
);
718 if (!(afi
== AFI_IP
|| afi
== AFI_IP6
))
722 from
= bgp
->peer_self
;
724 bgp_attr_default_set(&attr
, BGP_ORIGIN_IGP
);
725 aspath
= attr
.aspath
;
727 attr
.local_pref
= bgp
->default_local_pref
;
729 memset(&p
, 0, sizeof(p
));
730 p
.family
= afi2family(afi
);
733 if ((afi
== AFI_IP6
) || peer_cap_enhe(peer
, afi
, safi
)) {
734 /* IPv6 global nexthop must be included. */
735 attr
.mp_nexthop_len
= BGP_ATTR_NHLEN_IPV6_GLOBAL
;
737 /* If the peer is on shared nextwork and we have link-local
739 if (peer
->shared_network
740 && !IN6_IS_ADDR_UNSPECIFIED(&peer
->nexthop
.v6_local
))
741 attr
.mp_nexthop_len
= BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL
;
744 if (peer
->default_rmap
[afi
][safi
].name
) {
745 SET_FLAG(bgp
->peer_self
->rmap_type
, PEER_RMAP_TYPE_DEFAULT
);
746 for (rn
= bgp_table_top(bgp
->rib
[afi
][safi
]); rn
;
747 rn
= bgp_route_next(rn
)) {
748 for (ri
= rn
->info
; ri
; ri
= ri
->next
) {
749 struct attr dummy_attr
;
751 /* Provide dummy so the route-map can't modify
753 bgp_attr_dup(&dummy_attr
, ri
->attr
);
754 tmp_info
.peer
= ri
->peer
;
755 tmp_info
.attr
= &dummy_attr
;
757 ret
= route_map_apply(
758 peer
->default_rmap
[afi
][safi
].map
,
759 &rn
->p
, RMAP_BGP
, &tmp_info
);
761 /* The route map might have set attributes. If
762 * we don't flush them
763 * here, they will be leaked. */
764 bgp_attr_flush(&dummy_attr
);
765 if (ret
!= RMAP_DENYMATCH
)
768 if (ret
!= RMAP_DENYMATCH
)
771 bgp
->peer_self
->rmap_type
= 0;
773 if (ret
== RMAP_DENYMATCH
)
778 if (CHECK_FLAG(subgrp
->sflags
, SUBGRP_STATUS_DEFAULT_ORIGINATE
))
779 subgroup_default_withdraw_packet(subgrp
);
780 UNSET_FLAG(subgrp
->sflags
, SUBGRP_STATUS_DEFAULT_ORIGINATE
);
782 if (!CHECK_FLAG(subgrp
->sflags
,
783 SUBGRP_STATUS_DEFAULT_ORIGINATE
)) {
785 if (bgp_flag_check(bgp
, BGP_FLAG_GRACEFUL_SHUTDOWN
)) {
786 bgp_attr_add_gshut_community(&attr
);
789 SET_FLAG(subgrp
->sflags
,
790 SUBGRP_STATUS_DEFAULT_ORIGINATE
);
791 subgroup_default_update_packet(subgrp
, &attr
, from
);
793 /* The 'neighbor x.x.x.x default-originate' default will
795 * implicit withdraw for any previous UPDATEs sent for
797 * clear adj_out for the 0.0.0.0/0 prefix in the BGP
800 memset(&p
, 0, sizeof(p
));
801 p
.family
= afi2family(afi
);
804 rn
= bgp_afi_node_get(bgp
->rib
[afi
][safi
], afi
, safi
,
806 bgp_adj_out_unset_subgroup(
808 BGP_ADDPATH_TX_ID_FOR_DEFAULT_ORIGINATE
);
812 aspath_unintern(&aspath
);
816 * Announce the BGP table to a subgroup.
818 * At startup, we try to optimize route announcement by coalescing the
819 * peer-up events. This is done only the first time - from then on,
820 * subgrp->v_coalesce will be set to zero and the normal logic
823 void subgroup_announce_all(struct update_subgroup
*subgrp
)
829 * If coalesce timer value is not set, announce routes immediately.
831 if (!subgrp
->v_coalesce
) {
832 if (bgp_debug_update(NULL
, NULL
, subgrp
->update_group
, 0))
833 zlog_debug("u%" PRIu64
":s%" PRIu64
834 " announcing all routes",
835 subgrp
->update_group
->id
, subgrp
->id
);
836 subgroup_announce_route(subgrp
);
841 * We should wait for the coalesce timer. Arm the timer if not done.
843 if (!subgrp
->t_coalesce
) {
844 thread_add_timer_msec(bm
->master
, subgroup_coalesce_timer
,
845 subgrp
, subgrp
->v_coalesce
,
846 &subgrp
->t_coalesce
);
851 * Go through all update subgroups and set up the adv queue for the
854 void group_announce_route(struct bgp
*bgp
, afi_t afi
, safi_t safi
,
855 struct bgp_node
*rn
, struct bgp_path_info
*pi
)
857 struct updwalk_context ctx
;
860 update_group_af_walk(bgp
, afi
, safi
, group_announce_route_walkcb
, &ctx
);
863 void update_group_show_adj_queue(struct bgp
*bgp
, afi_t afi
, safi_t safi
,
864 struct vty
*vty
, uint64_t id
)
866 updgrp_show_adj(bgp
, afi
, safi
, vty
, id
, UPDWALK_FLAGS_ADVQUEUE
);
869 void update_group_show_advertised(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_ADVERTISED
);
875 void update_group_announce(struct bgp
*bgp
)
877 update_group_walk(bgp
, update_group_announce_walkcb
, NULL
);
880 void update_group_announce_rrclients(struct bgp
*bgp
)
882 update_group_walk(bgp
, update_group_announce_rrc_walkcb
, NULL
);