aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVaiTon2023-06-05 14:14:44 +0000
committerVaiTon2023-06-05 14:14:44 +0000
commit31545a5a221176e6077205fa8ad796b0025e3438 (patch)
treeb4d31a9e5b330aefe941f6662ce258208876515b
parent59253fccf8a7d5df0e193721336ae726f6db7306 (diff)
Warn on pcap packet error
-rw-r--r--pcap_importer.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/pcap_importer.go b/pcap_importer.go
index 4cca916..0df4bcb 100644
--- a/pcap_importer.go
+++ b/pcap_importer.go
@@ -224,6 +224,7 @@ func (pi *PcapImporter) parsePcap(session ImportingSession, fileName string, flu
if packet.NetworkLayer() == nil || packet.TransportLayer() == nil ||
packet.TransportLayer().LayerType() != layers.LayerTypeTCP { // invalid packet
+ log.Warn("Invalid packet: no network or transport layer")
session.InvalidPackets++
continue
}
@@ -241,6 +242,7 @@ func (pi *PcapImporter) parsePcap(session ImportingSession, fileName string, flu
servicePort = uint16(tcp.SrcPort)
index = 1
} else {
+ log.Warn("Invalid packet: source and destination are the same")
session.InvalidPackets++
continue
}