6#include <netlink/cli/utils.h>
7#include <netlink/cli/link.h>
9#include <linux/netlink.h>
11static void print_usage(
void)
13 printf(
"Usage: nl-link-name2ifindex <name>\n");
17int main(
int argc,
char *argv[])
20 struct nl_cache *link_cache;
26 sock = nl_cli_alloc_socket();
27 nl_cli_connect(sock, NETLINK_ROUTE);
28 link_cache = nl_cli_link_alloc_cache(sock);
34 printf(
"%u\n", ifindex);
void nl_cli_fatal(int err, const char *fmt,...)
Print error message and quit application.
int rtnl_link_name2i(struct nl_cache *cache, const char *name)
Translate link name to corresponding interface index.