On Thu, Apr 26, 2007 at 06:16:35PM +0200, Claudio Jeker wrote:
> This diff brings the scapy port to the newest version.
> This is needed to make scapy6 work -- I'll create a port for that too.
> 
> I had to fix a few issues -- grrr grumble. Lesson to learn: never try to
> parse netstat output assuming that you can simply split it to seven
> fields! Locked MTU entries add a 8 field and interfaces with the name 'L'
> will not work on OpenBSD. Took me about 1-2 hours of head scratching to
> understand why scapy suddenly crashed on startup.
> 
> Before aplying the diff you need to "mkdir patches"

This is an updated version that fixes a obvious programming error in the
PcapWriter module.

-- 
:wq Claudio

Index: Makefile
===================================================================
RCS file: /cvs/ports/net/scapy/Makefile,v
retrieving revision 1.2
diff -u -p -r1.2 Makefile
--- Makefile    3 Jun 2006 09:43:03 -0000       1.2
+++ Makefile    25 Apr 2007 22:16:34 -0000
@@ -2,8 +2,7 @@
 
 COMMENT=       "powerful interactive packet manipulation in python"
 
-DISTNAME=      scapy-1.0.4
-PKGNAME=       ${DISTNAME}p0
+DISTNAME=      scapy-1.1.1
 CATEGORIES=    net
 
 HOMEPAGE=      http://secdev.org/projects/scapy/
@@ -30,7 +29,6 @@ PKG_ARCH=     *
 NO_REGRESS=    Yes
 
 do-build:
-       gunzip < ${WRKSRC}/scapy.1.gz > ${WRKBUILD}/scapy.1
        perl -p -i -e "s,^(\#\S+ \S+ )python\$$,#!${MODPY_BIN}," \
                ${WRKSRC}/*.py
        perl -p -i -e "s,/etc/ethertypes,${SYSCONFDIR}/ethertypes,g" \
Index: distinfo
===================================================================
RCS file: /cvs/ports/net/scapy/distinfo,v
retrieving revision 1.2
diff -u -p -r1.2 distinfo
--- distinfo    5 Apr 2007 16:20:15 -0000       1.2
+++ distinfo    25 Apr 2007 22:15:40 -0000
@@ -1,10 +1,10 @@
 MD5 (ethertypes) = lL/96PdaG4+JH7eAv+Fcog==
-MD5 (scapy-1.0.4.tar.gz) = wVZmjPq0wf3idvgeC4W12Q==
+MD5 (scapy-1.1.1.tar.gz) = iscgob6kMEeXxxPvHtBj8Q==
 RMD160 (ethertypes) = KWuI/tkRslOYtfZXzWu1yR5y4og=
-RMD160 (scapy-1.0.4.tar.gz) = JhhUgEL2Ww0CRhYj/s6T1MJYiVk=
+RMD160 (scapy-1.1.1.tar.gz) = IL2x6lmgX0UqUV5DjiMOHYW4EBY=
 SHA1 (ethertypes) = btD+JEZmaHbXe4lx/Y7fSVqcC+M=
-SHA1 (scapy-1.0.4.tar.gz) = q+fMJCr08g7wFlV4AOLlIcLhShs=
+SHA1 (scapy-1.1.1.tar.gz) = hw2o5uKoeGsDoAVfwswdExfzCOQ=
 SHA256 (ethertypes) = 4UAHHkYt+Kq597Y6OWW/IGeX7Lz/M0o+xJQlbe/jXcs=
-SHA256 (scapy-1.0.4.tar.gz) = NAvrsmu/jLN728+3uN+SJa04Sgs/CzO1XKC4umyaOwI=
+SHA256 (scapy-1.1.1.tar.gz) = KhG6BfNLKXivOt1iOmQeA0DTkyK0yivSa6rnQ8eN6VY=
 SIZE (ethertypes) = 1317
-SIZE (scapy-1.0.4.tar.gz) = 132677
+SIZE (scapy-1.1.1.tar.gz) = 147401
--- /dev/null   Fri Apr 27 11:24:24 2007
+++ patches/patch-scapy_py      Thu Apr 26 23:15:05 2007
@@ -0,0 +1,38 @@
+$OpenBSD$
+--- scapy.py.orig      Mon Apr  9 15:17:35 2007
++++ scapy.py   Thu Apr 26 23:14:39 2007
+@@ -1152,7 +1152,7 @@ if not LINUX:
+                 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]
++                    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:
+                 dest, = struct.unpack("I",inet_aton(dest))
+             if not "G" in flg:
+                 gw = '0.0.0.0'
++            if netif.find("L") >= 0:
++              dummy,netif = netif.split()
+             ifaddr = get_if_addr(netif)
+             routes.append((dest,netmask,gw,netif,ifaddr))
+         f.close()
+@@ -9847,7 +9849,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 +12193,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)

Reply via email to