Browse Source

Do not auto-assign IP addresses on bridges. IPs can still be assigned manually.

Adam Ierymenko 9 years ago
parent
commit
2c328d61ad
1 changed files with 4 additions and 1 deletions
  1. 4 1
      controller/SqliteNetworkController.cpp

+ 4 - 1
controller/SqliteNetworkController.cpp

@@ -1861,6 +1861,7 @@ NetworkController::ResultCode SqliteNetworkController::_doNetworkConfigRequest(c
 			netconf[ZT_NETWORKCONFIG_DICT_KEY_MULTICAST_LIMIT] = ml;
 			netconf[ZT_NETWORKCONFIG_DICT_KEY_MULTICAST_LIMIT] = ml;
 		}
 		}
 
 
+		bool amActiveBridge = false;
 		{
 		{
 			std::string activeBridges;
 			std::string activeBridges;
 			sqlite3_reset(_sGetActiveBridges);
 			sqlite3_reset(_sGetActiveBridges);
@@ -1871,6 +1872,8 @@ NetworkController::ResultCode SqliteNetworkController::_doNetworkConfigRequest(c
 					if (activeBridges.length())
 					if (activeBridges.length())
 						activeBridges.push_back(',');
 						activeBridges.push_back(',');
 					activeBridges.append(ab);
 					activeBridges.append(ab);
+					if (!strcmp(member.nodeId,ab))
+						amActiveBridge = true;
 				}
 				}
 				if (activeBridges.length() > 1024) // sanity check -- you can't have too many active bridges at the moment
 				if (activeBridges.length() > 1024) // sanity check -- you can't have too many active bridges at the moment
 					break;
 					break;
@@ -1992,7 +1995,7 @@ NetworkController::ResultCode SqliteNetworkController::_doNetworkConfigRequest(c
 				}
 				}
 			}
 			}
 
 
-			if (!haveStaticIpAssignment) {
+			if ((!haveStaticIpAssignment)&&(!amActiveBridge)) {
 				// Attempt to auto-assign an IPv4 address from an available routed pool
 				// Attempt to auto-assign an IPv4 address from an available routed pool
 				sqlite3_reset(_sGetIpAssignmentPools);
 				sqlite3_reset(_sGetIpAssignmentPools);
 				sqlite3_bind_text(_sGetIpAssignmentPools,1,network.id,16,SQLITE_STATIC);
 				sqlite3_bind_text(_sGetIpAssignmentPools,1,network.id,16,SQLITE_STATIC);