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?