/* Build a rule cache including all rules currently configured in the kernel.  */
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.  */
int rtnl_rule_alloc_cache(struct nl_sock *sock, int family, struct nl_cache **result)
{
	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;
}