summaryrefslogtreecommitdiffstats
path: root/test/patches
diff options
context:
space:
mode:
authorFilip Varga <fivarga@cisco.com>2018-10-31 07:58:05 +0100
committerNeale Ranns <nranns@cisco.com>2018-11-02 13:16:10 +0000
commiteb601240981a02f1baf0d52808503293382f8450 (patch)
tree2360b95705fe8d30de8ecaba75b8ff443aeca4aa /test/patches
parentcc8fa169297b0052e5a8d570eb41e5875b28561f (diff)
cdp scapy protocol & cdp unit tests
Change-Id: Ieb362523f81f7ae3e1a9dceb341c499ff1f402c8 Signed-off-by: Filip Varga <fivarga@cisco.com>
Diffstat (limited to 'test/patches')
-rw-r--r--test/patches/scapy-2.4/cdp.patch24
1 files changed, 24 insertions, 0 deletions
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) ]
+
+