Hi,

Scapy does not handle the DTL_LOOP type, that is used when sniffing
from OpenBSD loopback device.  Add a new layer for that.

ok?

bluhm


Index: net/scapy/Makefile
===================================================================
RCS file: /data/mirror/openbsd/cvs/ports/net/scapy/Makefile,v
retrieving revision 1.17
diff -u -p -r1.17 Makefile
--- net/scapy/Makefile  16 Sep 2011 11:13:40 -0000      1.17
+++ net/scapy/Makefile  11 Jan 2012 22:57:35 -0000
@@ -4,7 +4,7 @@ COMMENT=        powerful interactive packet man
 
 MODPY_EGG_VERSION=     2.1.0
 DISTNAME=              scapy-${MODPY_EGG_VERSION}
-REVISION=              1
+REVISION=              2
 
 CATEGORIES=            net
 
Index: net/scapy/patches/patch-scapy_config_py
===================================================================
RCS file: net/scapy/patches/patch-scapy_config_py
diff -N net/scapy/patches/patch-scapy_config_py
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ net/scapy/patches/patch-scapy_config_py     20 Sep 2011 21:50:06 -0000
@@ -0,0 +1,12 @@
+$OpenBSD$
+--- scapy/config.py.orig       Mon Dec 14 16:31:55 2009
++++ scapy/config.py    Tue Sep 20 23:49:47 2011
+@@ -366,7 +366,7 @@ extensions_paths: path or list of paths where extensio
+     netcache = NetCache()
+     load_layers = ["l2", "inet", "dhcp", "dns", "dot11", "gprs", "hsrp", 
"inet6", "ir", "isakmp", "l2tp",
+                    "mgcp", "mobileip", "netbios", "netflow", "ntp", "ppp", 
"radius", "rip", "rtp",
+-                   "sebek", "skinny", "smb", "snmp", "tftp", "x509", 
"bluetooth", "dhcp6", "llmnr" ]
++                   "sebek", "skinny", "smb", "snmp", "tftp", "x509", 
"bluetooth", "dhcp6", "llmnr", "loop" ]
+     
+ 
+ if not Conf.ipv6_enabled:
Index: net/scapy/patches/patch-scapy_layers_loop_py
===================================================================
RCS file: net/scapy/patches/patch-scapy_layers_loop_py
diff -N net/scapy/patches/patch-scapy_layers_loop_py
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ net/scapy/patches/patch-scapy_layers_loop_py        11 Jan 2012 23:13:12 
-0000
@@ -0,0 +1,38 @@
+$OpenBSD$
+Add layer for sniffing on OpenBSD loopback device.
+http://trac.secdev.org/scapy/ticket/485
+
+--- scapy/layers/loop.py.orig  Wed Jan 11 23:58:04 2012
++++ scapy/layers/loop.py       Thu Jan 12 00:12:21 2012
+@@ -0,0 +1,31 @@
++## This file is part of Scapy
++## See http://www.secdev.org/projects/scapy for more informations
++## Copyright (C) Alexander Bluhm <[email protected]>
++## Copyright (C) Philippe Biondi <[email protected]>
++## This program is published under a GPLv2 license
++
++import scapy.arch
++from scapy.packet import *
++from scapy.fields import *
++from scapy.layers.inet import IP
++if conf.ipv6_enabled:
++    from scapy.layers.inet6 import IPv6
++from scapy.config import conf
++
++class Loop(Packet):
++    name = "Loop"
++    # from OpenBSD src/sys/net/if_loop.c
++    fields_desc = [ IntEnumField("addrfamily", 2, { socket.AF_INET: "IPv4",
++                                                    socket.AF_INET6: "IPv6" 
}),
++                    ]
++    def mysummary(self):
++        return self.sprintf("%Loop.addrfamily%")
++
++bind_layers(Loop, IP, addrfamily=socket.AF_INET)
++if conf.ipv6_enabled:
++    bind_layers(Loop, IPv6, addrfamily=socket.AF_INET6)
++
++if scapy.arch.OPENBSD:
++    conf.l2types.register(12, Loop)
++else:
++    conf.l2types.register(108, Loop)
Index: net/scapy/pkg/PLIST
===================================================================
RCS file: /data/mirror/openbsd/cvs/ports/net/scapy/pkg/PLIST,v
retrieving revision 1.3
diff -u -p -r1.3 PLIST
--- net/scapy/pkg/PLIST 5 Oct 2010 09:18:05 -0000       1.3
+++ net/scapy/pkg/PLIST 20 Sep 2011 21:09:47 -0000
@@ -96,6 +96,8 @@ lib/python${MODPY_VERSION}/site-packages
 lib/python${MODPY_VERSION}/site-packages/scapy/layers/l2tp.pyc
 lib/python${MODPY_VERSION}/site-packages/scapy/layers/llmnr.py
 lib/python${MODPY_VERSION}/site-packages/scapy/layers/llmnr.pyc
+lib/python${MODPY_VERSION}/site-packages/scapy/layers/loop.py
+lib/python${MODPY_VERSION}/site-packages/scapy/layers/loop.pyc
 lib/python${MODPY_VERSION}/site-packages/scapy/layers/mgcp.py
 lib/python${MODPY_VERSION}/site-packages/scapy/layers/mgcp.pyc
 lib/python${MODPY_VERSION}/site-packages/scapy/layers/mobileip.py

Reply via email to