X-Git-Url: http://git.onelab.eu/?p=libnl.git;a=blobdiff_plain;f=src%2Fnl-neigh-delete.c;fp=src%2Fnl-neigh-delete.c;h=0000000000000000000000000000000000000000;hp=54a0324a4fdb68269c61fc212a8055c048612750;hb=332c8b7561dcac7ac95cc0d07328b1cb22d780a6;hpb=eabdd897b75ecc1fac5e255229a899126085e57a diff --git a/src/nl-neigh-delete.c b/src/nl-neigh-delete.c deleted file mode 100644 index 54a0324..0000000 --- a/src/nl-neigh-delete.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * src/nl-neigh-delete.c Delete a neighbour - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * Copyright (c) 2003-2006 Thomas Graf - */ - -#include "utils.h" - -int main(int argc, char *argv[]) -{ - struct nl_handle *nlh; - struct rtnl_neigh *neigh; - struct nl_addr *addr; - int err = 1; - - if (nltool_init(argc, argv) < 0) - return -1; - - if (argc < 3 || !strcmp(argv[1], "-h")) { - printf("Usage: nl-neigh-delete \n"); - return 2; - } - - nlh = nl_handle_alloc_nondefault(nltool_cbset); - - neigh = rtnl_neigh_alloc(); - if (neigh == NULL) - goto errout; - - if (nl_connect(nlh, NETLINK_ROUTE) < 0) { - fprintf(stderr, "%s\n", nl_geterror()); - goto errout_free; - } - - addr = nl_addr_parse(argv[1], AF_UNSPEC); - if (addr == NULL) { - fprintf(stderr, "Invalid address \"%s\"\n", argv[1]); - goto errout_close; - } - rtnl_neigh_set_dst(neigh, addr); - nl_addr_put(addr); - - rtnl_neigh_set_ifindex(neigh, strtoul(argv[2], NULL, 0)); - - if (rtnl_neigh_delete(nlh, neigh, 0) < 0) { - fprintf(stderr, "%s\n", nl_geterror()); - goto errout_close; - } - - err = 0; - -errout_close: - nl_close(nlh); -errout_free: - rtnl_neigh_put(neigh); -errout: - nl_handle_destroy(nlh); - return err; -}