Signed-off-by: Ben Pfaff <b...@nicira.com> --- lib/lldp/lldp.c | 10 ++++++---- lib/lldp/lldpd.c | 27 ++++++++++++++------------- 2 files changed, 20 insertions(+), 17 deletions(-)
diff --git a/lib/lldp/lldp.c b/lib/lldp/lldp.c index b3c8346..7c80296 100644 --- a/lib/lldp/lldp.c +++ b/lib/lldp/lldp.c @@ -328,7 +328,9 @@ lldp_decode(struct lldpd *cfg OVS_UNUSED, char *frame, int s, const char avaya_oid[] = LLDP_TLV_ORG_AVAYA; const char dcbx[] = LLDP_TLV_ORG_DCBX; char orgid[3]; - int length, gotend = 0, ttl_received = 0, af; + int length, af; + bool gotend = false; + bool ttl_received = false; int tlv_size, tlv_type, tlv_subtype; u_int8_t *pos, *tlv; char *b; @@ -365,7 +367,7 @@ lldp_decode(struct lldpd *cfg OVS_UNUSED, char *frame, int s, goto malformed; } - while (length && (!gotend)) { + while (length && !gotend) { if (length < 2) { VLOG_WARN("tlv header too short received on %s", hardware->h_ifname); @@ -392,7 +394,7 @@ lldp_decode(struct lldpd *cfg OVS_UNUSED, char *frame, int s, VLOG_DBG("extra data after lldp end on %s", hardware->h_ifname); } - gotend = 1; + gotend = true; break; case LLDP_TLV_CHASSIS_ID: @@ -420,7 +422,7 @@ lldp_decode(struct lldpd *cfg OVS_UNUSED, char *frame, int s, case LLDP_TLV_TTL: CHECK_TLV_SIZE(2, "TTL"); chassis->c_ttl = PEEK_UINT16; - ttl_received = 1; + ttl_received = true; break; case LLDP_TLV_PORT_DESCR: diff --git a/lib/lldp/lldpd.c b/lib/lldp/lldpd.c index ff77afd..f35ea44 100644 --- a/lib/lldp/lldpd.c +++ b/lib/lldp/lldpd.c @@ -241,7 +241,7 @@ lldpd_decode(struct lldpd *cfg, char *frame, int s, int guess = LLDPD_MODE_LLDP; struct eth_header eheader; int count = 0; - int found = 0; + bool found = false; VLOG_DBG("decode a received frame on %s size %d", hw->h_ifname,s); @@ -315,7 +315,7 @@ lldpd_decode(struct lldpd *cfg, char *frame, int s, chassis->c_id_len) == 0)) { ochassis = oport->p_chassis; VLOG_DBG("MSAP is already known"); - found = 1; + found = true; break; } } @@ -344,7 +344,7 @@ lldpd_decode(struct lldpd *cfg, char *frame, int s, /* No, but do we already know the system? */ if (!oport) { - int found = 0; + bool found = false; VLOG_DBG("MSAP is unknown, search for the chassis"); LIST_FOR_EACH (ochassis, list, &cfg->g_chassis.list) { @@ -353,7 +353,7 @@ lldpd_decode(struct lldpd *cfg, char *frame, int s, (chassis->c_id_len == ochassis->c_id_len) && (memcmp(chassis->c_id, ochassis->c_id, chassis->c_id_len) == 0)) { - found=1; + found = true; break; } } @@ -423,7 +423,8 @@ lldpd_hide_ports(struct lldpd *cfg, struct lldpd_port *port; int protocols[LLDPD_MODE_MAX + 1]; char buffer[256]; - int i, j, k, found = 0; + bool found = false; + int i, j, k; unsigned int min; VLOG_DBG("apply smart filter for port %s", hw->h_ifname); @@ -452,7 +453,7 @@ lldpd_hide_ports(struct lldpd *cfg, /* If we need a tie breaker, we take the first protocol only */ if (cfg->g_config.c_smart & mask & (SMART_OUTGOING_ONE_PROTO | SMART_INCOMING_ONE_PROTO)) { - found = 1; + found = true; } protocols[i] = 1; } else { @@ -463,32 +464,32 @@ lldpd_hide_ports(struct lldpd *cfg, /* We set the p_hidden flag to 1 if the protocol is disabled */ LIST_FOR_EACH (port, p_entries, &hw->h_rports.p_entries) { if (mask == SMART_OUTGOING) { - port->p_hidden_out = protocols[port->p_protocol] ? 0 : 1; + port->p_hidden_out = protocols[port->p_protocol] ? false : true; } else { - port->p_hidden_in = protocols[port->p_protocol] ? 0 : 1; + port->p_hidden_in = protocols[port->p_protocol] ? false : true; } } /* If we want only one neighbor, we take the first one */ if (cfg->g_config.c_smart & mask & (SMART_OUTGOING_ONE_NEIGH | SMART_INCOMING_ONE_NEIGH)) { - found = 0; + found = false; LIST_FOR_EACH (port, p_entries, &hw->h_rports.p_entries) { if (mask == SMART_OUTGOING) { if (found) { - port->p_hidden_out = 1; + port->p_hidden_out = true; } if (!port->p_hidden_out) { - found = 1; + found = true; } } if (mask == SMART_INCOMING) { if (found) { - port->p_hidden_in = 1; + port->p_hidden_in = true; } if (!port->p_hidden_in) { - found = 1; + found = true; } } } -- 2.1.3 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev