This member is typically an Ethernet address so the appropriate type is uint8_t, not char. This eliminates a couple of casts.
Signed-off-by: Ben Pfaff <b...@nicira.com> --- lib/lldp/lldp.c | 2 +- lib/lldp/lldpd-structs.h | 2 +- lib/ovs-lldp.c | 4 ++-- tests/test-aa.c | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/lldp/lldp.c b/lib/lldp/lldp.c index 2bd7d48..2b8de0e 100644 --- a/lib/lldp/lldp.c +++ b/lib/lldp/lldp.c @@ -341,7 +341,7 @@ lldp_decode(struct lldpd *cfg OVS_UNUSED, char *frame, int s, bool ttl_received = false; int tlv_size, tlv_type, tlv_subtype; u_int8_t *pos, *tlv; - char *b; + void *b; struct lldpd_aa_isid_vlan_maps_tlv *isid_vlan_map = NULL; u_int8_t msg_auth_digest[LLDP_TLV_AA_ISID_VLAN_DIGEST_LENGTH]; struct lldpd_mgmt *mgmt; diff --git a/lib/lldp/lldpd-structs.h b/lib/lldp/lldpd-structs.h index 64ca093..f38969b 100644 --- a/lib/lldp/lldpd-structs.h +++ b/lib/lldp/lldpd-structs.h @@ -66,7 +66,7 @@ struct lldpd_chassis { u_int16_t c_index; /* Monotonic index */ u_int8_t c_protocol; /* Protocol used to get this chassis */ u_int8_t c_id_subtype; - char *c_id; + uint8_t *c_id; /* Typically an Ethernet address. */ int c_id_len; char *c_name; char *c_descr; diff --git a/lib/ovs-lldp.c b/lib/ovs-lldp.c index 446386a..68e8c24 100644 --- a/lib/ovs-lldp.c +++ b/lib/ovs-lldp.c @@ -207,7 +207,7 @@ aa_print_element_status_port(struct ds *ds, struct lldpd_hardware *hw) if (port->p_chassis) { if (port->p_chassis->c_id_len > 0) { - chassisid_to_string((uint8_t *) port->p_chassis->c_id, + chassisid_to_string(port->p_chassis->c_id, port->p_chassis->c_id_len, &id); } @@ -808,7 +808,7 @@ lldp_create(const struct netdev *netdev, lchassis->c_id_subtype = LLDP_CHASSISID_SUBTYPE_LLADDR; lchassis->c_id_len = ETH_ADDR_LEN; lchassis->c_id = xmalloc(ETH_ADDR_LEN); - netdev_get_etheraddr(netdev, (uint8_t *) lchassis->c_id); + netdev_get_etheraddr(netdev, lchassis->c_id); list_init(&lchassis->c_mgmt); lchassis->c_ttl = lldp->lldpd->g_config.c_tx_interval * diff --git a/tests/test-aa.c b/tests/test-aa.c index 09d137c..95a5d0d 100644 --- a/tests/test-aa.c +++ b/tests/test-aa.c @@ -26,7 +26,7 @@ #define ETH_TYPE_LLDP 0x88cc /* Dummy MAC addresses */ -static char chassis_mac[ETH_ADDR_LEN] = { 0x5e, 0x10, 0x8e, 0xe7, 0x84, 0xad }; +static uint8_t chassis_mac[ETH_ADDR_LEN] = { 0x5e, 0x10, 0x8e, 0xe7, 0x84, 0xad }; static uint8_t eth_src[ETH_ADDR_LEN] = { 0x5e, 0x10, 0x8e, 0xe7, 0x84, 0xad }; /* LLDP multicast address */ @@ -61,7 +61,7 @@ check_received_chassis(struct lldpd_chassis *schassis, { assert(rchassis->c_id_subtype == schassis->c_id_subtype); assert(rchassis->c_id_len == schassis->c_id_len); - assert(strncmp(rchassis->c_id, schassis->c_id, schassis->c_id_len) == 0); + assert(memcmp(rchassis->c_id, schassis->c_id, schassis->c_id_len) == 0); assert(strcmp(rchassis->c_name, schassis->c_name) == 0); assert(strcmp(rchassis->c_descr, schassis->c_descr) == 0); assert(rchassis->c_cap_available == schassis->c_cap_available); -- 2.1.3 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev