2 * src/f_neigh.c Neighbour Filter
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
9 * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
12 static void get_filter(struct rtnl_neigh *n, int ac, char **av, int idx,
13 struct nl_cache *cache)
15 struct nl_cache *lc = nl_cache_mngt_require("route/link");
18 if (!strcasecmp(av[idx], "dev")) {
20 int ifindex = rtnl_link_name2i(lc, av[idx++]);
21 if (ifindex == RTNL_LINK_NOT_FOUND)
23 rtnl_neigh_set_ifindex(n, ifindex);
25 } else if (!strcasecmp(av[idx], "dst")) {
27 struct nl_addr *a = nl_addr_parse(av[idx++], AF_UNSPEC);
30 rtnl_neigh_set_dst(n, a);
33 } else if (!strcasecmp(av[idx], "lladdr")) {
35 struct nl_addr *a = nl_addr_parse(av[idx++], AF_UNSPEC);
38 rtnl_neigh_set_lladdr(n, a);
46 fprintf(stderr, "Unable to find interface %s\n", av[idx-1]);
49 fprintf(stderr, "%s\n", nl_geterror());