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 449 of file rule.c.

References nl_cache_alloc(), and nl_cache_refill().

Referenced by rtnl_rule_alloc_cache().

{
      struct nl_cache * cache;

      cache = nl_cache_alloc(&rtnl_rule_ops);
      if (cache == NULL)
            return NULL;

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

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

      return cache;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index