[Patch v2 1/4] link: call rtnl_link_set_type() in link_msg_parser()
Cong Wang
xiyou.wangcong at gmail.com
Fri Mar 28 21:08:15 EDT 2014
We need to call link-specific ->io_alloc() to alloc
addtional structures.
Signed-off-by: Cong Wang <xiyou.wangcong at gmail.com>
---
lib/route/link.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/lib/route/link.c b/lib/route/link.c
index d609b17..7f7b1ce 100644
--- a/lib/route/link.c
+++ b/lib/route/link.c
@@ -537,16 +537,10 @@ 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;
- goto errout;
- }
- link->l_info_kind = kind;
- link->ce_mask |= LINK_ATTR_LINKINFO;
+ rtnl_link_set_type(link, kind);
if ((af = nl_str2af(kind)) >= 0 &&
!af_ops && (af_ops = af_lookup_and_alloc(link, af))) {
--
1.7.11.7
More information about the libnl
mailing list