1/*
2 * src/nl-pktloc-lookup.c     Lookup packet location alias
3 *
4 *	This library is free software; you can redistribute it and/or
5 *	modify it under the terms of the GNU Lesser General Public
6 *	License as published by the Free Software Foundation version 2.1
7 *	of the License.
8 *
9 * Copyright (c) 2010 Thomas Graf <tgraf@suug.ch>
10 */
11
12#include <netlink/cli/utils.h>
13#include <netlink/route/pktloc.h>
14
15static void print_usage(void)
16{
17	printf("Usage: nl-pktloc-lookup <name>\n");
18	exit(0);
19}
20
21int main(int argc, char *argv[])
22{
23	struct rtnl_pktloc *loc;
24	int err;
25
26	if (argc < 2)
27		print_usage();
28
29	if ((err = rtnl_pktloc_lookup(argv[1], &loc)) < 0)
30		nl_cli_fatal(err, "Unable to lookup packet location: %s",
31			nl_geterror(err));
32
33	printf("%s: %u %u+%u 0x%x %u\n", loc->name, loc->align,
34		loc->layer, loc->offset, loc->mask, loc->flags);
35
36	return 0;
37}
38