google / gopacket

Provides packet processing capabilities for Go
BSD 3-Clause "New" or "Revised" License
6.35k stars 1.14k forks source link

Unable to decode LinkType 20 #1198

Open HaibaraAi119 opened 3 days ago

HaibaraAi119 commented 3 days ago

i use tcpdump to get a tcp package,and then save a cap file, but i use gopacket parsing this cap file,following error occurs: "Packet decoding error: Unable to decode LinkType 20"

my code: handle, err = pcap.OpenOffline(capFile)

packetSource := gopacket.NewPacketSource(handle, handle.LinkType()) //go print_counter() for packet := range packetSource.Packets() { fmt.Println(packet) //Packet decoding error: Unable to decode LinkType 20 printPacketInfo(packet) }

... ...

tcpLayer := packet.Layer(layers.LayerTypeTCP) //Causes an error here ,is null