Logo Search packages:      
Sourcecode: libnl version File versions  Download package

struct nl_cache* rtnl_rule_alloc_cache_by_family ( struct nl_handle *  handle,
int  family 
) [read]

Build a rule cache including all rules of the specified family currently configured in the kernel.

  • handle netlink handle
  • family address family
Allocates a new rule cache, initializes it properly and updates it to include all rules of the specified address family currently configured in the kernel.

Note:
The caller is responsible for destroying and freeing the cache after using it. (nl_cache_destroy_and_free())
Returns:
The new cache or NULL if an error occured.

Definition at line 370 of file rule.c.

References nl_cache_alloc_from_ops(), and nl_cache_update().

Referenced by rtnl_rule_alloc_cache().

{
      struct nl_cache * cache = nl_cache_alloc_from_ops(&rtnl_rule_ops);

      if (cache == NULL)
            return NULL;

      /* XXX RULE_CACHE_FAMILY(cache) = family; */

      if (nl_cache_update(handle, cache) < 0) {
            free(cache);
            return NULL;
      }

      return cache;
}


Generated by  Doxygen 1.6.0   Back to index