Пример #1
0
static void
ui_packetlog(char *cmd)
{
	char	subcmd[201];

	if (sscanf(cmd, "p %200s", subcmd) != 1)
		goto fail;

	if (strncasecmp(subcmd, "on=", 3) == 0) {
		/* Start capture to a new file.  */
		if (subcmd[strlen(subcmd) - 1] == '\n')
			subcmd[strlen(subcmd) - 1] = 0;
		log_packet_restart(subcmd + 3);
	} else if (strcasecmp(subcmd, "on") == 0)
		log_packet_restart(NULL);
	else if (strcasecmp(subcmd, "off") == 0)
		log_packet_stop();
	return;

fail:
	log_print("ui_packetlog: command \"%s\" malformed", cmd);
}
Пример #2
0
static void
daemon_shutdown(void)
{
	/* Perform a (protocol-wise) clean shutdown of the daemon.  */
	struct sa	*sa;

	if (sigtermed == 1) {
		log_print("isakmpd: shutting down...");

		if (delete_sas &&
		    strncmp("no", conf_get_str("General", "Delete-SAs"), 2)) {
			/*
			 * Delete all active SAs.  First IPsec SAs, then
			 * ISAKMPD.  Each DELETE is another (outgoing) message.
			 */
			while ((sa = sa_find(phase2_sa_check, NULL)))
				sa_delete(sa, 1);

			while ((sa = sa_find(phase1_sa_check, NULL)))
				sa_delete(sa, 1);
		}

		/* We only want to do this once. */
		sigtermed++;
	}
	if (transport_prio_sendqs_empty()) {
		/*
		 * When the prioritized transport sendq:s are empty, i.e all
		 * the DELETE notifications have been sent, we can shutdown.
		 */

		log_packet_stop();
		log_print("isakmpd: exit");
		exit(0);
	}
}
Пример #3
0
static void
daemon_shutdown (void)
{
  /* Perform a (protocol-wise) clean shutdown of the daemon.  */
  struct sa *sa;

  if (sigtermed == 1)
    {
      log_print ("isakmpd: shutting down...");

      /* Delete all active phase 2 SAs.  */
      while ((sa = sa_find (phase2_sa_check, NULL)))
	{
	  /* Each DELETE is another (outgoing) message.  */
	  sa_delete (sa, 1);
	}
      sigtermed++;
    }

  if (transport_prio_sendqs_empty ())
    {
      /*
       * When the prioritized transport sendq:s are empty, i.e all
       * the DELETE notifications have been sent, we can shutdown.
       */
	
#ifdef USE_DEBUG
      log_packet_stop ();
#endif
      /* Remove FIFO and pid files.  */
      unlink (ui_fifo);
      unlink (pid_file);
      log_print ("isakmpd: exit");
      exit (0);
    }
}