For UDP packets, applicationLayer.Payload() is not the same of udpLayer.LayerPayload()
- Dominant language
- Go
- Stars
- 6.8k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
I am observing a strange behaviour while filtering UDP packets from a .pcap file and getting their payload.
`
for packet := range packetSource.Packets() {
if err := packet.ErrorLayer(); err != nil {
continue
}
udpLayer := packet.Layer(layers.LayerTypeUDP)
if udpLayer == nil {
continue
}
// Condition A
if len(udpLayer.LayerPayload()) == 0 {
continue
}
/* Condition B
appLayer := packet.ApplicationLayer()
if appLayer == nil || len(appLayer.Payload()) == 0 {
continue
}*/
`
With condition A I get 179 packets, with condition B (and A disabled) I get 89 packets. Why?
Contributor guide
Assessment
This issue has not been assessed yet.