13#include <netlink/cli/utils.h>
14#include <netlink/cli/neigh.h>
16struct rtnl_neigh *nl_cli_neigh_alloc(
void)
18 struct rtnl_neigh *neigh;
20 neigh = rtnl_neigh_alloc();
22 nl_cli_fatal(ENOMEM,
"Unable to allocate neighbour object");
27void nl_cli_neigh_parse_dst(
struct rtnl_neigh *neigh,
char *arg)
32 a = nl_cli_addr_parse(arg, rtnl_neigh_get_family(neigh));
33 if ((err = rtnl_neigh_set_dst(neigh, a)) < 0)
40void nl_cli_neigh_parse_lladdr(
struct rtnl_neigh *neigh,
char *arg)
44 a = nl_cli_addr_parse(arg, AF_UNSPEC);
45 rtnl_neigh_set_lladdr(neigh, a);
49void nl_cli_neigh_parse_dev(
struct rtnl_neigh *neigh,
50 struct nl_cache *link_cache,
char *arg)
57 rtnl_neigh_set_ifindex(neigh, ival);
60void nl_cli_neigh_parse_family(
struct rtnl_neigh *neigh,
char *arg)
64 if ((family = nl_str2af(arg)) == AF_UNSPEC)
66 "Unable to translate address family \"%s\"", arg);
68 rtnl_neigh_set_family(neigh, family);
71void nl_cli_neigh_parse_state(
struct rtnl_neigh *neigh,
char *arg)
75 if ((state = rtnl_neigh_str2state(arg)) < 0)
76 nl_cli_fatal(state,
"Unable to translate state \"%s\": %s",
79 rtnl_neigh_set_state(neigh, state);
void nl_addr_put(struct nl_addr *addr)
Decrease the reference counter of an abstract address.
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.