From 42b608df8f82a3c6d85e531c979f19280165bbd2 Mon Sep 17 00:00:00 2001
From: Pierre Lalet <pierre@droids-corp.org>
Date: Mon, 18 Sep 2017 20:58:18 +0200
Subject: [PATCH] Tiny Python 3 fixes (#820)

* Python3: fix set_promisc() with Linux

* Fix debug dissector error message

* Make run_scapy3 executable
---
 run_scapy3          | 0
 scapy/arch/linux.py | 2 +-
 scapy/packet.py     | 2 +-
 3 files changed, 2 insertions(+), 2 deletions(-)
 mode change 100644 => 100755 run_scapy3

diff --git a/run_scapy3 b/run_scapy3
old mode 100644
new mode 100755
diff --git a/scapy/arch/linux.py b/scapy/arch/linux.py
index a035f00f..6c7c8ed8 100644
--- a/scapy/arch/linux.py
+++ b/scapy/arch/linux.py
@@ -163,7 +163,7 @@ def attach_filter(s, bpf_filter, iface):
     s.setsockopt(SOL_SOCKET, SO_ATTACH_FILTER, bpfh)
 
 def set_promisc(s,iff,val=1):
-    mreq = struct.pack("IHH8s", get_if_index(iff), PACKET_MR_PROMISC, 0, "")
+    mreq = struct.pack("IHH8s", get_if_index(iff), PACKET_MR_PROMISC, 0, b"")
     if val:
         cmd = PACKET_ADD_MEMBERSHIP
     else:
diff --git a/scapy/packet.py b/scapy/packet.py
index 12ba22c2..7bed20c8 100644
--- a/scapy/packet.py
+++ b/scapy/packet.py
@@ -701,7 +701,7 @@ class Packet(six.with_metaclass(Packet_metaclass, BasePacket)):
             except:
                 if conf.debug_dissector:
                     if isinstance(cls,type) and issubclass(cls,Packet):
-                        log_runtime.error("%s dissector failed" % cls.name)
+                        log_runtime.error("%s dissector failed" % cls.__name__)
                     else:
                         log_runtime.error("%s.guess_payload_class() returned [%s]" % (self.__class__.__name__,repr(cls)))
                     if cls is not None:
-- 
GitLab