From c2c7feb03209a7d1c5f12e8e5b40fbf56902a1f8 Mon Sep 17 00:00:00 2001 From: Arne Sund Date: Wed, 18 Mar 2015 22:15:03 +0100 Subject: If distro7 switch came before distro6 switch, things broke --- planning/planning.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'planning/planning.cpp') diff --git a/planning/planning.cpp b/planning/planning.cpp index e6c14a5..ac2e10d 100644 --- a/planning/planning.cpp +++ b/planning/planning.cpp @@ -683,6 +683,9 @@ int Planner::do_work(int distro_placements[NUM_DISTRO]) in_addr_t subnet_address = inet_addr(FIRST_SUBNET_ADDRESS); num_ports_used.clear(); vector distro_mgmt_ip; + for (unsigned i = 0; i < NUM_DISTRO + 1; i++) { + distro_mgmt_ip.push_back(htonl(ntohl(inet_addr(FIRST_MGMT_ADDRESS))+ 1 + i * 64)); + } for (unsigned i = 0; i < switches.size(); ++i) { const auto distro_it = switches_to_distros.find(i); if (distro_it == switches_to_distros.end()) { @@ -691,12 +694,7 @@ int Planner::do_work(int distro_placements[NUM_DISTRO]) unsigned int distro = distro_it->second; int port_num = num_ports_used[distro]++; - if(distro_mgmt_ip.size() < distro + 1) { - distro_mgmt_ip.push_back(htonl(ntohl(inet_addr(FIRST_MGMT_ADDRESS))+ 2 + distro * 64)); - } - else { - distro_mgmt_ip[distro] = htonl(ntohl(distro_mgmt_ip[distro]) + 1); - } + distro_mgmt_ip[distro] = htonl(ntohl(distro_mgmt_ip[distro]) + 1); fprintf(patchlist, "e%u-%u %s %s %s %s %s\n", switches[i].row * 2 - 1, switches[i].num + 1, -- cgit v1.2.3