@@ -69,10 +69,17 @@ # define PBL_ID_T u_int32_t # define PBL_ERRSTR "" #define DEBUG(x, y) if (conf.debug >= x) { printf(y "\n"); } #define INVALID_OCTET(x) x < 0 || x > 255 +#define DPRINT(format, args...) if (conf.debug == 0) { \ + syslog(LOG_INFO, format , ## args); \ +} else { \ + fprintf(stderr, format , ## args); \ +} + +#define DPRINTQ(format, args...) if (!conf.quiet) { DPRINT(format, ## args) }; struct packet_info { uint8_t b1; uint8_t b2; @@ -97,15 +104,14 @@ char *string; struct config_entry *next; struct packet_info ip; struct cidr cidr; + int index; }; -char msgbuf[BUFFERSIZE]; - struct config { int allow_non25; int allow_nonsyn; int default_accept; int dryrun; @@ -139,11 +145,11 @@ time_t expires; int action; }; struct packet_cache_t *packet_cache = NULL; uint32_t packet_cache_len = USE_CACHE_DEF_LEN; -uint16_t packet_cache_ttl = USE_CACHE_DEF_TTL; +uint32_t packet_cache_ttl = USE_CACHE_DEF_TTL; #endif struct config_entry *hostlistcache = NULL; int get_packet_info(char *payload, struct packet_info *ip); @@ -153,11 +159,11 @@ int parse_cidr(struct config_entry *ce); /* int validate_blacklist(char *); */ void parse_config(void); void parse_arguments(int argc, char **argv); void pbl_init_sockstat(void); -static void get_ip_string(const struct packet_info *ip); +char * get_ip_string(const struct packet_info *ip); static void pbl_set_verdict(struct PBL_HANDLE *h, PBL_ID_T id, unsigned int verdict); static int pbl_callback(struct nfq_q_handle *qh, struct nfgenmsg *nfmsg, struct nfq_data *nfa, void *data);