]> git.ipfire.org Git - thirdparty/libnl.git/commitdiff
Set tc->tc_link if link cache is available
authorThomas Graf <tgraf@suug.ch>
Wed, 20 Apr 2011 14:30:49 +0000 (16:30 +0200)
committerThomas Graf <tgraf@suug.ch>
Wed, 20 Apr 2011 14:30:49 +0000 (16:30 +0200)
When parsing tc objects, lookup link in link cache if such a
cache is available.

lib/route/tc.c

index 56aa41090959a91cb20c26ae49ae2cfb93b72fe7..0aa44f753a7984b5b4354eb4525330e73a41b9c4 100644 (file)
@@ -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;
 }