aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pcap_importer.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/pcap_importer.go b/pcap_importer.go
index 0df4bcb..388ec2d 100644
--- a/pcap_importer.go
+++ b/pcap_importer.go
@@ -222,8 +222,15 @@ func (pi *PcapImporter) parsePcap(session ImportingSession, fileName string, flu
session.ProcessedPackets++
- if packet.NetworkLayer() == nil || packet.TransportLayer() == nil ||
- packet.TransportLayer().LayerType() != layers.LayerTypeTCP { // invalid packet
+ if packet.NetworkLayer() == nil {
+ log.Warn("Invalid packet: no network layer")
+ session.InvalidPackets++
+ continue
+ } else if packet.TransportLayer() == nil {
+ log.Warn("Invalid packet: no transport layer")
+ session.InvalidPackets++
+ continue
+ } else if packet.TransportLayer().LayerType() != layers.LayerTypeTCP {
log.Warn("Invalid packet: no network or transport layer")
session.InvalidPackets++
continue