link: Keep reference to af_ops during lifetime of link object
authorThomas Graf <tgraf@suug.ch>
Tue, 5 Feb 2013 12:18:25 +0000 (13:18 +0100)
committerThomas Graf <tgraf@suug.ch>
Tue, 5 Feb 2013 12:18:25 +0000 (13:18 +0100)
Signed-off-by: Thomas Graf <tgraf@suug.ch>
include/netlink-private/types.h
lib/route/link.c

index 60a3bceb0dada9229ebd00561450344f50591506..89f6418bebd14dcd48d5fbfa1dc43c417eb645da 100644 (file)
@@ -183,6 +183,8 @@ struct rtnl_link
        uint32_t                        l_num_rx_queues;
        uint32_t                        l_group;
        uint8_t                         l_carrier;
+       /* 3 byte hole */
+       struct rtnl_link_af_ops *       l_af_ops;
 };
 
 struct rtnl_ncacheinfo
index e395529dcc808e2c1a53502c4863bffc6b929f9f..752f63a6bd694ed289f5aa7ac88be3f61d203457 100644 (file)
@@ -201,6 +201,8 @@ static void link_free_data(struct nl_object *c)
                if ((io = link->l_info_ops) != NULL)
                        release_link_info(link);
 
+               rtnl_link_af_ops_put(link->l_af_ops);
+
                nl_addr_put(link->l_addr);
                nl_addr_put(link->l_bcast);
 
@@ -313,6 +315,8 @@ static int link_msg_parser(struct nl_cache_ops *ops, struct sockaddr_nl *who,
                               af_ops->ao_protinfo_policy,
                               sizeof(struct nla_policy));
                }
+
+               link->l_af_ops = af_ops;
        }
 
        err = nlmsg_parse(n, sizeof(*ifi), tb, IFLA_MAX, link_policy);