Skip to main content

Module lldp

Module lldp 

Source
Available on crate feature lldp only.
Expand description

LLDP parser (IEEE 802.1AB-2016, EtherType 0x88cc).

Gated by the lldp feature. LLDP is the vendor-neutral L2 discovery protocol — every modern switch / router / IP-phone / printer / IPMI BMC broadcasts identity + capabilities on its directly-connected links. It’s the L2 sibling of crate::arp / crate::ndp for infrastructure-device asset discovery, in contrast to crate::dhcp which sees client-side bindings.

§Operational signals

  • Asset discovery: chassis-ID + port-ID + system-name + management-address from a switch’s LLDPDU reconstructs cable maps without logging in to the switch.
  • Rogue-switch detection: an LLDPDU on a port where one isn’t expected (or with a system-name that doesn’t match the asset register) is a high-confidence MITM / VLAN- hopping IOC.
  • Shutdown announces: ttl_seconds == 0 is the “purge my entry” marker (IEEE 802.1AB §8.5.5); forged shutdown announces are a DoS signal.

§Wire shape

  • parse — pure LLDPDU payload (after the 01:80:c2:..:..:.. Ethernet header). Use this when you’ve already routed by destination MAC + EtherType.
  • parse_frame — full Ethernet frame (strips one optional 802.1Q tag and validates dst MAC + EtherType 0x88cc).
  • LldpParser — stateless marker for consumers wiring up slots / event hooks.

Issue #23 (0.18).

Structs§

CapabilityBits
IEEE 802.1AB system-capability bit vocabulary.
LldpManagementAddress
Management Address TLV (type 8). Often the device’s management-plane IP — useful for asset discovery.
LldpMessage
One parsed LLDPDU. The three mandatory TLVs (chassis-ID, port-ID, TTL) are always populated; everything else is optional.
LldpParser
Stateless LLDP “parser” tag — provided so consumers wiring up lldp slots / event hooks can pass it as a marker.
LldpVendorTlv
Organizationally Specific TLV (type 127). OUI identifies the standards body (00-80-c2 = IEEE 802.1, 00-12-0f = IEEE 802.3, 00-12-bb = TIA LLDP-MED, 00-01-42 = Cisco).
SystemCapabilities
System Capabilities TLV. Each field is a bitmask of CapabilityBits.

Enums§

ChassisId
Chassis ID TLV value. Subtypes per IEEE 802.1AB §8.5.2.2.
ParseError
Failure mode for the parse* functions (issue #85).
PortId
Port ID TLV value. Subtypes per IEEE 802.1AB §8.5.3.2.

Constants§

LLDP_ETHERTYPE
EtherType for LLDP.

Functions§

parse
Parse an LLDP payload (no Ethernet header).
parse_frame
Parse an Ethernet frame whose EtherType is 0x88cc (LLDP), destined for an IEEE-reserved LLDP multicast.