summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2011-04-20 16:30:49 +0200
committerThomas Graf <tgraf@suug.ch>2011-04-20 16:30:49 +0200
commitc18730ddf69f70c79ebd77e6b0e173eadce96096 (patch)
tree8c304f52fe00faef97922e830b201672fc45993f
parentfac48856087d11627bb7c2b78776529ceadc213a (diff)
downloadlibnl-c18730ddf69f70c79ebd77e6b0e173eadce96096.tar.gz
Set tc->tc_link if link cache is available
When parsing tc objects, lookup link in link cache if such a cache is available.
-rw-r--r--lib/route/tc.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/route/tc.c b/lib/route/tc.c
index 56aa410..0aa44f7 100644
--- a/lib/route/tc.c
+++ b/lib/route/tc.c
@@ -60,6 +60,7 @@ static struct nla_policy tc_stats2_policy[TCA_STATS_MAX+1] = {
int rtnl_tc_msg_parse(struct nlmsghdr *n, struct rtnl_tc *tc)
{
+ struct nl_cache *link_cache;
struct rtnl_tc_ops *ops;
struct nlattr *tb[TCA_MAX + 1];
char kind[TCKINDSIZ];
@@ -175,6 +176,13 @@ compat_xstats:
return err;
}
+ if ((link_cache = nl_cache_mngt_require("route/link"))) {
+ struct rtnl_link *link;
+
+ if ((link = rtnl_link_get(link_cache, tc->tc_ifindex)))
+ rtnl_tc_set_link(tc, link);
+ }
+
return 0;
}