8#include <linux/netlink.h>
10#include <netlink/cli/utils.h>
11#include <netlink/cli/link.h>
13static void print_usage(
void)
16 "Usage: nl-neightbl-list [OPTION]...\n"
19 " -f, --format=TYPE Output format { brief | details | stats }\n"
20 " -h, --help Show this help\n"
21 " -v, --version Show versioning information\n"
26int main(
int argc,
char *argv[])
29 struct nl_cache *neightbl_cache;
35 sock = nl_cli_alloc_socket();
36 nl_cli_connect(sock, NETLINK_ROUTE);
37 nl_cli_link_alloc_cache(sock);
38 neightbl_cache = nl_cli_alloc_cache(sock,
"neighbour table",
43 static struct option long_opts[] = {
44 {
"format", 1, 0,
'f' },
45 {
"help", 0, 0,
'h' },
46 {
"version", 0, 0,
'v' },
50 c = getopt_long(argc, argv,
"f:hv", long_opts, &optidx);
55 case 'f': params.
dp_type = nl_cli_parse_dumptype(optarg);
break;
56 case 'h': print_usage();
break;
57 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.