We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
scapy import fail: NameError: name 'get_working_if' is not defined
Hello,

On an Ubuntu 16.04.3 LTS, when launching `scapy` CLI or importing `scapy.route` without any interface in use, I got the following error:
```Python
Traceback (most recent call last):
  File "/usr/local/bin/scapy", line 25, in <module>
    interact()
  File "tools/scapy/scapy/main.py", line 421, in interact
    init_session(session_name, mydict)
  File "tools/scapy/scapy/main.py", line 293, in init_session
    scapy_builtins = {k: v for k, v in six.iteritems(importlib.import_module(".all", "scapy").__dict__) if _validate_local(k)}
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "tools/scapy/scapy/all.py", line 25, in <module>
    from scapy.route import *
  File "tools/scapy/scapy/route.py", line 195, in <module>
    conf.iface = get_working_if()
NameError: name 'get_working_if' is not defined
```

A bisect leads to the recent commit fd50b349263256e0aaa69780937ae02d4f4ee46c, more likely to [this code](https://github.com/secdev/scapy/commit/fd50b349263256e0aaa69780937ae02d4f4ee46c#diff-3fc486d3e1085d11c80c20bab07375f2R194)

I'm not sure to correctly understand for this code snippet and how it works on the different OS. This is why I prefer opening an issue :smiley: 

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `scapy/route.py`
Content:
```
1 ## This file is part of Scapy
2 ## See http://www.secdev.org/projects/scapy for more informations
3 ## Copyright (C) Philippe Biondi <phil@secdev.org>
4 ## This program is published under a GPLv2 license
5 
6 """
7 Routing and handling of network interfaces.
8 """
9 
10 from __future__ import absolute_import
11 from scapy.utils import atol, ltoa, itom, pretty_routes
12 from scapy.config import conf
13 from scapy.error import Scapy_Exception, warning
14 from scapy.arch import WINDOWS
15 import scapy.consts
16 import scapy.modules.six as six
17 
18 ##############################
19 ## Routing/Interfaces stuff ##
20 ##############################
21 
22 class Route:
23     def __init__(self):
24         self.resync()
25         self.cache = {}
26 
27     def invalidate_cache(self):
28         self.cache = {}
29 
30     def resync(self):
31         from scapy.arch import read_routes
32         self.invalidate_cache()
33         self.routes = read_routes()
34 
35     def __repr__(self):
36         rtlst = []
37         for net, msk, gw, iface, addr, metric in self.routes:
38             rtlst.append((ltoa(net),
39                       ltoa(msk),
40                       gw,
41                       (iface.name if not isinstance(iface, six.string_types) else iface),
42                       addr,
43                       str(metric)))
44 
45         return pretty_routes(rtlst,
46                              [("Network", "Netmask", "Gateway", "Iface", "Output IP", "Metric")])
47 
48     def make_route(self, host=None, net=None, gw=None, dev=None, metric=1):
49         from scapy.arch import get_if_addr
50         if host is not None:
51             thenet,msk = host,32
52         elif net is not None:
53             thenet,msk = net.split("/")
54             msk = int(msk)
55         else:
56             raise Scapy_Exception("make_route: Incorrect parameters. You should specify a host or a net")
57         if gw is None:
58             gw="0.0.0.0"
59         if dev is None:
60             if gw:
61                 nhop = gw
62             else:
63                 nhop = thenet
64             dev,ifaddr,x = self.route(nhop)
65         else:
66             ifaddr = get_if_addr(dev)
67         return (atol(thenet), itom(msk), gw, dev, ifaddr, metric)
68 
69     def add(self, *args, **kargs):
70         """Ex:
71         add(net="192.168.1.0/24",gw="1.2.3.4")
72         """
73         self.invalidate_cache()
74         self.routes.append(self.make_route(*args,**kargs))
75 
76         
77     def delt(self,  *args, **kargs):
78         """delt(host|net, gw|dev)"""
79         self.invalidate_cache()
80         route = self.make_route(*args,**kargs)
81         try:
82             i=self.routes.index(route)
83             del(self.routes[i])
84         except ValueError:
85             warning("no matching route found")
86              
87     def ifchange(self, iff, addr):
88         self.invalidate_cache()
89         the_addr,the_msk = (addr.split("/")+["32"])[:2]
90         the_msk = itom(int(the_msk))
91         the_rawaddr = atol(the_addr)
92         the_net = the_rawaddr & the_msk
93         
94         
95         for i, route in enumerate(self.routes):
96             net, msk, gw, iface, addr, metric = route
97             if WINDOWS:
98                 if iff.guid != iface.guid:
99                     continue
100             elif iff != iface:
101                 continue
102             if gw == '0.0.0.0':
103                 self.routes[i] = (the_net,the_msk,gw,iface,the_addr,metric)
104             else:
105                 self.routes[i] = (net,msk,gw,iface,the_addr,metric)
106         conf.netcache.flush()
107         
108                 
109 
110     def ifdel(self, iff):
111         self.invalidate_cache()
112         new_routes=[]
113         for rt in self.routes:
114             if WINDOWS:
115                 if iff.guid == rt[3].guid:
116                     continue
117             elif iff == rt[3]:
118                 continue
119             new_routes.append(rt)
120         self.routes=new_routes
121         
122     def ifadd(self, iff, addr):
123         self.invalidate_cache()
124         the_addr,the_msk = (addr.split("/")+["32"])[:2]
125         the_msk = itom(int(the_msk))
126         the_rawaddr = atol(the_addr)
127         the_net = the_rawaddr & the_msk
128         self.routes.append((the_net,the_msk,'0.0.0.0',iff,the_addr,1))
129 
130 
131     def route(self,dest,verbose=None):
132         if isinstance(dest, list) and dest:
133             dest = dest[0]
134         if dest in self.cache:
135             return self.cache[dest]
136         if verbose is None:
137             verbose=conf.verb
138         # Transform "192.168.*.1-5" to one IP of the set
139         dst = dest.split("/")[0]
140         dst = dst.replace("*","0") 
141         while True:
142             l = dst.find("-")
143             if l < 0:
144                 break
145             m = (dst[l:]+".").find(".")
146             dst = dst[:l]+dst[l+m:]
147 
148             
149         dst = atol(dst)
150         pathes=[]
151         for d,m,gw,i,a,me in self.routes:
152             if not a: # some interfaces may not currently be connected
153                 continue
154             aa = atol(a)
155             if aa == dst:
156                 pathes.append((0xffffffff, 1, (scapy.consts.LOOPBACK_INTERFACE,a,"0.0.0.0")))
157             if (dst & m) == (d & m):
158                 pathes.append((m, me, (i,a,gw)))
159         if not pathes:
160             if verbose:
161                 warning("No route found (no default route?)")
162             return scapy.consts.LOOPBACK_INTERFACE,"0.0.0.0","0.0.0.0"
163         # Choose the more specific route
164         # Sort by greatest netmask
165         pathes.sort(key=lambda x: x[0], reverse=True)
166         # Get all pathes having the (same) greatest mask
167         pathes = [i for i in pathes if i[0] == pathes[0][0]]
168         # Tie-breaker: Metrics
169         pathes.sort(key=lambda x: x[1])
170         # Return interface
171         ret = pathes[0][2]
172         self.cache[dest] = ret
173         return ret
174             
175     def get_if_bcast(self, iff):
176         for net, msk, gw, iface, addr, metric in self.routes:
177             if net == 0:
178                 continue
179             if WINDOWS:
180                 if iff.guid != iface.guid:
181                     continue
182             elif iff != iface:
183                 continue
184             bcast = atol(addr)|(~msk&0xffffffff); # FIXME: check error in atol()
185             return ltoa(bcast)
186         warning("No broadcast address found for iface %s\n", iff);
187 
188 conf.route=Route()
189 
190 #XXX use "with"
191 _betteriface = conf.route.route("0.0.0.0", verbose=0)[0]
192 if ((_betteriface if (isinstance(_betteriface, six.string_types) or _betteriface is None) else _betteriface.name) != scapy.consts.LOOPBACK_NAME):
193     conf.iface = _betteriface
194 else:
195     conf.iface = get_working_if()
196 del(_betteriface)
197
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/scapy/route.py b/scapy/route.py
--- a/scapy/route.py
+++ b/scapy/route.py
@@ -11,7 +11,7 @@
 from scapy.utils import atol, ltoa, itom, pretty_routes
 from scapy.config import conf
 from scapy.error import Scapy_Exception, warning
-from scapy.arch import WINDOWS
+from scapy.arch import WINDOWS, get_working_if
 import scapy.consts
 import scapy.modules.six as six

{"golden_diff": "diff --git a/scapy/route.py b/scapy/route.py\n--- a/scapy/route.py\n+++ b/scapy/route.py\n@@ -11,7 +11,7 @@\n from scapy.utils import atol, ltoa, itom, pretty_routes\n from scapy.config import conf\n from scapy.error import Scapy_Exception, warning\n-from scapy.arch import WINDOWS\n+from scapy.arch import WINDOWS, get_working_if\n import scapy.consts\n import scapy.modules.six as six\n", "issue": "scapy import fail: NameError: name 'get_working_if' is not defined\nHello,\r\n\r\nOn an Ubuntu 16.04.3 LTS, when launching `scapy` CLI or importing `scapy.route` without any interface in use, I got the following error:\r\n```Python\r\nTraceback (most recent call last):\r\n  File \"/usr/local/bin/scapy\", line 25, in <module>\r\n    interact()\r\n  File \"tools/scapy/scapy/main.py\", line 421, in interact\r\n    init_session(session_name, mydict)\r\n  File \"tools/scapy/scapy/main.py\", line 293, in init_session\r\n    scapy_builtins = {k: v for k, v in six.iteritems(importlib.import_module(\".all\", \"scapy\").__dict__) if _validate_local(k)}\r\n  File \"/usr/lib/python2.7/importlib/__init__.py\", line 37, in import_module\r\n    __import__(name)\r\n  File \"tools/scapy/scapy/all.py\", line 25, in <module>\r\n    from scapy.route import *\r\n  File \"tools/scapy/scapy/route.py\", line 195, in <module>\r\n    conf.iface = get_working_if()\r\nNameError: name 'get_working_if' is not defined\r\n```\r\n\r\nA bisect leads to the recent commit fd50b349263256e0aaa69780937ae02d4f4ee46c, more likely to [this code](https://github.com/secdev/scapy/commit/fd50b349263256e0aaa69780937ae02d4f4ee46c#diff-3fc486d3e1085d11c80c20bab07375f2R194)\r\n\r\nI'm not sure to correctly understand for this code snippet and how it works on the different OS. This is why I prefer opening an issue :smiley: \n", "before_files": [{"content": "## This file is part of Scapy\n## See http://www.secdev.org/projects/scapy for more informations\n## Copyright (C) Philippe Biondi <phil@secdev.org>\n## This program is published under a GPLv2 license\n\n\"\"\"\nRouting and handling of network interfaces.\n\"\"\"\n\nfrom __future__ import absolute_import\nfrom scapy.utils import atol, ltoa, itom, pretty_routes\nfrom scapy.config import conf\nfrom scapy.error import Scapy_Exception, warning\nfrom scapy.arch import WINDOWS\nimport scapy.consts\nimport scapy.modules.six as six\n\n##############################\n## Routing/Interfaces stuff ##\n##############################\n\nclass Route:\n    def __init__(self):\n        self.resync()\n        self.cache = {}\n\n    def invalidate_cache(self):\n        self.cache = {}\n\n    def resync(self):\n        from scapy.arch import read_routes\n        self.invalidate_cache()\n        self.routes = read_routes()\n\n    def __repr__(self):\n        rtlst = []\n        for net, msk, gw, iface, addr, metric in self.routes:\n            rtlst.append((ltoa(net),\n                      ltoa(msk),\n                      gw,\n                      (iface.name if not isinstance(iface, six.string_types) else iface),\n                      addr,\n                      str(metric)))\n\n        return pretty_routes(rtlst,\n                             [(\"Network\", \"Netmask\", \"Gateway\", \"Iface\", \"Output IP\", \"Metric\")])\n\n    def make_route(self, host=None, net=None, gw=None, dev=None, metric=1):\n        from scapy.arch import get_if_addr\n        if host is not None:\n            thenet,msk = host,32\n        elif net is not None:\n            thenet,msk = net.split(\"/\")\n            msk = int(msk)\n        else:\n            raise Scapy_Exception(\"make_route: Incorrect parameters. You should specify a host or a net\")\n        if gw is None:\n            gw=\"0.0.0.0\"\n        if dev is None:\n            if gw:\n                nhop = gw\n            else:\n                nhop = thenet\n            dev,ifaddr,x = self.route(nhop)\n        else:\n            ifaddr = get_if_addr(dev)\n        return (atol(thenet), itom(msk), gw, dev, ifaddr, metric)\n\n    def add(self, *args, **kargs):\n        \"\"\"Ex:\n        add(net=\"192.168.1.0/24\",gw=\"1.2.3.4\")\n        \"\"\"\n        self.invalidate_cache()\n        self.routes.append(self.make_route(*args,**kargs))\n\n        \n    def delt(self,  *args, **kargs):\n        \"\"\"delt(host|net, gw|dev)\"\"\"\n        self.invalidate_cache()\n        route = self.make_route(*args,**kargs)\n        try:\n            i=self.routes.index(route)\n            del(self.routes[i])\n        except ValueError:\n            warning(\"no matching route found\")\n             \n    def ifchange(self, iff, addr):\n        self.invalidate_cache()\n        the_addr,the_msk = (addr.split(\"/\")+[\"32\"])[:2]\n        the_msk = itom(int(the_msk))\n        the_rawaddr = atol(the_addr)\n        the_net = the_rawaddr & the_msk\n        \n        \n        for i, route in enumerate(self.routes):\n            net, msk, gw, iface, addr, metric = route\n            if WINDOWS:\n                if iff.guid != iface.guid:\n                    continue\n            elif iff != iface:\n                continue\n            if gw == '0.0.0.0':\n                self.routes[i] = (the_net,the_msk,gw,iface,the_addr,metric)\n            else:\n                self.routes[i] = (net,msk,gw,iface,the_addr,metric)\n        conf.netcache.flush()\n        \n                \n\n    def ifdel(self, iff):\n        self.invalidate_cache()\n        new_routes=[]\n        for rt in self.routes:\n            if WINDOWS:\n                if iff.guid == rt[3].guid:\n                    continue\n            elif iff == rt[3]:\n                continue\n            new_routes.append(rt)\n        self.routes=new_routes\n        \n    def ifadd(self, iff, addr):\n        self.invalidate_cache()\n        the_addr,the_msk = (addr.split(\"/\")+[\"32\"])[:2]\n        the_msk = itom(int(the_msk))\n        the_rawaddr = atol(the_addr)\n        the_net = the_rawaddr & the_msk\n        self.routes.append((the_net,the_msk,'0.0.0.0',iff,the_addr,1))\n\n\n    def route(self,dest,verbose=None):\n        if isinstance(dest, list) and dest:\n            dest = dest[0]\n        if dest in self.cache:\n            return self.cache[dest]\n        if verbose is None:\n            verbose=conf.verb\n        # Transform \"192.168.*.1-5\" to one IP of the set\n        dst = dest.split(\"/\")[0]\n        dst = dst.replace(\"*\",\"0\") \n        while True:\n            l = dst.find(\"-\")\n            if l < 0:\n                break\n            m = (dst[l:]+\".\").find(\".\")\n            dst = dst[:l]+dst[l+m:]\n\n            \n        dst = atol(dst)\n        pathes=[]\n        for d,m,gw,i,a,me in self.routes:\n            if not a: # some interfaces may not currently be connected\n                continue\n            aa = atol(a)\n            if aa == dst:\n                pathes.append((0xffffffff, 1, (scapy.consts.LOOPBACK_INTERFACE,a,\"0.0.0.0\")))\n            if (dst & m) == (d & m):\n                pathes.append((m, me, (i,a,gw)))\n        if not pathes:\n            if verbose:\n                warning(\"No route found (no default route?)\")\n            return scapy.consts.LOOPBACK_INTERFACE,\"0.0.0.0\",\"0.0.0.0\"\n        # Choose the more specific route\n        # Sort by greatest netmask\n        pathes.sort(key=lambda x: x[0], reverse=True)\n        # Get all pathes having the (same) greatest mask\n        pathes = [i for i in pathes if i[0] == pathes[0][0]]\n        # Tie-breaker: Metrics\n        pathes.sort(key=lambda x: x[1])\n        # Return interface\n        ret = pathes[0][2]\n        self.cache[dest] = ret\n        return ret\n            \n    def get_if_bcast(self, iff):\n        for net, msk, gw, iface, addr, metric in self.routes:\n            if net == 0:\n                continue\n            if WINDOWS:\n                if iff.guid != iface.guid:\n                    continue\n            elif iff != iface:\n                continue\n            bcast = atol(addr)|(~msk&0xffffffff); # FIXME: check error in atol()\n            return ltoa(bcast)\n        warning(\"No broadcast address found for iface %s\\n\", iff);\n\nconf.route=Route()\n\n#XXX use \"with\"\n_betteriface = conf.route.route(\"0.0.0.0\", verbose=0)[0]\nif ((_betteriface if (isinstance(_betteriface, six.string_types) or _betteriface is None) else _betteriface.name) != scapy.consts.LOOPBACK_NAME):\n    conf.iface = _betteriface\nelse:\n    conf.iface = get_working_if()\ndel(_betteriface)\n", "path": "scapy/route.py"}], "after_files": [{"content": "## This file is part of Scapy\n## See http://www.secdev.org/projects/scapy for more informations\n## Copyright (C) Philippe Biondi <phil@secdev.org>\n## This program is published under a GPLv2 license\n\n\"\"\"\nRouting and handling of network interfaces.\n\"\"\"\n\nfrom __future__ import absolute_import\nfrom scapy.utils import atol, ltoa, itom, pretty_routes\nfrom scapy.config import conf\nfrom scapy.error import Scapy_Exception, warning\nfrom scapy.arch import WINDOWS, get_working_if\nimport scapy.consts\nimport scapy.modules.six as six\n\n##############################\n## Routing/Interfaces stuff ##\n##############################\n\nclass Route:\n    def __init__(self):\n        self.resync()\n        self.cache = {}\n\n    def invalidate_cache(self):\n        self.cache = {}\n\n    def resync(self):\n        from scapy.arch import read_routes\n        self.invalidate_cache()\n        self.routes = read_routes()\n\n    def __repr__(self):\n        rtlst = []\n        for net, msk, gw, iface, addr, metric in self.routes:\n            rtlst.append((ltoa(net),\n                      ltoa(msk),\n                      gw,\n                      (iface.name if not isinstance(iface, six.string_types) else iface),\n                      addr,\n                      str(metric)))\n\n        return pretty_routes(rtlst,\n                             [(\"Network\", \"Netmask\", \"Gateway\", \"Iface\", \"Output IP\", \"Metric\")])\n\n    def make_route(self, host=None, net=None, gw=None, dev=None, metric=1):\n        from scapy.arch import get_if_addr\n        if host is not None:\n            thenet,msk = host,32\n        elif net is not None:\n            thenet,msk = net.split(\"/\")\n            msk = int(msk)\n        else:\n            raise Scapy_Exception(\"make_route: Incorrect parameters. You should specify a host or a net\")\n        if gw is None:\n            gw=\"0.0.0.0\"\n        if dev is None:\n            if gw:\n                nhop = gw\n            else:\n                nhop = thenet\n            dev,ifaddr,x = self.route(nhop)\n        else:\n            ifaddr = get_if_addr(dev)\n        return (atol(thenet), itom(msk), gw, dev, ifaddr, metric)\n\n    def add(self, *args, **kargs):\n        \"\"\"Ex:\n        add(net=\"192.168.1.0/24\",gw=\"1.2.3.4\")\n        \"\"\"\n        self.invalidate_cache()\n        self.routes.append(self.make_route(*args,**kargs))\n\n        \n    def delt(self,  *args, **kargs):\n        \"\"\"delt(host|net, gw|dev)\"\"\"\n        self.invalidate_cache()\n        route = self.make_route(*args,**kargs)\n        try:\n            i=self.routes.index(route)\n            del(self.routes[i])\n        except ValueError:\n            warning(\"no matching route found\")\n             \n    def ifchange(self, iff, addr):\n        self.invalidate_cache()\n        the_addr,the_msk = (addr.split(\"/\")+[\"32\"])[:2]\n        the_msk = itom(int(the_msk))\n        the_rawaddr = atol(the_addr)\n        the_net = the_rawaddr & the_msk\n        \n        \n        for i, route in enumerate(self.routes):\n            net, msk, gw, iface, addr, metric = route\n            if WINDOWS:\n                if iff.guid != iface.guid:\n                    continue\n            elif iff != iface:\n                continue\n            if gw == '0.0.0.0':\n                self.routes[i] = (the_net,the_msk,gw,iface,the_addr,metric)\n            else:\n                self.routes[i] = (net,msk,gw,iface,the_addr,metric)\n        conf.netcache.flush()\n        \n                \n\n    def ifdel(self, iff):\n        self.invalidate_cache()\n        new_routes=[]\n        for rt in self.routes:\n            if WINDOWS:\n                if iff.guid == rt[3].guid:\n                    continue\n            elif iff == rt[3]:\n                continue\n            new_routes.append(rt)\n        self.routes=new_routes\n        \n    def ifadd(self, iff, addr):\n        self.invalidate_cache()\n        the_addr,the_msk = (addr.split(\"/\")+[\"32\"])[:2]\n        the_msk = itom(int(the_msk))\n        the_rawaddr = atol(the_addr)\n        the_net = the_rawaddr & the_msk\n        self.routes.append((the_net,the_msk,'0.0.0.0',iff,the_addr,1))\n\n\n    def route(self,dest,verbose=None):\n        if isinstance(dest, list) and dest:\n            dest = dest[0]\n        if dest in self.cache:\n            return self.cache[dest]\n        if verbose is None:\n            verbose=conf.verb\n        # Transform \"192.168.*.1-5\" to one IP of the set\n        dst = dest.split(\"/\")[0]\n        dst = dst.replace(\"*\",\"0\") \n        while True:\n            l = dst.find(\"-\")\n            if l < 0:\n                break\n            m = (dst[l:]+\".\").find(\".\")\n            dst = dst[:l]+dst[l+m:]\n\n            \n        dst = atol(dst)\n        pathes=[]\n        for d,m,gw,i,a,me in self.routes:\n            if not a: # some interfaces may not currently be connected\n                continue\n            aa = atol(a)\n            if aa == dst:\n                pathes.append((0xffffffff, 1, (scapy.consts.LOOPBACK_INTERFACE,a,\"0.0.0.0\")))\n            if (dst & m) == (d & m):\n                pathes.append((m, me, (i,a,gw)))\n        if not pathes:\n            if verbose:\n                warning(\"No route found (no default route?)\")\n            return scapy.consts.LOOPBACK_INTERFACE,\"0.0.0.0\",\"0.0.0.0\"\n        # Choose the more specific route\n        # Sort by greatest netmask\n        pathes.sort(key=lambda x: x[0], reverse=True)\n        # Get all pathes having the (same) greatest mask\n        pathes = [i for i in pathes if i[0] == pathes[0][0]]\n        # Tie-breaker: Metrics\n        pathes.sort(key=lambda x: x[1])\n        # Return interface\n        ret = pathes[0][2]\n        self.cache[dest] = ret\n        return ret\n            \n    def get_if_bcast(self, iff):\n        for net, msk, gw, iface, addr, metric in self.routes:\n            if net == 0:\n                continue\n            if WINDOWS:\n                if iff.guid != iface.guid:\n                    continue\n            elif iff != iface:\n                continue\n            bcast = atol(addr)|(~msk&0xffffffff); # FIXME: check error in atol()\n            return ltoa(bcast)\n        warning(\"No broadcast address found for iface %s\\n\", iff);\n\nconf.route=Route()\n\n#XXX use \"with\"\n_betteriface = conf.route.route(\"0.0.0.0\", verbose=0)[0]\nif ((_betteriface if (isinstance(_betteriface, six.string_types) or _betteriface is None) else _betteriface.name) != scapy.consts.LOOPBACK_NAME):\n    conf.iface = _betteriface\nelse:\n    conf.iface = get_working_if()\ndel(_betteriface)\n", "path": "scapy/route.py"}]}