libnl  1.1.4
Modules

Modules

 Route Object
 
 Utilities
 Routing Utility Functions.
 

Cache Management

struct nl_cache * rtnl_route_alloc_cache (struct nl_handle *handle)
 Build a route cache holding all routes currently configured in the kernel. More...
 

Route Addition

struct nl_msg * rtnl_route_build_add_request (struct rtnl_route *tmpl, int flags)
 
int rtnl_route_add (struct nl_handle *handle, struct rtnl_route *route, int flags)
 
struct nl_msg * rtnl_route_build_del_request (struct rtnl_route *tmpl, int flags)
 
int rtnl_route_del (struct nl_handle *handle, struct rtnl_route *route, int flags)
 

Detailed Description

Function Documentation

◆ rtnl_route_alloc_cache()

struct nl_cache* rtnl_route_alloc_cache ( struct nl_handle *  handle)
Parameters
handlenetlink handle

Allocates a new cache, initializes it properly and updates it to contain all routes currently configured in the kernel.

Note
The caller is responsible for destroying and freeing the cache after using it.
Returns
The cache or NULL if an error has occured.

Definition at line 241 of file route.c.

References nl_cache_alloc().

242 {
243  struct nl_cache *cache;
244 
245  cache = nl_cache_alloc(&rtnl_route_ops);
246  if (!cache)
247  return NULL;
248 
249  if (handle && nl_cache_refill(handle, cache) < 0) {
250  free(cache);
251  return NULL;
252  }
253 
254  return cache;
255 }
int nl_cache_refill(struct nl_handle *handle, struct nl_cache *cache)
(Re)fill a cache with the contents in the kernel.
Definition: cache.c:680
struct nl_cache * nl_cache_alloc(struct nl_cache_ops *ops)
Allocate an empty cache.
Definition: cache.c:170