55 lines
2.2 KiB
Plaintext
55 lines
2.2 KiB
Plaintext
$OpenBSD: patch-scapy_layers_l2_py,v 1.3 2019/04/24 20:33:53 bluhm Exp $
|
|
|
|
https://github.com/secdev/scapy/commit/37e5cf1aae3f78bb75f768fca2a1d4594ff01a2a
|
|
https://github.com/secdev/scapy/commit/b65e795c62accd383e1bb6b17cd9f7a9143ae117
|
|
|
|
Index: scapy/layers/l2.py
|
|
--- scapy/layers/l2.py.orig
|
|
+++ scapy/layers/l2.py
|
|
@@ -25,9 +25,9 @@ from scapy.data import ARPHDR_ETHER, ARPHDR_LOOPBACK,
|
|
ETHER_BROADCAST, ETHER_TYPES, ETH_P_ARP, ETH_P_MACSEC
|
|
from scapy.error import warning
|
|
from scapy.fields import BCDFloatField, BitField, ByteField, \
|
|
- ConditionalField, EnumField, FieldLenField, IntField, IP6Field, IPField, \
|
|
- LenField, MACField, MultipleTypeField, ShortEnumField, ShortField, \
|
|
- SourceIP6Field, SourceIPField, StrFixedLenField, StrLenField, \
|
|
+ ConditionalField, FieldLenField, IntEnumField, IntField, IP6Field, \
|
|
+ IPField, LenField, MACField, MultipleTypeField, ShortEnumField, \
|
|
+ ShortField, SourceIP6Field, SourceIPField, StrFixedLenField, StrLenField, \
|
|
X3BytesField, XByteField, XIntField, XShortEnumField, XShortField
|
|
from scapy.modules.six import viewitems
|
|
from scapy.packet import bind_layers, Packet
|
|
@@ -128,8 +128,7 @@ class SourceMACField(MACField):
|
|
|
|
def __init__(self, name, getif=None):
|
|
MACField.__init__(self, name, None)
|
|
- self.getif = ((lambda pkt: pkt.payload.route()[0])
|
|
- if getif is None else getif)
|
|
+ self.getif = (lambda pkt: pkt.route()[0]) if getif is None else getif
|
|
|
|
def i2h(self, pkt, x):
|
|
if x is None:
|
|
@@ -497,9 +496,7 @@ class GRE_PPTP(GRE):
|
|
|
|
# *BSD loopback layer
|
|
|
|
-class LoIntEnumField(EnumField):
|
|
- def __init__(self, name, default, enum):
|
|
- EnumField.__init__(self, name, default, enum, "!I")
|
|
+class LoIntEnumField(IntEnumField):
|
|
|
|
def m2i(self, pkt, x):
|
|
return x >> 24
|
|
@@ -521,7 +518,10 @@ class Loopback(Packet):
|
|
"""*BSD loopback layer"""
|
|
|
|
name = "Loopback"
|
|
- fields_desc = [LoIntEnumField("type", 0x2, LOOPBACK_TYPES)]
|
|
+ if consts.OPENBSD:
|
|
+ fields_desc = [IntEnumField("type", 0x2, LOOPBACK_TYPES)]
|
|
+ else:
|
|
+ fields_desc = [LoIntEnumField("type", 0x2, LOOPBACK_TYPES)]
|
|
__slots__ = ["_defrag_pos"]
|
|
|
|
|