/* Build a route cache holding all routes currently configured in the kernel  */
int rtnl_route_alloc_cache(struct nl_sock *sk, int family, int flags, struct nl_cache **result)
/* Build a route cache holding all routes currently configured in the kernel  */
int rtnl_route_alloc_cache(struct nl_sock *sk, int family, int flags, struct nl_cache **result)
{
	struct nl_cache *cache;
	int err;
	if (!(cache = nl_cache_alloc(&rtnl_route_ops)))
		return -NLE_NOMEM;
	cache->c_iarg1 = family;
	cache->c_iarg2 = flags;
	if (sk && (err = nl_cache_refill(sk, cache)) < 0) {
		free(cache);
		return err;
	}
	*result = cache;
	return 0;
}