summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Flynn <drflynn@avaya.com>2015-06-16 17:33:35 -0400
committerBen Pfaff <blp@nicira.com>2015-06-17 07:25:58 -0700
commit86b68e90b3bf96f10da90e53872b17240f6c8271 (patch)
tree20a1fa5970637cad2fc3daa42705d27a7b3819ad
parent84072381c60d112c49ecbb634898069d682e23cb (diff)
downloadopenvswitch-86b68e90b3bf96f10da90e53872b17240f6c8271.tar.gz
auto-attach: Cleanup i-sid/vlan mappings associated with lldp-enabled port.
This commit fixes a bug where the i-sid/vlan mapping structures associated with an lldp-enabled port were not being freed during general port cleanup. Signed-off-by: Dennis Flynn <drflynn@avaya.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
-rw-r--r--lib/lldp/lldpd-structs.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/lib/lldp/lldpd-structs.c b/lib/lldp/lldpd-structs.c
index b78c2e19a..71c4f5e0b 100644
--- a/lib/lldp/lldpd-structs.c
+++ b/lib/lldp/lldpd-structs.c
@@ -93,17 +93,41 @@ lldpd_remote_cleanup(struct lldpd_hardware *hw,
}
}
+/* 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);
+ }
+}
+
/* If `all' is true, clear all information, including information that
are not refreshed periodically. Port should be freed manually. */
void
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.*/