From 1a8d88e29b8593ea521c82a801578aa5929047d5 Mon Sep 17 00:00:00 2001
From: Guillaume Valadon <guillaume@valadon.net>
Date: Wed, 12 Aug 2015 15:16:02 +0200
Subject: [PATCH] Support form arm64

--HG--
branch : Issue #5130
---
 scapy/arch/__init__.py | 1 +
 scapy/arch/linux.py    | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/scapy/arch/__init__.py b/scapy/arch/__init__.py
index 23e1cb7c..7d231148 100644
--- a/scapy/arch/__init__.py
+++ b/scapy/arch/__init__.py
@@ -52,6 +52,7 @@ SOLARIS=sys.platform.startswith("sunos")
 WINDOWS=sys.platform.startswith("win32")
 
 X86_64 = not WINDOWS and (os.uname()[4] == 'x86_64')
+ARM_64 = not WINDOWS and (os.uname()[4] == 'aarch64')
 
 
 # Next step is to import following architecture specific functions:
diff --git a/scapy/arch/linux.py b/scapy/arch/linux.py
index 40fcffd3..222cd011 100644
--- a/scapy/arch/linux.py
+++ b/scapy/arch/linux.py
@@ -132,7 +132,7 @@ def attach_filter(s, filter):
 
     # XXX. Argl! We need to give the kernel a pointer on the BPF,
     # python object header seems to be 20 bytes. 36 bytes for x86 64bits arch.
-    if scapy.arch.X86_64:
+    if scapy.arch.X86_64 or scapy.arch.ARM_64:
         bpfh = struct.pack("HL", nb, id(bpf)+36)
     else:
         bpfh = struct.pack("HI", nb, id(bpf)+20)  
@@ -282,7 +282,7 @@ def get_if(iff,cmd):
 def get_if_index(iff):
     return int(struct.unpack("I",get_if(iff, SIOCGIFINDEX)[16:20])[0])
 
-if os.uname()[4] == 'x86_64':
+if os.uname()[4] in [ 'x86_64', 'aarch64' ]:
     def get_last_packet_timestamp(sock):
         ts = ioctl(sock, SIOCGSTAMP, "1234567890123456")
         s,us = struct.unpack("QQ",ts)
-- 
GitLab