OpenDNSSEC-signer  2.1.3
signercommands.c
Go to the documentation of this file.
1 #include "config.h"
2 
3 #include "file.h"
4 #include "str.h"
5 #include "locks.h"
6 #include "log.h"
7 #include "status.h"
8 #include "util.h"
9 #include "daemon/engine.h"
10 #include "cmdhandler.h"
11 #include "signercommands.h"
12 #include "clientpipe.h"
13 
14 static char const * cmdh_str = "cmdhandler";
15 
16 static const char*
17 cmdargument(const char* cmd, const char* matchValue, const char* defaultValue)
18 {
19  const char* s = cmd;
20  if (!s)
21  return defaultValue;
22  while(*s && !isspace(*s))
23  ++s;
24  while(*s && isspace(*s))
25  ++s;
26  if(matchValue) {
27  if (!strcmp(s,matchValue))
28  return s;
29  else
30  return defaultValue;
31  } else if(*s) {
32  return s;
33  } else {
34  return defaultValue;
35  }
36 }
37 
42 static int
43 cmdhandler_handle_cmd_help(int sockfd, cmdhandler_ctx_type* context, const char *cmd)
44 {
45  char buf[ODS_SE_MAXLINE];
46 
47  (void) snprintf(buf, ODS_SE_MAXLINE,
48  "Commands:\n"
49  "zones Show the currently known zones.\n"
50  "sign <zone> [--serial <nr>] Read zone and schedule for immediate "
51  "(re-)sign.\n"
52  " If a serial is given, that serial is used "
53  "in the output zone.\n"
54  "sign --all Read all zones and schedule all for "
55  "immediate (re-)sign.\n"
56  );
57  client_printf(sockfd, buf);
58 
59  (void) snprintf(buf, ODS_SE_MAXLINE,
60  "clear <zone> Delete the internal storage of this "
61  "zone.\n"
62  " All signatures will be regenerated "
63  "on the next re-sign.\n"
64  "queue Show the current task queue.\n"
65  "flush Execute all scheduled tasks "
66  "immediately.\n"
67  );
68  client_printf(sockfd, buf);
69 
70  (void) snprintf(buf, ODS_SE_MAXLINE,
71  "update <zone> Update this zone signer "
72  "configurations.\n"
73  "update [--all] Update zone list and all signer "
74  "configurations.\n"
75  "retransfer <zone> Retransfer the zone from the master.\n"
76  "start Start the engine.\n"
77  "running Check if the engine is running.\n"
78  "reload Reload the engine.\n"
79  "stop Stop the engine.\n"
80  "verbosity <nr> Set verbosity.\n"
81  );
82  client_printf(sockfd, buf);
83  return 0;
84 }
85 
86 
91 static int
92 cmdhandler_handle_cmd_zones(int sockfd, cmdhandler_ctx_type* context, const char *cmd)
93 {
94  engine_type* engine;
95  char buf[ODS_SE_MAXLINE];
96  size_t i;
97  ldns_rbnode_t* node = LDNS_RBTREE_NULL;
98  zone_type* zone = NULL;
99  engine = getglobalcontext(context);
100  if (!engine->zonelist || !engine->zonelist->zones) {
101  (void)snprintf(buf, ODS_SE_MAXLINE, "There are no zones configured\n");
102  client_printf(sockfd, buf);
103  return 0;
104  }
105  /* how many zones */
106  pthread_mutex_lock(&engine->zonelist->zl_lock);
107  (void)snprintf(buf, ODS_SE_MAXLINE, "There are %i zones configured\n",
108  (int) engine->zonelist->zones->count);
109  client_printf(sockfd, buf);
110  /* list zones */
111  node = ldns_rbtree_first(engine->zonelist->zones);
112  while (node && node != LDNS_RBTREE_NULL) {
113  zone = (zone_type*) node->data;
114  for (i=0; i < ODS_SE_MAXLINE; i++) {
115  buf[i] = 0;
116  }
117  (void)snprintf(buf, ODS_SE_MAXLINE, "- %s\n", zone->name);
118  client_printf(sockfd, buf);
119  node = ldns_rbtree_next(node);
120  }
121  pthread_mutex_unlock(&engine->zonelist->zl_lock);
122  return 0;
123 }
124 
125 
130 static int
131 cmdhandler_handle_cmd_update(int sockfd, cmdhandler_ctx_type* context, const char *cmd)
132 {
133  engine_type* engine;
134  char buf[ODS_SE_MAXLINE];
135  ods_status status = ODS_STATUS_OK;
136  zone_type* zone = NULL;
137  ods_status zl_changed = ODS_STATUS_OK;
138  engine = getglobalcontext(context);
139  ods_log_assert(engine->taskq);
140  if (cmdargument(cmd, "--all", NULL)) {
141  pthread_mutex_lock(&engine->zonelist->zl_lock);
142  zl_changed = zonelist_update(engine->zonelist,
143  engine->config->zonelist_filename);
144  if (zl_changed == ODS_STATUS_UNCHANGED) {
145  (void)snprintf(buf, ODS_SE_MAXLINE, "Zone list has not changed."
146  " Signer configurations updated.\n");
147  client_printf(sockfd, buf);
148  } else if (zl_changed == ODS_STATUS_OK) {
149  (void)snprintf(buf, ODS_SE_MAXLINE, "Zone list updated: %i "
150  "removed, %i added, %i updated.\n",
151  engine->zonelist->just_removed,
152  engine->zonelist->just_added,
153  engine->zonelist->just_updated);
154  client_printf(sockfd, buf);
155  } else {
156  pthread_mutex_unlock(&engine->zonelist->zl_lock);
157  (void)snprintf(buf, ODS_SE_MAXLINE, "Zone list has errors.\n");
158  client_printf(sockfd, buf);
159  }
160  if (zl_changed == ODS_STATUS_OK ||
161  zl_changed == ODS_STATUS_UNCHANGED) {
162  engine->zonelist->just_removed = 0;
163  engine->zonelist->just_added = 0;
164  engine->zonelist->just_updated = 0;
165  pthread_mutex_unlock(&engine->zonelist->zl_lock);
170  engine_update_zones(engine, ODS_STATUS_OK);
171  }
172  } else {
173  /* look up zone */
174  pthread_mutex_lock(&engine->zonelist->zl_lock);
175  zone = zonelist_lookup_zone_by_name(engine->zonelist, cmdargument(cmd, NULL, ""),
176  LDNS_RR_CLASS_IN);
177  /* If this zone is just added, don't update (it might not have a
178  * task yet) */
179  if (zone && zone->zl_status == ZONE_ZL_ADDED) {
180  zone = NULL;
181  }
182  pthread_mutex_unlock(&engine->zonelist->zl_lock);
183 
184  if (!zone) {
185  (void)snprintf(buf, ODS_SE_MAXLINE, "Error: Zone %s not found.\n",
186  cmdargument(cmd, NULL, ""));
187  client_printf(sockfd, buf);
188  /* update all */
189  cmdhandler_handle_cmd_update(sockfd, context, "update --all");
190  return 1;
191  }
192 
193  pthread_mutex_lock(&zone->zone_lock);
194  schedule_scheduletask(engine->taskq, TASK_FORCESIGNCONF, zone->name, zone, &zone->zone_lock, schedule_PROMPTLY);
195  pthread_mutex_unlock(&zone->zone_lock);
196 
197  (void)snprintf(buf, ODS_SE_MAXLINE, "Zone %s config being updated.\n",
198  cmdargument(cmd, NULL, ""));
199  client_printf(sockfd, buf);
200  ods_log_verbose("[%s] zone %s scheduled for immediate update signconf",
201  cmdh_str, cmdargument(cmd, NULL, ""));
202  engine_wakeup_workers(engine);
203  }
204  return 0;
205 }
206 
207 
212 static int
213 cmdhandler_handle_cmd_retransfer(int sockfd, cmdhandler_ctx_type* context, const char *cmd)
214 {
215  engine_type* engine;
216  char buf[ODS_SE_MAXLINE];
217  zone_type* zone = NULL;
218  engine = getglobalcontext(context);
219  ods_log_assert(engine->taskq);
220  /* look up zone */
221  pthread_mutex_lock(&engine->zonelist->zl_lock);
222  zone = zonelist_lookup_zone_by_name(engine->zonelist, cmdargument(cmd, NULL, ""),
223  LDNS_RR_CLASS_IN);
224  /* If this zone is just added, don't retransfer (it might not have a
225  * task yet) */
226  if (zone && zone->zl_status == ZONE_ZL_ADDED) {
227  zone = NULL;
228  }
229  pthread_mutex_unlock(&engine->zonelist->zl_lock);
230 
231  if (!zone) {
232  (void)snprintf(buf, ODS_SE_MAXLINE, "Error: Zone %s not found.\n",
233  cmdargument(cmd, NULL, ""));
234  client_printf(sockfd, buf);
235  } else if (zone->adinbound->type != ADAPTER_DNS) {
236  (void)snprintf(buf, ODS_SE_MAXLINE,
237  "Error: Zone %s not configured to use DNS input adapter.\n",
238  cmdargument(cmd, NULL, ""));
239  client_printf(sockfd, buf);
240  } else {
241  zone->xfrd->serial_retransfer = 1;
242  xfrd_set_timer_now(zone->xfrd);
243  ods_log_debug("[%s] forward a notify", cmdh_str);
245  (uint8_t*) ODS_SE_NOTIFY_CMD, strlen(ODS_SE_NOTIFY_CMD));
246  (void)snprintf(buf, ODS_SE_MAXLINE, "Zone %s being re-transfered.\n", cmdargument(cmd, NULL, ""));
247  client_printf(sockfd, buf);
248  ods_log_verbose("[%s] zone %s being re-transfered", cmdh_str, cmdargument(cmd, NULL, ""));
249  }
250  return 0;
251 }
252 
253 
254 static uint32_t
255 max(uint32_t a, uint32_t b)
256 {
257  return (a<b?b:a);
258 }
259 
260 static ods_status
261 forceread(engine_type* engine, zone_type *zone, int force_serial, uint32_t serial, int sockfd)
262 {
263  pthread_mutex_lock(&zone->zone_lock);
264  if (force_serial) {
265  ods_log_assert(zone->db);
266  if (!util_serial_gt(serial, max(zone->db->outserial,
267  zone->db->inbserial))) {
268  pthread_mutex_unlock(&zone->zone_lock);
269  client_printf(sockfd, "Error: Unable to enforce serial %u for zone %s.\n", serial, zone->name);
270  return 1;
271  }
272  zone->db->altserial = serial;
273  zone->db->force_serial = 1;
274  }
275  schedule_scheduletask(engine->taskq, TASK_FORCEREAD, zone->name, zone, &zone->zone_lock, schedule_IMMEDIATELY);
276  pthread_mutex_unlock(&zone->zone_lock);
277  return 0;
278 }
279 
284 static int
285 cmdhandler_handle_cmd_sign(int sockfd, cmdhandler_ctx_type* context, const char *cmd)
286 {
287  engine_type* engine;
288  zone_type *zone = NULL;
289  ods_status status = ODS_STATUS_OK;
290  char buf[ODS_SE_MAXLINE];
291 
292  engine = getglobalcontext(context);
293  ods_log_assert(engine->taskq);
294  if (cmdargument(cmd, "--all", NULL)) {
295  pthread_mutex_lock(&engine->zonelist->zl_lock);
296  ldns_rbnode_t* node;
297  for (node = ldns_rbtree_first(engine->zonelist->zones); node != LDNS_RBTREE_NULL && node != NULL; node = ldns_rbtree_next(node)) {
298  zone = (zone_type*)node->data;
299  forceread(engine, zone, 0, 0, sockfd);
300  }
301  pthread_mutex_unlock(&engine->zonelist->zl_lock);
302  engine_wakeup_workers(engine);
303  client_printf(sockfd, "All zones scheduled for immediate re-sign.\n");
304  } else {
305  char* delim1 = strchr(cmdargument(cmd, NULL, ""), ' ');
306  char* delim2 = NULL;
307  int force_serial = 0;
308  uint32_t serial = 0;
309  if (delim1) {
310  char* end = NULL;
312  if (strncmp(delim1+1, "--serial ", 9) != 0) {
313  (void)snprintf(buf, ODS_SE_MAXLINE, "Error: Expecting <zone> "
314  "--serial <nr>, got %s.\n", cmdargument(cmd, NULL, ""));
315  client_printf(sockfd, buf);
316  return -1;
317  }
318  delim2 = strchr(delim1+1, ' ');
319  if (!delim2) {
320  (void)snprintf(buf, ODS_SE_MAXLINE, "Error: Expecting serial.\n");
321  client_printf(sockfd, buf);
322  return -1;
323  }
324  serial = (uint32_t) strtol(delim2+1, &end, 10);
325  if (*end != '\0') {
326  (void)snprintf(buf, ODS_SE_MAXLINE, "Error: Expecting serial, "
327  "got %s.\n", delim2+1);
328  client_printf(sockfd, buf);
329  return -1;
330  }
331  force_serial = 1;
332  *delim1 = '\0';
333  }
334  pthread_mutex_lock(&engine->zonelist->zl_lock);
335  zone = zonelist_lookup_zone_by_name(engine->zonelist, cmdargument(cmd, NULL, ""),
336  LDNS_RR_CLASS_IN);
337  /* If this zone is just added, don't update (it might not have a task
338  * yet).
339  */
340  if (zone && zone->zl_status == ZONE_ZL_ADDED) {
341  zone = NULL;
342  }
343  pthread_mutex_unlock(&engine->zonelist->zl_lock);
344 
345  if (!zone) {
346  (void)snprintf(buf, ODS_SE_MAXLINE, "Error: Zone %s not found.\n",
347  cmdargument(cmd, NULL, ""));
348  client_printf(sockfd, buf);
349  return 1;
350  }
351 
352  forceread(engine, zone, force_serial, serial, sockfd);
353  engine_wakeup_workers(engine);
354  client_printf(sockfd, "Zone %s scheduled for immediate re-sign.\n", cmdargument(cmd, NULL, ""));
355  ods_log_verbose("zone %s scheduled for immediate re-sign", cmdargument(cmd, NULL, ""));
356  }
357  return 0;
358 }
359 
364 static void
365 unlink_backup_file(const char* filename, const char* extension)
366 {
367  char* tmpname = ods_build_path(filename, extension, 0, 1);
368  if (tmpname) {
369  ods_log_debug("[%s] unlink file %s", cmdh_str, tmpname);
370  unlink(tmpname);
371  free((void*)tmpname);
372  }
373 }
374 
379 static int
380 cmdhandler_handle_cmd_clear(int sockfd, cmdhandler_ctx_type* context, const char *cmd)
381 {
382  engine_type* engine;
383  char buf[ODS_SE_MAXLINE];
384  zone_type* zone = NULL;
385  uint32_t inbserial = 0;
386  uint32_t intserial = 0;
387  uint32_t outserial = 0;
388  engine = getglobalcontext(context);
389  unlink_backup_file(cmdargument(cmd, NULL, ""), ".inbound");
390  unlink_backup_file(cmdargument(cmd, NULL, ""), ".backup");
391  unlink_backup_file(cmdargument(cmd, NULL, ""), ".axfr");
392  unlink_backup_file(cmdargument(cmd, NULL, ""), ".ixfr");
393  pthread_mutex_lock(&engine->zonelist->zl_lock);
394  zone = zonelist_lookup_zone_by_name(engine->zonelist, cmdargument(cmd, NULL, ""),
395  LDNS_RR_CLASS_IN);
396  pthread_mutex_unlock(&engine->zonelist->zl_lock);
397  if (zone) {
398  pthread_mutex_lock(&zone->zone_lock);
399  inbserial = zone->db->inbserial;
400  intserial = zone->db->intserial;
401  outserial = zone->db->outserial;
402  namedb_cleanup(zone->db);
403  ixfr_cleanup(zone->ixfr);
404  signconf_cleanup(zone->signconf);
405 
406  zone->db = namedb_create((void*)zone);
407  zone->ixfr = ixfr_create();
408  zone->signconf = signconf_create();
409 
410  if (!zone->signconf || !zone->ixfr || !zone->db) {
411  ods_fatal_exit("[%s] unable to clear zone %s: failed to recreate"
412  "signconf, ixfr of db structure (out of memory?)", cmdh_str, cmdargument(cmd, NULL, ""));
413  return 1;
414  }
415  /* restore serial management */
416  zone->db->inbserial = inbserial;
417  zone->db->intserial = intserial;
418  zone->db->outserial = outserial;
419  zone->db->have_serial = 1;
420 
421  /* If a zone does not have a task we probably never read a signconf
422  * for it. Skip reschedule step */
423  schedule_scheduletask(engine->taskq, TASK_FORCESIGNCONF, zone->name, zone, &zone->zone_lock, schedule_IMMEDIATELY);
424  pthread_mutex_unlock(&zone->zone_lock);
425 
426  (void)snprintf(buf, ODS_SE_MAXLINE, "Internal zone information about "
427  "%s cleared", cmdargument(cmd, NULL, ""));
428  ods_log_info("[%s] internal zone information about %s cleared",
429  cmdh_str, cmdargument(cmd, NULL, ""));
430  } else {
431  (void)snprintf(buf, ODS_SE_MAXLINE, "Cannot clear zone %s, zone not "
432  "found", cmdargument(cmd, NULL, ""));
433  ods_log_warning("[%s] cannot clear zone %s, zone not found",
434  cmdh_str, cmdargument(cmd, NULL, ""));
435  }
436  client_printf(sockfd, buf);
437  return 0;
438 }
439 
440 
445 static int
446 cmdhandler_handle_cmd_queue(int sockfd, cmdhandler_ctx_type* context, const char *cmd)
447 {
448  engine_type* engine;
449  char* strtime = NULL;
450  char buf[ODS_SE_MAXLINE];
451  char* taskdesc;
452  size_t i = 0;
453  time_t now = 0;
454  ldns_rbnode_t* node = LDNS_RBTREE_NULL;
455  task_type* task = NULL;
456  engine = getglobalcontext(context);
457  if (!engine->taskq || !engine->taskq->tasks) {
458  (void)snprintf(buf, ODS_SE_MAXLINE, "There are no tasks scheduled.\n");
459  client_printf(sockfd, buf);
460  return 0;
461  }
462  /* current time */
463  now = time_now();
464  strtime = ctime(&now);
465  (void)snprintf(buf, ODS_SE_MAXLINE, "It is now %s",
466  strtime?strtime:"(null)");
467  client_printf(sockfd, buf);
468  /* current work */
469  pthread_mutex_lock(&engine->taskq->schedule_lock);
470  /* how many tasks */
471  (void)snprintf(buf, ODS_SE_MAXLINE, "\nThere are %i tasks scheduled.\n",
472  (int) engine->taskq->tasks->count);
473  client_printf(sockfd, buf);
474  /* list tasks */
475  node = ldns_rbtree_first(engine->taskq->tasks);
476  while (node && node != LDNS_RBTREE_NULL) {
477  task = (task_type*) node->data;
478  for (i=0; i < ODS_SE_MAXLINE; i++) {
479  buf[i] = 0;
480  }
481  taskdesc = schedule_describetask(task);
482  client_printf(sockfd, taskdesc);
483  free(taskdesc);
484  node = ldns_rbtree_next(node);
485  }
486  pthread_mutex_unlock(&engine->taskq->schedule_lock);
487  return 0;
488 }
489 
490 
495 static int
496 cmdhandler_handle_cmd_flush(int sockfd, cmdhandler_ctx_type* context, const char *cmd)
497 {
498  engine_type* engine;
499  char buf[ODS_SE_MAXLINE];
500  engine = getglobalcontext(context);
501  ods_log_assert(engine->taskq);
502  schedule_flush(engine->taskq);
503  engine_wakeup_workers(engine);
504  (void)snprintf(buf, ODS_SE_MAXLINE, "All tasks scheduled immediately.\n");
505  client_printf(sockfd, buf);
506  ods_log_verbose("[%s] all tasks scheduled immediately", cmdh_str);
507  return 0;
508 }
509 
510 
515 static int
516 cmdhandler_handle_cmd_reload(int sockfd, cmdhandler_ctx_type* context, const char *cmd)
517 {
518  engine_type* engine;
519  char buf[ODS_SE_MAXLINE];
520  engine = getglobalcontext(context);
521  ods_log_error("signer instructed to reload due to explicit command");
522  engine->need_to_reload = 1;
523  pthread_mutex_lock(&engine->signal_lock);
524  pthread_cond_signal(&engine->signal_cond);
525  pthread_mutex_unlock(&engine->signal_lock);
526  (void)snprintf(buf, ODS_SE_MAXLINE, "Reloading engine.\n");
527  client_printf(sockfd, buf);
528  return 0;
529 }
530 
531 
536 static int
537 cmdhandler_handle_cmd_stop(int sockfd, cmdhandler_ctx_type* context, const char *cmd)
538 {
539  engine_type* engine;
540  char buf[ODS_SE_MAXLINE];
541  engine = getglobalcontext(context);
542  engine->need_to_exit = 1;
543  pthread_mutex_lock(&engine->signal_lock);
544  pthread_cond_signal(&engine->signal_cond);
545  pthread_mutex_unlock(&engine->signal_lock);
546  (void)snprintf(buf, ODS_SE_MAXLINE, ODS_SE_STOP_RESPONSE);
547  client_printf(sockfd, buf);
548  return 0;
549 }
550 
551 
556 static int
557 cmdhandler_handle_cmd_start(int sockfd, cmdhandler_ctx_type* context, const char *cmd)
558 {
559  char buf[ODS_SE_MAXLINE];
560  (void)snprintf(buf, ODS_SE_MAXLINE, "Engine already running.\n");
561  client_printf(sockfd, buf);
562  return 0;
563 }
564 
565 
570 static int
571 cmdhandler_handle_cmd_running(int sockfd, cmdhandler_ctx_type* context, const char *cmd)
572 {
573  char buf[ODS_SE_MAXLINE];
574  (void)snprintf(buf, ODS_SE_MAXLINE, "Engine running.\n");
575  client_printf(sockfd, buf);
576  return 0;
577 }
578 
579 
584 static int
585 cmdhandler_handle_cmd_verbosity(int sockfd, cmdhandler_ctx_type* context, const char *cmd)
586 {
587  char buf[ODS_SE_MAXLINE];
588  int val;
589  val = atoi(cmdargument(cmd, NULL, "1"));
590  ods_log_setverbosity(val);
591  (void)snprintf(buf, ODS_SE_MAXLINE, "Verbosity level set to %i.\n", val);
592  client_printf(sockfd, buf);
593  return 0;
594 }
595 
596 
601 static void
602 cmdhandler_handle_cmd_error(int sockfd, cmdhandler_ctx_type* context, const char* str)
603 {
604  char buf[ODS_SE_MAXLINE];
605  (void)snprintf(buf, ODS_SE_MAXLINE, "Error: %s.\n", str?str:"(null)");
606  client_printf(sockfd, buf);
607 }
608 
609 
614 static void
615 cmdhandler_handle_cmd_unknown(int sockfd, cmdhandler_ctx_type* context, const char* str)
616 {
617  char buf[ODS_SE_MAXLINE];
618  (void)snprintf(buf, ODS_SE_MAXLINE, "Unknown command %s.\n",
619  str?str:"(null)");
620  client_printf(sockfd, buf);
621 }
622 
623 
624 struct cmd_func_block helpCmdDef = { "help", NULL, NULL, NULL, &cmdhandler_handle_cmd_help };
625 struct cmd_func_block zonesCmdDef = { "zones", NULL, NULL, NULL, &cmdhandler_handle_cmd_zones };
626 struct cmd_func_block signCmdDef = { "sign", NULL, NULL, NULL, &cmdhandler_handle_cmd_sign };
627 struct cmd_func_block clearCmdDef = { "clear", NULL, NULL, NULL, &cmdhandler_handle_cmd_clear };
628 struct cmd_func_block queueCmdDef = { "queue", NULL, NULL, NULL, &cmdhandler_handle_cmd_queue };
629 struct cmd_func_block flushCmdDef = { "flush", NULL, NULL, NULL, &cmdhandler_handle_cmd_flush };
630 struct cmd_func_block updateCmdDef = { "update", NULL, NULL, NULL, &cmdhandler_handle_cmd_update };
631 struct cmd_func_block stopCmdDef = { "stop", NULL, NULL, NULL, &cmdhandler_handle_cmd_stop };
632 struct cmd_func_block startCmdDef = { "start", NULL, NULL, NULL, &cmdhandler_handle_cmd_start };
633 struct cmd_func_block reloadCmdDef = { "reload", NULL, NULL, NULL, &cmdhandler_handle_cmd_reload };
634 struct cmd_func_block retransferCmdDef = { "retransfer", NULL, NULL, NULL, &cmdhandler_handle_cmd_retransfer };
635 struct cmd_func_block runningCmdDef = { "running", NULL, NULL, NULL, &cmdhandler_handle_cmd_running };
636 struct cmd_func_block verbosityCmdDef = { "verbosity", NULL, NULL, NULL, &cmdhandler_handle_cmd_verbosity };
637 
638 struct cmd_func_block* signcommands[] = {
639  &helpCmdDef,
640  &zonesCmdDef,
641  &signCmdDef,
642  &clearCmdDef,
643  &queueCmdDef,
644  &flushCmdDef,
645  &updateCmdDef,
646  &stopCmdDef,
647  &startCmdDef,
648  &reloadCmdDef,
650  &runningCmdDef,
652  NULL
653 };
654 struct cmd_func_block** signercommands = signcommands;
655 
657 getglobalcontext(cmdhandler_ctx_type* context)
658 {
659  return (engine_type*) context->globalcontext;
660 }
signconf_type * signconf_create(void)
Definition: signconf.c:47
void ixfr_cleanup(ixfr_type *ixfr)
Definition: ixfr.c:279
uint32_t intserial
Definition: namedb.h:54
ixfr_type * ixfr_create()
Definition: ixfr.c:91
pthread_mutex_t zl_lock
Definition: zonelist.h:50
#define ODS_SE_NOTIFY_CMD
Definition: dnshandler.h:48
zonelist_type * zonelist
Definition: engine.h:69
struct cmd_func_block retransferCmdDef
void engine_wakeup_workers(engine_type *engine)
Definition: engine.c:290
int just_updated
Definition: zonelist.h:48
const char * zonelist_filename
Definition: cfg.h:49
void engine_update_zones(engine_type *engine, ods_status zl_changed)
Definition: engine.c:617
void signconf_cleanup(signconf_type *sc)
Definition: signconf.c:470
void namedb_cleanup(namedb_type *db)
Definition: namedb.c:1131
unsigned have_serial
Definition: namedb.h:60
struct cmd_func_block verbosityCmdDef
ldns_rbtree_t * zones
Definition: zonelist.h:45
struct cmd_func_block helpCmdDef
uint32_t outserial
Definition: namedb.h:55
adapter_mode type
Definition: adapter.h:58
zone_zl_status zl_status
Definition: zone.h:72
struct cmd_func_block * signcommands[]
int just_removed
Definition: zonelist.h:49
pthread_cond_t signal_cond
Definition: engine.h:66
pthread_mutex_t zone_lock
Definition: zone.h:86
engineconfig_type * config
Definition: engine.h:52
namedb_type * db
Definition: zone.h:79
ixfr_type * ixfr
Definition: zone.h:80
uint32_t inbserial
Definition: namedb.h:53
struct cmd_func_block ** signercommands
signconf_type * signconf
Definition: zone.h:77
adapter_type * adinbound
Definition: zone.h:74
unsigned force_serial
Definition: namedb.h:59
struct cmd_func_block zonesCmdDef
struct cmd_func_block stopCmdDef
namedb_type * namedb_create(void *zone)
Definition: namedb.c:121
struct cmd_func_block updateCmdDef
pthread_mutex_t signal_lock
Definition: engine.h:67
engine_type * getglobalcontext(cmdhandler_ctx_type *context)
struct cmd_func_block reloadCmdDef
zone_type * zonelist_lookup_zone_by_name(zonelist_type *zonelist, const char *name, ldns_rr_class klass)
Definition: zonelist.c:157
void xfrd_set_timer_now(xfrd_type *xfrd)
Definition: xfrd.c:454
const char * name
Definition: zone.h:69
schedule_type * taskq
Definition: engine.h:54
uint8_t serial_retransfer
Definition: xfrd.h:119
uint32_t altserial
Definition: namedb.h:56
struct cmd_func_block signCmdDef
ods_status zonelist_update(zonelist_type *zl, const char *zlfile)
Definition: zonelist.c:342
int need_to_exit
Definition: engine.h:62
struct cmd_func_block flushCmdDef
struct cmd_func_block clearCmdDef
struct cmd_func_block queueCmdDef
int need_to_reload
Definition: engine.h:63
xfrd_type * xfrd
Definition: zone.h:82
void dnshandler_fwd_notify(dnshandler_type *dnshandler, uint8_t *pkt, size_t len)
Definition: dnshandler.c:231
struct cmd_func_block runningCmdDef
dnshandler_type * dnshandler
Definition: engine.h:70
struct cmd_func_block startCmdDef