示例#1
0
文件: lookup.c 项目: Alenevod/libnl
/**
 * Perform FIB Lookup
 * @arg sk		Netlink socket.
 * @arg req		Lookup request object.
 * @arg cache		Cache for result.
 *
 * Builds a netlink message to request a FIB lookup, waits for the
 * reply and adds the result to the specified cache.
 *
 * @return 0 on success or a negative error code.
 */
int flnl_lookup(struct nl_sock *sk, struct flnl_request *req,
		struct nl_cache *cache)
{
	struct nl_msg *msg;
	int err;

	if ((err = flnl_lookup_build_request(req, 0, &msg)) < 0)
		return err;

	err = nl_send_auto_complete(sk, msg);
	nlmsg_free(msg);
	if (err < 0)
		return err;

	return nl_cache_pickup(sk, cache);
}
示例#2
0
文件: lookup.c 项目: 62gs8ha/batphone
/**
 * Perform FIB Lookup
 * @arg handle		Netlink handle.
 * @arg req		Lookup request object.
 * @arg cache		Cache for result.
 *
 * Builds a netlink message to request a FIB lookup, waits for the
 * reply and adds the result to the specified cache.
 *
 * @return 0 on success or a negative error code.
 */
int flnl_lookup(struct nl_handle *handle, struct flnl_request *req,
		struct nl_cache *cache)
{
	struct nl_msg *msg;
	int err;

	msg = flnl_lookup_build_request(req, 0);
	if (!msg)
		return nl_errno(ENOMEM);

	err = nl_send_auto_complete(handle, msg);
	nlmsg_free(msg);
	if (err < 0)
		return err;

	return nl_cache_pickup(handle, cache);
}