From ab55ea80a4fbad94c75e31e4107bbb48406ec999 Mon Sep 17 00:00:00 2001 From: Cong Wang Date: Tue, 1 Apr 2014 18:03:29 -0700 Subject: [PATCH] link: call rtnl_link_set_type() in link_msg_parser() We need to call link-specific ->io_alloc() to alloc addtional structures. Acked-by: Thomas Graf Signed-off-by: Cong Wang Signed-off-by: Thomas Haller --- lib/route/link.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/route/link.c b/lib/route/link.c index 3263096..65e42ec 100644 --- a/lib/route/link.c +++ b/lib/route/link.c @@ -541,16 +541,12 @@ static int link_msg_parser(struct nl_cache_ops *ops, struct sockaddr_nl *who, if (li[IFLA_INFO_KIND]) { struct rtnl_link_info_ops *ops; - char *kind; + char *kind = nla_get_string(li[IFLA_INFO_KIND]); int af; - kind = nla_strdup(li[IFLA_INFO_KIND]); - if (kind == NULL) { - err = -NLE_NOMEM; + err = rtnl_link_set_type(link, kind); + if (err < 0) goto errout; - } - link->l_info_kind = kind; - link->ce_mask |= LINK_ATTR_LINKINFO; if ((af = nl_str2af(kind)) >= 0 && !af_ops && (af_ops = af_lookup_and_alloc(link, af))) {