mirror of https://github.com/secdev/scapy.git
Improve CDPMsgIPPrefix : allow more than one IP address (#4585)
* Update cdp.py for CDPIPPrefix if the length of IP addresses prefixes was more than one address all the following content wasn't interpreted (Raw payload). This seams to fix it * Update cdp.py A better approach with a list rather than packets * Update cdp.py case error on Prefix * Fix PEP8 formatting * Rename IPPrefix -> CDPPrefix --------- Co-authored-by: gpotter2 <10530980+gpotter2@users.noreply.github.com>
This commit is contained in:
parent
8e08cbf759
commit
680107d30f
|
@ -250,13 +250,23 @@ class CDPMsgIPGateway(CDPMsgGeneric):
|
|||
IPField("defaultgw", "192.168.0.1")]
|
||||
|
||||
|
||||
class CDPIPPrefix(Packet):
|
||||
fields_desc = [
|
||||
IPField("prefix", "192.168.0.1"),
|
||||
ByteField("plen", 24),
|
||||
]
|
||||
|
||||
def guess_payload_class(self, p):
|
||||
return conf.padding_layer
|
||||
|
||||
|
||||
class CDPMsgIPPrefix(CDPMsgGeneric):
|
||||
name = "IP Prefix"
|
||||
type = 0x0007
|
||||
fields_desc = [XShortEnumField("type", 0x0007, _cdp_tlv_types),
|
||||
ShortField("len", 9),
|
||||
IPField("prefix", "192.168.0.1"),
|
||||
ByteField("plen", 24)]
|
||||
PacketListField("prefixes", [], CDPIPPrefix,
|
||||
length_from=lambda p: p.len - 4)]
|
||||
|
||||
|
||||
class CDPMsgProtoHello(CDPMsgGeneric):
|
||||
|
|
Loading…
Reference in New Issue