示例#1
0
void reader_pfring_stop() 
{

    int i;
    for (i = 0; i < MAX_INTERFACES && config.interface[i]; i++) {
        if (rings[i])
            pfring_breakloop(rings[i]);
    }
}
void sigproc(int sig) {

	pfring_close(handle);
	pfring_breakloop(handle);
	pcap_dump_close(dumper);

	printf("\nSniffer closed. %d files written to disk.\n",filenumber);

 	exit(0);
}
示例#3
0
void sigproc(int sig) {
  static int called = 0;

  fprintf(stderr, "Leaving...\n");
  if(called) return; else called = 1;
  stats->do_shutdown = 1;

  print_stats();

  pfring_breakloop(pd);
}
示例#4
0
/**
 * \brief Stop function for ReceivePfringLoop.
 *
 * This function forces ReceivePfringLoop to stop the
 * execution, exiting the packet capture loop.
 *
 * \param tv pointer to ThreadVars
 * \param data pointer that gets cast into PfringThreadVars for ptv
 * \retval TM_ECODE_OK on success
 * \retval TM_ECODE_FAILED on failure
 */
TmEcode PfringBreakLoop(ThreadVars *tv, void *data)
{
    PfringThreadVars *ptv = (PfringThreadVars *)data;

    /* Safety check */
    if (ptv->pd == NULL) {
        return TM_ECODE_FAILED;
    }

    pfring_breakloop(ptv->pd);

    return TM_ECODE_OK;
}
示例#5
0
void game_over()
{
    if (config.inpacket == 0) {
        expire_all_dns_records();
        print_pdns_stats();
        if (config.handle != NULL) pcap_close(config.handle);
        config.handle = NULL;
#ifdef HAVE_PFRING
        if (config.use_pfring && config.pfhandle != NULL) {
            pfring_breakloop(config.pfhandle);
            pfring_close(config.pfhandle);
        }
#endif /* HAVE_PFRING */
        end_all_sessions();
        if (config.logfile_fd != NULL && config.logfile_fd != stdout)
            fclose(config.logfile_fd);
        if (config.logfile_nxd_fd != NULL && config.logfile_nxd_fd != stdout)
            fclose(config.logfile_nxd_fd);
        free_config();
        olog("\n[*] passivedns ended.\n");
        exit(0);
    }
    config.intr_flag |= INTERRUPT_END;
}