From d8c9326eb996da1d0fc9eff375e1b67c938aabf5 Mon Sep 17 00:00:00 2001
From: Dirk Loss <mail@dirk-loss.de>
Date: Wed, 14 Jul 2010 13:04:52 +0200
Subject: [PATCH] Remove dependency on special 'scapy' string in
 pcap.__version__

Newer versions of the pypcap library now include our fixes
and support the timeout_ms argument. So we should not depend
on our customized, specially marked, pypcap version anymore.
---
 scapy/arch/pcapdnet.py | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/scapy/arch/pcapdnet.py b/scapy/arch/pcapdnet.py
index bb2419f9..13bacc4a 100644
--- a/scapy/arch/pcapdnet.py
+++ b/scapy/arch/pcapdnet.py
@@ -43,11 +43,10 @@ if conf.use_pcap:
         if hasattr(pcap,"pcap"): # python-pypcap
             class _PcapWrapper_pypcap:
                 def __init__(self, device, snaplen, promisc, to_ms):
-                    # Normal pypcap module has no timeout parameter,
-                    # only the specially patched "scapy" variant has.                 
-                    if "scapy" in pcap.__version__.lower():
+                    try:
                         self.pcap = pcap.pcap(device, snaplen, promisc, immediate=1, timeout_ms=to_ms)
-                    else:
+                    except TypeError:
+                        # Older pypcap versions do not support the timeout_ms argument
                         self.pcap = pcap.pcap(device, snaplen, promisc, immediate=1)                    
                 def __getattr__(self, attr):
                     return getattr(self.pcap, attr)
-- 
GitLab