From 00aa2627a871367d6614b38ee4fa39de4d02881f Mon Sep 17 00:00:00 2001 From: Lorenzo Nicolodi <lo@microlab.red> Date: Mon, 7 Aug 2017 17:34:09 +0200 Subject: [PATCH] Fix OSPF LSA list dissection --- scapy/contrib/ospf.py | 4 ++-- scapy/fields.py | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/scapy/contrib/ospf.py b/scapy/contrib/ospf.py index 8b316ca5..fe798862 100644 --- a/scapy/contrib/ospf.py +++ b/scapy/contrib/ospf.py @@ -260,7 +260,7 @@ class OSPF_Link(Packet): def _LSAGuessPayloadClass(p, **kargs): """ Guess the correct LSA class for a given payload """ # This is heavily based on scapy-cdp.py by Nicolas Bareil and Arnaud Ebalard - # XXX: This only works if all payload + cls = conf.raw_layer if len(p) >= 4: typ = struct.unpack("!B", p[3])[0] @@ -410,7 +410,7 @@ class OSPF_LSReq(Packet): class OSPF_LSUpd(Packet): name = "OSPF Link State Update" fields_desc = [FieldLenField("lsacount", None, fmt="!I", count_of="lsalist"), - PacketListField("lsalist", [], _LSAGuessPayloadClass, + PacketListField("lsalist", None, _LSAGuessPayloadClass, count_from = lambda pkt: pkt.lsacount, length_from = lambda pkt: pkt.underlayer.len - 24)] diff --git a/scapy/fields.py b/scapy/fields.py index 28ff64d9..73161055 100644 --- a/scapy/fields.py +++ b/scapy/fields.py @@ -439,7 +439,6 @@ class PacketListField(PacketField): self.count_from = count_from self.length_from = length_from - def any2i(self, pkt, x): if not isinstance(x, list): return [x] -- GitLab