From: Roy Marples Date: Tue, 4 Apr 2017 08:45:27 +0000 (+0100) Subject: bpf: don't check caplen == datalen X-Git-Tag: v7.0.0-beta3~44 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5db2a161af8c39e3bdc47bd2ae7b8ba190db679c;p=thirdparty%2Fdhcpcd.git bpf: don't check caplen == datalen Some drivers return FCS at the end of the payload to BPF. AFAIK, we have no way of knowing this in userland. We can guess that FCS is there because the BPF filter trims the DHCP payload to the Frame and IP lengths, but equally the data could be anything. As such removing the check that caplen == datalen makes sense. --- diff --git a/src/bpf.c b/src/bpf.c index 46c5db38..d7cb3616 100644 --- a/src/bpf.c +++ b/src/bpf.c @@ -222,8 +222,6 @@ bpf_read(struct interface *ifp, int fd, void *data, size_t len, int *flags) bytes = -1; memcpy(&packet, state->buffer + state->buffer_pos, sizeof(packet)); - if (packet.bh_caplen != packet.bh_datalen) - goto next; /* Incomplete packet, drop. */ if (state->buffer_pos + packet.bh_caplen + packet.bh_hdrlen > state->buffer_len) goto next; /* Packet beyond buffer, drop. */