Never assign v4 IPs ending in .255 even within range.

This commit is contained in:
Adam Ierymenko 2015-09-28 15:28:30 -07:00
parent 2d0adb562d
commit a7bd1eaa40

View File

@ -1742,6 +1742,8 @@ NetworkController::ResultCode SqliteNetworkController::_doNetworkConfigRequest(c
for(uint32_t k=ipRangeStart,l=0;(k<=ipRangeEnd)&&(l < 1000000);++k,++l) {
uint32_t ip = (ipRangeLen > 0) ? (ipRangeStart + (ipTrialCounter % ipRangeLen)) : ipRangeStart;
++ipTrialCounter;
if ((ip & 0x000000ff) == 0x000000ff)
continue; // don't allow addresses that end in .255
for(std::vector< std::pair<uint32_t,int> >::const_iterator r(routedNetworks.begin());r!=routedNetworks.end();++r) {
if ((ip & (0xffffffff << (32 - r->second))) == r->first) {