Fix tcp4 frag error caused by enabled IP fragmentation

If the packet is fragmented here is no way to deal with it, but we don't
care about DF flag in real
This commit is contained in:
Vadim Vetrov
2024-08-07 11:38:26 +03:00
parent 1b8d3a0e66
commit c9949a3605
2 changed files with 10 additions and 6 deletions

View File

@@ -226,7 +226,11 @@ int tcp4_frag(const __u8 *pkt, __u32 buflen, __u32 payload_offset,
}
if (!(ntohs(hdr->frag_off) & IP_DF)) {
if (
ntohs(hdr->frag_off) & IP_MF ||
ntohs(hdr->frag_off) & IP_OFFMASK) {
printf("tcp4_frag: frag value: %d\n",
ntohs(hdr->frag_off));
lgerror("tcp4_frag: ip fragmentation is set", -EINVAL);
return -EINVAL;
}