From 9ba2798c65c02254ec000ab03a76fbbaae1ddc97 Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Fri, 23 Mar 2012 01:17:02 +0100 Subject: Adds krt_metric linux route attribute. --- sysdep/linux/netlink/netlink.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'sysdep/linux/netlink') 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; -- cgit v1.2.3