/* pdumpq - Pcap Dump for Linux/Netfilter QUEUE * * Copyright (C) 2001 Ian Jones * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define PIDFILE "/var/run/pdumpq.pid" #ifdef MAIL #include #endif /* MAIL */ #ifndef MAX_ROTATE #define MAX_ROTATE 10 #endif #ifndef VERSION #define VERSION "unknown" #endif /* runtime variables */ typedef struct _V { unsigned int policy; int daemon; int rotate; int mcount; unsigned long *marks; unsigned int *verdicts; #ifdef MAIL int mail; char *email; int timer; int maxq; #endif /* MAIL */ char *dumpfile; struct ipq_handle *h; struct sigaction sa; FILE *file; } Values; Values v; void detach (void); void ipq_init (void); void usage (char *app); pid_t is_running (void); void rotate (char *fn); void set_signals (void); int open_file (char *fn); void q_handler (int sig); void crash (char *error); int gmt2local (time_t t); void cmdline (int argc, char **argv); void process_pkt (ipq_packet_msg_t * m, unsigned int verdict);