0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-22 09:41:54 +00:00

protocol->import_control() could potentially call rte_cow() as well.

AFAIK it doesn't happen in any of our protocol, but better be sure.
This commit is contained in:
Martin Mares 2003-08-13 20:04:39 +00:00
parent 2adab6ae9c
commit 13b75bacf7

View File

@ -168,22 +168,19 @@ do_rte_announce(struct announce_hook *a, net *net, rte *new, rte *old, ea_list *
if (new) if (new)
{ {
char *drop_reason = NULL;
if ((class & IADDR_SCOPE_MASK) < p->min_scope) if ((class & IADDR_SCOPE_MASK) < p->min_scope)
{ drop_reason = "out of scope";
rte_trace_out(D_FILTERS, p, new, "out of scope");
new = NULL;
}
else if ((ok = p->import_control ? p->import_control(p, &new, &tmpa, rte_update_pool) : 0) < 0) else if ((ok = p->import_control ? p->import_control(p, &new, &tmpa, rte_update_pool) : 0) < 0)
{ drop_reason = "rejected by protocol";
rte_trace_out(D_FILTERS, p, new, "rejected by protocol");
new = NULL;
}
else if (ok) else if (ok)
rte_trace_out(D_FILTERS, p, new, "forced accept by protocol"); rte_trace_out(D_FILTERS, p, new, "forced accept by protocol");
else if (p->out_filter == FILTER_REJECT || else if (p->out_filter == FILTER_REJECT ||
p->out_filter && f_run(p->out_filter, &new, &tmpa, rte_update_pool, FF_FORCE_TMPATTR) > F_ACCEPT) p->out_filter && f_run(p->out_filter, &new, &tmpa, rte_update_pool, FF_FORCE_TMPATTR) > F_ACCEPT)
drop_reason = "filtered out";
if (drop_reason)
{ {
rte_trace_out(D_FILTERS, p, new, "filtered out"); rte_trace_out(D_FILTERS, p, new, drop_reason);
if (new != new0) if (new != new0)
rte_free(new); rte_free(new);
new = NULL; new = NULL;
@ -198,9 +195,13 @@ do_rte_announce(struct announce_hook *a, net *net, rte *new, rte *old, ea_list *
ea_list *tmpb = p->make_tmp_attrs ? p->make_tmp_attrs(old, rte_update_pool) : NULL; ea_list *tmpb = p->make_tmp_attrs ? p->make_tmp_attrs(old, rte_update_pool) : NULL;
ok = p->import_control ? p->import_control(p, &old, &tmpb, rte_update_pool) : 0; ok = p->import_control ? p->import_control(p, &old, &tmpb, rte_update_pool) : 0;
if (ok < 0 || (!ok && f_run(p->out_filter, &old, &tmpb, rte_update_pool, FF_FORCE_TMPATTR) > F_ACCEPT)) if (ok < 0 || (!ok && f_run(p->out_filter, &old, &tmpb, rte_update_pool, FF_FORCE_TMPATTR) > F_ACCEPT))
{
if (old != old0)
rte_free(old);
old = NULL; old = NULL;
} }
} }
}
if (p->debug & D_ROUTES) if (p->debug & D_ROUTES)
{ {
if (new && old) if (new && old)