Skip to content

Commit

Permalink
Merge pull request #236 from larseggert/fix-attr
Browse files Browse the repository at this point in the history
Fix for #235
  • Loading branch information
marten-seemann authored Oct 14, 2020
2 parents fbd9621 + 0eb5ce1 commit 0ea8c72
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down

0 comments on commit 0ea8c72

Please sign in to comment.