diff options
author | Nicolas PLANEL <nicolas.planel@enovance.com> | 2013-10-10 20:51:38 (GMT) |
---|---|---|
committer | Thomas Graf <tgraf@suug.ch> | 2013-10-22 12:20:41 (GMT) |
commit | fdd1ba220dd7b780400e9d0652cde80e59f63572 (patch) | |
tree | c162179a9349fd35e551594d66cabc83a9ef7c8c /lib | |
parent | 27019c5671b146fd42de352c7722d398c5740ec6 (diff) | |
download | libnl-fdd1ba220dd7b780400e9d0652cde80e59f63572.zip libnl-fdd1ba220dd7b780400e9d0652cde80e59f63572.tar.gz libnl-fdd1ba220dd7b780400e9d0652cde80e59f63572.tar.bz2 |
route/link: fixup link->l_af_ops must be set for some kind of links
Lookup on IFLA_INFO_KIND information to setup the right link->l_af_ops callbacks
For example, if you setup a bridge this is avoid to trig IS_BRIDGE_LINK_ASSERT() on rtnl_link_bridge_get_flags() call.
line=<optimized out>, function=<optimized out>) at assert.c:94
0x7ffff5dc39a0 "rtnl_link_bridge_get_flags") at assert.c:103
Signed-off-by: Nicolas PLANEL <nicolas.planel@enovance.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/route/link.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/route/link.c b/lib/route/link.c index 0bb90a0..a016899 100644 --- a/lib/route/link.c +++ b/lib/route/link.c @@ -523,6 +523,7 @@ 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; + int af; kind = nla_strdup(li[IFLA_INFO_KIND]); if (kind == NULL) { @@ -532,6 +533,16 @@ static int link_msg_parser(struct nl_cache_ops *ops, struct sockaddr_nl *who, 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))) { + + if (af_ops->ao_protinfo_policy) { + tb[IFLA_PROTINFO] = (struct nlattr *)af_ops->ao_protinfo_policy; + } + link->l_family = family = af; + link->l_af_ops = af_ops; + } + ops = rtnl_link_info_ops_lookup(kind); link->l_info_ops = ops; |