2ab389682e
Initial report and testing from Tim Donahue <tdonahue at vonsystems dot com> (and subsequent poke from sthen); thanks! ok sthen@
62 lines
2.2 KiB
Plaintext
62 lines
2.2 KiB
Plaintext
$OpenBSD: patch-scapy_py,v 1.2 2008/06/12 12:46:05 wcmaier Exp $
|
|
--- scapy.py.orig Mon Apr 9 08:17:35 2007
|
|
+++ scapy.py Wed Jun 11 08:02:10 2008
|
|
@@ -1131,6 +1131,7 @@ if not LINUX:
|
|
else:
|
|
f=os.popen("netstat -rn") # -f inet
|
|
ok = 0
|
|
+ prio_present = False
|
|
mtu_present = False
|
|
routes = []
|
|
for l in f.readlines():
|
|
@@ -1141,7 +1142,9 @@ if not LINUX:
|
|
continue
|
|
if l.find("Destination") >= 0:
|
|
ok = 1
|
|
- if l.find("Mtu") >= 0:
|
|
+ if l.find("Prio") >= 0:
|
|
+ prio_present = True
|
|
+ elif l.find("Mtu") >= 0:
|
|
mtu_present = True
|
|
continue
|
|
if ok == 0:
|
|
@@ -1151,8 +1154,10 @@ if not LINUX:
|
|
if SOLARIS:
|
|
dest,mask,gw,netif,mxfrg,rtt,ref,flg = l.split()[:8]
|
|
else:
|
|
- if mtu_present:
|
|
- dest,gw,flg,ref,use,mtu,netif = l.split()[:7]
|
|
+ if prio_present:
|
|
+ dest,gw,flg,ref,use,mtu,prio,netif = l.split()[:8]
|
|
+ elif mtu_present:
|
|
+ dest,gw,flg,ref,use,mtu,netif = l.split(None, 6)[:7]
|
|
else:
|
|
dest,gw,flg,ref,use,netif = l.split()[:6]
|
|
if flg.find("Lc") >= 0:
|
|
@@ -1172,6 +1177,8 @@ if not LINUX:
|
|
dest, = struct.unpack("I",inet_aton(dest))
|
|
if not "G" in flg:
|
|
gw = '0.0.0.0'
|
|
+ if 'L' in netif:
|
|
+ _,netif = netif.split()
|
|
ifaddr = get_if_addr(netif)
|
|
routes.append((dest,netmask,gw,netif,ifaddr))
|
|
f.close()
|
|
@@ -9847,7 +9854,8 @@ class PcapWriter:
|
|
"""
|
|
|
|
if self.header_done == 0:
|
|
- if self.linktype == None:
|
|
+ linktype = self.linktype
|
|
+ if linktype == None:
|
|
if isinstance(pkt,Packet):
|
|
linktype = LLNumTypes.get(pkt.__class__,1)
|
|
else:
|
|
@@ -12190,4 +12198,5 @@ def read_config_file(configfile):
|
|
if __name__ == "__main__":
|
|
interact()
|
|
else:
|
|
- read_config_file(DEFAULT_CONFIG_FILE)
|
|
+ if DEFAULT_CONFIG_FILE:
|
|
+ read_config_file(DEFAULT_CONFIG_FILE)
|