-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
sniff()ed packets do not contain Dot1Q - using libpcap, exception occurs #1289
Description
Linux, python3.4/python3.6
Packets, that are Dot1Q vlan tagged on wire, are not sniffed with Dot1Q tag. Due to that, I used:
conf.use_pcap = True
import scapy.arch.pcapdnet
pkt = sniff(iface="lan3", count=1)
Got:
<L2pcapListenSocket: read packets at layer 2 using libpcap>
Traceback (most recent call last):
File "./test_vk.py", line 9, in
pkt = sniff(iface="lan3", count=1)
File "/opt/scapy_secdev/scapy/sendrecv.py", line 741, in sniff
ins = _select(sniff_sockets)
File "/opt/scapy_secdev/scapy/sendrecv.py", line 729, in _select
return select(sockets, [], [], remain)[0]
File "/opt/scapy_secdev/scapy/supersocket.py", line 49, in fileno
return self.ins.fileno()
File "/opt/scapy_secdev/scapy/arch/pcapdnet.py", line 434, in fileno
self.class.name)
RuntimeError: _PcapWrapper_pcapy has no fileno. Please report this bug.
My fix is:
$ git diff
diff --git a/scapy/sendrecv.py b/scapy/sendrecv.py
index 416cdbe4..4539bf63 100644
--- a/scapy/sendrecv.py
+++ b/scapy/sendrecv.py
@@ -738,7 +738,7 @@ Examples:
from scapy.arch.bpf.supersocket import bpf_select
def _select(sockets):
return bpf_select(sockets, remain)
- elif WINDOWS:
+ elif WINDOWS or conf.use_pcap:
from scapy.arch.pcapdnet import PcapTimeoutElapsed
read_allowed_exceptions = (PcapTimeoutElapsed,)
def _select(sockets):