Sync scapy with route(8) output now that we support priorities.

Initial report and testing from Tim Donahue <tdonahue at vonsystems
dot com> (and subsequent poke from sthen); thanks!

ok sthen@
This commit is contained in:
wcmaier 2008-06-12 12:46:05 +00:00
parent 960b2df8de
commit 2ab389682e
2 changed files with 33 additions and 10 deletions

View File

@ -1,9 +1,9 @@
# $OpenBSD: Makefile,v 1.7 2007/10/08 08:22:42 steven Exp $
# $OpenBSD: Makefile,v 1.8 2008/06/12 12:46:05 wcmaier Exp $
COMMENT= powerful interactive packet manipulation in python
DISTNAME= scapy-1.1.1
PKGNAME= ${DISTNAME}p1
PKGNAME= ${DISTNAME}p2
CATEGORIES= net
HOMEPAGE= http://secdev.org/projects/scapy/

View File

@ -1,16 +1,39 @@
$OpenBSD: patch-scapy_py,v 1.1 2007/05/05 14:23:18 claudio Exp $
--- scapy.py.orig Mon Apr 9 15:17:35 2007
+++ scapy.py Sat May 5 15:59:19 2007
@@ -1152,7 +1152,7 @@ if not LINUX:
$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:
- 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 +1172,8 @@ if not LINUX:
@@ -1172,6 +1177,8 @@ if not LINUX:
dest, = struct.unpack("I",inet_aton(dest))
if not "G" in flg:
gw = '0.0.0.0'
@ -19,7 +42,7 @@ $OpenBSD: patch-scapy_py,v 1.1 2007/05/05 14:23:18 claudio Exp $
ifaddr = get_if_addr(netif)
routes.append((dest,netmask,gw,netif,ifaddr))
f.close()
@@ -9847,7 +9849,8 @@ class PcapWriter:
@@ -9847,7 +9854,8 @@ class PcapWriter:
"""
if self.header_done == 0:
@ -29,7 +52,7 @@ $OpenBSD: patch-scapy_py,v 1.1 2007/05/05 14:23:18 claudio Exp $
if isinstance(pkt,Packet):
linktype = LLNumTypes.get(pkt.__class__,1)
else:
@@ -12190,4 +12193,5 @@ def read_config_file(configfile):
@@ -12190,4 +12198,5 @@ def read_config_file(configfile):
if __name__ == "__main__":
interact()
else: