From feae132e0f9bdc62d2b90bf676d12241af8e794c Mon Sep 17 00:00:00 2001 From: "Ondrej Zajicek (work)" Date: Thu, 24 May 2018 14:51:05 +0200 Subject: 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). --- proto/babel/babel.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'proto/babel/babel.c') 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; } -- cgit v1.2.3