#include "top.h"
#ifdef HAVE_MINGW
-#define mkdir(a, b) mkdir(a)
#define SCRIPTEXTENSION ".bat"
#else
#define SCRIPTEXTENSION ""
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},
- {"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},
- {"force", no_argument, NULL, 6},
+ {"pidfile", required_argument, NULL, 3},
+ {"force", no_argument, NULL, 4},
{NULL, 0, NULL, 0}
};
" del VARIABLE [VALUE] Remove VARIABLE [only ones with watching VALUE]\n"
" start [tincd options] Start tincd.\n"
" stop Stop tincd.\n"
- " restart Restart tincd.\n"
+ " restart [tincd options] Restart tincd.\n"
" reload Partially reload configuration of running tincd.\n"
" pid Show PID of currently running tincd.\n"
" generate-keys [bits] Generate new RSA and ECDSA public/private keypairs.\n"
int r;
int option_index = 0;
- while((r = getopt_long(argc, argv, "c:n:Dd::Lo:RU:", long_options, &option_index)) != EOF) {
+ while((r = getopt_long(argc, argv, "+c:n:", long_options, &option_index)) != EOF) {
switch (r) {
case 0: /* long option */
break;
show_version = true;
break;
- case 5: /* open control socket here */
+ case 3: /* open control socket here */
pidfilename = xstrdup(optarg);
break;
- case 6: /* force */
+ case 4: /* force */
force = true;
break;
char *newline = NULL;
if(!fd)
-abort();
+ abort();
+
while(!(newline = memchr(buffer, '\n', blen))) {
int result = recv(fd, buffer + blen, sizeof buffer - blen, 0);
if(result == -1 && errno == EINTR)
}
static int cmd_restart(int argc, char *argv[]) {
- cmd_stop(argc, argv);
+ cmd_stop(1, argv);
return cmd_start(argc, argv);
}
return 0;
}
+#ifdef SIGINT
+static void sigint_handler(int sig) {
+ fprintf(stderr, "\n");
+ shutdown(fd, SHUT_RDWR);
+}
+#endif
+
static int cmd_log(int argc, char *argv[]) {
if(argc > 2) {
fprintf(stderr, "Too many arguments!\n");
if(!connect_tincd(true))
return 1;
+#ifdef SIGINT
+ signal(SIGINT, sigint_handler);
+#endif
+
logcontrol(fd, stdout, argc > 1 ? atoi(argv[1]) : -1);
+
+#ifdef SIGINT
+ signal(SIGINT, SIG_DFL);
+#endif
+
+ close(fd);
+ fd = -1;
return 0;
}
{"KeyExpire", VAR_SERVER},
{"LocalDiscovery", VAR_SERVER},
{"MACExpire", VAR_SERVER},
+ {"MaxConnectionBurst", VAR_SERVER},
{"MaxOutputBufferSize", VAR_SERVER},
{"MaxTimeout", VAR_SERVER},
{"Mode", VAR_SERVER | VAR_SAFE},