void
lldpd_chassis_mgmt_cleanup(struct lldpd_chassis *chassis)
{
- struct lldpd_mgmt *mgmt, *mgmt_next;
+ struct lldpd_mgmt *mgmt;
VLOG_DBG("cleanup management addresses for chassis %s",
chassis->c_name ? chassis->c_name : "(unknown)");
- LIST_FOR_EACH_SAFE (mgmt,
- mgmt_next,
- m_entries,
- &chassis->c_mgmt.m_entries) {
- list_remove(&mgmt->m_entries);
+ LIST_FOR_EACH_POP (mgmt, m_entries, &chassis->c_mgmt) {
free(mgmt);
}
- list_init(&chassis->c_mgmt.m_entries);
+ list_init(&chassis->c_mgmt);
}
void
{
lldpd_chassis_mgmt_cleanup(chassis);
VLOG_DBG("cleanup chassis %s",
- chassis->c_name ? chassis->c_name : "(unkwnon)");
+ chassis->c_name ? chassis->c_name : "(unknown)");
free(chassis->c_id);
free(chassis->c_name);
free(chassis->c_descr);
time_t now = time_now();
VLOG_DBG("cleanup remote port on %s", hw->h_ifname);
- LIST_FOR_EACH_SAFE (port, port_next, p_entries, &hw->h_rports.p_entries) {
+ LIST_FOR_EACH_SAFE (port, port_next, p_entries, &hw->h_rports) {
bool del = all;
if (!all && expire &&
(now >= port->p_lastupdate + port->p_chassis->c_ttl)) {
}
}
if (all) {
- list_init(&hw->h_rports.p_entries);
+ list_init(&hw->h_rports);
+ }
+}
+
+/* Cleanup the auto-attach mappings attached to port.
+ */
+static void
+lldpd_aa_maps_cleanup(struct lldpd_port *port)
+{
+ struct lldpd_aa_isid_vlan_maps_tlv *isid_vlan_map = NULL;
+ struct lldpd_aa_isid_vlan_maps_tlv *isid_vlan_map_next = NULL;
+
+ if (!list_is_empty(&port->p_isid_vlan_maps)) {
+
+ LIST_FOR_EACH_SAFE (isid_vlan_map, isid_vlan_map_next, m_entries,
+ &port->p_isid_vlan_maps) {
+
+ list_remove(&isid_vlan_map->m_entries);
+ free(isid_vlan_map);
+ }
+
+ list_init(&port->p_isid_vlan_maps);
}
}
lldpd_port_cleanup(struct lldpd_port *port, bool all)
{
/* We set these to NULL so we don't free wrong memory */
-
free(port->p_id);
port->p_id = NULL;
free(port->p_descr);
port->p_descr = NULL;
+
+ /* Cleanup auto-attach mappings */
+ lldpd_aa_maps_cleanup(port);
+
if (all) {
free(port->p_lastframe);
/* Chassis may not have been attributed, yet.*/