]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
daemon/edp: dedup management addresses against the destination list
authorVincent Bernat <vincent@bernat.ch>
Sat, 9 May 2026 13:02:38 +0000 (15:02 +0200)
committerVincent Bernat <vincent@bernat.ch>
Sat, 9 May 2026 13:26:12 +0000 (15:26 +0200)
When merging VLAN-only EDP frames into an existing port, the dedup
loop searched chassis->c_mgmt — the source we were draining — instead
of oport->p_chassis->c_mgmt where the entries were about to be
inserted. The check could therefore never fire and duplicates
accumulated on the destination chassis. Free duplicates that the
destination already has.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
src/daemon/protocols/edp.c

index 773d210653f6f9203bbe29532c91ac6468f78faa..6107e4dbdea6d62673192d5e73e0a35193783dd9 100644 (file)
@@ -476,7 +476,8 @@ edp_decode(struct lldpd *cfg, char *frame, int s, struct lldpd_hardware *hardwar
                                        mgmt_next = TAILQ_NEXT(mgmt, m_entries);
                                        TAILQ_REMOVE(&chassis->c_mgmt, mgmt, m_entries);
                                        /* Don't add an address that already exists! */
-                                       TAILQ_FOREACH (m, &chassis->c_mgmt, m_entries)
+                                       TAILQ_FOREACH (m, &oport->p_chassis->c_mgmt,
+                                           m_entries)
                                                if (m->m_family == mgmt->m_family &&
                                                    !memcmp(&m->m_addr, &mgmt->m_addr,
                                                        sizeof(m->m_addr)))
@@ -485,6 +486,8 @@ edp_decode(struct lldpd *cfg, char *frame, int s, struct lldpd_hardware *hardwar
                                                TAILQ_INSERT_TAIL(
                                                    &oport->p_chassis->c_mgmt, mgmt,
                                                    m_entries);
+                                       else
+                                               free(mgmt);
                                }
                        }
                        /* We discard the remaining frame */