Filip Varga | eb60124 | 2018-10-31 07:58:05 +0100 | [diff] [blame] | 1 | diff --git a/scapy/contrib/cdp.py b/scapy/contrib/cdp.py |
| 2 | index c8b7f106..7b1ff64d 100644 |
| 3 | --- a/scapy/contrib/cdp.py |
| 4 | +++ b/scapy/contrib/cdp.py |
| 5 | @@ -102,7 +102,8 @@ def _CDPGuessPayloadClass(p, **kargs): |
| 6 | class CDPMsgGeneric(Packet): |
| 7 | name = "CDP Generic Message" |
| 8 | fields_desc = [ XShortEnumField("type", None, _cdp_tlv_types), |
| 9 | - FieldLenField("len", None, "val", "!H"), |
| 10 | + FieldLenField("len", None, "val", "!H", |
| 11 | + adjust=lambda pkt, x: x + 4), |
| 12 | StrLenField("val", "", length_from=lambda x:x.len - 4) ] |
| 13 | |
| 14 | |
| 15 | @@ -178,7 +179,8 @@ class CDPMsgAddr(CDPMsgGeneric): |
| 16 | class CDPMsgPortID(CDPMsgGeneric): |
| 17 | name = "Port ID" |
| 18 | fields_desc = [ XShortEnumField("type", 0x0003, _cdp_tlv_types), |
| 19 | - FieldLenField("len", None, "iface", "!H"), |
| 20 | + FieldLenField("len", None, "iface", "!H", |
| 21 | + adjust=lambda pkt, x: x + 4), |
| 22 | StrLenField("iface", "Port 1", length_from=lambda x:x.len - 4) ] |
| 23 | |
| 24 | |