summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_rpki.c
diff options
context:
space:
mode:
authorMarcel Röthke <marcel.roethke@haw-hamburg.de>2018-07-19 17:58:05 +0200
committerMarcel Röthke <marcel.roethke@haw-hamburg.de>2018-08-22 16:50:04 +0200
commit31a2af325e67b6ae4bb3c110b4e49c77dd523dec (patch)
tree3c38b659e7603ee7761073ff29e20e942a516916 /bgpd/bgp_rpki.c
parentbgpd: fix wrong allocation size in rpki route map (diff)
downloadfrr-31a2af325e67b6ae4bb3c110b4e49c77dd523dec.tar.xz
frr-31a2af325e67b6ae4bb3c110b4e49c77dd523dec.zip
bgpd: use correct bgp tables for rpki revalidation
Signed-off-by: Marcel Röthke <marcel.roethke@haw-hamburg.de>
Diffstat (limited to 'bgpd/bgp_rpki.c')
-rw-r--r--bgpd/bgp_rpki.c73
1 files changed, 40 insertions, 33 deletions
diff --git a/bgpd/bgp_rpki.c b/bgpd/bgp_rpki.c
index 1371ce802..53fc221f3 100644
--- a/bgpd/bgp_rpki.c
+++ b/bgpd/bgp_rpki.c
@@ -372,26 +372,36 @@ static int bgpd_sync_callback(struct thread *thread)
afi_t afi = (rec.prefix.ver == LRTR_IPV4) ? AFI_IP : AFI_IP6;
for (ALL_LIST_ELEMENTS_RO(bm->bgp, node, bgp)) {
- safi_t safi;
+ struct peer *peer;
+ struct listnode *peer_listnode;
- for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) {
- if (!bgp->rib[afi][safi])
- continue;
+ for (ALL_LIST_ELEMENTS_RO(bgp->peer, peer_listnode, peer)) {
+ safi_t safi;
+
+ for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) {
+ if (!peer->bgp->rib[afi][safi])
+ continue;
- struct list *matches = list_new();
+ struct list *matches = list_new();
- matches->del = (void (*)(void *))bgp_unlock_node;
+ matches->del =
+ (void (*)(void *))bgp_unlock_node;
- bgp_table_range_lookup(bgp->rib[afi][safi], prefix,
- rec.max_len, matches);
+ bgp_table_range_lookup(
+ peer->bgp->rib[afi][safi], prefix,
+ rec.max_len, matches);
- struct bgp_node *bgp_node;
+ struct bgp_node *bgp_node;
+ struct listnode *bgp_listnode;
- for (ALL_LIST_ELEMENTS_RO(matches, node, bgp_node))
- revalidate_bgp_node(bgp_node, afi, safi);
+ for (ALL_LIST_ELEMENTS_RO(matches, bgp_listnode,
+ bgp_node))
+ revalidate_bgp_node(bgp_node, afi,
+ safi);
- list_delete_and_null(&matches);
+ list_delete_and_null(&matches);
+ }
}
}
@@ -414,14 +424,13 @@ static void revalidate_bgp_node(struct bgp_node *bgp_node, afi_t afi,
label = bgp_info->extra->label;
num_labels = bgp_info->extra->num_labels;
}
- ret = bgp_update(ain->peer, &bgp_node->p, 0, ain->attr, afi,
- safi, ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, NULL,
- label, num_labels, 1, NULL);
+ ret = bgp_update(ain->peer, &bgp_node->p, ain->addpath_rx_id,
+ ain->attr, afi, safi, ZEBRA_ROUTE_BGP,
+ BGP_ROUTE_NORMAL, NULL, label, num_labels, 1,
+ NULL);
- if (ret < 0) {
- bgp_unlock_node(bgp_node);
+ if (ret < 0)
return;
- }
}
}
@@ -429,25 +438,23 @@ static void revalidate_all_routes(void)
{
struct bgp *bgp;
struct listnode *node;
- struct bgp_node *bgp_node;
for (ALL_LIST_ELEMENTS_RO(bm->bgp, node, bgp)) {
- for (size_t i = 0; i < 2; i++) {
- safi_t safi;
- afi_t afi = (i == 0) ? AFI_IP : AFI_IP6;
+ struct peer *peer;
+ struct listnode *peer_listnode;
- for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) {
- if (!bgp->rib[afi][safi])
- continue;
+ for (ALL_LIST_ELEMENTS_RO(bgp->peer, peer_listnode, peer)) {
+
+ for (size_t i = 0; i < 2; i++) {
+ safi_t safi;
+ afi_t afi = (i == 0) ? AFI_IP : AFI_IP6;
+
+ for (safi = SAFI_UNICAST; safi < SAFI_MAX;
+ safi++) {
+ if (!peer->bgp->rib[afi][safi])
+ continue;
- for (bgp_node =
- bgp_table_top(bgp->rib[afi][safi]);
- bgp_node;
- bgp_node = bgp_route_next(bgp_node)) {
- if (bgp_node->info != NULL) {
- revalidate_bgp_node(bgp_node,
- afi, safi);
- }
+ bgp_soft_reconfig_in(peer, afi, safi);
}
}
}