6#include <netlink/cli/utils.h>
7#include <netlink/cli/link.h>
9#include <linux/netlink.h>
11static void print_usage(
void)
14 "Usage: nl-neightbl-list [OPTION]...\n"
17 " -f, --format=TYPE Output format { brief | details | stats }\n"
18 " -h, --help Show this help\n"
19 " -v, --version Show versioning information\n"
24int main(
int argc,
char *argv[])
27 struct nl_cache *neightbl_cache;
33 sock = nl_cli_alloc_socket();
34 nl_cli_connect(sock, NETLINK_ROUTE);
35 nl_cli_link_alloc_cache(sock);
36 neightbl_cache = nl_cli_alloc_cache(sock,
"neighbour table",
41 static struct option long_opts[] = {
42 {
"format", 1, 0,
'f' },
43 {
"help", 0, 0,
'h' },
44 {
"version", 0, 0,
'v' },
48 c = getopt_long(argc, argv,
"f:hv", long_opts, &optidx);
53 case 'f': params.
dp_type = nl_cli_parse_dumptype(optarg);
break;
54 case 'h': print_usage();
break;
55 case 'v': nl_cli_print_version();
break;
void nl_cache_dump(struct nl_cache *cache, struct nl_dump_params *params)
Dump all elements of a cache.
int rtnl_neightbl_alloc_cache(struct nl_sock *sk, struct nl_cache **result)
Build a neighbour table cache including all neighbour tables currently configured in the kernel.
@ NL_DUMP_LINE
Dump object briefly on one line.
enum nl_dump_type dp_type
Specifies the type of dump that is requested.