mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-06 20:43:44 +02:00
Fix a possible infinite loop in netconf service... in the long term need to fix IP assignment logic period cause the current incarnation sucks.
This commit is contained in:
parent
d0e5da2884
commit
6d17993eb6
1 changed files with 30 additions and 28 deletions
|
@ -277,7 +277,7 @@ int main(int argc,char **argv)
|
||||||
std::string desc;
|
std::string desc;
|
||||||
{
|
{
|
||||||
Query q = dbCon->query();
|
Query q = dbCon->query();
|
||||||
q << "SELECT name,`desc`,isOpen,multicastPrefixBits,multicastDepth,emulateArp,emulateNdp,arpCacheTtl,ndpCacheTtl FROM Network WHERE id = " << nwid;
|
q << "SELECT * FROM Network WHERE id = " << nwid;
|
||||||
StoreQueryResult rs = q.store();
|
StoreQueryResult rs = q.store();
|
||||||
if (rs.num_rows() > 0) {
|
if (rs.num_rows() > 0) {
|
||||||
name = rs[0]["name"].c_str();
|
name = rs[0]["name"].c_str();
|
||||||
|
@ -411,6 +411,7 @@ int main(int argc,char **argv)
|
||||||
uint32_t ipNet = (uint32_t)((unsigned long)rs[aaRow]["ipNet"]);
|
uint32_t ipNet = (uint32_t)((unsigned long)rs[aaRow]["ipNet"]);
|
||||||
unsigned int netmaskBits = (unsigned int)rs[aaRow]["netmaskBits"];
|
unsigned int netmaskBits = (unsigned int)rs[aaRow]["netmaskBits"];
|
||||||
|
|
||||||
|
if ((netmaskBits > 0)&&(ipNet)) {
|
||||||
uint32_t tryIp = (((uint32_t)addressBytes[1]) << 24) |
|
uint32_t tryIp = (((uint32_t)addressBytes[1]) << 24) |
|
||||||
(((uint32_t)addressBytes[2]) << 16) |
|
(((uint32_t)addressBytes[2]) << 16) |
|
||||||
(((uint32_t)addressBytes[3]) << 8) |
|
(((uint32_t)addressBytes[3]) << 8) |
|
||||||
|
@ -445,6 +446,7 @@ int main(int argc,char **argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Assemble response dictionary to send to peer
|
// Assemble response dictionary to send to peer
|
||||||
Dictionary netconf;
|
Dictionary netconf;
|
||||||
|
|
Loading…
Add table
Reference in a new issue