A list of some type should have type "struct ovs_list", not some other
type that encapsulates it.

Signed-off-by: Ben Pfaff <b...@nicira.com>
---
 lib/lldp/lldp.c          | 6 +++---
 lib/lldp/lldpd-structs.c | 7 ++-----
 lib/lldp/lldpd-structs.h | 2 +-
 lib/lldp/lldpd.c         | 9 +++------
 lib/ovs-lldp.c           | 4 ++--
 5 files changed, 11 insertions(+), 17 deletions(-)

diff --git a/lib/lldp/lldp.c b/lib/lldp/lldp.c
index cb3fbbc..2bd7d48 100644
--- a/lib/lldp/lldp.c
+++ b/lib/lldp/lldp.c
@@ -206,7 +206,7 @@ lldp_send(struct lldpd *global OVS_UNUSED,
     lldp_tlv_put_u16(p, chassis->c_cap_enabled);
     lldp_tlv_end(p, start);
 
-    LIST_FOR_EACH (mgmt, m_entries, &chassis->c_mgmt.m_entries) {
+    LIST_FOR_EACH (mgmt, m_entries, &chassis->c_mgmt) {
         lldp_tlv_start(p, LLDP_TLV_MGMT_ADDR, &start);
         lldp_tlv_put_u8(p, mgmt->m_addrsize + 1);
         lldp_tlv_put_u8(p, lldpd_af_to_lldp_proto(mgmt->m_family));
@@ -352,7 +352,7 @@ lldp_decode(struct lldpd *cfg OVS_UNUSED, char *frame, int 
s,
     VLOG_DBG("receive LLDP PDU on %s", hardware->h_ifname);
 
     chassis = xzalloc(sizeof *chassis);
-    list_init(&chassis->c_mgmt.m_entries);
+    list_init(&chassis->c_mgmt);
 
     port = xzalloc(sizeof *port);
     list_init(&port->p_isid_vlan_maps);
@@ -480,7 +480,7 @@ lldp_decode(struct lldpd *cfg OVS_UNUSED, char *frame, int 
s,
                 VLOG_WARN("unable to allocate memory for management address");
                 goto malformed;
             }
-            list_push_back(&chassis->c_mgmt.m_entries, &mgmt->m_entries);
+            list_push_back(&chassis->c_mgmt, &mgmt->m_entries);
             break;
 
         case LLDP_TLV_ORG:
diff --git a/lib/lldp/lldpd-structs.c b/lib/lldp/lldpd-structs.c
index 33598b4..d440df9 100644
--- a/lib/lldp/lldpd-structs.c
+++ b/lib/lldp/lldpd-structs.c
@@ -32,15 +32,12 @@ lldpd_chassis_mgmt_cleanup(struct lldpd_chassis *chassis)
     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_FOR_EACH_SAFE (mgmt, mgmt_next, m_entries, &chassis->c_mgmt) {
        list_remove(&mgmt->m_entries);
        free(mgmt);
     }
 
-    list_init(&chassis->c_mgmt.m_entries);
+    list_init(&chassis->c_mgmt);
 }
 
 void
diff --git a/lib/lldp/lldpd-structs.h b/lib/lldp/lldpd-structs.h
index 5d33561..1ea2225 100644
--- a/lib/lldp/lldpd-structs.h
+++ b/lib/lldp/lldpd-structs.h
@@ -76,7 +76,7 @@ struct lldpd_chassis {
 
     u_int16_t       c_ttl;
 
-    struct lldpd_mgmt  c_mgmt;
+    struct ovs_list c_mgmt;     /* Contains "struct lldp_mgmt"s. */
 };
 /* WARNING: any change to this structure should also be reflected into
    `lldpd_copy_chassis()` which is not using marshaling. */
diff --git a/lib/lldp/lldpd.c b/lib/lldp/lldpd.c
index f35ea44..03d58fd 100644
--- a/lib/lldp/lldpd.c
+++ b/lib/lldp/lldpd.c
@@ -180,15 +180,12 @@ lldpd_move_chassis(struct lldpd_chassis *ochassis,
      * marshaling.
      */
     memcpy(ochassis, chassis, sizeof *ochassis);
-    list_init(&ochassis->c_mgmt.m_entries);
+    list_init(&ochassis->c_mgmt);
 
     /* Copy of management addresses */
-    LIST_FOR_EACH_SAFE (mgmt,
-                        mgmt_next,
-                        m_entries,
-                        &chassis->c_mgmt.m_entries) {
+    LIST_FOR_EACH_SAFE (mgmt, mgmt_next, m_entries, &chassis->c_mgmt) {
         list_remove(&mgmt->m_entries);
-        list_insert(&ochassis->c_mgmt.m_entries, &mgmt->m_entries);
+        list_insert(&ochassis->c_mgmt, &mgmt->m_entries);
     }
 
     /* Restore saved values */
diff --git a/lib/ovs-lldp.c b/lib/ovs-lldp.c
index cae2a2e..23dd46e 100644
--- a/lib/ovs-lldp.c
+++ b/lib/ovs-lldp.c
@@ -824,7 +824,7 @@ lldp_create(const struct netdev *netdev,
     lchassis->c_id = xmalloc(ETH_ADDR_LEN);
     netdev_get_etheraddr(netdev, (uint8_t *) lchassis->c_id);
 
-    list_init(&lchassis->c_mgmt.m_entries);
+    list_init(&lchassis->c_mgmt);
     lchassis->c_ttl = lldp->lldpd->g_config.c_tx_interval *
                       lldp->lldpd->g_config.c_tx_hold;
     lchassis->c_ttl = LLDP_CHASSIS_TTL;
@@ -921,7 +921,7 @@ lldp_create_dummy(void)
     lchassis->c_id_len = ETH_ADDR_LEN;
     lchassis->c_id = xmalloc(ETH_ADDR_LEN);
 
-    list_init(&lchassis->c_mgmt.m_entries);
+    list_init(&lchassis->c_mgmt);
     lchassis->c_ttl = LLDP_CHASSIS_TTL;
     lldpd_assign_cfg_to_protocols(lldp->lldpd);
     list_init(&lldp->lldpd->g_chassis.list);
-- 
2.1.3

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to