]>
git.proxmox.com Git - mirror_iproute2.git/blob - tipc/peer.c
2 * peer.c TIPC peer functionality.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
9 * Authors: Richard Alpe <richard.alpe@ericsson.com>
17 #include <linux/tipc_netlink.h>
18 #include <linux/tipc.h>
19 #include <linux/genetlink.h>
20 #include <libmnl/libmnl.h>
27 static int cmd_peer_rm_addr(struct nlmsghdr
*nlh
, const struct cmd
*cmd
,
28 struct cmdl
*cmdl
, void *data
)
33 char buf
[MNL_SOCKET_BUFFER_SIZE
];
35 if ((cmdl
->argc
!= cmdl
->optind
+ 1) || help_flag
) {
36 fprintf(stderr
, "Usage: %s peer remove address ADDRESS\n",
41 str
= shift_cmdl(cmdl
);
46 if (!(nlh
= msg_init(buf
, TIPC_NL_PEER_REMOVE
))) {
47 fprintf(stderr
, "error, message initialisation failed\n");
51 nest
= mnl_attr_nest_start(nlh
, TIPC_NLA_NET
);
52 mnl_attr_put_u32(nlh
, TIPC_NLA_NET_ADDR
, addr
);
53 mnl_attr_nest_end(nlh
, nest
);
55 return msg_doit(nlh
, NULL
, NULL
);
58 static void cmd_peer_rm_help(struct cmdl
*cmdl
)
60 fprintf(stderr
, "Usage: %s peer remove address ADDRESS\n",
64 static int cmd_peer_rm(struct nlmsghdr
*nlh
, const struct cmd
*cmd
,
65 struct cmdl
*cmdl
, void *data
)
67 const struct cmd cmds
[] = {
68 { "address", cmd_peer_rm_addr
, cmd_peer_rm_help
},
72 return run_cmd(nlh
, cmd
, cmds
, cmdl
, NULL
);
75 void cmd_peer_help(struct cmdl
*cmdl
)
78 "Usage: %s peer COMMAND [ARGS] ...\n\n"
80 " remove - Remove an offline peer node\n",
84 int cmd_peer(struct nlmsghdr
*nlh
, const struct cmd
*cmd
, struct cmdl
*cmdl
,
87 const struct cmd cmds
[] = {
88 { "remove", cmd_peer_rm
, cmd_peer_rm_help
},
92 return run_cmd(nlh
, cmd
, cmds
, cmdl
, NULL
);