diff options
author | snaramre <snaramre@cisco.com> | 2019-12-13 23:39:35 +0000 |
---|---|---|
committer | Paul Vinciguerra <pvinci@vinciconsulting.com> | 2019-12-14 22:14:12 +0000 |
commit | 5d4b8912d2fe186b4fb920a72b3a2f7b556f4e7d (patch) | |
tree | 4530f71a783679e3566ed501471cbad481c128d7 /test/patches/scapy-2.4.3/cdp.patch | |
parent | aa72578637e2a346ee845545b2e26aad83e12192 (diff) |
tests: changes for scapy 2.4.3 migration
Type: fix
Change-Id: I7e041b666dabd90df23a920a1f1d99db4c10ddfe
Signed-off-by: snaramre <snaramre@cisco.com>
Diffstat (limited to 'test/patches/scapy-2.4.3/cdp.patch')
-rw-r--r-- | test/patches/scapy-2.4.3/cdp.patch | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test/patches/scapy-2.4.3/cdp.patch b/test/patches/scapy-2.4.3/cdp.patch new file mode 100644 index 00000000000..de16f5d5079 --- /dev/null +++ b/test/patches/scapy-2.4.3/cdp.patch @@ -0,0 +1,31 @@ +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,5 +179,6 @@ 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) ] +@@ -319,7 +319,7 @@ class _CDPChecksum: + This padding is only used for checksum computation. The original + packet should not be altered.""" + if len(pkt) % 2: +- last_chr = pkt[-1] ++ last_chr = pkt[len(pkt)-1:] + if last_chr <= b'\x80': + return pkt[:-1] + b'\x00' + last_chr + else: |