summaryrefslogtreecommitdiff
path: root/proto/babel/babel.c
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2018-05-24 14:51:05 +0200
committerOndrej Zajicek (work) <santiago@crfreenet.org>2018-05-24 14:51:05 +0200
commitfeae132e0f9bdc62d2b90bf676d12241af8e794c (patch)
tree2767cf9b23d85fdd7f029e27afe855f758430a60 /proto/babel/babel.c
parentb24b781117179f301116837f0a39468343e4805b (diff)
Do not initialize route metrics in import_control hook
During route export, the receiving protocol often initialized route metrics to default value in its import_control hook before export filter was executed. This is inconsistent with the expectation that an export filter would process the same route as one in the routing table and it breaks setting these metrics before (e.g. for static routes directly in static protocol). The patch removes the initialization of route metrics in import_control hook, the default values are already handled in rt_notify hook called after export filters. The patch also changed the behavior of OSPF to keep metrics when a route is reannounced between OSPF instances (to be consistent with other protocols) and the behavior when both ospf_metric1 and ospf_metric2 are specified (to have more expected behavior).
Diffstat (limited to 'proto/babel/babel.c')
-rw-r--r--proto/babel/babel.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/proto/babel/babel.c b/proto/babel/babel.c
index ce05191c..44c6adb8 100644
--- a/proto/babel/babel.c
+++ b/proto/babel/babel.c
@@ -2087,20 +2087,14 @@ babel_prepare_attrs(struct linpool *pool, ea_list *next, uint metric, u64 router
static int
-babel_import_control(struct proto *P, struct rte **new, struct ea_list **attrs, struct linpool *pool)
+babel_import_control(struct proto *P, struct rte **new, struct ea_list **attrs UNUSED, struct linpool *pool UNUSED)
{
- struct babel_proto *p = (void *) P;
- rte *rt = *new;
+ rte *e = *new;
/* Reject our own unreachable routes */
- if ((rt->attrs->dest == RTD_UNREACHABLE) && (rt->attrs->src->proto == P))
+ if ((e->attrs->dest == RTD_UNREACHABLE) && (e->attrs->src->proto == P))
return -1;
-
- /* Prepare attributes with initial values */
- if (rt->attrs->source != RTS_BABEL)
- *attrs = babel_prepare_attrs(pool, NULL, 0, p->router_id);
-
return 0;
}