Skip to content

Commit

Permalink
Use API integerToHexString() to convert uint8_t to string
Browse files Browse the repository at this point in the history
<< 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
  • Loading branch information
ananth-at-camphor-networks committed Dec 9, 2016
1 parent ba836a1 commit 6da39ca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/bgp/bgp_attr.cc
Expand Up @@ -156,7 +156,7 @@ void ClusterListSpec::ToCanonical(BgpAttr *attr) {
std::string ClusterListSpec::ToString() const {
std::stringstream repr;
repr << "CLUSTER_LIST <code: " << std::dec << code;
repr << ", flags: 0x" << std::hex << flags << "> :";
repr << ", flags: 0x" << std::hex << int(flags) << "> :";
for (std::vector<uint32_t>::const_iterator iter = cluster_list.begin();
iter != cluster_list.end(); ++iter) {
repr << " " << Ip4Address(*iter).to_string();
Expand Down
8 changes: 4 additions & 4 deletions src/bgp/bgp_proto.cc
Expand Up @@ -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);
}
}

Expand All @@ -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";
}
}
}
Expand Down

0 comments on commit 6da39ca

Please sign in to comment.