projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
"tincctl info" gives more human readable information about nodes or subnets.
[tinc]
/
src
/
tincctl.c
diff --git
a/src/tincctl.c
b/src/tincctl.c
index
b2a6561
..
f3a73b7
100644
(file)
--- a/
src/tincctl.c
+++ b/
src/tincctl.c
@@
-25,6
+25,7
@@
#include "protocol.h"
#include "control_common.h"
#include "ecdsagen.h"
#include "protocol.h"
#include "control_common.h"
#include "ecdsagen.h"
+#include "info.h"
#include "rsagen.h"
#include "utils.h"
#include "tincctl.h"
#include "rsagen.h"
#include "utils.h"
#include "tincctl.h"
@@
-62,10
+63,18
@@
static struct WSAData wsa_state;
static struct option const long_options[] = {
{"config", required_argument, NULL, 'c'},
static struct option const long_options[] = {
{"config", required_argument, NULL, 'c'},
+ {"debug", optional_argument, NULL, 0},
+ {"no-detach", no_argument, NULL, 0},
+ {"mlock", no_argument, NULL, 0},
{"net", required_argument, NULL, 'n'},
{"help", no_argument, NULL, 1},
{"version", no_argument, NULL, 2},
{"pidfile", required_argument, NULL, 5},
{"net", required_argument, NULL, 'n'},
{"help", no_argument, NULL, 1},
{"version", no_argument, NULL, 2},
{"pidfile", required_argument, NULL, 5},
+ {"logfile", required_argument, NULL, 0},
+ {"bypass-security", no_argument, NULL, 0},
+ {"chroot", no_argument, NULL, 0},
+ {"user", required_argument, NULL, 0},
+ {"option", required_argument, NULL, 0},
{NULL, 0, NULL, 0}
};
{NULL, 0, NULL, 0}
};
@@
-98,7
+107,7
@@
static void usage(bool status) {
" [set] VARIABLE VALUE - set VARIABLE to VALUE\n"
" add VARIABLE VALUE - add VARIABLE with the given VALUE\n"
" del VARIABLE [VALUE] - remove VARIABLE [only ones with watching VALUE]\n"
" [set] VARIABLE VALUE - set VARIABLE to VALUE\n"
" add VARIABLE VALUE - add VARIABLE with the given VALUE\n"
" del VARIABLE [VALUE] - remove VARIABLE [only ones with watching VALUE]\n"
- " start
Start tincd.\n"
+ " start
[tincd options]
Start tincd.\n"
" stop Stop tincd.\n"
" restart Restart tincd.\n"
" reload Partially reload configuration of running tincd.\n"
" stop Stop tincd.\n"
" restart Restart tincd.\n"
" reload Partially reload configuration of running tincd.\n"
@@
-112,6
+121,7
@@
static void usage(bool status) {
" subnets - all known subnets in the VPN\n"
" connections - all meta connections with ourself\n"
" graph - graph of the VPN in dotty format\n"
" subnets - all known subnets in the VPN\n"
" connections - all meta connections with ourself\n"
" graph - graph of the VPN in dotty format\n"
+ " info NODE|SUBNET|ADDRESS Give information about a particular NODE, SUBNET or ADDRESS.\n"
" purge Purge unreachable nodes\n"
" debug N Set debug level\n"
" retry Retry all outgoing connections\n"
" purge Purge unreachable nodes\n"
" debug N Set debug level\n"
" retry Retry all outgoing connections\n"
@@
-130,7
+140,7
@@
static bool parse_options(int argc, char **argv) {
int r;
int option_index = 0;
int r;
int option_index = 0;
- while((r = getopt_long(argc, argv, "c:n:", long_options, &option_index)) != EOF) {
+ while((r = getopt_long(argc, argv, "c:n:
Dd::Lo:RU:
", long_options, &option_index)) != EOF) {
switch (r) {
case 0: /* long option */
break;
switch (r) {
case 0: /* long option */
break;
@@
-655,6
+665,9
@@
static bool connect_tincd() {
static int cmd_start(int argc, char *argv[]) {
int i, j;
char *c;
static int cmd_start(int argc, char *argv[]) {
int i, j;
char *c;
+
+ argc += optind;
+ argv -= optind;
char *slash = strrchr(argv[0], '/');
#ifdef HAVE_MINGW
char *slash = strrchr(argv[0], '/');
#ifdef HAVE_MINGW
@@
-723,6
+736,9
@@
static int cmd_dump(int argc, char *argv[]) {
return 1;
}
return 1;
}
+ if(!connect_tincd())
+ return 1;
+
bool do_graph = false;
if(!strcasecmp(argv[1], "nodes"))
bool do_graph = false;
if(!strcasecmp(argv[1], "nodes"))
@@
-743,9
+759,6
@@
static int cmd_dump(int argc, char *argv[]) {
return 1;
}
return 1;
}
- if(!connect_tincd())
- return 1;
-
if(do_graph)
printf("digraph {\n");
if(do_graph)
printf("digraph {\n");
@@
-1275,6
+1288,18
@@
static int cmd_version(int argc, char *argv[]) {
return 0;
}
return 0;
}
+static int cmd_info(int argc, char *argv[]) {
+ if(argc != 2) {
+ fprintf(stderr, "Invalid number of arguments.\n");
+ return 1;
+ }
+
+ if(!connect_tincd())
+ return 1;
+
+ return info(fd, argv[1]);
+}
+
static const char *conffiles[] = {
"tinc.conf",
"tinc-up",
static const char *conffiles[] = {
"tinc.conf",
"tinc-up",
@@
-1363,6
+1388,7
@@
static const struct {
{"generate-ecdsa-keys", cmd_generate_ecdsa_keys},
{"help", cmd_help},
{"version", cmd_version},
{"generate-ecdsa-keys", cmd_generate_ecdsa_keys},
{"help", cmd_help},
{"version", cmd_version},
+ {"info", cmd_info},
{"edit", cmd_edit},
{NULL, NULL},
};
{"edit", cmd_edit},
{NULL, NULL},
};