From: acst1223 Date: Thu, 26 Sep 2024 07:56:28 +0000 (+0900) Subject: Include frame header in buffer length (#371) X-Git-Tag: v10.1.0~8 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=005111278ce60fa290638769d876ec2e6e03e033;p=thirdparty%2Fdhcpcd.git 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 --- 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;