From 8b7b6170e1004e3f988cda616213e880433a8ed6 Mon Sep 17 00:00:00 2001 From: Ananth Suryanarayana Date: Thu, 8 Dec 2016 17:29:49 -0800 Subject: [PATCH] Use API integerToHexString() to convert uint8_t to string << operator converts to a character, which need not be a valid xml character and causes issues during message send via sandesh infra TODO: Add an assert to sandesh library when mal-formed xml string is formed and enable it in tests so that issues like these can be caught in UTs itself Change-Id: Ifb0ebcd1e7065037d8848389d5b7e86a1f681064 Closes-Bug: #1648180 --- src/bgp/bgp_attr.cc | 2 +- src/bgp/bgp_proto.cc | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/bgp/bgp_attr.cc b/src/bgp/bgp_attr.cc index 38119d0b39d..4e4e7387462 100644 --- a/src/bgp/bgp_attr.cc +++ b/src/bgp/bgp_attr.cc @@ -155,7 +155,7 @@ void ClusterListSpec::ToCanonical(BgpAttr *attr) { std::string ClusterListSpec::ToString() const { std::stringstream repr; repr << "CLUSTER_LIST :"; + repr << ", flags: 0x" << std::hex << int(flags) << "> :"; for (std::vector::const_iterator iter = cluster_list.begin(); iter != cluster_list.end(); ++iter) { repr << " " << Ip4Address(*iter).to_string(); diff --git a/src/bgp/bgp_proto.cc b/src/bgp/bgp_proto.cc index e79daeda752..05467b9bc75 100644 --- a/src/bgp/bgp_proto.cc +++ b/src/bgp/bgp_proto.cc @@ -301,12 +301,12 @@ const string BgpProto::OpenMessage::ToString() const { Capability::GR gr_params = Capability::GR(); if (Capability::GR::Decode(&gr_params, param->capabilities)) { - os << ", GR_Flags 0x" << std::hex << gr_params.flags; + os << ", GR_Flags 0x" << std::hex << int(gr_params.flags); os << ", GR_Time " << gr_params.time; BOOST_FOREACH(Capability::GR::Family family, gr_params.families) { os << ", GR_family " << BgpAf::AfiSafiToFamily(family.afi, family.safi); - os << ", GR_family_flags 0x" << std::hex << family.flags; + os << ", GR_family_flags 0x" << std::hex << int(family.flags); } } @@ -316,8 +316,8 @@ const string BgpProto::OpenMessage::ToString() const { llgr_params.families) { os << ", LLGR_family " << BgpAf::AfiSafiToFamily(family.afi, family.safi); - os << ", LLGR_family_flags 0x" << std::hex << family.flags; - os << ", LLGR_Time 0x" << std::hex << family.time << " Seconds"; + os << ", LLGR_family_flags 0x" << std::hex << int(family.flags); + os << ", LLGR_Time " << family.time << " Seconds"; } } }