Skip to content
Snippets Groups Projects
Commit 1a8d88e2 authored by Guillaume Valadon's avatar Guillaume Valadon
Browse files

Support form arm64

--HG--
branch : Issue #5130
parent 29a048a3
No related branches found
No related tags found
No related merge requests found
...@@ -52,6 +52,7 @@ SOLARIS=sys.platform.startswith("sunos") ...@@ -52,6 +52,7 @@ SOLARIS=sys.platform.startswith("sunos")
WINDOWS=sys.platform.startswith("win32") WINDOWS=sys.platform.startswith("win32")
X86_64 = not WINDOWS and (os.uname()[4] == 'x86_64') 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: # Next step is to import following architecture specific functions:
......
...@@ -132,7 +132,7 @@ def attach_filter(s, filter): ...@@ -132,7 +132,7 @@ def attach_filter(s, filter):
# XXX. Argl! We need to give the kernel a pointer on the BPF, # 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. # 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) bpfh = struct.pack("HL", nb, id(bpf)+36)
else: else:
bpfh = struct.pack("HI", nb, id(bpf)+20) bpfh = struct.pack("HI", nb, id(bpf)+20)
...@@ -282,7 +282,7 @@ def get_if(iff,cmd): ...@@ -282,7 +282,7 @@ def get_if(iff,cmd):
def get_if_index(iff): def get_if_index(iff):
return int(struct.unpack("I",get_if(iff, SIOCGIFINDEX)[16:20])[0]) 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): def get_last_packet_timestamp(sock):
ts = ioctl(sock, SIOCGSTAMP, "1234567890123456") ts = ioctl(sock, SIOCGSTAMP, "1234567890123456")
s,us = struct.unpack("QQ",ts) s,us = struct.unpack("QQ",ts)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment