From 0eb5ce16fe7382c7754593a8da4e836a5c1cef77 Mon Sep 17 00:00:00 2001 From: Lars Eggert Date: Wed, 14 Oct 2020 13:46:22 +0300 Subject: [PATCH] Fix for #235 --- trace.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/trace.py b/trace.py index 7509d41e..80f7e74e 100644 --- a/trace.py +++ b/trace.py @@ -36,10 +36,16 @@ class PacketType(Enum): def get_direction(p) -> Direction: - if p.ip.src == IP4_CLIENT or p.ipv6.src == IP6_CLIENT: + if (hasattr(p, "ip") and p.ip.src == IP4_CLIENT) or ( + hasattr(p, "ipv6") and p.ipv6.src == IP6_CLIENT + ): return Direction.FROM_CLIENT - if p.ip.src == IP4_SERVER or p.ipv6.src == IP6_SERVER: + + if (hasattr(p, "ip") and p.ip.src == IP4_SERVER) or ( + hasattr(p, "ipv6") and p.ipv6.src == IP6_SERVER + ): return Direction.FROM_SERVER + return Direction.INVALID