From 4ccc82a5dc91be24616912b5d4c98b145be9c945 Mon Sep 17 00:00:00 2001 From: Dirk Loss <mail@dirk-loss.de> Date: Fri, 20 Nov 2009 22:12:13 +0100 Subject: [PATCH] Improved startup performance on Windows When enumerating usable network interfaces we now only try those that have an IP address, because the IP address is needed anyway to construct the mapping between dnet and pcap interface names. This significantly improves Scapy's startup performance. --- scapy/arch/windows/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scapy/arch/windows/__init__.py b/scapy/arch/windows/__init__.py index edbacddb..851bb9d1 100755 --- a/scapy/arch/windows/__init__.py +++ b/scapy/arch/windows/__init__.py @@ -159,7 +159,10 @@ class NetworkInterfaceDict(IterableUserDict): for i in pcapdnet.dnet.intf(): try: # XXX: Only Ethernet for the moment: localhost is not supported by dnet and pcap - if i["name"].startswith("eth"): + # We only take interfaces that have an IP address, because the IP + # is used for the mapping between dnet and pcap interface names + # and this significantly improves Scapy's startup performance + if i["name"].startswith("eth") and "addr" in i: self.data[i["name"]] = NetworkInterface(i) except (KeyError, PcapNameNotFoundError): pass -- GitLab