From eb601240981a02f1baf0d52808503293382f8450 Mon Sep 17 00:00:00 2001 From: Filip Varga Date: Wed, 31 Oct 2018 07:58:05 +0100 Subject: cdp scapy protocol & cdp unit tests Change-Id: Ieb362523f81f7ae3e1a9dceb341c499ff1f402c8 Signed-off-by: Filip Varga --- test/patches/scapy-2.4/cdp.patch | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 test/patches/scapy-2.4/cdp.patch (limited to 'test/patches/scapy-2.4/cdp.patch') diff --git a/test/patches/scapy-2.4/cdp.patch b/test/patches/scapy-2.4/cdp.patch new file mode 100644 index 00000000000..324891500d5 --- /dev/null +++ b/test/patches/scapy-2.4/cdp.patch @@ -0,0 +1,24 @@ +diff --git a/scapy/contrib/cdp.py b/scapy/contrib/cdp.py +index c8b7f106..7b1ff64d 100644 +--- a/scapy/contrib/cdp.py ++++ b/scapy/contrib/cdp.py +@@ -102,7 +102,8 @@ def _CDPGuessPayloadClass(p, **kargs): + class CDPMsgGeneric(Packet): + name = "CDP Generic Message" + fields_desc = [ XShortEnumField("type", None, _cdp_tlv_types), +- FieldLenField("len", None, "val", "!H"), ++ FieldLenField("len", None, "val", "!H", ++ adjust=lambda pkt, x: x + 4), + StrLenField("val", "", length_from=lambda x:x.len - 4) ] + + +@@ -178,7 +179,8 @@ class CDPMsgAddr(CDPMsgGeneric): + class CDPMsgPortID(CDPMsgGeneric): + name = "Port ID" + fields_desc = [ XShortEnumField("type", 0x0003, _cdp_tlv_types), +- FieldLenField("len", None, "iface", "!H"), ++ FieldLenField("len", None, "iface", "!H", ++ adjust=lambda pkt, x: x + 4), + StrLenField("iface", "Port 1", length_from=lambda x:x.len - 4) ] + + -- cgit 1.2.3-korg