20 #include <netlink/cli/utils.h> 21 #include <netlink/cli/neigh.h> 23 struct rtnl_neigh *nl_cli_neigh_alloc(
void)
25 struct rtnl_neigh *neigh;
27 neigh = rtnl_neigh_alloc();
29 nl_cli_fatal(ENOMEM,
"Unable to allocate neighbour object");
34 void nl_cli_neigh_parse_dst(
struct rtnl_neigh *neigh,
char *arg)
39 a = nl_cli_addr_parse(arg, rtnl_neigh_get_family(neigh));
40 if ((err = rtnl_neigh_set_dst(neigh, a)) < 0)
47 void nl_cli_neigh_parse_lladdr(
struct rtnl_neigh *neigh,
char *arg)
51 a = nl_cli_addr_parse(arg, AF_UNSPEC);
52 rtnl_neigh_set_lladdr(neigh, a);
56 void nl_cli_neigh_parse_dev(
struct rtnl_neigh *neigh,
57 struct nl_cache *link_cache,
char *arg)
64 rtnl_neigh_set_ifindex(neigh, ival);
67 void nl_cli_neigh_parse_family(
struct rtnl_neigh *neigh,
char *arg)
71 if ((family = nl_str2af(arg)) == AF_UNSPEC)
73 "Unable to translate address family \"%s\"", arg);
75 rtnl_neigh_set_family(neigh, family);
78 void nl_cli_neigh_parse_state(
struct rtnl_neigh *neigh,
char *arg)
82 if ((state = rtnl_neigh_str2state(arg)) < 0)
83 nl_cli_fatal(state,
"Unable to translate state \"%s\": %s",
86 rtnl_neigh_set_state(neigh, state);
void nl_cli_fatal(int err, const char *fmt,...)
Print error message and quit application.
void nl_addr_put(struct nl_addr *addr)
Decrease the reference counter of an abstract address.
int rtnl_link_name2i(struct nl_cache *cache, const char *name)
Translate link name to corresponding interface index.