0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-22 17:51:53 +00:00

Route export: Packed all the export code before export table update to one function

This commit is contained in:
Maria Matejka 2020-05-08 23:08:07 +02:00 committed by Maria Matejka
parent d24a6ad4c7
commit b7c26c1030

View File

@ -707,8 +707,8 @@ rt_notify_merged(struct channel *c, struct rte_export_internal *e)
return RTE_EXPORT_IS_OK(ep); return RTE_EXPORT_IS_OK(ep);
} }
static void static struct rte_export *
rte_export(struct channel *c, struct rte_export_internal *e) rte_export_obtain(struct channel *c, struct rte_export_internal *e)
{ {
uint ra_mode = c->ra_mode; uint ra_mode = c->ra_mode;
_Bool accepted = 0; _Bool accepted = 0;
@ -741,12 +741,11 @@ rte_export(struct channel *c, struct rte_export_internal *e)
if (!accepted) if (!accepted)
{ {
DBG("Idempotent export.\n"); DBG("Idempotent export.\n");
goto cleanup; return NULL;
} }
struct rte_export *ep = &(e->pub); struct rte_export *ep = &(e->pub);
struct proto *p = c->proto;
struct proto_stats *stats = &c->stats; struct proto_stats *stats = &c->stats;
if (e->refeed && ep->new.attrs) if (e->refeed && ep->new.attrs)
@ -763,9 +762,20 @@ rte_export(struct channel *c, struct rte_export_internal *e)
{ {
stats->exp_updates_rejected++; stats->exp_updates_rejected++;
rte_trace_out(D_FILTERS, c, &ep->new, "rejected [limit]"); rte_trace_out(D_FILTERS, c, &ep->new, "rejected [limit]");
return NULL;
}
}
return ep;
}
static void
rte_export(struct channel *c, struct rte_export_internal *e)
{
struct rte_export *ep = rte_export_obtain(c, e);
if (!ep)
goto cleanup; goto cleanup;
}
}
struct rte_storage *old_stored = NULL; struct rte_storage *old_stored = NULL;
/* Apply export table */ /* Apply export table */
@ -778,6 +788,9 @@ rte_export(struct channel *c, struct rte_export_internal *e)
/* We aren't sure about the old route attributes */ /* We aren't sure about the old route attributes */
ep->old.attrs = NULL; ep->old.attrs = NULL;
struct proto_stats *stats = &c->stats;
struct proto *p = c->proto;
if (ep->new.attrs) if (ep->new.attrs)
stats->exp_updates_accepted++; stats->exp_updates_accepted++;
else else