From 005111278ce60fa290638769d876ec2e6e03e033 Mon Sep 17 00:00:00 2001 From: acst1223 Date: Thu, 26 Sep 2024 16:56:28 +0900 Subject: [PATCH] Include frame header in buffer length (#371) Since we are capturing packets at L2 we should not be using ETH_DATA_LEN but ETH_FRAME_LEN to include also dst/src MAC and EtherType. Co-authored-by: Andrzej Ostruszka --- src/if-linux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/if-linux.c b/src/if-linux.c index b9075952..682f935f 100644 --- a/src/if-linux.c +++ b/src/if-linux.c @@ -1768,7 +1768,7 @@ bpf_open(const struct interface *ifp, bpf->bpf_ifp = ifp; /* Allocate a suitably large buffer for a single packet. */ - bpf->bpf_size = ETH_DATA_LEN; + bpf->bpf_size = ETH_FRAME_LEN; bpf->bpf_buffer = malloc(bpf->bpf_size); if (bpf->bpf_buffer == NULL) goto eexit; -- 2.47.2