diff options
author | roopa <roopa@cumulusnetworks.com> | 2012-11-01 07:15:28 -0700 |
---|---|---|
committer | Thomas Graf <tgraf@redhat.com> | 2012-11-05 13:31:55 +0100 |
commit | 690264a193c2cf548e3561bec3c7bbe3e4407ee4 (patch) | |
tree | 6b38ca6601d9caf82b6fed4bc2572ac7d507c7fe /include | |
parent | 3750e2ac31c15c85069ab3a087c4353f8bc6e80a (diff) | |
download | libnl-690264a193c2cf548e3561bec3c7bbe3e4407ee4.tar.gz |
Add new object op oo_id_attrs_get
The current oo_id_attrs nl_object op allows a fixed
id attribute list for an cache. But a cache with multiple families
may need to specify different id attributes for different families.
An example for this is the bridge fdb entries in the neigh cache:
neigh entries belonging to the AF_UNSPEC family use
(NEIGH_ATTR_IFINDEX | NEIGH_ATTR_DST | NEIGH_ATTR_FAMILY) as id attributes.
AF_BRIDGE fdb entries which also support the same msg type, will need to use
(NEIGH_ATTR_LLADDR | NEIGH_ATTR_FAMILY) as id attributes.
Today you cannot specify different set of attributes to two families belonging
to the same cache.
This patch adds a new object function oo_id_attrs_get to get the attributes.
An example implementation of oo_id_attrs_get for the neigh cache will
look like:
static uint32_t neigh_id_attrs_get(struct nl_object *obj)
{
struct rtnl_neigh *neigh = (struct rtnl_neigh *)obj;
if (neigh->n_family == AF_BRIDGE)
return (NEIGH_ATTR_LLADDR | NEIGH_ATTR_FAMILY);
else
return (NEIGH_ATTR_IFINDEX | NEIGH_ATTR_DST | NEIGH_ATTR_FAMILY);
}
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Reviewed-by: Nolan Leake <nolan@cumulusnetworks.com>
Reviewed-by: Shrijeet Mukherjee <shm@cumulusnetworks.com>
Reviewed-by: Wilson Kok <wkok@cumulusnetworks.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/netlink/object-api.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/netlink/object-api.h b/include/netlink/object-api.h index 70a4ddd..cfd5699 100644 --- a/include/netlink/object-api.h +++ b/include/netlink/object-api.h @@ -337,6 +337,11 @@ struct nl_object_ops char *(*oo_attrs2str)(int, char *, size_t); + + /** + * Get key attributes by family function + */ + uint32_t (*oo_id_attrs_get)(struct nl_object *); }; /** @} */ |