Skip to content

Commit

Permalink
Merge pull request #101 from ggtakec/fixbug
Browse files Browse the repository at this point in the history
Fixed a bug that a case of registered multi-FQDNs in DNS
  • Loading branch information
ggtakec authored Sep 8, 2021
2 parents ea4fd82 + 1e4f864 commit 9f27d30
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/chmimdata.cc
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,23 @@ bool ChmIMData::CompareChmpxNameAndCustomSeed(const CHMPXSVR& src1, const CHMPXS
if(0 == strncmp(src1.name, src2.custom_seed, NI_MAXHOST) || 0 == strncmp(src2.name, src1.custom_seed, NI_MAXHOST)){ // [NOTE] NI_MAXHOST < CUSTOM_ID_SEED_MAX
return true;
}

// [NOTE]
// A very complex problem arises when IP addresses are assigned to multiple names.
// In this case, assuming CUSTOM SEED, compare by all names.
//
strlst_t hostnames1;
strlst_t hostnames2;
ChmNetDb::Get()->GetHostnameList(src1.name, hostnames1, true);
ChmNetDb::Get()->GetHostnameList(src2.name, hostnames2, true);
for(strlst_t::const_iterator iter1 = hostnames1.begin(); iter1 != hostnames1.end(); ++iter1){
for(strlst_t::const_iterator iter2 = hostnames2.begin(); iter2 != hostnames2.end(); ++iter2){
if(0 == strcmp(iter1->c_str(), iter2->c_str())){
return true;
}
}
}

return false;
}

Expand Down

0 comments on commit 9f27d30

Please sign in to comment.