summaryrefslogtreecommitdiff
path: root/proto/static
diff options
context:
space:
mode:
Diffstat (limited to 'proto/static')
-rw-r--r--proto/static/Makefile3
-rw-r--r--proto/static/static.c21
2 files changed, 16 insertions, 8 deletions
diff --git a/proto/static/Makefile b/proto/static/Makefile
index e38f9b74..26aed31f 100644
--- a/proto/static/Makefile
+++ b/proto/static/Makefile
@@ -2,5 +2,6 @@ src := static.c
obj := $(src-o-files)
$(all-daemon)
$(cf-local)
+$(call proto-build,static_build)
-tests_objs := $(tests_objs) $(src-o-files) \ No newline at end of file
+tests_objs := $(tests_objs) $(src-o-files)
diff --git a/proto/static/static.c b/proto/static/static.c
index 2789c1bb..cd31afd3 100644
--- a/proto/static/static.c
+++ b/proto/static/static.c
@@ -56,10 +56,11 @@ static void
static_announce_rte(struct static_proto *p, struct static_route *r)
{
rta *a = allocz(RTA_MAX_SIZE);
- a->src = static_get_source(p, r->index);
+ struct rte_src *src = static_get_source(p, r->index);
a->source = RTS_STATIC;
a->scope = SCOPE_UNIVERSE;
a->dest = r->dest;
+ a->pref = p->p.main_channel->preference;
if (r->dest == RTD_UNICAST)
{
@@ -102,7 +103,7 @@ static_announce_rte(struct static_proto *p, struct static_route *r)
return;
/* We skip rta_lookup() here */
- rte *e = rte_get_temp(a);
+ rte *e = rte_get_temp(a, src);
e->pflags = 0;
if (r->cmds)
@@ -119,7 +120,7 @@ static_announce_rte(struct static_proto *p, struct static_route *r)
e->net = NULL;
}
- rte_update2(p->p.main_channel, r->net, e, a->src);
+ rte_update2(p->p.main_channel, r->net, e, src);
r->state = SRS_CLEAN;
if (r->cmds)
@@ -131,7 +132,7 @@ withdraw:
if (r->state == SRS_DOWN)
return;
- rte_update2(p->p.main_channel, r->net, NULL, a->src);
+ rte_update2(p->p.main_channel, r->net, NULL, src);
r->state = SRS_DOWN;
}
@@ -485,7 +486,7 @@ static_start(struct proto *P)
struct static_route *r;
if (!static_lp)
- static_lp = lp_new(&root_pool, LP_GOOD_SIZE(1024));
+ static_lp = lp_new(&root_pool);
if (p->igp_table_ip4)
rt_lock_table(p->igp_table_ip4);
@@ -721,9 +722,9 @@ static_get_route_info(rte *rte, byte *buf)
{
eattr *a = ea_find(rte->attrs->eattrs, EA_GEN_IGP_METRIC);
if (a)
- buf += bsprintf(buf, " (%d/%u)", rte->pref, a->u.data);
+ buf += bsprintf(buf, " (%d/%u)", rte->attrs->pref, a->u.data);
else
- buf += bsprintf(buf, " (%d)", rte->pref);
+ buf += bsprintf(buf, " (%d)", rte->attrs->pref);
}
static void
@@ -792,3 +793,9 @@ struct protocol proto_static = {
.copy_config = static_copy_config,
.get_route_info = static_get_route_info,
};
+
+void
+static_build(void)
+{
+ proto_build(&proto_static);
+}