2 * src/nl-link-release.c release a link
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) 2011 Thomas Graf <tgraf@suug.ch>
12 #include <netlink/cli/utils.h>
13 #include <netlink/cli/link.h>
14 #include <netlink/route/link/bonding.h>
16 int main(int argc, char *argv[])
19 struct nl_cache *link_cache;
20 struct rtnl_link *slave;
24 fprintf(stderr, "Usage: nl-link-release slave\n");
28 sock = nl_cli_alloc_socket();
29 nl_cli_connect(sock, NETLINK_ROUTE);
30 link_cache = nl_cli_link_alloc_cache(sock);
32 if (!(slave = rtnl_link_get_by_name(link_cache, argv[1]))) {
33 fprintf(stderr, "Unknown link: %s\n", argv[1]);
37 if ((err = rtnl_link_bond_release(sock, slave)) < 0) {
38 fprintf(stderr, "Unable to release slave %s: %s\n",
39 argv[1], nl_geterror(err));