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.
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. */