summaryrefslogtreecommitdiff
path: root/zebra/rt_netlink.c
diff options
context:
space:
mode:
authorDmitry Popov <dp@highloadlab.com>2011-09-11 13:48:25 +0400
committerDenis Ovsienko <infrastation@yandex.ru>2011-09-27 20:46:25 +0400
commit83d1614952faf100a0a1bacaa0a1b3f70a013c9f (patch)
tree3b1ffb4fbd385e6f5ee2277ed24015ce2305f5db /zebra/rt_netlink.c
parent3c9cfcdebf680c1d2c0e6b69cb4e11885a049e05 (diff)
zebra: fix loss of metric for Linux routes
* rt_netlink.c * netlink_route_change(): fetch metric information like netlink_routing_table() does and pass it further
Diffstat (limited to 'zebra/rt_netlink.c')
-rw-r--r--zebra/rt_netlink.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c
index 7652f80a..eb9eae3a 100644
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -768,6 +768,8 @@ netlink_route_change (struct sockaddr_nl *snl, struct nlmsghdr *h)
int index;
int table;
+ int metric;
+
void *dest;
void *gate;
void *src;
@@ -825,6 +827,7 @@ netlink_route_change (struct sockaddr_nl *snl, struct nlmsghdr *h)
}
index = 0;
+ metric = 0;
dest = NULL;
gate = NULL;
src = NULL;
@@ -843,6 +846,9 @@ netlink_route_change (struct sockaddr_nl *snl, struct nlmsghdr *h)
if (tb[RTA_PREFSRC])
src = RTA_DATA (tb[RTA_PREFSRC]);
+ if (h->nlmsg_type == RTM_NEWROUTE && tb[RTA_PRIORITY])
+ metric = *(int *) RTA_DATA(tb[RTA_PRIORITY]);
+
if (rtm->rtm_family == AF_INET)
{
struct prefix_ipv4 p;
@@ -861,7 +867,7 @@ netlink_route_change (struct sockaddr_nl *snl, struct nlmsghdr *h)
}
if (h->nlmsg_type == RTM_NEWROUTE)
- rib_add_ipv4 (ZEBRA_ROUTE_KERNEL, 0, &p, gate, src, index, table, 0, 0);
+ rib_add_ipv4 (ZEBRA_ROUTE_KERNEL, 0, &p, gate, src, index, table, metric, 0);
else
rib_delete_ipv4 (ZEBRA_ROUTE_KERNEL, 0, &p, gate, index, table);
}
@@ -889,7 +895,7 @@ netlink_route_change (struct sockaddr_nl *snl, struct nlmsghdr *h)
}
if (h->nlmsg_type == RTM_NEWROUTE)
- rib_add_ipv6 (ZEBRA_ROUTE_KERNEL, 0, &p, gate, index, table, 0, 0);
+ rib_add_ipv6 (ZEBRA_ROUTE_KERNEL, 0, &p, gate, index, table, metric, 0);
else
rib_delete_ipv6 (ZEBRA_ROUTE_KERNEL, 0, &p, gate, index, table);
}