summaryrefslogtreecommitdiff
path: root/sysdep/linux
diff options
context:
space:
mode:
Diffstat (limited to 'sysdep/linux')
-rw-r--r--sysdep/linux/netlink.c33
1 files changed, 22 insertions, 11 deletions
diff --git a/sysdep/linux/netlink.c b/sysdep/linux/netlink.c
index 12bacd35..342b746c 100644
--- a/sysdep/linux/netlink.c
+++ b/sysdep/linux/netlink.c
@@ -1378,8 +1378,6 @@ nl_send_route(struct krt_proto *p, rte *e, int op)
if (p->af == AF_MPLS)
priority = 0;
- else if (a->source == RTS_DUMMY)
- priority = e->u.krt.metric;
else if (KRT_CF->sys.metric)
priority = KRT_CF->sys.metric;
else if ((op != NL_OP_DELETE) && (ea = ea_find(eattrs, EA_KRT_METRIC)))
@@ -1650,10 +1648,28 @@ nl_parse_route(struct nl_parse_state *s, struct nlmsghdr *h)
net *net = net_get(p->p.main_channel->table, n);
rta *ra = lp_allocz(s->pool, RTA_MAX_SIZE);
- ra->src = p->p.main_source;
ra->source = RTS_INHERIT;
ra->scope = SCOPE_UNIVERSE;
+ {
+ ea_list *ea = lp_alloc(s->pool, sizeof(ea_list) + 2 * sizeof(eattr));
+ *ea = (ea_list) { .flags = EALF_SORTED, .count = 2 };
+ ea->next = ra->eattrs;
+ ra->eattrs = ea;
+
+ ea->attrs[0] = (eattr) {
+ .id = EA_KRT_SOURCE,
+ .type = EAF_TYPE_INT,
+ .u.data = i->rtm_protocol
+ };
+
+ ea->attrs[1] = (eattr) {
+ .id = EA_KRT_METRIC,
+ .type = EAF_TYPE_INT,
+ .u.data = priority,
+ };
+ }
+
if (a[RTA_FLOW])
s->rta_flow = rta_get_u32(a[RTA_FLOW]);
else
@@ -1830,18 +1846,13 @@ nl_parse_route(struct nl_parse_state *s, struct nlmsghdr *h)
}
}
- rte *e = rte_get_temp(ra);
+ rte *e = rte_get_temp(ra, p->p.main_source);
e->net = net;
- e->u.krt.src = krt_src;
- e->u.krt.proto = i->rtm_protocol;
- e->u.krt.seen = 0;
- e->u.krt.best = 0;
- e->u.krt.metric = priority;
if (s->scan)
- krt_got_route(p, e);
+ krt_got_route(p, e, krt_src);
else
- krt_got_route_async(p, e, new);
+ krt_got_route_async(p, e, new, krt_src);
lp_flush(s->pool);
}