13 #include <netlink/cli/utils.h> 14 #include <netlink/cli/link.h> 16 #include <linux/netlink.h> 18 static void print_usage(
void)
21 "Usage: nl-neightbl-list [OPTION]...\n" 24 " -f, --format=TYPE Output format { brief | details | stats }\n" 25 " -h, --help Show this help\n" 26 " -v, --version Show versioning information\n" 31 int main(
int argc,
char *argv[])
34 struct nl_cache *neightbl_cache;
40 sock = nl_cli_alloc_socket();
41 nl_cli_connect(sock, NETLINK_ROUTE);
42 nl_cli_link_alloc_cache(sock);
43 neightbl_cache = nl_cli_alloc_cache(sock,
"neighbour table",
48 static struct option long_opts[] = {
49 {
"format", 1, 0,
'f' },
50 {
"help", 0, 0,
'h' },
51 {
"version", 0, 0,
'v' },
55 c = getopt_long(argc, argv,
"f:hv", long_opts, &optidx);
60 case 'f': params.
dp_type = nl_cli_parse_dumptype(optarg);
break;
61 case 'h': print_usage();
break;
62 case 'v': nl_cli_print_version();
break;
Dump object briefly on one line.
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.
enum nl_dump_type dp_type
Specifies the type of dump that is requested.
void nl_cache_dump(struct nl_cache *cache, struct nl_dump_params *params)
Dump all elements of a cache.