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
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