summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2013-04-01 09:16:34 (GMT)
committerThomas Graf <tgraf@suug.ch>2013-04-01 09:21:22 (GMT)
commitad545f2854458f98498e0cfed136845ef029a115 (patch)
tree014931e930eecd85b80418aa521df11ffa192164
parentaad041c46f6f0720bff8e8727e8ff39f2196d2a8 (diff)
downloadlibnl-ad545f2854458f98498e0cfed136845ef029a115.zip
libnl-ad545f2854458f98498e0cfed136845ef029a115.tar.gz
libnl-ad545f2854458f98498e0cfed136845ef029a115.tar.bz2
genl: Update mt_id of cache ops when resolving genl id
The cache layer uses the message type array stored in the cache ops to lookup which cache a message belongs to. Update to the the message array with the resolved generic netlink id to make it compatible with the caching API. Allows to use nl_cache_refill() and others for generic netlink based caches with dynamic generic netlink ids. Signed-off-by: Thomas Graf <tgraf@suug.ch>
-rw-r--r--lib/genl/mngt.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/genl/mngt.c b/lib/genl/mngt.c
index 35bbb12..3648663 100644
--- a/lib/genl/mngt.c
+++ b/lib/genl/mngt.c
@@ -295,6 +295,10 @@ static int __genl_ops_resolve(struct nl_cache *ctrl, struct genl_ops *ops)
family = genl_ctrl_search_by_name(ctrl, ops->o_name);
if (family != NULL) {
ops->o_id = genl_family_get_id(family);
+
+ if (ops->o_cache_ops)
+ ops->o_cache_ops->co_msgtypes[0].mt_id = ops->o_id;
+
genl_family_put(family);
return 0;