Ignoring packet padding for IPv4 capture (#21)

This commit is contained in:
ddirect
2026-01-18 19:04:28 +02:00
committed by GitHub
parent 80b740827f
commit 1a6ce6b056
2 changed files with 34 additions and 10 deletions
+2
View File
@@ -195,6 +195,8 @@ func (pc *PacketBreakdown) CaptureIPv4(dst []Frame, pkt []byte, bitOffset int) (
if pc.validator().HasError() {
return dst, pc.validator().ErrPop()
}
// limit packet to the actual IPv4 frame size
pkt = pkt[:bitOffset/8+int(ifrm4.TotalLength())]
finfo := Frame{
Protocol: ethernet.TypeIPv4,
PacketBitOffset: bitOffset,