Skip to content

Commit

Permalink
bgpd: Avoid triggering prefix validation in some circumstances
Browse files Browse the repository at this point in the history
* If the cache manager is not yet synced;
* If the cache socket is in sync.

Signed-off-by: Donatas Abraitis <[email protected]>
  • Loading branch information
ton31337 committed Nov 29, 2024
1 parent 962312a commit 0efba5c
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions bgpd/bgp_rpki.c
Original file line number Diff line number Diff line change
Expand Up @@ -781,10 +781,16 @@ static void rpki_update_cb_sync_rtr(struct pfx_table *p __attribute__((unused)),
goto err;
}

if (is_stopping(rpki_vrf) ||
atomic_load_explicit(&rpki_vrf->rtr_update_overflow,
memory_order_seq_cst))
if (is_stopping(rpki_vrf) || !is_synchronized(rpki_vrf) ||
atomic_load_explicit(&rpki_vrf->rtr_update_overflow, memory_order_seq_cst)) {
RPKI_DEBUG("rtr_mgr is stopping or not synchronized, ignore validating prefixes");
return;
}

if (rtr->state == RTR_SYNC) {
RPKI_DEBUG("rtr_mgr socket is in sync, ignore validating prefixes");
return;
}

int retval = write(rpki_vrf->rpki_sync_socket_rtr, &rec,
sizeof(struct pfx_record));
Expand Down Expand Up @@ -953,10 +959,9 @@ static int start(struct rpki_vrf *rpki_vrf)
struct rtr_mgr_group *groups = get_groups(rpki_vrf->cache_list);

RPKI_DEBUG("Polling period: %d", rpki_vrf->polling_period);
ret = rtr_mgr_init(&rpki_vrf->rtr_config, groups, groups_len,
rpki_vrf->polling_period, rpki_vrf->expire_interval,
rpki_vrf->retry_interval, rpki_update_cb_sync_rtr,
NULL, NULL, NULL);
ret = rtr_mgr_init(&rpki_vrf->rtr_config, groups, groups_len, rpki_vrf->polling_period,
rpki_vrf->expire_interval, rpki_vrf->retry_interval,
rpki_update_cb_sync_rtr, NULL, NULL, NULL);
if (ret == RTR_ERROR) {
RPKI_DEBUG("Init rtr_mgr failed (%s).", vrf->name);
return ERROR;
Expand Down

0 comments on commit 0efba5c

Please sign in to comment.