summaryrefslogtreecommitdiff
path: root/proto/static
diff options
context:
space:
mode:
Diffstat (limited to 'proto/static')
-rw-r--r--proto/static/static.c34
1 files changed, 8 insertions, 26 deletions
diff --git a/proto/static/static.c b/proto/static/static.c
index 29285d37..d1d5b92b 100644
--- a/proto/static/static.c
+++ b/proto/static/static.c
@@ -114,24 +114,13 @@ static_announce_rte(struct static_proto *p, struct static_route *r)
return;
/* We skip rta_lookup() here */
- rte *e = rte_get_temp(ea, src);
- e->pflags = 0;
+ rte e0 = { .attrs = ea, .src = src, .net = r->net, }, *e = &e0;
+ /* Evaluate the filter */
if (r->cmds)
- {
- /* Create a temporary table node */
- e->net = alloca(sizeof(net) + r->net->length);
- memset(e->net, 0, sizeof(net) + r->net->length);
- net_copy(e->net->n.addr, r->net);
-
- /* Evaluate the filter */
- f_eval_rte(r->cmds, &e);
-
- /* Remove the temporary node */
- e->net = NULL;
- }
+ f_eval_rte(r->cmds, e);
- rte_update2(p->p.main_channel, r->net, e, src);
+ rte_update(p->p.main_channel, r->net, e, src);
r->state = SRS_CLEAN;
return;
@@ -139,7 +128,7 @@ withdraw:
if (r->state == SRS_DOWN)
return;
- rte_update2(p->p.main_channel, r->net, NULL, src);
+ rte_update(p->p.main_channel, r->net, NULL, src);
r->state = SRS_DOWN;
}
@@ -305,7 +294,7 @@ static void
static_remove_rte(struct static_proto *p, struct static_route *r)
{
if (r->state)
- rte_update2(p->p.main_channel, r->net, NULL, static_get_source(p, r->index));
+ rte_update(p->p.main_channel, r->net, NULL, static_get_source(p, r->index));
static_reset_rte(p, r);
}
@@ -508,19 +497,13 @@ static_shutdown(struct proto *P)
WALK_LIST(r, cf->routes)
static_reset_rte(p, r);
- return PS_DOWN;
-}
-
-static void
-static_cleanup(struct proto *P)
-{
- struct static_proto *p = (void *) P;
-
if (p->igp_table_ip4)
rt_unlock_table(p->igp_table_ip4);
if (p->igp_table_ip6)
rt_unlock_table(p->igp_table_ip6);
+
+ return PS_DOWN;
}
static void
@@ -778,7 +761,6 @@ struct protocol proto_static = {
.dump = static_dump,
.start = static_start,
.shutdown = static_shutdown,
- .cleanup = static_cleanup,
.reconfigure = static_reconfigure,
.copy_config = static_copy_config,
.get_route_info = static_get_route_info,