I also kept the SIGHUP handler, which many people will expect to see.
The control socket is better, though - it will tell you if there is a
problem.
.Xr tincd 8
didn't succeed to connect to an uplink the first time after it started,
it defaults to the maximum time of 15 minutes.
+.It reload
+Partially rereads configuration files.
+Connections to hosts whose host config files are removed are closed.
+New outgoing connections specified in
+.Pa tinc.conf
+will be made.
.El
.Sh BUGS
-The "start", "restart", and "reload" commands are not yet implemented.
+The "start" and "restart" commands are not yet implemented.
.Pp
If you find any bugs, report them to tinc@tinc-vpn.org.
.Sh SEE ALSO
goto respond;
}
+ if(req.type == REQ_RELOAD) {
+ logger(LOG_NOTICE, _("Got '%s' command"), "reload");
+ res.res_errno = reload_configuration();
+ goto respond;
+ }
+
logger(LOG_DEBUG, _("Malformed control command received"));
res.res_errno = EINVAL;
}
static void sighup_handler(int signal, short events, void *data) {
+ logger(LOG_NOTICE, _("Got %s signal"), strsignal(signal));
+ reload_configuration();
+}
+
+int reload_configuration(void) {
connection_t *c;
splay_node_t *node, *next;
char *fname;
struct stat s;
static time_t last_config_check = 0;
-
- logger(LOG_NOTICE, _("Got %s signal"), strsignal(signal));
/* Reread our own configuration file */
if(!read_server_config()) {
logger(LOG_ERR, _("Unable to reread configuration file, exitting."));
event_loopexit(NULL);
- return;
+ return EINVAL;
}
/* Close connections to hosts that have a changed or deleted host config file */
/* Try to make outgoing connections */
try_outgoing_connections();
+
+ return 0;
}
void retry(void) {
extern void regenerate_key();
extern void purge(void);
extern void retry(void);
+extern int reload_configuration(void);
#ifndef HAVE_MINGW
#define closesocket(s) close(s)
" 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"));
}
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);