diff options
author | Cong Wang <xiyou.wangcong@gmail.com> | 2014-04-02 01:03:29 (GMT) |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2014-04-09 07:10:19 (GMT) |
commit | ab55ea80a4fbad94c75e31e4107bbb48406ec999 (patch) | |
tree | 5bb8927810a27abac6115ac2abfe6766c82a1a8a /lib/route | |
parent | 690545a20eb486d4829900378caa1dc4dd5aa0ba (diff) | |
download | libnl-ab55ea80a4fbad94c75e31e4107bbb48406ec999.zip libnl-ab55ea80a4fbad94c75e31e4107bbb48406ec999.tar.gz libnl-ab55ea80a4fbad94c75e31e4107bbb48406ec999.tar.bz2 |
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 <tgraf@suug.ch>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
Diffstat (limited to 'lib/route')
-rw-r--r-- | lib/route/link.c | 10 |
1 files 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))) { |