summaryrefslogtreecommitdiff
path: root/sysdep/linux/netlink
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2012-03-23 01:17:02 +0100
committerOndrej Zajicek <santiago@crfreenet.org>2012-03-23 17:22:13 +0100
commit9ba2798c65c02254ec000ab03a76fbbaae1ddc97 (patch)
tree51f2a88061dd0f4adc122a122370658b4a557e18 /sysdep/linux/netlink
parent72aed1a00ba9e18116d6fd907f7e1a36d0a0a583 (diff)
Adds krt_metric linux route attribute.
Diffstat (limited to 'sysdep/linux/netlink')
-rw-r--r--sysdep/linux/netlink/netlink.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sysdep/linux/netlink/netlink.c b/sysdep/linux/netlink/netlink.c
index 17c369ea..a0743da7 100644
--- a/sysdep/linux/netlink/netlink.c
+++ b/sysdep/linux/netlink/netlink.c
@@ -639,6 +639,9 @@ nl_send_route(struct krt_proto *p, rte *e, int new)
r.r.rtm_scope = RT_SCOPE_UNIVERSE;
nl_add_attr_ipa(&r.h, sizeof(r), RTA_DST, net->n.prefix);
+ if (ea = ea_find(a->eattrs, EA_KRT_METRIC))
+ nl_add_attr_u32(&r.h, sizeof(r), RTA_PRIORITY, ea->u.data);
+
if (ea = ea_find(a->eattrs, EA_KRT_PREFSRC))
nl_add_attr_ipa(&r.h, sizeof(r), RTA_PREFSRC, *(ip_addr *)ea->u.ptr->data);
@@ -886,7 +889,7 @@ nl_parse_route(struct nlmsghdr *h, int scan)
e->u.krt.type = i->rtm_type;
if (a[RTA_PRIORITY])
- memcpy(&e->u.krt.metric, RTA_DATA(a[RTA_PRIORITY]), sizeof(e->u.krt.metric));
+ memcpy(&e->u.krt.metric, RTA_DATA(a[RTA_PRIORITY]), sizeof(e->u.krt.metric));
else
e->u.krt.metric = 0;