From 6da39ca4d3d791b483bd2951c3c7e6fdf9c259b2 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 148c0833436..6a70ed711e5 100644 --- a/src/bgp/bgp_attr.cc +++ b/src/bgp/bgp_attr.cc @@ -156,7 +156,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 19d6662d0b6..0de7fdcb24c 100644 --- a/src/bgp/bgp_proto.cc +++ b/src/bgp/bgp_proto.cc @@ -303,12 +303,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); } } @@ -318,8 +318,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"; } } }