commit 415647025488b44ba155c7c5facc8e77595e453c
parent 771a214274e8c15778d8dad76ed311ea0d42091e
Author: Stephen Gregoratto <dev@sgregoratto.me>
Date: Thu, 17 Sep 2020 11:24:10 +1000
Make packet buffer timeout a ppc constant
Diffstat:
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/ngrep.c b/ngrep.c
@@ -68,7 +68,6 @@ size_t seen_frames = 0;
uint32_t limitlen = 65535;
char nonprint_char = '.';
uint32_t snaplen = 65535;
-uint32_t to = 100;
int quiet = 0;
char *read_file = NULL;
@@ -389,7 +388,7 @@ setup_pcap_source(void)
dev = devs->name;
}
- pd = pcap_open_live(dev, snaplen, promisc, to, pc_err);
+ pd = pcap_open_live(dev, snaplen, promisc, BUF_TIMEOUT, pc_err);
if (pd == NULL) {
warnx("pcap_open_live: %s", pc_err);
return -1;
diff --git a/ngrep.h b/ngrep.h
@@ -23,6 +23,8 @@
#define VLANHDR_SIZE 4
#define IPNETHDR_SIZE 24
+#define BUF_TIMEOUT 100
+
#define EXTRACT_16BITS(p) \
((uint16_t)((uint16_t) * ((const uint8_t *)(p) + 0) << 8 | \
(uint16_t) * ((const uint8_t *)(p) + 1)))