summaryrefslogtreecommitdiff
path: root/proto/static/static.c
diff options
context:
space:
mode:
authorJan Moskyto Matejka <mq@ucw.cz>2016-04-08 13:08:03 +0200
committerJan Moskyto Matejka <mq@ucw.cz>2016-04-08 13:09:06 +0200
commit2003a1840731bd57365876e48c96c5a1ea0348cb (patch)
treec473a93f4027ea2706ccac3502ccef36736fbb6d /proto/static/static.c
parent4bdf1881dc6230b742d7efcaad8eeac4ed25f445 (diff)
Route update: move table lookup from protocols into rte_update2().
Many protocols do almost the same when creating a rte_update request before calling rte_update2(). This commit should simplify the protocol side of the route-creation routine.
Diffstat (limited to 'proto/static/static.c')
-rw-r--r--proto/static/static.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/proto/static/static.c b/proto/static/static.c
index 6239fccb..28cb1e77 100644
--- a/proto/static/static.c
+++ b/proto/static/static.c
@@ -60,7 +60,6 @@ p_igp_table(struct proto *p)
static void
static_install(struct proto *p, struct static_route *r, struct iface *ifa)
{
- net *n;
rta a;
rte *e;
@@ -112,15 +111,13 @@ static_install(struct proto *p, struct static_route *r, struct iface *ifa)
/* We skip rta_lookup() here */
- n = net_get(p->main_channel->table, r->net);
e = rte_get_temp(&a);
- e->net = n;
e->pflags = 0;
if (r->cmds)
f_eval_rte(r->cmds, &e, static_lp);
- rte_update(p, n, e);
+ rte_update(p, r->net, e);
r->installed = 1;
if (r->cmds)
@@ -130,14 +127,11 @@ static_install(struct proto *p, struct static_route *r, struct iface *ifa)
static void
static_remove(struct proto *p, struct static_route *r)
{
- net *n;
-
if (!r->installed)
return;
DBG("Removing static route %N via %I\n", r->net, r->via);
- n = net_find(p->main_channel->table, r->net);
- rte_update(p, n, NULL);
+ rte_update(p, r->net, NULL);
r->installed = 0;
}