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

int rtnl_rule_alloc_cache ( struct nl_sock *  sock,
int  family,
struct nl_cache **  result 
)

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

  • sk Netlink socket.
  • family Address family or AF_UNSPEC.
  • result Pointer to store resulting cache.
Allocates a new rule cache, initializes it properly and updates it to include all rules currently configured in the kernel.

Returns:
0 on success or a negative error code.

Definition at line 359 of file rule.c.

References nl_cache_alloc(), and nl_cache_refill().

{
      struct nl_cache * cache;
      int err;

      if (!(cache = nl_cache_alloc(&rtnl_rule_ops)))
            return -NLE_NOMEM;

      cache->c_iarg1 = family;

      if (sock && (err = nl_cache_refill(sock, cache)) < 0) {
            free(cache);
            return err;
      }

      *result = cache;
      return 0;
}


Generated by  Doxygen 1.6.0   Back to index