From 03f781f7e106185c3a8a9bbadce60b87e8282720 Mon Sep 17 00:00:00 2001 From: Siyuan Date: Thu, 6 Nov 2025 15:52:37 +0000 Subject: [PATCH] chore: skip TLV end check for LLDP shutdown frame --- internal/lldp/rx.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/lldp/rx.go b/internal/lldp/rx.go index fbb38b4e..7ccb1033 100644 --- a/internal/lldp/rx.go +++ b/internal/lldp/rx.go @@ -248,14 +248,11 @@ func (l *LLDP) handlePacketLLDP(mac string, raw *layers.LinkLayerDiscovery, info Source: "lldp", Mac: mac, } - gotEnd := false ttl := lldpDefaultTTL for _, v := range raw.Values { switch v.Type { - case layers.LLDPTLVEnd: - gotEnd = true case layers.LLDPTLVChassisID: n.ChassisID = string(raw.ChassisID.ID) n.Values["chassis_id"] = n.ChassisID @@ -292,7 +289,10 @@ func (l *LLDP) handlePacketLLDP(mac string, raw *layers.LinkLayerDiscovery, info } } - if gotEnd || ttl < 1*time.Second { + // delete the neighbor if the TTL is less than 1 second + // LLDP shutdown frame should have a TTL of 0 and contains mandatory TLVs only + // but we will simply ignore the TLVs check for now + if ttl < 1*time.Second { l.deleteNeighbor(n) } else { l.addNeighbor(n, ttl)