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

struct nl_cache* rtnl_addr_alloc_cache ( struct nl_handle *  handle  )  [read]

Allocate address cache and fill in all configured addresses

  • handle Netlink handle.
Allocates a new address cache, initializes it properly and updates it to include all addresses currently configured in the kernel.

Note:
Free the memory after usage using nl_cache_destroy_and_free().
Returns:
Newly allocated cache or NULL if an error occured.

Definition at line 536 of file addr.c.

References nl_cache_alloc_from_ops(), nl_cache_destroy_and_free(), and nl_cache_update().

{
      struct nl_cache *cache;
      
      cache = nl_cache_alloc_from_ops(&rtnl_addr_ops);
      if (!cache)
            return NULL;

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

      return cache;
}


Generated by  Doxygen 1.6.0   Back to index