{
.name = {
.begin = "/stat",
- .len = 5
+ .len = sizeof ("/stat") - 1
},
.type = RSPAMD_CONTROL_STAT
},
{
.name = {
.begin = "/reload",
- .len = 7
+ .len = sizeof ("/reload") - 1
},
.type = RSPAMD_CONTROL_RELOAD
},
+ {
+ .name = {
+ .begin = "/reresolve",
+ .len = sizeof ("/reresolve") - 1
+ },
+ .type = RSPAMD_CONTROL_RERESOLVE
+ },
};
void
ucl_object_insert_key (cur, ucl_object_fromint (
elt->reply.reply.reload.status), "status", 0, false);
break;
+ case RSPAMD_CONTROL_RERESOLVE:
+ ucl_object_insert_key (cur, ucl_object_fromint (
+ elt->reply.reply.reresolve.status), "status", 0, false);
+ break;
default:
break;
}
struct rspamd_control_reply rep;
gssize r;
struct rusage rusg;
+ struct rspamd_config *cfg;
memset (&rep, 0, sizeof (rep));
rep.type = cmd->type;
break;
case RSPAMD_CONTROL_RELOAD:
break;
+ case RSPAMD_CONTROL_RERESOLVE:
+ if (cd->worker->srv->cfg) {
+ REF_RETAIN (cd->worker->srv->cfg);
+ cfg = cd->worker->srv->cfg;
+
+ if (cfg->ups_ctx) {
+ msg_info_config ("reresolving upstreams");
+ rspamd_upstream_reresolve (cfg->ups_ctx);
+ }
+
+ rep.reply.reresolve.status = 0;
+ REF_RELEASE (cfg);
+ }
+ else {
+ rep.reply.reresolve.status = EINVAL;
+ }
+ break;
default:
break;
}
"--help: shows available options and commands\n\n"
"Supported commands:\n"
"stat - show statistics\n"
- "reload - reload workers dynamic data\n";
+ "reload - reload workers dynamic data\n"
+ "reresolve - resolve upstreams addresses\n";
}
else {
help_str = "Manage rspamd main control interface";
gint sock;
context = g_option_context_new (
- "keypair - create encryption keys");
+ "control - manage rspamd main control interface");
g_option_context_set_summary (context,
"Summary:\n Rspamd administration utility version "
RVERSION
exit (1);
}
- if (argc == 0) {
+ if (argc <= 1) {
rspamd_fprintf (stderr, "command required\n");
exit (1);
}
else if (g_ascii_strcasecmp (cmd, "reload") == 0) {
path = "/reload";
}
+ else if (g_ascii_strcasecmp (cmd, "reresolve") == 0) {
+ path = "/reresolve";
+ }
else {
rspamd_fprintf (stderr, "unknown command: %s\n", cmd);
exit (1);