" connections - all meta connections with ourself\n"
" graph - graph of the VPN in dotty format\n"
" purge Purge unreachable nodes\n"
+ " debug N Set debug level\n"
+ " retry Retry all outgoing connections\n"
+ " reload Partial reload of configuration\n"
"\n"));
printf(_("Report bugs to tinc@tinc-vpn.org.\n"));
}
static int fullread(int fd, void *data, size_t datalen) {
int rv, len = 0;
- while (len < datalen) {
+ while(len < datalen) {
rv = read(fd, data + len, datalen - len);
if(rv == -1 && errno == EINTR)
continue;
- else if (rv == -1)
+ else if(rv == -1)
return rv;
- else if (rv == 0) {
+ else if(rv == 0) {
errno = ENODATA;
return -1;
}
}
if(req.length > sizeof req) {
- if (indata_p == NULL) {
+ if(indata_p == NULL) {
errno = EINVAL;
return -1;
}
}
if(!strcasecmp(argv[optind], "dump")) {
- if (argc < optind + 2) {
+ if(argc < optind + 2) {
fprintf(stderr, _("Not enough arguments.\n"));
usage(true);
return 1;
return send_ctl_request_cooked(fd, REQ_PURGE, NULL, 0) != -1;
}
+ if(!strcasecmp(argv[optind], "debug")) {
+ int debuglevel;
+
+ if(argc != optind + 2) {
+ fprintf(stderr, "Invalid arguments.\n");
+ return 1;
+ }
+ debuglevel = atoi(argv[optind+1]);
+ return send_ctl_request_cooked(fd, REQ_SET_DEBUG, &debuglevel,
+ sizeof(debuglevel)) != -1;
+ }
+
+ if(!strcasecmp(argv[optind], "retry")) {
+ return send_ctl_request_cooked(fd, REQ_RETRY, NULL, 0) != -1;
+ }
+
+ if(!strcasecmp(argv[optind], "reload")) {
+ return send_ctl_request_cooked(fd, REQ_RELOAD, NULL, 0) != -1;
+ }
+
fprintf(stderr, _("Unknown command `%s'.\n"), argv[optind]);
usage(true);