Index: utils/nfqnl_test.c =================================================================== --- utils/nfqnl_test.c (revision 6652) +++ utils/nfqnl_test.c (working copy) @@ -2,11 +2,14 @@ #include #include #include +#include #include #include /* for NF_ACCEPT */ #include +#define PRINT_INFOS + /* returns packet id */ static u_int32_t print_pkt (struct nfq_data *tb) { @@ -16,13 +19,17 @@ int ret; char *data; + id = ntohl(ph->packet_id); ph = nfq_get_msg_packet_hdr(tb); if (ph){ id = ntohl(ph->packet_id); +#ifdef PRINT_INFOS printf("hw_protocol=0x%04x hook=%u id=%u ", ntohs(ph->hw_protocol), ph->hook, id); +#endif } +#ifdef PRINT_INFOS mark = nfq_get_nfmark(tb); if (mark) printf("mark=%u ", mark); @@ -40,7 +47,7 @@ printf("payload_len=%d ", ret); fputc('\n', stdout); - +#endif return id; } @@ -49,7 +56,9 @@ struct nfq_data *nfa, void *data) { u_int32_t id = print_pkt(nfa); +#ifdef PRINT_INFOS printf("entering callback\n"); +#endif return nfq_set_verdict(qh, id, NF_ACCEPT, 0, NULL); } @@ -96,12 +105,17 @@ nh = nfq_nfnlh(h); fd = nfnl_fd(nh); - while ((rv = recv(fd, buf, sizeof(buf), 0)) && rv >= 0) { +#ifdef PRINT_INFOS printf("pkt received\n"); +#endif nfq_handle_packet(h, buf, rv); } + if (rv<0){ + printf("got error %d during recv\n",errno); + } + printf("unbinding from queue 0\n"); nfq_destroy_queue(qh);