12 #include <netlink/cli/utils.h> 13 #include <netlink/cli/link.h> 15 #include <linux/netlink.h> 17 static void print_usage(
void)
20 "Usage: nl-neightbl-list [OPTION]...\n" 23 " -f, --format=TYPE Output format { brief | details | stats }\n" 24 " -h, --help Show this help\n" 25 " -v, --version Show versioning information\n" 30 int main(
int argc,
char *argv[])
33 struct nl_cache *neightbl_cache;
39 sock = nl_cli_alloc_socket();
40 nl_cli_connect(sock, NETLINK_ROUTE);
41 nl_cli_link_alloc_cache(sock);
42 neightbl_cache = nl_cli_alloc_cache(sock,
"neighbour table",
47 static struct option long_opts[] = {
48 {
"format", 1, 0,
'f' },
49 {
"help", 0, 0,
'h' },
50 {
"version", 0, 0,
'v' },
54 c = getopt_long(argc, argv,
"f:hv", long_opts, &optidx);
59 case 'f': params.
dp_type = nl_cli_parse_dumptype(optarg);
break;
60 case 'h': print_usage();
break;
61 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.