]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Include frame header in buffer length (#371)
authoracst1223 <natnstart@gmail.com>
Thu, 26 Sep 2024 07:56:28 +0000 (16:56 +0900)
committerGitHub <noreply@github.com>
Thu, 26 Sep 2024 07:56:28 +0000 (08:56 +0100)
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 <amo@semihalf.com>
src/if-linux.c

index b907595298cf1ee4831b591245b997c244f5fee1..682f935fe56c86c223b6e0ed0b6a6e6566d15aff 100644 (file)
@@ -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;